Skip to content

Commit 2b4426e

Browse files
Closure Teamcopybara-github
authored andcommitted
Remove obsolete null check for JSDoc on a closureUnaware script
PiperOrigin-RevId: 900207699
1 parent 58c132e commit 2b4426e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/com/google/javascript/jscomp/TranspileAndOptimizeClosureUnaware.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package com.google.javascript.jscomp;
1818

19-
import static com.google.common.base.Preconditions.checkNotNull;
2019
import static com.google.common.base.Preconditions.checkState;
2120

2221
import com.google.common.collect.ImmutableList;
@@ -77,8 +76,12 @@ public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
7776
if (!n.isClosureUnawareCode()) {
7877
return false;
7978
}
80-
JSDocInfo fileJsDoc =
81-
checkNotNull(n.getJSDocInfo(), "closure unaware script must have JSDoc, found %s", n);
79+
JSDocInfo fileJsDoc = n.getJSDocInfo();
80+
if (fileJsDoc == null || fileJsDoc.getPerFileClosureUnawareMode() == null) {
81+
// TODO: b/475302905 - remove this null check, once the JSC release to always serialize a
82+
// ClosureUnawareMode lands.
83+
return true;
84+
}
8285
var minificationLevel = fileJsDoc.getPerFileClosureUnawareMode();
8386
return switch (minificationLevel) {
8487
case UNSPECIFIED, SIMPLE -> true;

0 commit comments

Comments
 (0)