Skip to content

feat(scope): maintain variable tables by data type namespace (#84)#152

Open
Dev10-sys wants to merge 1 commit intosugarlabs:developfrom
Dev10-sys:feat/scope-variable-datatype-namespace
Open

feat(scope): maintain variable tables by data type namespace (#84)#152
Dev10-sys wants to merge 1 commit intosugarlabs:developfrom
Dev10-sys:feat/scope-variable-datatype-namespace

Conversation

@Dev10-sys
Copy link
Copy Markdown

Implements Issue #84 by introducing data-type namespaced variable tables
for global, process, and routine scopes.

Changes

  • Added:

    • _globalVariableTable[dataType][variable]
    • _processVariableTable[process][dataType][variable]
    • _routineVariableTable[routine][dataType][variable]
  • Implemented:

    • addGlobalVariable / getGlobalVariable(variable, dataType?)
    • addProcessVariable / getProcessVariable(variable, process, dataType?)
    • addRoutineVariable / getRoutineVariable(variable, routine, dataType?)
  • Improved query logic:

    • With dataType → strict namespace lookup
    • Without dataType → throws AmbiguousVariableError if multiple matches exist
    • Avoided Object.values() allocation in hot path
  • Reset clears new variable tables

  • Exported new APIs via scope module and package entrypoint

Testing

All existing tests pass.
TypeScript check clean.
No changes to existing SymbolTableStack behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant