Module suggest

Class FunctionSymbol

All Implemented Interfaces:
Member, Scope, Symbol, SymbolWithModifiers, TypedSymbol
Direct Known Subclasses:
MethodSymbol

public class FunctionSymbol extends SymbolWithScope implements TypedSymbol
This symbol represents a function ala C, not a method ala Java. You can associate a node in the parse tree that is responsible for defining this symbol.
  • Field Details

    • defNode

      protected org.antlr.v4.runtime.ParserRuleContext defNode
    • retType

      protected Type retType
    • isArray

      protected boolean isArray
    • typeResolved

      public boolean typeResolved
    • typeAsText

      public String typeAsText
  • Constructor Details

    • FunctionSymbol

      public FunctionSymbol(String name)
  • Method Details

    • setDefNode

      public void setDefNode(org.antlr.v4.runtime.ParserRuleContext defNode)
    • getDefNode

      public org.antlr.v4.runtime.ParserRuleContext getDefNode()
    • getType

      public Type getType()
      Specified by:
      getType in interface TypedSymbol
    • isArray

      public boolean isArray()
      Specified by:
      isArray in interface TypedSymbol
    • setType

      public void setType(Type type)
      Specified by:
      setType in interface TypedSymbol
    • getNumberOfVariables

      public int getNumberOfVariables()
      Return the number of VariableSymbols specifically defined in the scope. This is useful as either the number of parameters or the number of parameters and locals depending on how you build the scope tree.
    • getNumberOfParameters

      public int getNumberOfParameters()
    • resolveType

      public Type resolveType(Scope scope)
      Description copied from interface: TypedSymbol
      Symbol can be set a type that will be define latter in the file. They can save the text as type and mark themselves as type unresovled. Then when the type is fetched for the first type it is looked in the type table.
      Specified by:
      resolveType in interface TypedSymbol
    • setTypeResolved

      public void setTypeResolved(boolean b)
      Specified by:
      setTypeResolved in interface TypedSymbol
    • toString

      public String toString()
      Overrides:
      toString in class SymbolWithScope