public override void EnterSingle_blockVarDeclaration(NewDecafParser.Single_blockVarDeclarationContext context) { IType varType = (IType)currentScope.resolve(context.varType().GetText()); VariableSymbol vs = new VariableSymbol(context.Id().GetText(), varType, theVariableType: VariableType.vField); currentScope.define(vs); setNodeScope(context, currentScope); }
public override void EnterArray_varDeclaration(NewDecafParser.Array_varDeclarationContext context) { IType varType = (IType)currentScope.resolve(context.varType().GetText()); int arraySize = Convert.ToInt32(context.Num().GetText()); VariableSymbol vs = new VariableSymbol(context.Id().GetText(), varType, theSize: arraySize, theVariableType: VariableType.vField); currentScope.define(vs); setNodeScope(context, currentScope); }