Examples of newCompilationUnit()


Examples of com.asakusafw.utils.java.model.syntax.ModelFactory.newCompilationUnit()

        assertThat(environment.hasError(), is(false));
    }

    private CompilationUnit getErroneousSource() {
        ModelFactory f = Models.getModelFactory();
        CompilationUnit cu = f.newCompilationUnit(
                f.newPackageDeclaration(Models.toName(f, "com.example")),
                Collections.<ImportDeclaration>emptyList(),
                Collections.singletonList(f.newClassDeclaration(
                        null,
                        new AttributeBuilder(f)
View Full Code Here

Examples of com.asakusafw.utils.java.model.syntax.ModelFactory.newCompilationUnit()

        }
    }

    private CompilationUnit java(String name) {
        ModelFactory f = Models.getModelFactory();
        return f.newCompilationUnit(
                f.newPackageDeclaration(Models.toName(f, "com.example")),
                Collections.<ImportDeclaration>emptyList(),
                Collections.singletonList(f.newClassDeclaration(
                        null,
                        new AttributeBuilder(f)
View Full Code Here

Examples of com.asakusafw.utils.java.model.syntax.ModelFactory.newCompilationUnit()

                    .toAttributes(),
                className,
                importer.resolve(baseClass),
                Collections.<Type>emptyList(),
                Collections.singletonList(ctorDecl));
        CompilationUnit source = f.newCompilationUnit(
                importer.getPackageDeclaration(),
                importer.toImportDeclarations(),
                Collections.singletonList(typeDecl),
                Collections.<Comment>emptyList());
        environment.emit(source);
View Full Code Here

Examples of flex2.compiler.Source.newCompilationUnit()

    CompilerContext context = new CompilerContext();
    context.setAscContext(interfaceGenerator.getContext());

    Object syntaxTree = interfaceGenerator.getSyntaxTree();
    result.newCompilationUnit(syntaxTree, context).setSyntaxTree(syntaxTree);

    return result;
  }

  // TODO return real-looking filename only if file is actually created
View Full Code Here

Examples of flex2.compiler.Source.newCompilationUnit()

    CompilerContext context = new CompilerContext();
    context.setAscContext(interfaceGenerator.getContext());

    Object syntaxTree = interfaceGenerator.getSyntaxTree();
    result.newCompilationUnit(syntaxTree, context).setSyntaxTree(syntaxTree);

    return result;
  }

  // TODO return real-looking filename only if file is actually created
View Full Code Here

Examples of flex2.compiler.Source.newCompilationUnit()

        PackageDefinitionNode packageDefinition = nodeFactory.finishPackage(cx, null);
        nodeFactory.statementList(programStatementList, packageDefinition);

    CompilerContext context = new CompilerContext();
    context.setAscContext(cx);
    result.newCompilationUnit(program, context).setSyntaxTree(program);

        // Useful when comparing abstract syntax trees
        //flash.swf.tools.SyntaxTreeDumper.dump(program, "/tmp/" + className + "New.xml");

        As3Compiler.cleanNodeFactory(nodeFactory);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.AST.newCompilationUnit()

          }

          // Create new CompilationUnit
          try {
            AST ast = AST.newAST(AST.JLS3);
            CompilationUnit unit = ast.newCompilationUnit();
            PackageDeclaration packageDeclaration = ast
                .newPackageDeclaration();
            packageDeclaration.setName(ast.newSimpleName(pkg
                .getElementName()));
            unit.setPackage(packageDeclaration);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.AST.newCompilationUnit()

public class ASTTest {

  @SuppressWarnings("unchecked")
  public void stackoverflow_answer() {
    AST ast = AST.newAST(AST.JLS4);
    CompilationUnit cu = ast.newCompilationUnit();

    PackageDeclaration p1 = ast.newPackageDeclaration();
    p1.setName(ast.newSimpleName("foo"));
    cu.setPackage(p1);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.AST.newCompilationUnit()

   *            UML class
   * @return JDT compilation unit
   */
  private CompilationUnit generateException(Classifier clazz) {
    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();

    generatePackage(clazz, ast, cu);
    TypeDeclaration td = generateClass(clazz, ast, cu);
    generateSerialVersionUID(clazz, ast, td);
    generateMethods(clazz, ast, td);
View Full Code Here

Examples of org.eclipse.jdt.core.dom.AST.newCompilationUnit()

    this.sourceDirectoryPackageName = sourceDirectoryPackageName;
    logger.log(Level.FINE, "Start generateInterface: " + clazz.getName()
        + " -----------------------------");

    AST ast = AST.newAST(AST.JLS3);
    CompilationUnit cu = ast.newCompilationUnit();

    generatePackage(clazz, ast, cu);
    TypeDeclaration td = generateClass(clazz, ast, cu);
    generateMethods(clazz, ast, td);
    generateGettersSetters(clazz, ast, td);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.