-
Couldn't load subscription status.
- Fork 35
Description
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 type number. Currently you can fetch it by getGlobalVariable('foo'). The objective is to optionally supply the type as well like getGlobalVariable('foo', 'number'), which returns the same. But, calling getGlobalVariable('foo', 'string') returns null.
Objectives
Refactor function signatures (make change in symbolTable.ts file and the symbolTable.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:
-
getGlobalVariablewithdataTypefield -
getProcessVariablewithdataTypefield -
getRoutineVariablewithdataTypefield