List of usage examples for org.eclipse.jdt.internal.compiler.lookup Scope getBinding
public Binding getBinding(char[] name, int mask, InvocationSite invocationSite, boolean needResolve)
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.ast.TypeAnchorReference.java
License:Open Source License
private ITeamAnchor findVariable(Scope scope, char[] token, boolean isStaticScope, int start, int end) { if (scope instanceof ClassScope && ((ClassScope) scope).superTypeReference != null) { scope.problemReporter().extendingExternalizedRole(((ClassScope) scope).superTypeReference); return null; }/*w w w . ja v a2s . c om*/ VariableBinding anchorBinding = null; switch (scope.kind) { case Scope.METHOD_SCOPE: // check arguments for possible anchor: AbstractMethodDeclaration method = ((MethodScope) scope).referenceMethod(); if (method != null) { Argument[] arguments = method.arguments; if (arguments != null) for (int i = 0; i < arguments.length; i++) if (CharOperation.equals(arguments[i].name, token)) return RoleTypeCreator.resolveTypeAnchoredToArgument(method, i); } //$FALL-THROUGH$ case Scope.BLOCK_SCOPE: case Scope.BINDING_SCOPE: anchorBinding = scope.findVariable(token); break; } if (anchorBinding == null) { Binding binding = scope.getBinding(token, Binding.VARIABLE, this, true); if (binding instanceof VariableBinding) anchorBinding = (VariableBinding) binding; } return checkAnchor(scope, this.anchor, token, start, end, anchorBinding); }