Es6ErrorReporter es6ErrorReporter =
new Es6ErrorReporter(errorReporter, file, config);
com.google.javascript.jscomp.parsing.parser.Parser.Config es6config =
new com.google.javascript.jscomp.parsing.parser.Parser.Config(mode(
config.languageMode));
Parser p = new Parser(es6config, es6ErrorReporter, file);
ProgramTree tree = p.parseProgram();
Node root = null;
List<Comment> comments = ImmutableList.of();
if (tree != null && (!es6ErrorReporter.hadError() || config.isIdeMode)) {
root = NewIRFactory.transformTree(
tree, sourceFile, sourceString, config, errorReporter);
root.setIsSyntheticBlock(true);
if (config.isIdeMode) {
comments = p.getComments();
}
}
return new ParseResult(root, comments);
}