Class Scope


  • public class Scope
    extends Object
    • Constructor Detail

      • Scope

        public Scope​(Scope outer,
                     Tree tree,
                     boolean isBlock)
        Parameters:
        outer - parent scope
        tree - syntax tree holding this scope (e.g. ScriptTree or BlockTree)
        isBlock - pass true for block scopes (loops, if, etc.), false for function scopes (script, functions, getter, etc.)
    • Method Detail

      • tree

        public Tree tree()
      • outer

        public Scope outer()
      • lookupSymbol

        public Symbol lookupSymbol​(String name)
        Parameters:
        name - of the symbol to look for
        Returns:
        the symbol corresponding to the given name
      • getSymbols

        public List<Symbol> getSymbols​(Symbol.Kind kind)
        Parameters:
        kind - of the symbols to look for
        Returns:
        the symbols corresponding to the given kind
      • isGlobal

        public boolean isGlobal()
      • addSymbol

        public void addSymbol​(Symbol symbol)
      • isBlock

        public boolean isBlock()
        Returns true for block scopes (loops, if, etc.), false for function scopes (script, functions, getter, etc.)