*/
synchronized IBinding resolveName(Name name) {
org.eclipse.jdt.internal.compiler.ast.ASTNode node = (org.eclipse.jdt.internal.compiler.ast.ASTNode) this.newAstToOldAst.get(name);
int index = name.index;
if (node instanceof QualifiedNameReference) {
QualifiedNameReference qualifiedNameReference = (QualifiedNameReference) node;
final char[][] tokens = qualifiedNameReference.tokens;
int indexOfFirstFieldBinding = qualifiedNameReference.indexOfFirstFieldBinding; // one-based
if (index < indexOfFirstFieldBinding) {
// an extra lookup is required
BlockScope internalScope = (BlockScope) this.astNodesToBlockScope.get(name);
Binding binding = null;
try {
if (internalScope == null) {
if (this.scope == null) return null;
binding = this.scope.getTypeOrPackage(CharOperation.subarray(tokens, 0, index));
} else {
binding = internalScope.getTypeOrPackage(CharOperation.subarray(tokens, 0, index));
}
} catch (AbortCompilation e) {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=63550
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=64299
}
if (binding instanceof org.eclipse.jdt.internal.compiler.lookup.PackageBinding) {
return getPackageBinding((org.eclipse.jdt.internal.compiler.lookup.PackageBinding)binding);
} else if (binding instanceof org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
// it is a type
return this.getTypeBinding((org.eclipse.jdt.internal.compiler.lookup.TypeBinding)binding);
}
} else if (index == indexOfFirstFieldBinding) {
if (qualifiedNameReference.isTypeReference()) {
return this.getTypeBinding(qualifiedNameReference.resolvedType);
} else {
Binding binding = qualifiedNameReference.binding;
if (binding != null) {
if (binding.isValidBinding()) {