Interface ISymbol

All Superinterfaces:
ISymbolNature, ITokenReference, Serializable
All Known Subinterfaces:
IAggregateSymbol, ICanBeGeneric, IScopedSymbol
All Known Implementing Classes:
AggregateSymbol, AggregateWithTraitsSymbol, CallSymbol, CaptureScopedSymbol, ConstantSymbol, ControlSymbol, ExpressionSymbol, ForSymbol, FunctionSymbol, MethodSymbol, ParamExpressionSymbol, PossibleGenericSymbol, ScopedSymbol, ServiceOperationSymbol, StackConsistencyScope, StreamCallSymbol, StreamPipeLineSymbol, SwitchSymbol, Symbol, TrySymbol, VariableSymbol, WhileSymbol

public interface ISymbol extends ISymbolNature, ITokenReference, Serializable
Represents the concept of what functionality a Symbol should have.
  • Field Details

  • Method Details

    • isNullAllowed

      boolean isNullAllowed()
    • setNullAllowed

      void setNullAllowed(boolean nullAllowed)
    • isInjectionExpected

      boolean isInjectionExpected()
    • setInjectionExpected

      void setInjectionExpected(boolean injectionExpected)
    • isReferenced

      boolean isReferenced()
    • setReferenced

      void setReferenced(boolean referenced)
    • putSquirrelledData

      void putSquirrelledData(CommonValues key, String value)
    • getSquirrelledData

      String getSquirrelledData(CommonValues key)
    • getParsedModule

      Optional<Module> getParsedModule()
    • setParsedModule

      void setParsedModule(Optional<Module> parsedModule)
      For some symbols you may wish to specify the parsed module they were defined in.
      Parameters:
      parsedModule - The parsedModule the symbol was defined in.
    • isDevSource

      boolean isDevSource()
    • isLibSource

      boolean isLibSource()
    • clone

      ISymbol clone(IScope withParentAsAppropriate)
      Clone the symbol and re-parent if this symbol like a method should have a parent. Other symbols like VariableSymbols are un-parented
    • isMarkedPure

      boolean isMarkedPure()
      This symbol itself can be marked as pure - i.e. an operator with no side effects.
      Returns:
      true if pure, false otherwise. By default, false - lets assume the worst.
    • isMutable

      boolean isMutable()
      Even constants can be mutable until set. then they change to being none mutable. Likewise in 'pure' scopes a variable can be mutable until it is first set then none mutable.
      Returns:
      If this symbol is mutable or not.
    • setNotMutable

      void setNotMutable()
    • getSourceToken

      IToken getSourceToken()
      Specified by:
      getSourceToken in interface ITokenReference
    • getInitialisedBy

      IToken getInitialisedBy()
    • setInitialisedBy

      void setInitialisedBy(IToken initialisedBy)
    • clearInitialisedBy

      void clearInitialisedBy()
    • isInitialised

      default boolean isInitialised()
    • isPrivate

      default boolean isPrivate()
    • isProtected

      default boolean isProtected()
    • isPublic

      default boolean isPublic()
    • isLoopVariable

      default boolean isLoopVariable()
    • isIncomingParameter

      default boolean isIncomingParameter()
    • isReturningParameter

      default boolean isReturningParameter()
    • isPropertyField

      default boolean isPropertyField()
    • isDeclaredAsConstant

      default boolean isDeclaredAsConstant()
      Only use on symbols, to see if they are directly defined as a constant.
    • isFromLiteral

      default boolean isFromLiteral()
    • isMarkedAbstract

      default boolean isMarkedAbstract()
    • isInjectable

      default boolean isInjectable()
      Some classes generated can be injected and others not.
      Returns:
      true if this can be injected, false if not.
    • isExtensionOfInjectable

      default boolean isExtensionOfInjectable()
      While this aggregate itself might not able been marked as injectable Does this extend an aggregate that is marked as injectable.
      Returns:
      true if this is injectable or any of its supers area
    • isExactSameType

      boolean isExactSameType(ISymbol symbolType)
      If is the symbol is an exact match.
    • isPromotionSupported

      boolean isPromotionSupported(ISymbol s)
      For some symbols we might support the _promote method via coercion. i.e. Long -> Float for example But with class structures and traits/interfaces there is a time when objects are assignable because of base and super classes/types but don't need coercion. The isAssignable deals with mingling both coercion and super/trait type compatibility. But we need to know when it comes to IR generation whether to include a PromoteNode or whether the code generated will just work because of class inheritance/interface implementation.
    • isAssignableTo

      boolean isAssignableTo(ISymbol s)
    • isAssignableTo

      boolean isAssignableTo(Optional<ISymbol> s)
    • getAssignableWeightTo

      double getAssignableWeightTo(Optional<ISymbol> s)
    • getAssignableWeightTo

      double getAssignableWeightTo(ISymbol s)
    • getUnCoercedAssignableWeightTo

      double getUnCoercedAssignableWeightTo(ISymbol s)
    • getFullyQualifiedName

      String getFullyQualifiedName()
      Provide the internal fully qualified name of this symbol. Defaults to just the name unless overridden. -Useful for generating output where you want to ensure fully qualified names are used.
    • getFriendlyName

      String getFriendlyName()
      Provide the name an end user would need to see on the screen. Normally this is just 'getName' but in the case of Templates We use a very nasty internal naming for List of SomeClass - which will probably be something like _List_hashed_version_of_ComeClass and the end user needs to see 'List of SomeClass' for it to be meaningful.
      Returns:
      a user presentable of the symbol name.
    • getName

      String getName()
      Provide the internal name of this symbol - not fully qualified in terms of the module it is in.
      Returns:
      The basic internal name we'd use to resolve the symbol
    • setName

      void setName(String name)
    • getType

      Optional<ISymbol> getType()
    • setType

      default ISymbol setType(ISymbol type)
    • setType

      ISymbol setType(Optional<ISymbol> type)