Class ConstantGlobal

  • All Implemented Interfaces:
    CodeElement

    public class ConstantGlobal
    extends Global
    A global variable, scoped by its container, that is fixed to a statically constant (and immutable) value. A constant global is never an instance global.
    • Constructor Detail

      • ConstantGlobal

        public ConstantGlobal​(CodeLocation location,
                              Unit container,
                              java.lang.String name,
                              Constant constant)
        Builds an constant global variable, identified by its name. The type of this global is the one of the constant.
        Parameters:
        location - the location of this global variable
        container - the Unit containing this global
        name - the name of this global
        constant - the constant value of this global
      • ConstantGlobal

        public ConstantGlobal​(CodeLocation location,
                              Unit container,
                              java.lang.String name,
                              Constant constant,
                              Annotations annotations)
        Builds the constant global, identified by its name, happening at the given location in the program.
        Parameters:
        location - the location where this global is defined within the program
        container - the Unit containing this global
        name - the name of this global
        constant - the constant value of this global
        annotations - the annotations of this global variable
    • Method Detail

      • getConstant

        public Constant getConstant()
        Yields the constant value associated to this global.
        Returns:
        the constant value
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Global
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class Global
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class Global