use of com.google.javascript.jscomp.NodeUtil in project closure-compiler by google.
the class JsDocInfoParserTest method parse.
private JSDocInfo parse(String comment, JsDocParsing parseDocumentation, boolean parseFileOverview, String... warnings) {
TestErrorReporter errorReporter = new TestErrorReporter().expectAllWarnings(warnings);
Config config = Config.builder().setExtraAnnotationNames(extraAnnotations).setJsDocParsingMode(parseDocumentation).setSuppressionNames(extraSuppressions).setClosurePrimitiveNames(extraPrimitives).setLanguageMode(LanguageMode.ECMASCRIPT3).setParseInlineSourceMaps(true).setStrictMode(Config.StrictMode.SLOPPY).build();
StaticSourceFile file = new SimpleSourceFile("testcode", SourceKind.STRONG);
Node templateNode = IR.script();
templateNode.setStaticSourceFile(file);
JsDocInfoParser jsdocParser = new JsDocInfoParser(stream(comment), comment, 0, templateNode, config, errorReporter);
jsdocParser.parse();
this.prevLicense = jsdocParser.getLicenseText();
errorReporter.verifyHasEncounteredAllWarningsAndErrors();
final JSDocInfo result;
if (parseFileOverview) {
result = jsdocParser.getFileOverviewJSDocInfo();
} else {
result = jsdocParser.retrieveAndResetParsedJSDocInfo();
}
if (result != null) {
assertThat(result.getTypeNodes()).comparingElementsUsing(transforming(NodeUtil::getSourceName, "has source name that")).doesNotContain(null);
}
return result;
}
Aggregations