Class LocalMember

  • All Implemented Interfaces:
    Constants, RuntimeConstants

    public class LocalMember
    extends MemberDefinition
    A local Field 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.
    • Field Detail

      • number

        int number
        The number of the variable
      • readcount

        int readcount
        Some statistics
      • writecount

        int writecount
      • scopeNumber

        int scopeNumber
        An indication of which block the variable comes from. Helps identify uplevel references.
      • originalOfCopy

        LocalMember originalOfCopy
        Used by copyInline to record the original of this copy.
      • prev

        LocalMember prev
        The previous local variable, this list is used to build a nested context of local variables.
    • Constructor Detail

      • LocalMember

        public LocalMember​(ClassDefinition innerClass)
        Constructor for a block-inner class.
      • LocalMember

        LocalMember​(MemberDefinition field)
        Constructor for a proxy to an instance or class variable.
    • Method Detail

      • getScopeNumber

        public int getScopeNumber()
        Return current nesting level, i.e., the value of 'scopeNumber'. Made public for the benefit of 'ClassDefinition.resolveName'.
      • getMember

        final MemberDefinition getMember()
        Is this a proxy for the given field?
      • copyInline

        public LocalMember copyInline​(Context ctx)
        Make a copy of this field, which is an argument to a method or constructor. Arrange so that when occurrences of the field are encountered in an immediately following copyInline() operation, the expression nodes will replace the original argument by the fresh copy.
      • getCurrentInlineCopy

        public LocalMember getCurrentInlineCopy​(Context ctx)
        Returns the previous result of copyInline(ctx). Must be called in the course of an Expression.copyInline() operation that immediately follows the LocalMember.copyInline(). Return "this" if there is no such copy.
      • doneWithArguments

        public static void doneWithArguments​(Context ctx,
                                             LocalMember[] res)
        Call this when finished with the result of a copyArguments() call.
      • isInlineable

        public boolean isInlineable​(Environment env,
                                    boolean fromFinal)
        Is this local variable's value stable and simple enough to be directly substituted for occurrences of the variable itself? (This decision is made by VarDeclarationStatement.inline().)
        Overrides:
        isInlineable in class MemberDefinition
      • isUsed

        public boolean isUsed()
        Check if used
      • getNumber

        public int getNumber​(Context ctx)
        Value number for vsets, or -1 if none.