public override void ExitSingle_varDeclaration(DecafParser.Single_varDeclarationContext context) { SymbolType theType = getNodeType(context.varType()); Symbol theSymbolRepresentation; if (theType != SymbolType.TstructImpl) theSymbolRepresentation = new Symbol(theType); else theSymbolRepresentation = getNodeSymbol(context.varType()); theScopeManager.AddSymbol(context.Id().GetText(), theSymbolRepresentation); }
public override void ExitArray_varDeclaration(DecafParser.Array_varDeclarationContext context) { SymbolType theType = getNodeType(context.varType()); string num = context.Num().GetText(); ArraySymbol theSymbolRepresentation; if (theType != SymbolType.TstructImpl) theSymbolRepresentation = new ArraySymbol(theType, Convert.ToInt32(num)); else { StructImpl theSymbol = getNodeSymbol(context.varType()) as StructImpl; theSymbolRepresentation = new StructArraySymbol(theType, Convert.ToInt32(num), theSymbol.ParentStructName); } theScopeManager.AddSymbol(context.Id().GetText(), theSymbolRepresentation); }