Symbol Table: Maintain tables by variable data type #84
Labels
enhancement
New feature or request
good first issue
Good for newcomers
unit-scope
Related to the scope module
Milestone
Description
The Symbol Table component in
src/syntax/symbol-table/symbolTable.ts
maintains global, program-specific, and routine-specific variables only by variable name. You can only fetch variables by variable name. Add methods for each table to fetch variables by variable name and variable data type.For example, say there is a global variable
foo
of data typenumber
. Currently you can fetch it bygetGlobalVariable('foo')
. The objective is to optionally supply the type as well likegetGlobalVariable('foo', 'number')
, which returns the same. But, callinggetGlobalVariable('foo', 'string')
returnsnull
.Objectives
Refactor function signatures (make change in
symbolTable.ts
file and thesymbolTable.spec.ts
file):getGlobalVariable(variable: string, dataType?: TDataName): IVariable | null
getProcessVariable(variable: string, program: string, dataType?: TDataName): IVariable | null
getRoutineVariable(variable: string, routine: string, dataType?: TDataName): IVariable | null
Add unit tests for:
getGlobalVariable
withdataType
fieldgetProcessVariable
withdataType
fieldgetRoutineVariable
withdataType
fieldThe text was updated successfully, but these errors were encountered: