From 513672323ffe300ce42e565eb5479240316626c1 Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Sat, 10 Feb 2018 00:49:41 +0100 Subject: [PATCH 1/6] Editorial: add a SetFunctionLength abstract operation --- spec.html | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/spec.html b/spec.html index 39db40867c..f2e9181cb9 100644 --- a/spec.html +++ b/spec.html @@ -7413,9 +7413,8 @@

FunctionAllocate ( _functionPrototype_, _strict_, _functionKind_ )

FunctionInitialize ( _F_, _kind_, _ParameterList_, _Body_, _Scope_ )

The abstract operation FunctionInitialize requires the arguments: a function object _F_, _kind_ which is one of (Normal, Method, Arrow), a parameter list Parse Node specified by _ParameterList_, a body Parse Node specified by _Body_, a Lexical Environment specified by _Scope_. FunctionInitialize performs the following steps:

- 1. Assert: _F_ is an extensible object that does not have a `length` own property. 1. Let _len_ be the ExpectedArgumentCount of _ParameterList_. - 1. Perform ! DefinePropertyOrThrow(_F_, `"length"`, PropertyDescriptor{[[Value]]: _len_, [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true*}). + 1. Perform ! SetFunctionLength(_F_, _len_). 1. Let _Strict_ be _F_.[[Strict]]. 1. Set _F_.[[Environment]] to _Scope_. 1. Set _F_.[[FormalParameters]] to _ParameterList_. @@ -7536,6 +7535,18 @@

SetFunctionName ( _F_, _name_ [ , _prefix_ ] )

+ +

SetFunctionLength ( _F_, _length_)

+

The abstract operation SetFunctionLength requires a Function argument _F_, and a Number argument _length_. This operation adds a `length` property to _F_ by performing the following steps:

+ + 1. Assert: _F_ is an extensible object that does not have a `length` own property. + 1. Assert: Type(_length_) is Number. + 1. Assert: ToLength(_length_) is equal to _length_. + 1. Return ! DefinePropertyOrThrow(_F_, `"length"`, PropertyDescriptor{[[Value]]: _length_, [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true*}). + +
+ +

FunctionDeclarationInstantiation ( _func_, _argumentsList_ )

@@ -24700,7 +24711,7 @@

Function.prototype.bind ( _thisArg_, ..._args_ )

1. Let _targetLen_ be ToInteger(_targetLen_). 1. Let _L_ be the larger of 0 and the result of _targetLen_ minus the number of elements of _args_. 1. Else, let _L_ be 0. - 1. Perform ! DefinePropertyOrThrow(_F_, `"length"`, PropertyDescriptor {[[Value]]: _L_, [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true*}). + 1. Perform ! SetFunctionLength(_F_, _L_). 1. Let _targetName_ be ? Get(_Target_, `"name"`). 1. If Type(_targetName_) is not String, let _targetName_ be the empty string. 1. Perform SetFunctionName(_F_, _targetName_, `"bound"`). From 0e5731a05558213cc0165b87993d453c4d6afec7 Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Sat, 10 Feb 2018 14:25:08 +0100 Subject: [PATCH 2/6] fixup! --- spec.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.html b/spec.html index f2e9181cb9..5ff82c3b40 100644 --- a/spec.html +++ b/spec.html @@ -7414,7 +7414,7 @@

FunctionInitialize ( _F_, _kind_, _ParameterList_, _Body_, _Scope_ )

The abstract operation FunctionInitialize requires the arguments: a function object _F_, _kind_ which is one of (Normal, Method, Arrow), a parameter list Parse Node specified by _ParameterList_, a body Parse Node specified by _Body_, a Lexical Environment specified by _Scope_. FunctionInitialize performs the following steps:

1. Let _len_ be the ExpectedArgumentCount of _ParameterList_. - 1. Perform ! SetFunctionLength(_F_, _len_). + 1. Perform SetFunctionLength(_F_, _len_). 1. Let _Strict_ be _F_.[[Strict]]. 1. Set _F_.[[Environment]] to _Scope_. 1. Set _F_.[[FormalParameters]] to _ParameterList_. @@ -24711,7 +24711,7 @@

Function.prototype.bind ( _thisArg_, ..._args_ )

1. Let _targetLen_ be ToInteger(_targetLen_). 1. Let _L_ be the larger of 0 and the result of _targetLen_ minus the number of elements of _args_. 1. Else, let _L_ be 0. - 1. Perform ! SetFunctionLength(_F_, _L_). + 1. Perform SetFunctionLength(_F_, _L_). 1. Let _targetName_ be ? Get(_Target_, `"name"`). 1. If Type(_targetName_) is not String, let _targetName_ be the empty string. 1. Perform SetFunctionName(_F_, _targetName_, `"bound"`). From 3e54fabc7d20701ae47e7a2e01d4d903030293dd Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Sat, 10 Feb 2018 14:26:20 +0100 Subject: [PATCH 3/6] fixup! address feedback --- spec.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec.html b/spec.html index 5ff82c3b40..d55e56c28d 100644 --- a/spec.html +++ b/spec.html @@ -7534,7 +7534,6 @@

SetFunctionName ( _F_, _name_ [ , _prefix_ ] )

-

SetFunctionLength ( _F_, _length_)

The abstract operation SetFunctionLength requires a Function argument _F_, and a Number argument _length_. This operation adds a `length` property to _F_ by performing the following steps:

@@ -7546,7 +7545,7 @@

SetFunctionLength ( _F_, _length_)

- +

FunctionDeclarationInstantiation ( _func_, _argumentsList_ )

From 293548a82131846447adba537ffc447cadfb7190 Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Sat, 10 Feb 2018 14:28:39 +0100 Subject: [PATCH 4/6] fixup! ws --- spec.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec.html b/spec.html index d55e56c28d..7d28e19a1b 100644 --- a/spec.html +++ b/spec.html @@ -7535,7 +7535,7 @@

SetFunctionName ( _F_, _name_ [ , _prefix_ ] )

-

SetFunctionLength ( _F_, _length_)

+

SetFunctionLength ( _F_, _length_ )

The abstract operation SetFunctionLength requires a Function argument _F_, and a Number argument _length_. This operation adds a `length` property to _F_ by performing the following steps:

1. Assert: _F_ is an extensible object that does not have a `length` own property. From 11c9c0733c97d71cab18c23d81f3cd4a16fe34a7 Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Mon, 12 Feb 2018 17:50:26 +0100 Subject: [PATCH 5/6] fixup! address grammar nit and length arg bounding --- spec.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.html b/spec.html index 7d28e19a1b..3cd4ae1e1d 100644 --- a/spec.html +++ b/spec.html @@ -7536,11 +7536,11 @@

SetFunctionName ( _F_, _name_ [ , _prefix_ ] )

SetFunctionLength ( _F_, _length_ )

-

The abstract operation SetFunctionLength requires a Function argument _F_, and a Number argument _length_. This operation adds a `length` property to _F_ by performing the following steps:

+

The abstract operation SetFunctionLength requires a Function argument _F_ and a Number argument _length_. This operation adds a `length` property to _F_ by performing the following steps:

1. Assert: _F_ is an extensible object that does not have a `length` own property. 1. Assert: Type(_length_) is Number. - 1. Assert: ToLength(_length_) is equal to _length_. + 1. Assert: _length_ ≥ 0 and ToInteger(_length_) is equal to _length_. 1. Return ! DefinePropertyOrThrow(_F_, `"length"`, PropertyDescriptor{[[Value]]: _length_, [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true*}).
From 0ca337c01e7d151d3ba350a7197b2c5e593758f2 Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Mon, 12 Feb 2018 17:57:07 +0100 Subject: [PATCH 6/6] fixup! Add "!" back in. --- spec.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.html b/spec.html index 3cd4ae1e1d..86e38d1df2 100644 --- a/spec.html +++ b/spec.html @@ -7414,7 +7414,7 @@

FunctionInitialize ( _F_, _kind_, _ParameterList_, _Body_, _Scope_ )

The abstract operation FunctionInitialize requires the arguments: a function object _F_, _kind_ which is one of (Normal, Method, Arrow), a parameter list Parse Node specified by _ParameterList_, a body Parse Node specified by _Body_, a Lexical Environment specified by _Scope_. FunctionInitialize performs the following steps:

1. Let _len_ be the ExpectedArgumentCount of _ParameterList_. - 1. Perform SetFunctionLength(_F_, _len_). + 1. Perform ! SetFunctionLength(_F_, _len_). 1. Let _Strict_ be _F_.[[Strict]]. 1. Set _F_.[[Environment]] to _Scope_. 1. Set _F_.[[FormalParameters]] to _ParameterList_. @@ -24710,7 +24710,7 @@

Function.prototype.bind ( _thisArg_, ..._args_ )

1. Let _targetLen_ be ToInteger(_targetLen_). 1. Let _L_ be the larger of 0 and the result of _targetLen_ minus the number of elements of _args_. 1. Else, let _L_ be 0. - 1. Perform SetFunctionLength(_F_, _L_). + 1. Perform ! SetFunctionLength(_F_, _L_). 1. Let _targetName_ be ? Get(_Target_, `"name"`). 1. If Type(_targetName_) is not String, let _targetName_ be the empty string. 1. Perform SetFunctionName(_F_, _targetName_, `"bound"`).