Skip to content

Commit

Permalink
Normative: Wrapped function should reuse target name and length
Browse files Browse the repository at this point in the history
Fixes #338
  • Loading branch information
leobalter committed Nov 2, 2021
1 parent 4671b87 commit 16733e7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,20 @@ <h1>WrappedFunctionCreate ( _callerRealm_, _Target_ )</h1>
1. Set _wrapped_.[[Call]] as described in <emu-xref href="#sec-wrapped-function-exotic-objects-call-thisargument-argumentslist"></emu-xref>.
1. Set _wrapped_.[[WrappedTargetFunction]] to _Target_.
1. Set _wrapped_.[[Realm]] to _callerRealm_.
1. Let _L_ be 0.
1. Let targetHasLength be ? HasOwnProperty(_Target_, *"length"*).
1. If _targetHasLength_ is *true*, then
1. Let _targetLen_ be ? Get(_Target_, *"length"*).
1. If Type(_targetLen_) is Number, then
1. If _targetLen_ is *+&infin;*<sub>𝔽</sub>, set _L_ to +&infin;.
1. Else if _targetLen_ is *-&infin;*<sub>𝔽</sub>, set _L_ to 0.
1. Else,
1. Let _targetLenAsInt_ be ! ToIntegerOrInfinity(_targetLen_).
1. Assert: _targetLenAsInt_ is finite.
1. Set _L_ to max(_targetLenAsInt_, 0).
1. Perform ! SetFunctionLength(_wrapped_, _L_).
1. Let _name_ be ? Get(_Target_, *"name"*).
1. Perform ! SetFunctionName(_wrapped_, _name_, *"wrapped"*).
1. Return _wrapped_.
</emu-alg>
</emu-clause>
Expand Down

0 comments on commit 16733e7

Please sign in to comment.