Class Symbol

java.lang.Object
gw.internal.gosu.parser.Symbol
All Implemented Interfaces:
IFunctionSymbol, IHasType, IReducedSymbol, ISymbol
Direct Known Subclasses:
AbstractDynamicSymbol, AmbiguousSymbol, CapturedSymbol, CommonSymbolsScope.LockedDownSymbol, CompileTimeExpressionParser.CompileTimeFieldSymbol, QueryPathRootSymbol, ReadOnlySymbol, ReducedSymbol.SyntheticSymbol, TemplateGenerator.LockedDownSymbol, ThisSymbol, TypedSymbol

public class Symbol extends Object implements IFunctionSymbol
Base class for all symbols in the symbol table.
  • Field Details

    • MEMBER_STACK_PROVIDER

      public static final IStackProvider MEMBER_STACK_PROVIDER
    • _name

      private String _name
    • _type

      private IType _type
    • _value

      protected Object _value
    • _defaultValue

      private IExpression _defaultValue
    • _iIndex

      protected int _iIndex
    • _bGlobal

      protected boolean _bGlobal
    • _stackProvider

      protected IStackProvider _stackProvider
    • _symbolTable

      protected ISymbolTable _symbolTable
    • _valueIsBoxed

      private MutableBoolean _valueIsBoxed
    • _modifiers

      private ModifierInfo _modifiers
  • Constructor Details

  • Method Details

    • setDynamicSymbolTable

      public void setDynamicSymbolTable(ISymbolTable symTable)
      Description copied from interface: ISymbol
      Assigns an optional symbol table so that the symbol can get/set its value dynamically e.g., via ThreadLocalSymbolTable.
      Specified by:
      setDynamicSymbolTable in interface ISymbol
    • hasDynamicSymbolTable

      public boolean hasDynamicSymbolTable()
      Specified by:
      hasDynamicSymbolTable in interface ISymbol
    • getDynamicSymbolTable

      public ISymbolTable getDynamicSymbolTable()
      Specified by:
      getDynamicSymbolTable in interface ISymbol
    • assignIndex

      protected int assignIndex(IScope scope)
    • assignIndexInStack

      protected int assignIndexInStack(IScope scope)
    • getName

      public String getName()
      Returns the Symbol's name.
      Specified by:
      getName in interface IReducedSymbol
      Specified by:
      getName in interface ISymbol
    • getDisplayName

      public String getDisplayName()
      Returns the Symbol's optional display name. If a display name is not assigned, returns the symbol's name.
      Specified by:
      getDisplayName in interface IReducedSymbol
      Specified by:
      getDisplayName in interface ISymbol
    • getFullDescription

      public String getFullDescription()
      Specified by:
      getFullDescription in interface IReducedSymbol
    • renameAsErrantDuplicate

      public void renameAsErrantDuplicate(int iIndex)
    • getType

      public IType getType()
      Returns the Symbol's type.
      Specified by:
      getType in interface IHasType
      Specified by:
      getType in interface IReducedSymbol
      Specified by:
      getType in interface ISymbol
    • setType

      public void setType(IType type)
      Sets the Symbol's type.
      Specified by:
      setType in interface ISymbol
    • getValue

      public Object getValue()
      Returns the value assigned to this Symbol.
      Specified by:
      getValue in interface ISymbol
    • getValueFromSymbolTable

      private Object getValueFromSymbolTable()
    • setValue

      public void setValue(Object value)
      Assigns a value to this Symbol.
      Specified by:
      setValue in interface ISymbol
    • getDefaultValueExpression

      public IExpression getDefaultValueExpression()
      Description copied from interface: ISymbol
      The symbol's default value e.g., a default parameter value for a function.
      Specified by:
      getDefaultValueExpression in interface IReducedSymbol
      Specified by:
      getDefaultValueExpression in interface ISymbol
    • setDefaultValueExpression

      public void setDefaultValueExpression(IExpression defaultValue)
      Specified by:
      setDefaultValueExpression in interface ISymbol
    • isStackSymbol

      public boolean isStackSymbol()
      Description copied from interface: IFunctionSymbol
      Returns true if the value of this function symbol is stored on the stack as a variable
      Specified by:
      isStackSymbol in interface IFunctionSymbol
    • setValueFromSymbolTable

      private void setValueFromSymbolTable(Object value)
    • getValueDirectly

      public Object getValueDirectly()
    • setValueDirectly

      public void setValueDirectly(Object value)
    • invoke

      public Object invoke(Object[] args)
      Invokes function.
      Specified by:
      invoke in interface IFunctionSymbol
      Parameters:
      args - An array of arguments to forward to the function.
    • getLightWeightReference

      public ISymbol getLightWeightReference()
      Description copied from interface: ISymbol
      Creates a copy of this symbol without the value so that the empty symbol can be stored.
      Specified by:
      getLightWeightReference in interface ISymbol
    • isImplicitlyInitialized

      public boolean isImplicitlyInitialized()
    • isWritable

      public boolean isWritable()
      Description copied from interface: ISymbol
      Returns true if this symbol is writable.

      An example of a symbol that is not writable is a readonly Property referenced as a symbol in a Gosu class.

      Specified by:
      isWritable in interface ISymbol
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getSignatureDescription

      public String getSignatureDescription()
      Description copied from interface: IFunctionSymbol
      Returns a description of arguments of the form ( < argName1 >, < argName2 >, etc. ) appropriate for display in a source editor ui.
      Specified by:
      getSignatureDescription in interface IFunctionSymbol
    • getIndex

      public int getIndex()
      Specified by:
      getIndex in interface IReducedSymbol
      Specified by:
      getIndex in interface ISymbol
    • isClassMember

      public boolean isClassMember()
    • setClassMember

      public void setClassMember(boolean bClassMember)
    • isStatic

      public boolean isStatic()
      Specified by:
      isStatic in interface IReducedSymbol
    • setStatic

      public void setStatic(boolean bStatic)
    • isPrivate

      public boolean isPrivate()
      Specified by:
      isPrivate in interface IReducedSymbol
    • setPrivate

      public void setPrivate(boolean bPrivate)
    • isInternal

      public boolean isInternal()
      Specified by:
      isInternal in interface IReducedSymbol
    • setInternal

      public void setInternal(boolean bInternal)
    • isProtected

      public boolean isProtected()
      Specified by:
      isProtected in interface IReducedSymbol
    • setProtected

      public void setProtected(boolean bProtected)
    • isPublic

      public boolean isPublic()
      Specified by:
      isPublic in interface IReducedSymbol
    • setPublic

      public void setPublic(boolean bPublic)
    • isAbstract

      public boolean isAbstract()
      Specified by:
      isAbstract in interface IReducedSymbol
    • setAbstract

      public void setAbstract(boolean bAbstract)
    • isFinal

      public boolean isFinal()
      Specified by:
      isFinal in interface IReducedSymbol
    • setFinal

      public void setFinal(boolean bFinal)
    • isReified

      public boolean isReified()
      Specified by:
      isReified in interface IReducedSymbol
    • setReified

      public void setReified(boolean bReified)
    • isOverride

      public boolean isOverride()
    • setOverride

      public void setOverride(boolean bOverride)
    • isHide

      public boolean isHide()
    • setHide

      public void setHide(boolean bHide)
    • getModifierInfo

      public ModifierInfo getModifierInfo()
      Specified by:
      getModifierInfo in interface ISymbol
    • setModifierInfo

      public void setModifierInfo(IModifierInfo modifiers)
    • replaceModifierInfo

      public void replaceModifierInfo(IModifierInfo mi)
    • getModifiers

      public int getModifiers()
      Description copied from interface: IFunctionSymbol
      Returns the modifiers for this function symbol
      Specified by:
      getModifiers in interface IFunctionSymbol
      Specified by:
      getModifiers in interface IReducedSymbol
    • getAnnotations

      public List<IGosuAnnotation> getAnnotations()
      Specified by:
      getAnnotations in interface IReducedSymbol
    • getScriptPart

      public IScriptPartId getScriptPart()
      Specified by:
      getScriptPart in interface IReducedSymbol
    • getGosuClass

      public IGosuClass getGosuClass()
      Specified by:
      getGosuClass in interface IReducedSymbol
    • hasTypeVariables

      public boolean hasTypeVariables()
      Specified by:
      hasTypeVariables in interface IReducedSymbol
    • setModifiers

      public void setModifiers(int modifiers)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • canBeCaptured

      public boolean canBeCaptured()
      Specified by:
      canBeCaptured in interface ISymbol
    • makeCapturedSymbol

      public ICapturedSymbol makeCapturedSymbol(String strName, ISymbolTable symbolTable, IScope scope)
      Specified by:
      makeCapturedSymbol in interface ISymbol
    • setIndex

      public void setIndex(int i)
    • setValueIsBoxed

      public void setValueIsBoxed(boolean b)
      Description copied from interface: ISymbol
      Indicates that this symbol should use a reference rather than storing its value directly.
      Specified by:
      setValueIsBoxed in interface ISymbol
    • isValueBoxed

      public boolean isValueBoxed()
      Specified by:
      isValueBoxed in interface IReducedSymbol
      Specified by:
      isValueBoxed in interface ISymbol
    • setName

      protected void setName(String name)
    • isLocal

      public boolean isLocal()
      Specified by:
      isLocal in interface ISymbol
    • isFromJava

      public boolean isFromJava()
      Specified by:
      isFromJava in interface IFunctionSymbol
      Returns:
      true if this function symbol came from a java superclass
    • getSymbolClass

      public Class getSymbolClass()
      Specified by:
      getSymbolClass in interface IReducedSymbol
    • createReducedSymbol

      public IReducedSymbol createReducedSymbol()
      Specified by:
      createReducedSymbol in interface ISymbol