Closed acutmore closed 2 years ago
[[DefineOwnProperty]]
can probably be simplified to:
1. Assert: IsPropertyKey(P) is true.
2. Let current be R.[[GetOwnProperty]](P).
3. Return IsCompatiblePropertyDescriptor ( false, Desc, current ).
But please double-check I didn't miss some corner cases.
I'd probably keep the early returns for clarity - something like:
1. Assert: IsPropertyKey(_P_) is true. (this line won't be necessary once the AO is using typed headers)
1. If Type(_P_) is not String, return *false*.
1. If IsDataDescriptor(_Desc_) is *false*, return *false*.
1. If RecordHasProperty(_P_, _R_) is *false*, return *false*.
1. Let _current_ be _R_.[[GetOwnProperty]](_P_).
1. Return IsCompatiblePropertyDescriptor (*false*, _Desc_, _current_).
1. If IsDataDescriptor(_Desc_) is *false*, return *false*.
Needs to be:
IsAccessorDescriptor(_Desc_) is *true*, return *false*.
to correctly handle generic descriptors.
ah, fair
Thanks for the further suggestions @anba and @ljharb , as this fix is currently a one liner. I'll merge this PR for now. And do the refactoring as a separate PR.
Fixes #342