-
Notifications
You must be signed in to change notification settings - Fork 9
spec: rename CreateNonEnumerableDataProperty to CreateNonEnumerableDataPropertyOrThrow #27
Conversation
4eb4ba9
to
79f07b7
Compare
spec.emu
Outdated
1. <ins>Let _newDesc_ be the PropertyDescriptor { [[Value]]: _V_, [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</ins> | ||
1. <ins>Return ? DefinePropertyOrThrow(_O_, _P_, _newDesc_).</ins> | ||
1. <ins>Return ? ? _O_.[[DefineOwnProperty]](_P_, _newDesc_).</ins> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this an improvement? The behavior of returning false on failure has caused a number of spec bugs, which is why most of them have been changed to call DefinePropertyOrThrow with ?
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the linked comment, the AO should have an “OrThrow” in the name, rather than not throwing at all.
42855a1
to
71e533d
Compare
@ljharb thanks for the context. I've updated the PR with renaming the AO to indicate they are throwing on failure. |
spec.emu
Outdated
<p><ins>The abstract operation CreateNonEnumerableDataProperty takes arguments _O_ (an Object), _P_ (a property key), and _V_ (an ECMAScript language value). It performs the following steps when called:</ins></p> | ||
<emu-clause id="sec-createnonenumerabledatapropertyorthrow"> | ||
<h1><ins>CreateNonEnumerableDataPropertyOrThrow ( _O_, _P_, _V_ )</ins></h1> | ||
<p><ins>The abstract operation CreateNonEnumerableDataPropertyOrThrow takes arguments _O_ (an Object), _P_ (a property key), and _V_ (an ECMAScript language value). It is used to create a new non-enumerable own property of an object. It throws a *TypeError* exception if the requested property update cannot be performed. It performs the following steps when called:</ins></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<p><ins>The abstract operation CreateNonEnumerableDataPropertyOrThrow takes arguments _O_ (an Object), _P_ (a property key), and _V_ (an ECMAScript language value). It is used to create a new non-enumerable own property of an object. It throws a *TypeError* exception if the requested property update cannot be performed. It performs the following steps when called:</ins></p> | |
<p><ins>The abstract operation CreateNonEnumerableDataPropertyOrThrow takes arguments _O_ (an Object), _P_ (a Property Key), and _V_ (an ECMAScript language value). It is used to create a new non-enumerable own property of an object. It throws a *TypeError* exception if the requested property update cannot be performed. It performs the following steps when called:</ins></p> |
spec.emu
Outdated
1. <ins>Assert: Type(_O_) is Object.</ins> | ||
1. <ins>Assert: IsPropertyKey(_P_) is true.</ins> | ||
1. <ins>Assert: IsPropertyKey(_P_) is *true*.</ins> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two can be removed, since they're now redundant
15d303e
to
6aaffb9
Compare
…taPropertyOrThrow
6aaffb9
to
9192e7a
Compare
Update abstract operation CreateNonEnumerableDataProperty with name CreateNonEnumerableDataPropertyOrThrow to indicate the AO is throwing on unable to perform the creation.
Refs: #2 (comment)