Skip to content

Commit

Permalink
Normative: Verify if Binding is preserved for PutValue
Browse files Browse the repository at this point in the history
In PutValue, verify if the Reference is still preserved in its base in Strict Mode.

Ref tc39#2093
  • Loading branch information
leobalter committed Jul 14, 2020
1 parent e08b018 commit 6038afe
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -4300,11 +4300,12 @@ <h1>PutValue ( _V_, _W_ )</h1>
1. ReturnIfAbrupt(_W_).
1. If Type(_V_) is not Reference, throw a *ReferenceError* exception.
1. Let _base_ be GetBase(_V_).
1. Let _name_ be GetReferencedName(_V_).
1. If IsUnresolvableReference(_V_) is *true*, then
1. If IsStrictReference(_V_) is *true*, then
1. Throw a *ReferenceError* exception.
1. Let _globalObj_ be GetGlobalObject().
1. Return ? Set(_globalObj_, GetReferencedName(_V_), _W_, *false*).
1. Return ? Set(_globalObj_, _name_, _W_, *false*).
1. Else if IsPropertyReference(_V_) is *true*, then
1. If HasPrimitiveBase(_V_) is *true*, then
1. Assert: In this case, _base_ will never be *undefined* or *null*.
Expand All @@ -4314,6 +4315,8 @@ <h1>PutValue ( _V_, _W_ )</h1>
1. Return.
1. Else,
1. Assert: _base_ is an Environment Record.
1. If IsStrictReference(_V_) is *true*, then
1. If ? _base_.HasBinding(_name_) is *false*, throw a *ReferenceError* exception.
1. Return ? _base_.SetMutableBinding(GetReferencedName(_V_), _W_, IsStrictReference(_V_)) (see <emu-xref href="#sec-environment-records"></emu-xref>).
</emu-alg>
<emu-note>
Expand Down

0 comments on commit 6038afe

Please sign in to comment.