Skip to content

Commit aae006c

Browse files
lauraharkercopybara-github
authored andcommitted
Remove CompilerTestCase::compareSyntheticCode option
This was only really used in one test case, IsolatePolyfillsTest. It appears unnecessary in RewriteObjectSpreadTest. I think it's better to have a bit of extra code in IsolatePolyfillsTest but be more explicit about what gets compared, rather than have this complexity in CompilerTestCase. PiperOrigin-RevId: 846290186
1 parent 571e88a commit aae006c

File tree

3 files changed

+99
-108
lines changed

3 files changed

+99
-108
lines changed

test/com/google/javascript/jscomp/CompilerTestCase.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ public abstract class CompilerTestCase {
8989
/** Libraries to inject before typechecking */
9090
final Set<String> librariesToInject;
9191

92-
/** Whether to include synthetic code when comparing actual to expected */
93-
private boolean compareSyntheticCode;
94-
9592
/** Whether to compare input and output as trees instead of strings */
9693
private boolean compareAsTree;
9794

@@ -306,7 +303,6 @@ public void setUp() throws Exception {
306303
this.closurePassEnabledForExpected = false;
307304
this.compareAsTree = true;
308305
this.compareJsDoc = true;
309-
this.compareSyntheticCode = true;
310306
this.computeSideEffects = false;
311307
this.annotateSourceInfo = false;
312308
this.expectParseWarningsInThisTest = false;
@@ -548,17 +544,6 @@ protected final void enableCreateModuleMap() {
548544
this.createModuleMap = true;
549545
}
550546

551-
/**
552-
* When comparing expected to actual, ignore nodes created through compiler.ensureLibraryInjected
553-
*
554-
* <p>This differs from using {@link RuntimeJsLibManager.RuntimeLibraryMode.RECORD_ONLY} in that
555-
* the compiler still injects the polyfills when requested.
556-
*/
557-
protected final void disableCompareSyntheticCode() {
558-
checkState(this.setUpRan, "Attempted to configure before running setUp().");
559-
compareSyntheticCode = false;
560-
}
561-
562547
/** Run using multistage compilation. */
563548
protected final void enableMultistageCompilation() {
564549
checkState(this.setUpRan, "Attempted to configure before running setUp().");
@@ -1510,16 +1495,6 @@ private void validateCodeChangeReporting(
15101495

15111496
private void compareExpectedToActualAsTree(
15121497
Node mainRoot, Node expectedRoot, Compiler compiler, Map<String, String> genericNameMapping) {
1513-
if (!compareSyntheticCode) {
1514-
Node scriptRoot = mainRoot.getFirstChild();
1515-
for (Node child = scriptRoot.getFirstChild(); child != null; ) {
1516-
Node nextChild = child.getNext();
1517-
if (NodeUtil.isInSyntheticScript(child)) {
1518-
child.detach();
1519-
}
1520-
child = nextChild;
1521-
}
1522-
}
15231498
if (compareJsDoc) {
15241499
assertNode(mainRoot)
15251500
.usingSerializer(createPrettyPrinter(compiler))

0 commit comments

Comments
 (0)