Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit dbdbdf3

Browse files
loganfsmythjasonLaster
authored andcommitted
[Scopes] Avoid exceptions when import bindings are optimized away. (#5722)
1 parent dc30d21 commit dbdbdf3

File tree

15 files changed

+131
-48
lines changed

15 files changed

+131
-48
lines changed

β€Žsrc/test/mochitest/browser_dbg-babel-preview.jsβ€Ž

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,33 +165,33 @@ add_task(async function() {
165165
},
166166
]);
167167

168-
await breakpointPreviews(dbg, "imported-bindings", { line: 17, column: 2 }, [
168+
await breakpointPreviews(dbg, "imported-bindings", { line: 20, column: 2 }, [
169169
{
170-
line: 19,
170+
line: 22,
171171
column: 16,
172172
expression: "_mod2.default;",
173173
result: '"a-default"',
174174
},
175175
{
176-
line: 20,
176+
line: 23,
177177
column: 16,
178178
expression: "_mod4.original;",
179179
result: '"an-original"',
180180
},
181181
{
182-
line: 21,
182+
line: 24,
183183
column: 16,
184184
expression: "_mod3.aNamed;",
185185
result: '"a-named"',
186186
},
187187
{
188-
line: 22,
188+
line: 25,
189189
column: 16,
190190
expression: "_mod4.original;",
191191
result: '"an-original"',
192192
},
193193
{
194-
line: 23,
194+
line: 26,
195195
column: 16,
196196
expression: "aNamespace;",
197197
fields: [
@@ -200,31 +200,31 @@ add_task(async function() {
200200
],
201201
},
202202
{
203-
line: 28,
203+
line: 31,
204204
column: 20,
205205
expression: "_mod7.default;",
206206
result: '"a-default2"',
207207
},
208208
{
209-
line: 29,
209+
line: 32,
210210
column: 20,
211211
expression: "_mod9.original;",
212212
result: '"an-original2"',
213213
},
214214
{
215-
line: 30,
215+
line: 33,
216216
column: 20,
217217
expression: "_mod8.aNamed2;",
218218
result: '"a-named2"',
219219
},
220220
{
221-
line: 31,
221+
line: 34,
222222
column: 20,
223223
expression: "_mod9.original;",
224224
result: '"an-original2"',
225225
},
226226
{
227-
line: 32,
227+
line: 35,
228228
column: 20,
229229
expression: "aNamespace2;",
230230
fields: [

β€Žsrc/test/mochitest/browser_dbg-babel-scopes.jsβ€Ž

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ add_task(async function() {
160160

161161
// Babel 6's imports aren't fully mapped, so they show as unavailable.
162162
// The call-based ones work, but the single-identifier ones do not.
163-
await breakpointScopes(dbg, "imported-bindings", { line: 17, column: 2 }, [
163+
await breakpointScopes(dbg, "imported-bindings", { line: 20, column: 2 }, [
164164
"Module",
165165
["aDefault", '"a-default"'],
166166
["aDefault2", '"a-default2"'],
@@ -174,6 +174,7 @@ add_task(async function() {
174174
["aNamespace", "{\u2026}"],
175175
["aNamespace2", "{\u2026}"],
176176
["aNamespace3", "{\u2026}"],
177+
["optimizedOut", "(optimized away)"],
177178
"root()"
178179
]);
179180

@@ -307,7 +308,7 @@ add_task(async function() {
307308
"root()"
308309
]);
309310

310-
await breakpointScopes(dbg, "webpack-modules", { line: 17, column: 2 }, [
311+
await breakpointScopes(dbg, "webpack-modules", { line: 20, column: 2 }, [
311312
"Module",
312313
["aDefault", '"a-default"'],
313314
["aDefault2", '"a-default2"'],
@@ -321,10 +322,11 @@ add_task(async function() {
321322
["aNamespace", "{\u2026}"],
322323
["aNamespace2", "{\u2026}"],
323324
["aNamespace3", "{\u2026}"],
325+
["optimizedOut", "(optimized away)"],
324326
"root()"
325327
]);
326328

327-
await breakpointScopes(dbg, "webpack-modules-es6", { line: 17, column: 2 }, [
329+
await breakpointScopes(dbg, "webpack-modules-es6", { line: 20, column: 2 }, [
328330
"Module",
329331
["aDefault", '"a-default"'],
330332
["aDefault2", '"a-default2"'],
@@ -338,6 +340,7 @@ add_task(async function() {
338340
["aNamespace", "{\u2026}"],
339341
["aNamespace2", "{\u2026}"],
340342
["aNamespace3", "{\u2026}"],
343+
["optimizedOut", "(optimized away)"],
341344
"root()"
342345
]);
343346

β€Žsrc/test/mochitest/examples/babel/fixtures/imported-bindings/input.jsβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import { aNamed3 } from "./src/mod10";
1313
import { original as anAliased3 } from "./src/mod11";
1414
import * as aNamespace3 from "./src/mod12";
1515

16+
import optimizedOut from "./src/optimized-out";
17+
optimizedOut();
18+
1619
export default function root() {
1720
console.log("pause here", root);
1821

β€Žsrc/test/mochitest/examples/babel/fixtures/imported-bindings/output.jsβ€Ž

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žsrc/test/mochitest/examples/babel/fixtures/imported-bindings/output.js.mapβ€Ž

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default function optimizedOut() {}

β€Žsrc/test/mochitest/examples/babel/fixtures/webpack-modules-es6/input.jsβ€Ž

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import { aNamed3 } from "./src/mod10";
1313
import { original as anAliased3 } from "./src/mod11";
1414
import * as aNamespace3 from "./src/mod12";
1515

16+
import optimizedOut from "./src/optimized-out";
17+
optimizedOut();
18+
1619
export default function root() {
1720
console.log("pause here", root);
1821

0 commit comments

Comments
Β (0)