diff --git a/src/ast/nodes/shared/knownGlobals.ts b/src/ast/nodes/shared/knownGlobals.ts index a6d752d4098..5b97c60426b 100644 --- a/src/ast/nodes/shared/knownGlobals.ts +++ b/src/ast/nodes/shared/knownGlobals.ts @@ -253,8 +253,8 @@ const knownGlobals: GlobalDescription = { isSealed: PF, keys: PF, fromEntries: O, - entries: PF, - values: PF, + entries: O, + values: O, prototype: O }, parseFloat: PF, diff --git a/test/function/samples/tree-shake-object-with-sideeffctful-getter/_config.js b/test/function/samples/tree-shake-object-with-sideeffctful-getter/_config.js new file mode 100644 index 00000000000..e35dd23c351 --- /dev/null +++ b/test/function/samples/tree-shake-object-with-sideeffctful-getter/_config.js @@ -0,0 +1,3 @@ +module.exports = { + description: 'retain functions that accept a object with a getter that has side effects' +}; diff --git a/test/function/samples/tree-shake-object-with-sideeffctful-getter/main.js b/test/function/samples/tree-shake-object-with-sideeffctful-getter/main.js new file mode 100644 index 00000000000..43c8c4499cc --- /dev/null +++ b/test/function/samples/tree-shake-object-with-sideeffctful-getter/main.js @@ -0,0 +1,13 @@ +let effects = 0; + +const obj = { + get foo() { + effects++; + return "foo"; + } +}; + +Object.values(obj); +Object.entries(obj); + +assert.equal(effects, 2);