Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #40: throw when map is mutated in getOrInsertComputed callbacks #73

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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