Skip to content

Commit 62af3a1

Browse files
natebiggsCommit Queue
authored andcommitted
[dart2wasm] Fix return in load ID module compile loop.
The 'return' on line 213 was causing only the first module to be compiled. The updated deferred_loading test now guards against this error. Change-Id: Idfc1583bc4facbfe70f291797084a913f6fc4525 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/455380 Reviewed-by: Mayank Patke <fishythefish@google.com> Commit-Queue: Nate Biggs <natebiggs@google.com>
1 parent c9671c5 commit 62af3a1

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

pkg/dart2wasm/lib/js/runtime_blob.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ final moduleLoadingHelperTemplate = Template(r'''
194194
const module = await ((source instanceof Response)
195195
? WebAssembly.compileStreaming(source, this.builtins)
196196
: WebAssembly.compile(source, this.builtins));
197-
return await WebAssembly.instantiate(module, {
197+
await WebAssembly.instantiate(module, {
198198
...baseImports,
199199
...additionalImports,
200200
<<JS_POLYFILL_IMPORT>>
@@ -210,7 +210,7 @@ final moduleLoadingHelperTemplate = Template(r'''
210210
const module = await ((source instanceof Response)
211211
? WebAssembly.compileStreaming(source, this.builtins)
212212
: WebAssembly.compile(source, this.builtins));
213-
return await WebAssembly.instantiate(module, {
213+
await WebAssembly.instantiate(module, {
214214
...baseImports,
215215
...additionalImports,
216216
<<JS_POLYFILL_IMPORT>>

pkg/dart2wasm/test/deferred_loading/data/b.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
import 'd.dart';
6+
57
void b() {
68
print('In b');
9+
d();
710
}

pkg/dart2wasm/test/deferred_loading/data/c.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
import 'd.dart';
6+
57
void c() {
68
print('In c');
9+
d();
710
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
void d() {
6+
print('In d');
7+
}

pkg/dart2wasm/test/deferred_loading/data/deferred_load_ids.golden.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
"name": "<unnamed>",
44
"imports": {
55
"1": [
6-
"out_module2.wasm"
6+
"out_module3.wasm"
77
],
88
"2": [
9-
"out_module1.wasm"
9+
"out_module1.wasm",
10+
"out_module2.wasm"
1011
]
1112
},
1213
"importPrefixToLoadId": {
@@ -18,10 +19,12 @@
1819
"name": "<unnamed>",
1920
"imports": {
2021
"3": [
21-
"out_module1.wasm"
22+
"out_module1.wasm",
23+
"out_module2.wasm"
2224
],
2325
"4": [
24-
"out_module3.wasm"
26+
"out_module2.wasm",
27+
"out_module4.wasm"
2528
]
2629
},
2730
"importPrefixToLoadId": {

0 commit comments

Comments
 (0)