Skip to content

Commit

Permalink
fix: use Reflect.getOwnPropertyDescriptor instead of Object.hasOwn
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Christophe committed Apr 27, 2024
1 parent 4d0b8da commit bae26c3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
7 changes: 6 additions & 1 deletion lib/unbuild/early-error.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,12 @@ const reportDuplicateEarlyError = (error, { root }) => {
makeConditionalEffect(
makeConditionalExpression(
makeApplyExpression(
makeIntrinsicExpression("Object.hasOwn", path),
// Reflect.getOwnPropertyDescriptor instead of Object.hasOwn
// https://github.com/nodejs/node/issues/52720
makeIntrinsicExpression(
"Reflect.getOwnPropertyDescriptor",
path,
),
makePrimitiveExpression({ undefined: null }, path),
[
makeIntrinsicExpression("aran.global", path),
Expand Down
2 changes: 1 addition & 1 deletion test/262/cursor.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"stage":"empty-emulate","index":4853,"target":null}
{"stage":"empty-emulate","index":6714,"target":null}
6 changes: 0 additions & 6 deletions test/262/stages/empty-emulate.manual.json
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,5 @@
"test/language/statements/let/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js",
"test/language/statements/try/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js",
"test/language/statements/variable/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js"
],
"https://github.com/nodejs/node/issues/52720": [
"test/built-ins/Array/prototype/methods-called-as-functions.js",
"test/built-ins/BigInt/prototype/toString/thisbigintvalue-not-valid-throws.js",
"test/built-ins/BigInt/prototype/valueOf/return.js",
"test/built-ins/BigInt/prototype/valueOf/this-value-invalid-object-throws.js"
]
}
2 changes: 0 additions & 2 deletions test/262/stages/empty-emulate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import {

const { JSON, URL } = globalThis;

console.log(generate(setup(SETUP_CONFIG)));

/** @type {test262.Stage} */
export default {
requirement: ["identity", "parsing"],
Expand Down
4 changes: 2 additions & 2 deletions yoyo.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ console.log(
`
"use strict";
({
hasOwn: Object.hasOwn(globalThis, "toLocaleString"),
descriptor: Reflect.getOwnPropertyDescriptor(globalThis, "toLocaleString"),
hasOwn: Object.prototype.hasOwnProperty.call(globalThis, "toString"),
descriptor: Reflect.getOwnPropertyDescriptor(globalThis, "toString"),
});
`,
createContext(),
Expand Down

0 comments on commit bae26c3

Please sign in to comment.