Пример #1
0
 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);
 }
Пример #2
0
 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);
 }