Skip to content

Commit

Permalink
fix: mark Map is impure
Browse files Browse the repository at this point in the history
  • Loading branch information
TrickyPi committed Apr 23, 2023
1 parent 40a389b commit d0fe9e0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ast/nodes/shared/knownGlobals.ts
Expand Up @@ -164,7 +164,7 @@ const knownGlobals: GlobalDescription = {
isNaN: PF,
isPrototypeOf: O,
JSON: O,
Map: PC,
Map: C,
Math: {
__proto__: null,
[ValueProperties]: IMPURE,
Expand Down
4 changes: 4 additions & 0 deletions test/function/samples/tree-shake-map-constructor/_config.js
@@ -0,0 +1,4 @@
module.exports = {
description:
'Retain the Map constructor is called with the new keyword if the accepted param has side effects'
};
12 changes: 12 additions & 0 deletions test/function/samples/tree-shake-map-constructor/main.js
@@ -0,0 +1,12 @@
assert.ok(
new Map({
[Symbol.iterator]() {
return {
next() {
console.log('side effect');
return { done: true };
}
};
}
})
);

0 comments on commit d0fe9e0

Please sign in to comment.