public override void Visit(VoidDcl n) { if (!KeyValExists(n.id)) { AST.SymbolTable.Add(GetKeyVal(n.id), AST.VOID); } else { error("variable " + n.id + " is already declared"); } }
public void VoidDclUnitTest() { try { VoidDcl voidDcl = new VoidDcl("testVar"); SymbolTableFilling symbolTableFilling = new SymbolTableFilling(); voidDcl.accept(symbolTableFilling); Dictionary <Tuple <string, string>, int> actual = AST.SymbolTable; Dictionary <Tuple <string, string>, int> expected = new Dictionary <Tuple <string, string>, int>() { { new Tuple <string, string>("1", "testVar"), 0 } }; Assert.IsTrue(ObjectCompare(actual, expected), "Void Dcl fail"); } finally { AST.SymbolTable.Clear(); } }
public override void Visit(VoidDcl n) { emit($"void {n.id} "); }
public override void Visit(VoidDcl n) { n.type = AST.VOID; }
public override void Visit(VoidDcl n) { }