Class Variable

    • Field Detail

      • index

        public final int index
      • sequence

        public final Sequence sequence
    • Constructor Detail

      • Variable

        public Variable​(Sequence owner,
                        int i)
      • Variable

        protected Variable()
        Do not use! Only for use by DummyVariable.
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • getType

        public Type getType()
        Returns the type of this variable.
        Returns:
        the type of this variable
      • getDeclaringStatement

        public Statement getDeclaringStatement()
        The statement that produced this variable.
        Returns:
        the statement to which this variable belongs
      • getDeclIndex

        public int getDeclIndex()
        The index of the statement that creates this value.
        Returns:
        the statement index where this variable is created
      • getName

        public String getName()
        Returns the name of this variable.
        Returns:
        the name of this variable as a string
      • getName

        private String getName​(String className,
                               int i)
        The name of this variable using the given type name and index.
        Parameters:
        className - the classname to use
        i - the index to use in the name
        Returns:
        the variable name that appends the index to the classname
      • classToVariableName

        static String classToVariableName​(Type type)
        Build a variable name from the name of the given type.
        Parameters:
        type - the type
        Returns:
        the variable name as a string
      • classNameToVariableName

        private static String classNameToVariableName​(String className)
        Convert the classname to a variable name, preserving camel case if used.
        Parameters:
        className - the class name
        Returns:
        the variable form of the classname
      • shouldInlineLiterals

        public boolean shouldInlineLiterals()
        True if this variable's value should be inlined as a literal at call sites, rather than referencing the variable.
        Returns:
        whether this variable's value should be inlined as a literal at call sites