1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Optimized adaptBinding method for bindings whose owners that are

composite bindings.
This commit is contained in:
Sergey Prigogin 2011-07-29 16:47:02 -07:00
parent 556ebadf7c
commit 35cae0899d

View file

@ -55,7 +55,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
* link time. These are generally global symbols specific to a given language. * link time. These are generally global symbols specific to a given language.
*/ */
public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage, IIndexBindingConstants { public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage, IIndexBindingConstants {
// record offsets // record offsets
private static final int ID_OFFSET = PDOMNamedNode.RECORD_SIZE + 0; private static final int ID_OFFSET = PDOMNamedNode.RECORD_SIZE + 0;
private static final int NEXT_OFFSET = PDOMNamedNode.RECORD_SIZE + 4; private static final int NEXT_OFFSET = PDOMNamedNode.RECORD_SIZE + 4;
@ -210,16 +209,16 @@ public abstract class PDOMLinkage extends PDOMNamedNode implements IIndexLinkage
} }
protected final PDOMBinding attemptFastAdaptBinding(final IBinding binding) throws CoreException { protected final PDOMBinding attemptFastAdaptBinding(final IBinding binding) throws CoreException {
if (binding instanceof PDOMBinding) { PDOMBinding pdomBinding= (PDOMBinding) binding.getAdapter(PDOMBinding.class);
// there is no guarantee, that the binding is from the same PDOM object. // There is no guarantee, that the binding is from the same PDOM object.
PDOMBinding pdomBinding = (PDOMBinding) binding; if (pdomBinding != null && pdomBinding.getPDOM() == getPDOM()) {
if (pdomBinding.getPDOM() == getPDOM()) { return pdomBinding;
return pdomBinding;
}
} }
return (PDOMBinding) fPDOM.getCachedResult(binding); return (PDOMBinding) fPDOM.getCachedResult(binding);
} }
public abstract PDOMBinding adaptBinding(IBinding binding) throws CoreException; public abstract PDOMBinding adaptBinding(IBinding binding) throws CoreException;
public abstract PDOMBinding addBinding(IASTName name) throws CoreException; public abstract PDOMBinding addBinding(IASTName name) throws CoreException;
final protected long getLocalToFileRec(PDOMNode parent, IBinding binding, PDOMBinding glob) throws CoreException { final protected long getLocalToFileRec(PDOMNode parent, IBinding binding, PDOMBinding glob) throws CoreException {