Package com.google.minijoe.compiler.ast

Examples of com.google.minijoe.compiler.ast.FunctionDeclaration


      return parseStatement();
    }
  }

  private Statement parseFunctionDeclaration() throws CompilerException {
    return new FunctionDeclaration(parseFunctionLiteral(true));
  }
View Full Code Here


    super(name);
  }

  public void testFunctionDeclaration() throws CompilerException {
    assertParserOutput(
        new FunctionDeclaration(
            new FunctionLiteral(
                new Identifier("foo"),
                new Identifier[] {
                },
                new Statement[] {
                }
            )
        ),
        "function foo() {};"
    );
    assertParserOutput(
        new FunctionDeclaration(
            new FunctionLiteral(
                new Identifier("foo"),
                new Identifier[] {
                  new Identifier("a"),
                },
                new Statement[] {
                }
            )
        ),
        "function foo(a) {}"
    );
    assertParserOutput(
        new FunctionDeclaration(
            new FunctionLiteral(
                new Identifier("foo"),
                new Identifier[] {
                  new Identifier("a"),
                  new Identifier("b"),
                  new Identifier("c"),
                },
                new Statement[] {
                }
            )
        ),
        "function foo(a, b, c) {};"
    );
    assertParserOutput(
        new FunctionDeclaration(
            new FunctionLiteral(
                new Identifier("a"),
                new Identifier[] {
                },
                new Statement[] {
                  new FunctionDeclaration(
                      new FunctionLiteral(
                          new Identifier("b"),
                          new Identifier[] {
                          },
                          new Statement[] {
View Full Code Here

TOP

Related Classes of com.google.minijoe.compiler.ast.FunctionDeclaration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.