Skip to content

Commit

Permalink
fixes tc39#40: throw when map is mutated in getOrInsertComputed callb…
Browse files Browse the repository at this point in the history
…acks
  • Loading branch information
michaelficarra committed Nov 18, 2024
1 parent 8668664 commit 9f4e7f2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec.emu
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ contributors: Jonas Haukenes, Daniel Minor
1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do
1. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is *true*, return _p_.[[Value]].
1. Let _value_ be ? Call(_callbackfn_, *undefined*, « _key_ »).
1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[MapData]], do
1. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is *true*, throw a *TypeError* exception.
1. Let _p_ be the Record { [[Key]]: _key_, [[Value]]: _value_ }.
1. Append _p_ to _M_.[[MapData]].
1. Return _value_.
Expand Down Expand Up @@ -75,6 +77,8 @@ contributors: Jonas Haukenes, Daniel Minor
1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[WeakMapData]], do
1. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is *true*, return _p_.[[Value]].
1. Let _value_ be ? Call(_callbackfn_, *undefined*, « _key_ »).
1. For each Record { [[Key]], [[Value]] } _p_ of _M_.[[WeakMapData]], do
1. If _p_.[[Key]] is not ~empty~ and SameValue(_p_.[[Key]], _key_) is *true*, throw a *TypeError* exception.
1. Let _p_ be the Record { [[Key]]: _key_, [[Value]]: _value_ }.
1. Append _p_ to _M_.[[WeakMapData]].
1. Return _value_.
Expand Down

0 comments on commit 9f4e7f2

Please sign in to comment.