fix: ensure […map.keys] can be correctly transformed in loose mode (#11901)
This commit is contained in:
parent
08054181c3
commit
c41dcd045b
@ -518,7 +518,7 @@ class BlockScoping {
|
|||||||
// remap loop heads with colliding variables
|
// remap loop heads with colliding variables
|
||||||
if (this.loop) {
|
if (this.loop) {
|
||||||
// nb: clone outsideRefs keys since the map is modified within the loop
|
// nb: clone outsideRefs keys since the map is modified within the loop
|
||||||
for (const name of [...outsideRefs.keys()]) {
|
for (const name of Array.from(outsideRefs.keys())) {
|
||||||
const id = outsideRefs.get(name);
|
const id = outsideRefs.get(name);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@ -210,6 +210,13 @@
|
|||||||
}),
|
}),
|
||||||
).not.toThrow();
|
).not.toThrow();
|
||||||
});
|
});
|
||||||
|
it("#11897 - [...map.keys()] in Babel source should be transformed correctly", () => {
|
||||||
|
expect(() =>
|
||||||
|
Babel.transform("for (let el of []) { s => el }", {
|
||||||
|
plugins: ["transform-block-scoping"],
|
||||||
|
}),
|
||||||
|
).not.toThrow();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user