Class RecordedSymbols

java.lang.Object
org.ek9lang.compiler.support.RecordedSymbols
All Implemented Interfaces:
BiFunction<ParsedModule, org.antlr.v4.runtime.tree.ParseTree, List<RecordedSymbols.Reference>>

public final class RecordedSymbols extends Object implements BiFunction<ParsedModule, org.antlr.v4.runtime.tree.ParseTree, List<RecordedSymbols.Reference>>
THE symbol-identity walk over a parse-tree fragment for the compiler and the mcp.oracle tools - use this (moved down from compiler-services with SymbolWrites, 2026-10-04), never a by-NAME walk (a regex over body text, getText().equals(name) on identifier nodes, a set of names).

Why: a name is not a symbol. The symbol-table audit (2026-10-02, EK9_SYMBOL_TABLE_AUDIT_2026_10_02.md) found eight editors that matched by name and so treated a same-named local in a SIBLING scope, a word in a comment or in a String, or a longer name sharing a prefix as the variable they were editing. The compiler has already bound every identifier to the symbol it means (ParsedModule.getRecordedSymbol(ParseTree)); this class reads those bindings and nothing else, so comments and String text can never appear (they are not identifier nodes) and two locals called label in sibling blocks are two different symbols.

No-statics lane S3, 2026-10-29: referencedIn is apply(ParsedModule, ParseTree); usesOf, aliasesOf, declaredIn and capturedCopy are the classes above; a call's resolved callable is BoundSymbol.

The fragment must come from the COMPILED tree of parsedModule (the one the program was built from): a re-parsed copy has no recorded symbols, so every query on it answers empty. Writes are SymbolWrites, which is built on this.

  • Constructor Details

    • RecordedSymbols

      public RecordedSymbols()
  • Method Details

    • apply

      public List<RecordedSymbols.Reference> apply(ParsedModule parsedModule, org.antlr.v4.runtime.tree.ParseTree fragment)
      Every identifier in fragment that the compiler bound to a symbol, in source order: variables, parameters, properties (bare and through .), functions and methods called, types named, this and super. Reads and writes alike (SymbolWrites tells them apart); the NAME of a declaration is not a reference (RecordedDeclarations). Never a comment, never String text - only the identifiers inside an interpolation hole ${...}, which are code. Was referencedIn.
      Specified by:
      apply in interface BiFunction<ParsedModule, org.antlr.v4.runtime.tree.ParseTree, List<RecordedSymbols.Reference>>