Ejemplo n.º 1
0
        public void AstStmt_Var()
        {
            var stmt = new Tree("var", "expr");

            AssertStmtEqual(stmt, "var foo = 3;");
        }
Ejemplo n.º 2
0
        public void AstStmt_Function()
        {
            var stmt = new Tree("func", this.block);

            AssertStmtEqual(stmt, "func foo(a:int):int {stmt();}");
        }
Ejemplo n.º 3
0
        public void AstStmt_ReturnValue()
        {
            var stmt = new Tree("return", "expr");

            AssertStmtEqual(stmt, "return 1;");
        }
Ejemplo n.º 4
0
        public void AstStmt_ReturnVoid()
        {
            var stmt = new Tree("return", (Tree)null);

            AssertStmtEqual(stmt, "return;");
        }
Ejemplo n.º 5
0
        public void AstStmt_DoWhile()
        {
            var stmt = new Tree("dowhile", this.block, "expr");

            AssertStmtEqual(stmt, "do{stmt();}while(1);");
        }
Ejemplo n.º 6
0
        public void AstStmt_While()
        {
            var stmt = new Tree("while", "expr", this.block);

            AssertStmtEqual(stmt, "while(1){stmt();}");
        }
Ejemplo n.º 7
0
        public void AstStmt_IfElse()
        {
            var stmt = new Tree("if", "expr", this.block, this.block);

            AssertStmtEqual(stmt, "if(0){stmt1();}else{stmt2();}");
        }
Ejemplo n.º 8
0
        public void AstStmt_If()
        {
            var stmt = new Tree("if", "expr", this.block, null);

            AssertStmtEqual(stmt, "if(0){stmt();}");
        }
Ejemplo n.º 9
0
        public void AstStmt_Block()
        {
            var stmt = new Tree("block", "stmt", "stmt");

            AssertStmtEqual(stmt, "{stmt1();stmt2();}");
        }