Skip to content

Commit 7dacf05

Browse files
Closure Teamcopybara-github
Closure Team
authored andcommitted
Fix ClosureRewriteModule crash on unrecognized goog.requireDynamic
PiperOrigin-RevId: 618091589
1 parent cbcaded commit 7dacf05

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -964,9 +964,8 @@ private void recordGoogRequireDynamic(NodeTraversal t, Node call) {
964964
if (!rewriteState.containsModule(namespaceId)) {
965965
unrecognizedRequires.add(
966966
new UnrecognizedRequire(call, namespaceId, /* mustBeOrdered= */ false));
967-
} else {
968-
this.googRequireDynamicCalls.add(call);
969967
}
968+
this.googRequireDynamicCalls.add(call);
970969
}
971970

972971
private void recordGoogModuleGet(NodeTraversal t, Node call) {

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

-17
Original file line numberDiff line numberDiff line change
@@ -1282,23 +1282,6 @@ public void testGoogRequireDynamic_then_name() {
12821282
"}")));
12831283
}
12841284

1285-
@Test
1286-
public void testGoogRequireDynamic_then_missingSources() {
1287-
test(
1288-
srcs(
1289-
lines(
1290-
"async function test() {", //
1291-
" /** @suppress {missingSourcesWarnings} */",
1292-
" goog.requireDynamic('a.b.c').then((foo) => {console.log(foo.Foo);});",
1293-
"}")),
1294-
expected(
1295-
lines(
1296-
"async function test() {", //
1297-
" /** @suppress {missingSourcesWarnings} */",
1298-
" null.then((foo) => {console.log(foo.Foo);});",
1299-
"}")));
1300-
}
1301-
13021285
@Test
13031286
public void testRequireDynamic_illegal_await_lhs() {
13041287
testError(

0 commit comments

Comments
 (0)