| java.lang.Object sun.tools.tree.Context
All known Subclasses: sun.tools.tree.CheckContext, sun.tools.tree.CodeContext,
Context | public class Context implements Constants(Code) | | WARNING: The contents of this source file are not part of any
supported API. Code that depends on them does so at its own risk:
they are subject to change or removal without notice.
|
Method Summary | |
public boolean | canReach(Environment env, MemberDefinition f) Check if a field can reach another field (only considers
forward references, not the access modifiers). | public void | checkBackBranch(Environment env, Statement loop, Vset vsEntry, Vset vsBack) Raise an error if a blank final was definitely unassigned
on entry to a loop, but has possibly been assigned on the
back-branch. | public int | declare(Environment env, LocalMember local) | public int | declareFieldNumber(MemberDefinition field) Assign a number to a class field. | public Expression | findOuterLink(Environment env, long where, MemberDefinition f) Return a local expression which can serve as the base reference
for the given field. | public Expression | findOuterLink(Environment env, long where, ClassDefinition reqc, MemberDefinition f, boolean needExactMatch) | public ClassDefinition | findScope(Environment env, ClassDefinition reqc) | public Identifier | getApparentClassName(Environment env, Identifier name) Return the name of a lexically apparent type,
skipping inherited members, and ignoring
the current pacakge and imports. | final public MemberDefinition | getApparentField(Environment env, Identifier name) Like getField, except that it skips over inherited fields. | public Context | getBreakContext(Identifier lbl) | public Context | getContinueContext(Identifier lbl) | public MemberDefinition | getElement(int number) Return the local field or member field corresponding to a number. | final public MemberDefinition | getField(Environment env, Identifier name) | final public MemberDefinition | getField() Return the field containing the present context. | public int | getFieldNumber(MemberDefinition field) Retrieve a number previously assigned by declareMember(). | Context | getInlineContext() | Context | getInlineMemberContext(MemberDefinition field) | public Context | getLabelContext(Identifier lbl) Get the context that corresponds to a label, return null if
not found. | public LocalMember | getLocalClass(Identifier name) | public LocalMember | getLocalField(Identifier name) | public CheckContext | getReturnContext() | public int | getScopeNumber(ClassDefinition c) | public int | getThisNumber() Return the number of the innermost current instance reference. | public CheckContext | getTryExitContext() Get the context of the innermost surrounding try-block.
Consider only try-blocks contained within the same method.
(There could be others when searching from within a method
of a local class, but they are irrelevant to our purpose.)
This is used for recording DA/DU information preceding
all abnormal transfers of control: break, continue, return,
and throw. | final public int | getVarNumber() | public boolean | isInScope(LocalMember field) Check if the given field is active in this context. | public Expression | makeReference(Environment env, LocalMember target) Implement a reference (usually an uplevel one). | public static Environment | newEnvironment(Environment env, Context ctx) Extend an environment with the given context. | public UplevelReference | noteReference(Environment env, LocalMember target) Notice a reference (usually an uplevel one). | public static boolean | outerLinkExists(Environment env, ClassDefinition reqc, ClassDefinition thisc) | final public Vset | removeAdditionalVars(Vset vset) Remove variables from the vset set that are no longer part of
this context. | Identifier | resolveName(Environment env, Identifier name) Resolve a type name from within a local scope. |
frameNumber | int frameNumber(Code) | | |
scopeNumber | int scopeNumber(Code) | | |
Context | Context(Context ctx, Node node)(Code) | | Create a new nested context, for a block statement
|
canReach | public boolean canReach(Environment env, MemberDefinition f)(Code) | | Check if a field can reach another field (only considers
forward references, not the access modifiers).
|
checkBackBranch | public void checkBackBranch(Environment env, Statement loop, Vset vsEntry, Vset vsBack)(Code) | | Raise an error if a blank final was definitely unassigned
on entry to a loop, but has possibly been assigned on the
back-branch. If this is the case, the loop may be assigning
it multiple times.
|
declareFieldNumber | public int declareFieldNumber(MemberDefinition field)(Code) | | Assign a number to a class field.
(This is used to track definite assignment of some blank finals.)
|
findOuterLink | public Expression findOuterLink(Environment env, long where, MemberDefinition f)(Code) | | Return a local expression which can serve as the base reference
for the given field. If the field is a constructor, return an
expression for the implicit enclosing instance argument.
Return null if there is no need for such an argument,
or if there was an error.
|
getApparentClassName | public Identifier getApparentClassName(Environment env, Identifier name)(Code) | | Return the name of a lexically apparent type,
skipping inherited members, and ignoring
the current pacakge and imports.
This is used for error checking.
|
getContinueContext | public Context getContinueContext(Identifier lbl)(Code) | | Get the destination context of a continue
|
getElement | public MemberDefinition getElement(int number)(Code) | | Return the local field or member field corresponding to a number.
Return null if there is no such field.
|
getFieldNumber | public int getFieldNumber(MemberDefinition field)(Code) | | Retrieve a number previously assigned by declareMember().
Return -1 if there was no such assignment in this context.
|
getInlineContext | Context getInlineContext()(Code) | | Get the nearest inlined context
|
getLabelContext | public Context getLabelContext(Identifier lbl)(Code) | | Get the context that corresponds to a label, return null if
not found.
|
getReturnContext | public CheckContext getReturnContext()(Code) | | Get the destination context of a return (the method body)
|
getThisNumber | public int getThisNumber()(Code) | | Return the number of the innermost current instance reference.
|
getTryExitContext | public CheckContext getTryExitContext()(Code) | | Get the context of the innermost surrounding try-block.
Consider only try-blocks contained within the same method.
(There could be others when searching from within a method
of a local class, but they are irrelevant to our purpose.)
This is used for recording DA/DU information preceding
all abnormal transfers of control: break, continue, return,
and throw.
|
getVarNumber | final public int getVarNumber()(Code) | | |
isInScope | public boolean isInScope(LocalMember field)(Code) | | Check if the given field is active in this context.
|
makeReference | public Expression makeReference(Environment env, LocalMember target)(Code) | | Implement a reference (usually an uplevel one).
Call noteReference() first, to make sure the reference
lists are up to date.
The resulting expression tree does not need checking;
it can be code-generated right away.
If the reference is not uplevel, the result is an IDENT or THIS.
|
newEnvironment | public static Environment newEnvironment(Environment env, Context ctx)(Code) | | Extend an environment with the given context.
The resulting environment behaves the same as
the given one, except that resolveName() takes
into account local class names in this context.
|
noteReference | public UplevelReference noteReference(Environment env, LocalMember target)(Code) | | Notice a reference (usually an uplevel one).
Update the references list of every enclosing class
which is enclosed by the scope of the target.
Update decisions about which uplevels to make into fields.
Return the uplevel reference descriptor, or null if it's local.
The target must be in scope in this context.
So, call this method only from the check phase.
(In other phases, the context may be less complete.)
This can and should be called both before and after classes are frozen.
It should be a no-op, and will raise a compiler error if not.
|
removeAdditionalVars | final public Vset removeAdditionalVars(Vset vset)(Code) | | Remove variables from the vset set that are no longer part of
this context.
|
|
|