List of usage examples for org.eclipse.jdt.internal.compiler.lookup Scope referenceContext
public ReferenceContext referenceContext()
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.lookup.TeamAnchor.java
License:Open Source License
/** * Check whether the given expression determines a proper bestName for this binding. * @param rhs expression being assigned to this variable (Expression or Argument) *//*from ww w . j a v a 2 s . c om*/ public void setBestNameFromStat(Statement rhs) { if (isFinal() && (this.type instanceof ReferenceBinding)) { ITeamAnchor[] path = getBestNameFromStat(rhs); if (path != null) { ITeamAnchor lastBinding = path[path.length - 1]; if (this instanceof FieldBinding) { if (lastBinding instanceof LocalVariableBinding) { LocalVariableBinding localVar = ((LocalVariableBinding) lastBinding); Scope scope = localVar.declaringScope; if (scope.referenceContext() instanceof ConstructorDeclaration) { // don't record the initial field assignment within a constructor, // but reverse this: pretend the local was initialized from the field, // to make both equivalent within this ctor. if (lastBinding.isFinal()) { if ((localVar.tagBits & TagBits.IsArgument) != 0 && !localVar.pathIsAbsolute()) { // localVar is really an argument not anchored to a field lastBinding.shareBestName(this); } } } return; // all others: ignore } else if (lastBinding instanceof TThisBinding) { return; // field may already have better anchor } } this.bestNamePath = path; } } }