Class ReferenceType

  • All Implemented Interfaces:
    Persistable, SecondOrderType, IVisitable<Node>

    public class ReferenceType
    extends Type
    implements SecondOrderType
    ReferenceTypes describe CPP References (int&), which are represent an alternative name for a variable. It is necessary to make this distinction, and not just rely on the original type as it is required for matching parameters in function arguments to discover which implementation is called.
    • Constructor Detail

      • ReferenceType

        public ReferenceType​(Type reference)
      • ReferenceType

        public ReferenceType​(Type type,
                             Type reference)
    • Method Detail

      • reference

        public Type reference​(PointerType.PointerOrigin pointerOrigin)
        Specified by:
        reference in class Type
        Parameters:
        pointerOrigin - Reason for the reference (array of pointer)
        Returns:
        Referencing a ReferenceType results in a PointerType to the original ReferenceType
      • dereference

        public Type dereference()
        Specified by:
        dereference in class Type
        Returns:
        Dereferencing a ReferenceType equals to dereferencing the original (non-reference) type
      • duplicate

        public Type duplicate()
        Specified by:
        duplicate in class Type
        Returns:
        Creates an exact copy of the current type (chain)
      • isSimilar

        public boolean isSimilar​(Type t)
        Description copied from class: Type
        Required for possibleSubTypes to check if the new Type should be considered a subtype or not
        Overrides:
        isSimilar in class Type
        Parameters:
        t - other type the similarity is checked with
        Returns:
        True if the parameter t is equal to the current type (this)
      • refreshName

        public void refreshName()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class Type
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Type
      • toString

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