Tricorder fixes!
* a hack for printing synthetic primitive nodes (looking for advice here)
* support printing SoyNodes
* reporting compilation errors from the analyzer
* apply multiple replacements in reverse order in the test infra
GITHUB_BREAKING_CHANGES=none
@@ -1136,12 +1136,21 @@ public final class SoyFileSet {
}
/** Performs enough work to retrieve all possible warnings in a compile. */
- public ParseResult compileForWarnings() {
+ public ParseResult compileForAnalysis() {
return entryPoint(
() -> {
disallowExternalCalls();
return parse(
passManagerBuilder()
+ // the optimizer mutates the AST heavily which inhibits certain source analysis
+ // rules.
+ .optimize(false)
+ // skip adding extra attributes
+ .addHtmlAttributesForDebugging(false)
+ // skip the autoescaper
+ .setAutoescaperEnabled(false)
+ // TODO(lukes): other passes should be disabled, basically anything that mutates
+ // the AST
.allowUnknownGlobals()
.allowUnknownJsGlobals()
.allowV1Expression(),
