@Override public Node getAstRoot(AbstractCompiler compiler) { if (root == null) { parse(compiler); root.setInputId(inputId); } return root; }
@Override public Node getAstRoot(AbstractCompiler compiler) { if (!isParsed()) { parse(compiler); root.setInputId(inputId); } return checkNotNull(root); }
@Override public void clearAst() { root = IR.script(); root.setInputId(inputId); root.setStaticSourceFile(sourceFile); }
@Override public void clearAst() { root = IR.script(); root.setInputId(inputId); root.setStaticSourceFile(sourceFile); }
/** * Adds a new Script AST to the compile state. If a script for the same file * already exists the script will not be added, instead a call to * #replaceScript should be used. * * @param ast the ast of the new file */ public void addNewScript(JsAst ast) { if (!addNewSourceAst(ast)) { return; } Node emptyScript = new Node(Token.SCRIPT); InputId inputId = ast.getInputId(); emptyScript.setInputId(inputId); emptyScript.setStaticSourceFile( SourceFile.fromCode(inputId.getIdName(), "")); processNewScript(ast, emptyScript); }
/** * Adds a new Script AST to the compile state. If a script for the same file * already exists the script will not be added, instead a call to * #replaceScript should be used. * * @param ast the ast of the new file */ public void addNewScript(JsAst ast) { if (!addNewSourceAst(ast)) { return; } Node emptyScript = new Node(Token.SCRIPT); InputId inputId = ast.getInputId(); emptyScript.setInputId(inputId); emptyScript.setStaticSourceFile( SourceFile.fromCode(inputId.getIdName(), "")); processNewScript(ast, emptyScript); }