Beispiel #1
0
 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");
     }
 }
Beispiel #2
0
        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();
            }
        }
Beispiel #3
0
 public override void Visit(VoidDcl n)
 {
     emit($"void {n.id} ");
 }
Beispiel #4
0
 public override void Visit(VoidDcl n)
 {
     n.type = AST.VOID;
 }
Beispiel #5
0
 public override void Visit(VoidDcl n)
 {
 }