Interface ISymbol

All Superinterfaces:
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 ITokenReference, Serializable
Represents the concept of what functionality a Symbol should have.
  • Field Details

  • Method Details

    • getModuleNameIfPresent

      static String getModuleNameIfPresent(String symbolName)
      Symbol names can be fully qualified (i.e. with the module name) or just a name. This method returns the module name if present or "" if not.
    • getUnqualifiedName

      static String getUnqualifiedName(String symbolName)
      Just returns the actual symbol name in unqualified form (i.e. no module name).
    • isQualifiedName

      static boolean isQualifiedName(String symbolName)
    • makeFullyQualifiedName

      static String makeFullyQualifiedName(String scopeName, String symbolName)
      Convert a scope name (module name) and a symbol name into a fully qualified symbol name.
    • 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(String key, String value)
    • getSquirrelledData

      String getSquirrelledData(String 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
    • isParameterisedType

      default boolean isParameterisedType()
      So just to add to the confusion. A type that has been used with a type that is generic in nature with some parameters. So this would normally result in a type that is now concrete. i.e. List (generic in nature) and String (concrete) so this resulting type 'List of String' isAParameterisedType=true and isGenericInNature=false. But if List were parameterised with another generic parameter it would still be of a generic nature. For example, consider List T and Iterator I when we defined List T and use the Iterator with it; we parameterise Iterator with 'T'. But they are still both 'isGenericTypeParameter' it only when we use List (and by implication Iterator) with String do they both stop being generic in nature.
      Returns:
      true if a parameterised type (note parameterised not just of a generic nature).
    • isGenericInNature

      default boolean isGenericInNature()
      Is this symbol a type that is generic in nature i.e. can it be parameterised with types. Aggregate Symbols can be defined to accept one or more parameters ie S and T.
    • isConceptualTypeParameter

      default boolean isConceptualTypeParameter()
      Some symbols are simulated as generic type parameters like T and S and U for example When they are constructed as AggregateTypes this will be set to true in those classes. In general this is useful when working with Generic classes and needing types like S and T But they can never really be generated.
    • 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()
    • isTemplateType

      default boolean isTemplateType()
    • isTemplateFunction

      default boolean isTemplateFunction()
    • isType

      default boolean isType()
    • isVariable

      default boolean isVariable()
    • isPrimitiveType

      default boolean isPrimitiveType()
      Is the symbol a core primitive type.
    • isApplication

      default boolean isApplication()
      Is the symbol an application of some sort.
    • isDeclaredAsConstant

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

      default boolean isMethod()
    • isFunction

      default boolean isFunction()
    • isControl

      default boolean isControl()
    • isConstant

      default boolean isConstant()
    • 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.
    • isEk9Core

      boolean isEk9Core()
      Is this a core thing from EK9.
    • 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)
    • getGenus

    • setGenus

      void setGenus(ISymbol.SymbolGenus genus)
    • getCategory

      ISymbol.SymbolCategory getCategory()
    • 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)