summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/async-arrow-function
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/test262/language/expressions/async-arrow-function
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/expressions/async-arrow-function')
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/array-destructuring-param-strict-body.js124
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/arrow-returns-promise.js18
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/async-lineterminator-identifier-throws.js21
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier-escaped.js35
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier.js35
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference-escaped.js35
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference.js35
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier-escaped.js35
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier.js35
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js16
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js16
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js16
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js16
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-abrupt.js59
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-not-undefined.js78
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-undefined.js61
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-duplicates.js53
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-later.js60
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-prior.js58
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-self.js60
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-rest.js57
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-trailing-comma.js53
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-NSPL-with-USD.js17
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-arguments-in-formal-parameters-strict.js19
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js15
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js15
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-call.js16
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-property.js16
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-duplicate-parameters.js35
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-eval-in-formal-parameters-strict.js18
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-body-duplicate.js16
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-call.js16
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-property.js16
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-lineterminator.js34
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/escaped-async-line-terminator.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/escaped-async.js25
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/eval-var-scope-syntax-err.js55
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-arguments.js43
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-caller.js43
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-get.js69
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-value.js69
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-prop-caller.js69
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/name.js37
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/object-destructuring-param-strict-body.js124
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-multiple.js53
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-single.js52
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/rest-param-strict-body.js124
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/rest-params-trailing-comma-early-error.js49
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/shell.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-reject.js28
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-return.js26
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-throw.js26
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-reject.js26
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-return.js26
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-throw.js24
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-reject.js26
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-return.js26
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-throw.js24
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with-in-nested-fn.js95
-rw-r--r--js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with.js89
67 files changed, 2468 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-arrow-function/array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..3d8bcdefa8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/array-destructuring-param-strict-body.js
@@ -0,0 +1,124 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/array-destructuring-param-strict-body.case
+// - src/function-forms/syntax/async-arrow-function.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+(async ([element]) => {
+ "use strict";
+});
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/arrow-returns-promise.js b/js/src/tests/test262/language/expressions/async-arrow-function/arrow-returns-promise.js
new file mode 100644
index 0000000000..2b99c630e3
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/arrow-returns-promise.js
@@ -0,0 +1,18 @@
+// |reftest| async
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ Async arrow functions return promises
+flags: [async]
+---*/
+
+var p = (async () => await 1 + await 2)();
+assert(Object.getPrototypeOf(p) === Promise.prototype);
+p.then(function (v) {
+ assert.sameValue(v, 3);
+ $DONE();
+}, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/async-lineterminator-identifier-throws.js b/js/src/tests/test262/language/expressions/async-arrow-function/async-lineterminator-identifier-throws.js
new file mode 100644
index 0000000000..51cfd59d43
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/async-lineterminator-identifier-throws.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AsyncArrowFunction
+description: >
+ async arrows cannot have a line terminator between "async" and the AsyncArrowBindingIdentifier
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction:
+ async [no LineTerminator here] AsyncArrowBindingIdentifier [no LineTerminator here] => AsyncConciseBody
+ [...]
+---*/
+
+assert.throws(ReferenceError, function() {
+ async
+ identifier => {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..e0e6055ce6
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier-escaped.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-binding-identifier-escaped.case
+// - src/async-functions/syntax/async-arrow.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async arrow function)
+esid: prod-AsyncArrowFunction
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Arrow Function Definitions
+
+ AsyncArrowFunction[In, Yield, Await]:
+ async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In]
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] [no LineTerminator here] => AsyncConciseBody[?In]
+
+ AsyncConciseBody[In]:
+ { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async () => {
+ var \u0061wait;
+}
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier.js
new file mode 100644
index 0000000000..709fb658f6
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-binding-identifier.case
+// - src/async-functions/syntax/async-arrow.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async arrow function)
+esid: prod-AsyncArrowFunction
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Arrow Function Definitions
+
+ AsyncArrowFunction[In, Yield, Await]:
+ async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In]
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] [no LineTerminator here] => AsyncConciseBody[?In]
+
+ AsyncConciseBody[In]:
+ { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async () => {
+ var await;
+}
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..9f4cc56460
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference-escaped.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-identifier-reference-escaped.case
+// - src/async-functions/syntax/async-arrow.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async arrow function)
+esid: prod-AsyncArrowFunction
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Arrow Function Definitions
+
+ AsyncArrowFunction[In, Yield, Await]:
+ async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In]
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] [no LineTerminator here] => AsyncConciseBody[?In]
+
+ AsyncConciseBody[In]:
+ { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async () => {
+ void \u0061wait;
+}
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference.js
new file mode 100644
index 0000000000..d8e08a5a8a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-identifier-reference.case
+// - src/async-functions/syntax/async-arrow.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async arrow function)
+esid: prod-AsyncArrowFunction
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Arrow Function Definitions
+
+ AsyncArrowFunction[In, Yield, Await]:
+ async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In]
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] [no LineTerminator here] => AsyncConciseBody[?In]
+
+ AsyncConciseBody[In]:
+ { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async () => {
+ void await;
+}
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..fd86e78d21
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier-escaped.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-label-identifier-escaped.case
+// - src/async-functions/syntax/async-arrow.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async arrow function)
+esid: prod-AsyncArrowFunction
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Arrow Function Definitions
+
+ AsyncArrowFunction[In, Yield, Await]:
+ async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In]
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] [no LineTerminator here] => AsyncConciseBody[?In]
+
+ AsyncConciseBody[In]:
+ { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async () => {
+ \u0061wait: ;
+}
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier.js
new file mode 100644
index 0000000000..7106dabe86
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-functions/await-as-label-identifier.case
+// - src/async-functions/syntax/async-arrow.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async arrow function)
+esid: prod-AsyncArrowFunction
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Arrow Function Definitions
+
+ AsyncArrowFunction[In, Yield, Await]:
+ async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In]
+ CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] [no LineTerminator here] => AsyncConciseBody[?In]
+
+ AsyncConciseBody[In]:
+ { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+async () => {
+ await: ;
+}
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js
new file mode 100644
index 0000000000..d96f342526
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-async-arrow-function-definitions
+description: >
+ It is a SyntaxError if FormalParameters' default expressions contains await.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async(a = await => {}) => {};
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js
new file mode 100644
index 0000000000..d2479b2701
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-async-arrow-function-definitions
+description: >
+ It is a SyntaxError if FormalParameters' default expressions contains await.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async() => { (a = await/r/g) => {} };
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js
new file mode 100644
index 0000000000..db0fdae8e4
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-async-arrow-function-definitions
+description: >
+ It is a SyntaxError if FormalParameters' default expressions contains await.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async(a = (await) => {}) => {};
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js
new file mode 100644
index 0000000000..e9afa0b40f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-async-arrow-function-definitions
+description: >
+ It is a SyntaxError if FormalParameters' default expressions contains await.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async(a = (...await) => {}) => {};
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/browser.js b/js/src/tests/test262/language/expressions/async-arrow-function/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/browser.js
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-abrupt.js
new file mode 100644
index 0000000000..f85de001a3
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-abrupt.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/async-arrow-function.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+
+
+var callCount = 0;
+var f;
+f = async (_ = (function() { throw new Test262Error(); }())) => {
+
+ callCount = callCount + 1;
+};
+
+f()
+ .then(_ => {
+ throw new Test262Error('function should not be resolved');
+ }, error => assert.sameValue(error.constructor, Test262Error))
+ .then(() => {
+ assert.sameValue(callCount, 0, 'function body is not evaluated');
+ }, $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..5b2234077d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,78 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-not-undefined.case
+// - src/function-forms/default/async-arrow-function.template
+/*---
+description: Use of initializer when argument value is not `undefined` (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+var obj = {};
+var falseCount = 0;
+var stringCount = 0;
+var nanCount = 0;
+var zeroCount = 0;
+var nullCount = 0;
+var objCount = 0;
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+var ref = async (aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) => {
+ assert.sameValue(aFalse, false);
+ assert.sameValue(aString, '');
+ assert.sameValue(aNaN, NaN);
+ assert.sameValue(a0, 0);
+ assert.sameValue(aNull, null);
+ assert.sameValue(aObj, obj);
+ callCount = callCount + 1;
+};
+
+ref(false, '', NaN, 0, null, obj).then(() => {
+ assert.sameValue(callCount, 1, 'async arrow function invoked exactly once')
+}).then($DONE, $DONE);
+
+assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
+assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
+assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
+assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
+assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
+assert.sameValue(objCount, 0, 'initializer not evaluated: object');
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..f78735f5b6
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-undefined.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-undefined.case
+// - src/function-forms/default/async-arrow-function.template
+/*---
+description: Use of initializer when argument value is `undefined` (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+var ref = async (fromLiteral = 23, fromExpr = 45, fromHole = 99) => {
+ assert.sameValue(fromLiteral, 23);
+ assert.sameValue(fromExpr, 45);
+ assert.sameValue(fromHole, 99);
+ callCount = callCount + 1;
+};
+
+ref(undefined, void 0).then(() => {
+ assert.sameValue(callCount, 1, 'async arrow function invoked exactly once')
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-duplicates.js
new file mode 100644
index 0000000000..998ec75d3d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-duplicates.js
@@ -0,0 +1,53 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/async-arrow-function.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+ 14.1.2 Static Semantics: Early Errors
+
+ StrictFormalParameters : FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+
+ FormalParameters : FormalParameterList
+
+ - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
+ false and BoundNames of FormalParameterList contains any duplicate
+ elements.
+
+---*/
+$DONOTEVALUATE();
+
+
+(async (x = 0, x) => {
+
+});
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-later.js
new file mode 100644
index 0000000000..9c463259ee
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-later.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/async-arrow-function.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+var f;
+f = async (x = y, y) => {
+
+ callCount = callCount + 1;
+};
+
+f()
+ .then(_ => {
+ throw new Test262Error('function should not be resolved');
+ }, error => assert.sameValue(error.constructor, ReferenceError))
+ .then(() => {
+ assert.sameValue(callCount, 0, 'function body is not evaluated');
+ }, $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-prior.js
new file mode 100644
index 0000000000..0ce7a9f5d5
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-prior.js
@@ -0,0 +1,58 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/async-arrow-function.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+var ref = async (x, y = x, z = y) => {
+ assert.sameValue(x, 3, 'first argument value');
+ assert.sameValue(y, 3, 'second argument value');
+ assert.sameValue(z, 3, 'third argument value');
+ callCount = callCount + 1;
+};
+
+ref(3).then(() => {
+ assert.sameValue(callCount, 1, 'async arrow function invoked exactly once')
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-self.js
new file mode 100644
index 0000000000..016d517105
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-self.js
@@ -0,0 +1,60 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/async-arrow-function.template
+/*---
+description: Referencing a parameter from within its own initializer (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+
+var callCount = 0;
+var f;
+f = async (x = x) => {
+
+ callCount = callCount + 1;
+};
+
+f()
+ .then(_ => {
+ throw new Test262Error('function should not be resolved');
+ }, error => assert.sameValue(error.constructor, ReferenceError))
+ .then(() => {
+ assert.sameValue(callCount, 0, 'function body is not evaluated');
+ }, $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-rest.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-rest.js
new file mode 100644
index 0000000000..b6fc000ba1
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-rest.js
@@ -0,0 +1,57 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/async-arrow-function.template
+/*---
+description: RestParameter does not support an initializer (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+
+(async (...x = []) => {
+
+});
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..80f5b4f503
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-trailing-comma.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/async-arrow-function.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [async-functions]
+flags: [generated, async]
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+var ref = async (a, b = 39,) => {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+};
+
+ref(42, undefined, 1).then(() => {
+ assert.sameValue(callCount, 1, 'async arrow function invoked exactly once')
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-NSPL-with-USD.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-NSPL-with-USD.js
new file mode 100644
index 0000000000..c3c922803f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-NSPL-with-USD.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: >
+ It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is *true* and IsSimpleParameterList of ArrowParameters is *false*.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async (x = 1) => {"use strict"}
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-arguments-in-formal-parameters-strict.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-arguments-in-formal-parameters-strict.js
new file mode 100644
index 0000000000..86ae49eb27
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-arguments-in-formal-parameters-strict.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if FormalParameters contains arguments
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+async(arguments) => { }
+
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js
new file mode 100644
index 0000000000..70f8de19a1
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if FormalParameters' default expressions contains await
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+async(x = await) => { }
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js
new file mode 100644
index 0000000000..23a22ac953
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if FormalParameters contains await
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+async(await) => { }
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-call.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-call.js
new file mode 100644
index 0000000000..f488d1c401
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-call.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a syntax error if AsyncFunctionBody contains SuperCall is true
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async(foo) => { super() };
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-property.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-property.js
new file mode 100644
index 0000000000..fb39611fc4
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-property.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a syntax error if AsyncFunctionBody contains SuperProperty is true
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async(foo) => { super.prop };
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-duplicate-parameters.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-duplicate-parameters.js
new file mode 100644
index 0000000000..80ea5e17ed
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-duplicate-parameters.js
@@ -0,0 +1,35 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: sec-async-arrow-function-definitions
+description: Formal parameters may not contain duplicates
+info: |
+ # 14.2 Arrow Function Definitions
+
+ When the production
+
+ ArrowParameters:CoverParenthesizedExpressionAndArrowParameterList
+
+ is recognized the following grammar is used to refine the interpretation
+ of CoverParenthesizedExpressionAndArrowParameterList:
+
+ ArrowFormalParameters[Yield, Await]:
+ (UniqueFormalParameters[?Yield, ?Await])
+
+ # 14.1.2 Static Semantics: Early Errors
+
+ UniqueFormalParameters:FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async(a, a) => { }
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-eval-in-formal-parameters-strict.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-eval-in-formal-parameters-strict.js
new file mode 100644
index 0000000000..07c07ef96f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-eval-in-formal-parameters-strict.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError
+'use strict';
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if FormalParameters contains eval
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+async(eval) => { }
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-body-duplicate.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-body-duplicate.js
new file mode 100644
index 0000000000..d1b956e3f0
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-body-duplicate.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a SyntaxError if BoundNames of FormalParameters also occurs in the LexicallyDeclaredNames of AsyncFunctionBody
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async(bar) => { let bar; }
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-call.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-call.js
new file mode 100644
index 0000000000..1b82159d4e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-call.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a syntax error if FormalParameters contains SuperCall is true
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async(foo = super()) => {}
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-property.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-property.js
new file mode 100644
index 0000000000..2ac2381d93
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-property.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError
+// Copyright 2016 Microsoft, Inc. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Brian Terlson <brian.terlson@microsoft.com>
+esid: pending
+description: It is a syntax error if FormalParameters contains SuperCall is true
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async (foo = super.foo) => { }
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-lineterminator.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-lineterminator.js
new file mode 100644
index 0000000000..1a5b378ae8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-lineterminator.js
@@ -0,0 +1,34 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AsyncArrowHead
+description: async arrows cannot have a line terminator between "async" and the formals
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction:
+ [...]
+ CoverCallExpressionAndAsyncArrowHead [no LineTerminator here] => AsyncConciseBody
+
+ Supplemental Syntax
+
+ When processing an instance of the production
+
+ AsyncArrowFunction:
+ CoverCallExpressionAndAsyncArrowHead [no LineTerminator here] => AsyncConciseBody
+
+ the interpretation of CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead:
+ async [no LineTerminator here] ArrowFormalParameters
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+async
+(foo) => { }
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/escaped-async-line-terminator.js b/js/src/tests/test262/language/expressions/async-arrow-function/escaped-async-line-terminator.js
new file mode 100644
index 0000000000..cdcfe6516a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/escaped-async-line-terminator.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2018 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-async-arrow-function-definitions
+description: >
+ Escaped "async" followed by a line-terminator is not misinterpreted as an AsyncArrowFunction.
+info: |
+ 14.7 Async Function Definitions
+
+ async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In]
+
+ 5.1.5 Grammar Notation
+
+ Terminal symbols of the lexical, RegExp, and numeric string grammars are shown
+ in fixed width font, both in the productions of the grammars and throughout this
+ specification whenever the text directly refers to such a terminal symbol. These
+ are to appear in a script exactly as written. All terminal symbol code points
+ specified in this way are to be understood as the appropriate Unicode code points
+ from the Basic Latin range, as opposed to any similar-looking code points from
+ other Unicode ranges.
+features: [async-functions]
+---*/
+
+// Throws ReferenceError because reference for "async" cannot be resolved.
+assert.throws(ReferenceError, function() {
+ \u0061sync
+ p => {}
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/escaped-async.js b/js/src/tests/test262/language/expressions/async-arrow-function/escaped-async.js
new file mode 100644
index 0000000000..f22a765f2e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/escaped-async.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-grammar-notation
+description: >
+ The `async` contextual keyword must not contain Unicode escape sequences.
+info: |
+ Terminal symbols of the lexical, RegExp, and numeric string grammars are shown
+ in fixed width font, both in the productions of the grammars and throughout this
+ specification whenever the text directly refers to such a terminal symbol. These
+ are to appear in a script exactly as written. All terminal symbol code points
+ specified in this way are to be understood as the appropriate Unicode code points
+ from the Basic Latin range, as opposed to any similar-looking code points from
+ other Unicode ranges.
+negative:
+ phase: parse
+ type: SyntaxError
+features: [async-functions]
+---*/
+
+$DONOTEVALUATE();
+
+\u0061sync () => {}
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/async-arrow-function/eval-var-scope-syntax-err.js
new file mode 100644
index 0000000000..d903924cc3
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/eval-var-scope-syntax-err.js
@@ -0,0 +1,55 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/eval-var-scope-syntax-err.case
+// - src/function-forms/error-no-strict/async-arrow-function.template
+/*---
+description: sloppy direct eval in params introduces var (async arrow function expression in sloppy code)
+esid: sec-async-arrow-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async, noStrict]
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+
+
+ Runtime Semantics: IteratorBindingInitialization
+ FormalParameter : BindingElement
+
+ 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment.
+
+---*/
+
+
+var callCount = 0;
+var f;
+f = async (a = eval("var a = 42")) => {
+
+ callCount = callCount + 1;
+};
+
+f()
+ .then(_ => {
+ throw new Test262Error('function should not be resolved');
+ }, error => assert.sameValue(error.constructor, SyntaxError))
+ .then(() => {
+ assert.sameValue(callCount, 0, 'function body is not evaluated');
+ }, $DONE)
+ .then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..33fcdb625b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
+// - src/function-forms/forbidden-extensions/bullet-one/async-arrow-function.template
+/*---
+description: Forbidden extension, f.arguments (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+
+var callCount = 0;
+var f;
+f = async () => {
+ assert.sameValue(f.hasOwnProperty("arguments"), false);
+ callCount++;
+};
+
+f()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..3578b85579
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-one/async-arrow-function.template
+/*---
+description: Forbidden extension, o.caller (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+
+var callCount = 0;
+var f;
+f = async () => {
+ assert.sameValue(f.hasOwnProperty("caller"), false);
+ callCount++;
+};
+
+f()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..f032c71462
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
+// - src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template
+/*---
+description: Forbidden extension, o.caller (async arrow function expression)
+esid: sec-async-arrow-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+var f;
+f = async () => {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {get(){return 1}});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+ callCount++;
+};
+
+f()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..e60e9e85c7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
+// - src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template
+/*---
+description: Forbidden extension, o.caller (async arrow function expression)
+esid: sec-async-arrow-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+var f;
+f = async () => {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {value: 1});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+ callCount++;
+};
+
+f()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..74358dc047
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template
+/*---
+description: Forbidden extension, o.caller (async arrow function expression)
+esid: sec-async-arrow-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+
+var callCount = 0;
+var f;
+f = async () => {
+ "use strict";
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ // the same templates.
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && false) {
+ Object.defineProperty(inner, "caller", {});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && false) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, f);
+ }
+ callCount++;
+};
+
+f()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/name.js b/js/src/tests/test262/language/expressions/async-arrow-function/name.js
new file mode 100644
index 0000000000..169a7ea036
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/name.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2019 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-async-arrow-function-definitions-runtime-semantics-evaluation
+description: Assignment of function `name` attribute
+info: |
+ AsyncArrowFunction : async AsyncArrowBindingIdentifier => AsyncConciseBody
+
+ 1. Let scope be the LexicalEnvironment of the running execution context.
+ 2. Let parameters be AsyncArrowBindingIdentifier.
+ 3. Let closure be ! AsyncFunctionCreate(Arrow, parameters, AsyncConciseBody,
+ scope, "").
+ ...
+ 5. Return closure.
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ 1. Let scope be the LexicalEnvironment of the running execution context.
+ 2. Let head be CoveredAsyncArrowHead of CoverCallExpressionAndAsyncArrowHead.
+ 3. Let parameters be the ArrowFormalParameters of head.
+ 4. Let closure be ! AsyncFunctionCreate(Arrow, parameters, AsyncConciseBody,
+ scope, "").
+ ...
+ 6. Return closure.
+includes: [propertyHelper.js]
+---*/
+
+verifyProperty(async x => {}, "name", {
+ value: "", writable: false, enumerable: false, configurable: true
+});
+
+verifyProperty(async () => {}, "name", {
+ value: "", writable: false, enumerable: false, configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-arrow-function/object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..033d885c65
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/object-destructuring-param-strict-body.js
@@ -0,0 +1,124 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/object-destructuring-param-strict-body.case
+// - src/function-forms/syntax/async-arrow-function.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+(async ({property}) => {
+ "use strict";
+});
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..4a5a5cd808
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-multiple.js
@@ -0,0 +1,53 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/async-arrow-function.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [async-functions]
+flags: [generated, async]
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+var ref = async (a, b,) => {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+};
+
+ref(42, 39, 1).then(() => {
+ assert.sameValue(callCount, 1, 'async arrow function invoked exactly once')
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 2, 'length is properly set');
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-single.js
new file mode 100644
index 0000000000..3d81239b67
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-single.js
@@ -0,0 +1,52 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/async-arrow-function.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [async-functions]
+flags: [generated, async]
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+var ref = async (a,) => {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+};
+
+ref(42, 39).then(() => {
+ assert.sameValue(callCount, 1, 'async arrow function invoked exactly once')
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/rest-param-strict-body.js b/js/src/tests/test262/language/expressions/async-arrow-function/rest-param-strict-body.js
new file mode 100644
index 0000000000..5eff09d848
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/rest-param-strict-body.js
@@ -0,0 +1,124 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-param-strict-body.case
+// - src/function-forms/syntax/async-arrow-function.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [rest-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+ 14.1.13 Static Semantics: IsSimpleParameterList
+
+ FormalParameters : FormalParameterList , FunctionRestParameter
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+
+(async (a,...rest) => {
+ "use strict";
+});
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/async-arrow-function/rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..10f131d4ad
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/rest-params-trailing-comma-early-error.js
@@ -0,0 +1,49 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-params-trailing-comma-early-error.case
+// - src/function-forms/syntax/async-arrow-function.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] :
+ [empty]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] ,
+ FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
+---*/
+$DONOTEVALUATE();
+
+
+(async (...a,) => {
+
+});
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/shell.js b/js/src/tests/test262/language/expressions/async-arrow-function/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/shell.js
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-reject.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-reject.js
new file mode 100644
index 0000000000..80c02eace1
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-reject.js
@@ -0,0 +1,28 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer rejecting an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+var f = async() => {
+ try {
+ await new Promise(function(resolve, reject) {
+ reject("early-reject");
+ });
+ } finally {
+ await new Promise(function(resolve, reject) {
+ reject("override");
+ });
+ }
+};
+
+f().then($DONE, function(value) {
+ assert.sameValue(value, "override", "Awaited rejection in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-return.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-return.js
new file mode 100644
index 0000000000..75bf2d4f9d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-return.js
@@ -0,0 +1,26 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer rejecting an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+var f = async() => {
+ try {
+ await new Promise(function(resolve, reject) {
+ reject("early-reject");
+ });
+ } finally {
+ return "override";
+ }
+};
+
+f().then(function(value) {
+ assert.sameValue(value, "override", "Return in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-throw.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-throw.js
new file mode 100644
index 0000000000..9b9235965c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-throw.js
@@ -0,0 +1,26 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer rejecting an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+var f = async() => {
+ try {
+ await new Promise(function(resolve, reject) {
+ reject("early-reject");
+ });
+ } finally {
+ throw "override";
+ }
+};
+
+f().then($DONE, function(value) {
+ assert.sameValue(value, "override", "Exception thrown in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-reject.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-reject.js
new file mode 100644
index 0000000000..29bb82bc08
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-reject.js
@@ -0,0 +1,26 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer resolving an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+var f = async() => {
+ try {
+ return "early-return";
+ } finally {
+ await new Promise(function(resolve, reject) {
+ reject("override");
+ });
+ }
+};
+
+f().then($DONE, function(value) {
+ assert.sameValue(value, "override", "Awaited rejection in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-return.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-return.js
new file mode 100644
index 0000000000..4b7bd86c85
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-return.js
@@ -0,0 +1,26 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer resolving an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+var f = async() => {
+ try {
+ return "early-return";
+ } finally {
+ return await new Promise(function(resolve, reject) {
+ resolve("override");
+ });
+ }
+};
+
+f().then(function(value) {
+ assert.sameValue(value, "override", "Return in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-throw.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-throw.js
new file mode 100644
index 0000000000..28dbdd7869
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-throw.js
@@ -0,0 +1,24 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer resolving an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+var f = async() => {
+ try {
+ return "early-return";
+ } finally {
+ throw "override";
+ }
+};
+
+f().then($DONE, function(value) {
+ assert.sameValue(value, "override", "Exception thrown in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-reject.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-reject.js
new file mode 100644
index 0000000000..aad6bb1e99
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-reject.js
@@ -0,0 +1,26 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer rejecting an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+var f = async() => {
+ try {
+ throw "early-throw";
+ } finally {
+ await new Promise(function(resolve, reject) {
+ reject("override");
+ });
+ }
+};
+
+f().then($DONE, function(value) {
+ assert.sameValue(value, "override", "Awaited rejection in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-return.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-return.js
new file mode 100644
index 0000000000..56045d416c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-return.js
@@ -0,0 +1,26 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer rejecting an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+var f = async() => {
+ try {
+ throw "early-throw";
+ } finally {
+ return await new Promise(function(resolve, reject) {
+ resolve("override");
+ });
+ }
+};
+
+f().then(function(value) {
+ assert.sameValue(value, "override", "Return in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-throw.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-throw.js
new file mode 100644
index 0000000000..36e8821007
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-throw.js
@@ -0,0 +1,24 @@
+// |reftest| async
+// Copyright 2017 Caitlin Potter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+author: Caitlin Potter <caitp@igalia.com>
+esid: pending
+description: >
+ Implementations must defer rejecting an async function's Promise until after
+ all finally blocks have been evaluated.
+flags: [async]
+---*/
+
+var f = async() => {
+ try {
+ throw "early-throw";
+ } finally {
+ throw "override";
+ }
+};
+
+f().then($DONE, function(value) {
+ assert.sameValue(value, "override", "Exception thrown in finally block");
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with-in-nested-fn.js
new file mode 100644
index 0000000000..6884e1524d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with-in-nested-fn.js
@@ -0,0 +1,95 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/unscopables-with-in-nested-fn.case
+// - src/function-forms/default/async-arrow-function.template
+/*---
+description: Symbol.unscopables behavior across scope boundaries (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [globalThis, Symbol.unscopables, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+
+ ...
+ Let envRec be lex's EnvironmentRecord.
+ Let exists be ? envRec.HasBinding(name).
+
+ HasBinding
+
+ ...
+ If the withEnvironment flag of envRec is false, return true.
+ Let unscopables be ? Get(bindings, @@unscopables).
+ If Type(unscopables) is Object, then
+ Let blocked be ToBoolean(? Get(unscopables, N)).
+ If blocked is true, return false.
+
+ (The `with` Statement) Runtime Semantics: Evaluation
+
+ ...
+ Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ ...
+
+---*/
+let count = 0;
+var v = 1;
+globalThis[Symbol.unscopables] = {
+ v: true,
+};
+
+{
+ count++;
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+var ref = async (x) => {
+ (function() {
+ count++;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 1, 'The value of `v` is 1');
+ }
+ })();
+ (function() {
+ count++;
+ var v = x;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 10, 'The value of `v` is 10');
+ v = 20;
+ }
+ assert.sameValue(v, 20, 'The value of `v` is 20');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ })();
+ assert.sameValue(v, 1, 'The value of `v` is 1');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ callCount = callCount + 1;
+};
+
+ref(10).then(() => {
+ assert.sameValue(callCount, 1, 'async arrow function invoked exactly once')
+}).then($DONE, $DONE);
+
+ count++;
+}
+assert.sameValue(count, 6, 'The value of `count` is 6');
diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with.js b/js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with.js
new file mode 100644
index 0000000000..09b90cd6bf
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with.js
@@ -0,0 +1,89 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/unscopables-with.case
+// - src/function-forms/default/async-arrow-function.template
+/*---
+description: Symbol.unscopables behavior across scope boundaries (async arrow function expression)
+esid: sec-async-arrow-function-definitions
+features: [globalThis, Symbol.unscopables, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ 14.7 Async Arrow Function Definitions
+
+ AsyncArrowFunction :
+ ...
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ AsyncConciseBody :
+ { AsyncFunctionBody }
+
+ ...
+
+ Supplemental Syntax
+
+ When processing an instance of the production AsyncArrowFunction :
+ CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of
+ CoverCallExpressionAndAsyncArrowHead is refined using the following grammar:
+
+ AsyncArrowHead :
+ async ArrowFormalParameters
+
+
+ ...
+ Let envRec be lex's EnvironmentRecord.
+ Let exists be ? envRec.HasBinding(name).
+
+ HasBinding
+
+ ...
+ If the withEnvironment flag of envRec is false, return true.
+ Let unscopables be ? Get(bindings, @@unscopables).
+ If Type(unscopables) is Object, then
+ Let blocked be ToBoolean(? Get(unscopables, N)).
+ If blocked is true, return false.
+
+ (The `with` Statement) Runtime Semantics: Evaluation
+
+ ...
+ Set the withEnvironment flag of newEnv’s EnvironmentRecord to true.
+ ...
+
+---*/
+let count = 0;
+var v = 1;
+globalThis[Symbol.unscopables] = {
+ v: true,
+};
+
+{
+ count++;
+
+
+var callCount = 0;
+
+// Stores a reference `ref` for case evaluation
+var ref = async (x) => {
+ count++;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`');
+ }
+ count++;
+ var v = x;
+ with (globalThis) {
+ count++;
+ assert.sameValue(v, 10, 'The value of `v` is 10');
+ v = 20;
+ }
+ assert.sameValue(v, 20, 'The value of `v` is 20');
+ assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1');
+ callCount = callCount + 1;
+};
+
+ref(10).then(() => {
+ assert.sameValue(callCount, 1, 'async arrow function invoked exactly once')
+}).then($DONE, $DONE);
+
+ count++;
+}
+assert.sameValue(count, 6, 'The value of `count` is 6');