summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/async-function
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/expressions/async-function')
-rw-r--r--js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier-escaped.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference-escaped.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/await-as-label-identifier-escaped.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/await-as-label-identifier.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-function/early-errors-expression-NSPL-with-USD.js17
-rw-r--r--js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-arguments-strict.js19
-rw-r--r--js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-eval-strict.js18
-rw-r--r--js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-call.js16
-rw-r--r--js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-property.js17
-rw-r--r--js/src/tests/test262/language/expressions/async-function/early-errors-expression-eval-in-formal-parameters-strict.js18
-rw-r--r--js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-body-duplicate.js16
-rw-r--r--js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-contains-super-call.js16
-rw-r--r--js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-contains-super-property.js16
-rw-r--r--js/src/tests/test262/language/expressions/async-function/early-errors-expression-not-simple-assignment-target.js17
-rw-r--r--js/src/tests/test262/language/expressions/async-function/escaped-async.js25
-rw-r--r--js/src/tests/test262/language/expressions/async-function/expression-returns-promise.js14
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-arguments.js38
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-caller.js38
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-arguments.js38
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-caller.js38
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-get.js65
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-value.js65
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-prop-caller.js65
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-get.js65
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-value.js65
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-prop-caller.js65
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-function/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/expressions/async-function/name.js38
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-array-destructuring-param-strict-body.js110
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier-escaped.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference-escaped.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier-escaped.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-dflt-params-abrupt.js43
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-dflt-params-arg-val-not-undefined.js64
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-dflt-params-arg-val-undefined.js47
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-dflt-params-duplicates.js39
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-later.js44
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-prior.js44
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-self.js44
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-dflt-params-rest.js43
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-dflt-params-trailing-comma.js39
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-eval-var-scope-syntax-err.js39
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-object-destructuring-param-strict-body.js110
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-multiple.js39
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-single.js38
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-arrow.js33
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-eval.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-rest-param-strict-body.js110
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-rest-params-trailing-comma-early-error.js36
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-arguments-from-parent-function.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-newtarget.js30
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow.js30
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-returns-async-function-returns-arguments-from-own-function.js31
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-returns-async-function-returns-newtarget.js30
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-returns-async-function.js30
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js41
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js39
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-strict.js39
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-unscopables-with-in-nested-fn.js81
-rw-r--r--js/src/tests/test262/language/expressions/async-function/named-unscopables-with.js75
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-array-destructuring-param-strict-body.js110
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-abrupt.js43
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-arg-val-not-undefined.js64
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-arg-val-undefined.js47
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-duplicates.js39
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-later.js44
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-prior.js44
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-self.js44
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-rest.js43
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-trailing-comma.js39
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-eval-var-scope-syntax-err.js39
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-object-destructuring-param-strict-body.js110
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-multiple.js39
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-single.js38
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-rest-param-strict-body.js110
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-rest-params-trailing-comma-early-error.js36
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with-in-nested-fn.js81
-rw-r--r--js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with.js75
-rw-r--r--js/src/tests/test262/language/expressions/async-function/shell.js113
-rw-r--r--js/src/tests/test262/language/expressions/async-function/syntax-expression-is-PrimaryExpression.js13
-rw-r--r--js/src/tests/test262/language/expressions/async-function/try-reject-finally-reject.js28
-rw-r--r--js/src/tests/test262/language/expressions/async-function/try-reject-finally-return.js26
-rw-r--r--js/src/tests/test262/language/expressions/async-function/try-reject-finally-throw.js26
-rw-r--r--js/src/tests/test262/language/expressions/async-function/try-return-finally-reject.js26
-rw-r--r--js/src/tests/test262/language/expressions/async-function/try-return-finally-return.js26
-rw-r--r--js/src/tests/test262/language/expressions/async-function/try-return-finally-throw.js24
-rw-r--r--js/src/tests/test262/language/expressions/async-function/try-throw-finally-reject.js26
-rw-r--r--js/src/tests/test262/language/expressions/async-function/try-throw-finally-return.js26
-rw-r--r--js/src/tests/test262/language/expressions/async-function/try-throw-finally-throw.js24
101 files changed, 4005 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..3c3a5f7f7b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier-escaped.js
@@ -0,0 +1,31 @@
+// |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-expression.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Unnamed async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+var asyncFn = async function () {
+ var \u0061wait;
+};
diff --git a/js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier.js
new file mode 100644
index 0000000000..26fd230ecb
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier.js
@@ -0,0 +1,31 @@
+// |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-expression.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Unnamed async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+var asyncFn = async function () {
+ var await;
+};
diff --git a/js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..b87b3947c6
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference-escaped.js
@@ -0,0 +1,31 @@
+// |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-expression.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Unnamed async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+var asyncFn = async function () {
+ void \u0061wait;
+};
diff --git a/js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference.js
new file mode 100644
index 0000000000..b4ef353d9b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference.js
@@ -0,0 +1,31 @@
+// |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-expression.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Unnamed async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+var asyncFn = async function () {
+ void await;
+};
diff --git a/js/src/tests/test262/language/expressions/async-function/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-function/await-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..3f1860d874
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/await-as-label-identifier-escaped.js
@@ -0,0 +1,31 @@
+// |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-expression.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Unnamed async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+var asyncFn = async function () {
+ \u0061wait: ;
+};
diff --git a/js/src/tests/test262/language/expressions/async-function/await-as-label-identifier.js b/js/src/tests/test262/language/expressions/async-function/await-as-label-identifier.js
new file mode 100644
index 0000000000..489c6915bb
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/await-as-label-identifier.js
@@ -0,0 +1,31 @@
+// |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-expression.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Unnamed async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+var asyncFn = async function () {
+ await: ;
+};
diff --git a/js/src/tests/test262/language/expressions/async-function/browser.js b/js/src/tests/test262/language/expressions/async-function/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/browser.js
diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-NSPL-with-USD.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-NSPL-with-USD.js
new file mode 100644
index 0000000000..25cf218555
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-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 function (x = 1) {"use strict"})
diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-arguments-strict.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-arguments-strict.js
new file mode 100644
index 0000000000..71974b5b8c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-arguments-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: >
+ If the source code matching this production is strict code, it is a Syntax Error if BindingIdentifier is the IdentifierName arguments.
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+(async function arguments () { })
+
diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-eval-strict.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-eval-strict.js
new file mode 100644
index 0000000000..6ae127531a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-eval-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: >
+ If the source code matching this production is strict code, it is a Syntax Error if BindingIdentifier is the IdentifierName eval.
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+(async function eval () { })
diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-call.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-call.js
new file mode 100644
index 0000000000..2e48bd063a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-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 function foo (foo) { super() })
diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-property.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-property.js
new file mode 100644
index 0000000000..4a22fe862a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-property.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 AsyncFunctionBody contains SuperProperty is true
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+(async function foo (foo) { super.prop });
+
diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-eval-in-formal-parameters-strict.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-eval-in-formal-parameters-strict.js
new file mode 100644
index 0000000000..140d721525
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-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 in strict mode
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [onlyStrict]
+---*/
+
+$DONOTEVALUATE();
+
+(async function foo (eval) { })
diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-body-duplicate.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-body-duplicate.js
new file mode 100644
index 0000000000..7ffe6e4e9a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-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 function foo (bar) { let bar; });
diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-contains-super-call.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-contains-super-call.js
new file mode 100644
index 0000000000..7b15bad0aa
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-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 function foo (foo = super()) { var bar; });
diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-contains-super-property.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-contains-super-property.js
new file mode 100644
index 0000000000..2bdfc7c5ff
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-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 function foo (foo = super.foo) { var bar; });
diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-not-simple-assignment-target.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-not-simple-assignment-target.js
new file mode 100644
index 0000000000..114df74a2c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-not-simple-assignment-target.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: >
+ Async function expressions are not a simple assignment target.
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+(async function foo() { } = 1)
diff --git a/js/src/tests/test262/language/expressions/async-function/escaped-async.js b/js/src/tests/test262/language/expressions/async-function/escaped-async.js
new file mode 100644
index 0000000000..329569898d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-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 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();
+
+void \u0061sync function f(){}
diff --git a/js/src/tests/test262/language/expressions/async-function/expression-returns-promise.js b/js/src/tests/test262/language/expressions/async-function/expression-returns-promise.js
new file mode 100644
index 0000000000..cb6d4ed35a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/expression-returns-promise.js
@@ -0,0 +1,14 @@
+// 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 function expressions return promises
+---*/
+
+var p = async function() { }();
+assert(p instanceof Promise, "async functions return promise instances");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..e0b79f9456
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,38 @@
+// |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-func-expr-named.template
+/*---
+description: Forbidden extension, f.arguments (async function named expression)
+esid: sec-async-function-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { 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 = async function f() {
+ 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-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..eba158b5e7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,38 @@
+// |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-func-expr-named.template
+/*---
+description: Forbidden extension, o.caller (async function named expression)
+esid: sec-async-function-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { 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 = async function f() {
+ 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-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..adb55c34c5
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,38 @@
+// |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-func-expr-nameless.template
+/*---
+description: Forbidden extension, f.arguments (async function nameless expression)
+esid: sec-async-function-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { 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 = async function() {
+ 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-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..3f2b3dec4a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,38 @@
+// |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-func-expr-nameless.template
+/*---
+description: Forbidden extension, o.caller (async function nameless expression)
+esid: sec-async-function-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { 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 = async function() {
+ 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-function/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..907d2d93b8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,65 @@
+// |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-func-expr-named.template
+/*---
+description: Forbidden extension, o.caller (async function named expression)
+esid: sec-async-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { 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 function f() {
+ "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-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..b388bb4057
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,65 @@
+// |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-func-expr-named.template
+/*---
+description: Forbidden extension, o.caller (async function named expression)
+esid: sec-async-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { 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 function f() {
+ "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-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..d5ba5804ee
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,65 @@
+// |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-func-expr-named.template
+/*---
+description: Forbidden extension, o.caller (async function named expression)
+esid: sec-async-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { 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 function f() {
+ "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-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..0b6014752c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,65 @@
+// |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-func-expr-nameless.template
+/*---
+description: Forbidden extension, o.caller (async function nameless expression)
+esid: sec-async-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { 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 function() {
+ "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-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..0abb2354e4
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,65 @@
+// |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-func-expr-nameless.template
+/*---
+description: Forbidden extension, o.caller (async function nameless expression)
+esid: sec-async-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { 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 function() {
+ "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-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..553328afd4
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,65 @@
+// |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-func-expr-nameless.template
+/*---
+description: Forbidden extension, o.caller (async function nameless expression)
+esid: sec-async-definitions
+features: [arrow-function, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { 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 function() {
+ "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-function/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/expressions/async-function/name.js b/js/src/tests/test262/language/expressions/async-function/name.js
new file mode 100644
index 0000000000..2991e5a649
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/name.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2019 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-async-function-definitions-runtime-semantics-evaluation
+description: Assignment of function `name` attribute
+info: |
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+
+ 1. Let scope be the LexicalEnvironment of the running execution context.
+ 2. Let closure be ! AsyncFunctionCreate(Normal, FormalParameters,
+ AsyncFunctionBody, scope, "").
+ ...
+ 4. Return closure.
+
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ 1. Let scope be the running execution context's LexicalEnvironment.
+ 2. Let funcEnv be ! NewDeclarativeEnvironment(scope).
+ 3. Let envRec be funcEnv's EnvironmentRecord.
+ 4. Let name be StringValue of BindingIdentifier.
+ 5. Perform ! envRec.CreateImmutableBinding(name).
+ 6. Let closure be ! AsyncFunctionCreate(Normal, FormalParameters,
+ AsyncFunctionBody, funcEnv, name).
+ ...
+ 9. Return closure.
+includes: [propertyHelper.js]
+---*/
+
+verifyProperty(async function() {}, "name", {
+ value: "", writable: false, enumerable: false, configurable: true
+});
+
+verifyProperty(async function func() {}, "name", {
+ value: "func", writable: false, enumerable: false, configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/async-function/named-array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-function/named-array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..8e534ff382
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-array-destructuring-param-strict-body.js
@@ -0,0 +1,110 @@
+// |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-func-expr-named.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async function named expression)
+esid: sec-async-function-definitions
+features: [rest-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 function f([element]) {
+ "use strict";
+});
diff --git a/js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..b84e02fb71
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier-escaped.js
@@ -0,0 +1,31 @@
+// |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-expression-named.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Named async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+var asyncFn = async function asyncFn() {
+ var \u0061wait;
+};
diff --git a/js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier.js
new file mode 100644
index 0000000000..5993397273
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier.js
@@ -0,0 +1,31 @@
+// |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-expression-named.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Named async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+var asyncFn = async function asyncFn() {
+ var await;
+};
diff --git a/js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..1b1e940b80
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference-escaped.js
@@ -0,0 +1,31 @@
+// |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-expression-named.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Named async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+var asyncFn = async function asyncFn() {
+ void \u0061wait;
+};
diff --git a/js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference.js
new file mode 100644
index 0000000000..f76f93e27e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference.js
@@ -0,0 +1,31 @@
+// |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-expression-named.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Named async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+var asyncFn = async function asyncFn() {
+ void await;
+};
diff --git a/js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..179b33bff2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier-escaped.js
@@ -0,0 +1,31 @@
+// |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-expression-named.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Named async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+var asyncFn = async function asyncFn() {
+ \u0061wait: ;
+};
diff --git a/js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier.js b/js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier.js
new file mode 100644
index 0000000000..96c7c2fa93
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier.js
@@ -0,0 +1,31 @@
+// |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-expression-named.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Named async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+var asyncFn = async function asyncFn() {
+ await: ;
+};
diff --git a/js/src/tests/test262/language/expressions/async-function/named-dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-abrupt.js
new file mode 100644
index 0000000000..dc5214cea9
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-abrupt.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/async-func-expr-named.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (async function named expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 = async function f(_ = (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-function/named-dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..6cb14f54ee
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,64 @@
+// |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-func-expr-named.template
+/*---
+description: Use of initializer when argument value is not `undefined` (async function named expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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;
+ref = async function ref(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, '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-function/named-dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..22e620a2dd
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-arg-val-undefined.js
@@ -0,0 +1,47 @@
+// |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-func-expr-named.template
+/*---
+description: Use of initializer when argument value is `undefined` (async function named expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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;
+ref = async function ref(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, 'function invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-function/named-dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-duplicates.js
new file mode 100644
index 0000000000..04beb5d7bb
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-duplicates.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/async-func-expr-named.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async function named expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 function f(x = 0, x) {
+
+});
diff --git a/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-later.js
new file mode 100644
index 0000000000..12241382ff
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-later.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/async-func-expr-named.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (async function named expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 = async function f(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-function/named-dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-prior.js
new file mode 100644
index 0000000000..613e7ad9f2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-prior.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/async-func-expr-named.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (async function named expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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;
+ref = async function ref(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, 'function invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-self.js
new file mode 100644
index 0000000000..9ec6996ebd
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-self.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/async-func-expr-named.template
+/*---
+description: Referencing a parameter from within its own initializer (async function named expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 = async function f(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-function/named-dflt-params-rest.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-rest.js
new file mode 100644
index 0000000000..d5b69ad2c7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-rest.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/async-func-expr-named.template
+/*---
+description: RestParameter does not support an initializer (async function named expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+
+(async function f(...x = []) {
+
+});
diff --git a/js/src/tests/test262/language/expressions/async-function/named-dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..9855054a3f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-trailing-comma.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/async-func-expr-named.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (async function named expression)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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;
+ref = async function ref(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+};
+
+ref(42, undefined, 1).then(() => {
+ assert.sameValue(callCount, 1, '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-function/named-eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/async-function/named-eval-var-scope-syntax-err.js
new file mode 100644
index 0000000000..96a523d96e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-eval-var-scope-syntax-err.js
@@ -0,0 +1,39 @@
+// |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-func-expr-named.template
+/*---
+description: sloppy direct eval in params introduces var (async function named expression in sloppy code)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async, noStrict]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+
+ Runtime Semantics: IteratorBindingInitialization
+ FormalParameter : BindingElement
+
+ 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment.
+
+---*/
+
+
+var callCount = 0;
+var f = async function f(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-function/named-object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-function/named-object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..33e766dee6
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-object-destructuring-param-strict-body.js
@@ -0,0 +1,110 @@
+// |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-func-expr-named.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async function named expression)
+esid: sec-async-function-definitions
+features: [rest-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 function f({property}) {
+ "use strict";
+});
diff --git a/js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..7e027423ff
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-multiple.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/async-func-expr-named.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (async function named expression)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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;
+ref = async function ref(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+};
+
+ref(42, 39, 1).then(() => {
+ assert.sameValue(callCount, 1, '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-function/named-params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-single.js
new file mode 100644
index 0000000000..ef2e252832
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-single.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/async-func-expr-named.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (async function named expression)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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;
+ref = async function ref(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+};
+
+ref(42, 39).then(() => {
+ assert.sameValue(callCount, 1, '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-function/named-reassign-fn-name-in-body-in-arrow.js b/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-arrow.js
new file mode 100644
index 0000000000..e5c3d9e514
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-arrow.js
@@ -0,0 +1,33 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/reassign-fn-name-in-body-in-arrow.case
+// - src/function-forms/expr-named/async-func-expr-named-no-strict.template
+/*---
+description: Reassignment of function name is silently ignored in non-strict mode code. (async function named expression in non-strict mode code)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async, noStrict]
+includes: [asyncHelpers.js]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+
+// increment callCount in case "body"
+let callCount = 0;
+let ref = async function BindingIdentifier() {
+ callCount++;
+ (() => {
+ BindingIdentifier = 1;
+ })();
+ return BindingIdentifier;
+};
+
+asyncTest(async () => {
+ assert.sameValue(await ref(), ref);
+ assert.sameValue(callCount, 1, 'function invoked exactly once');
+});
+
diff --git a/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-eval.js b/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-eval.js
new file mode 100644
index 0000000000..2409f60b72
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-eval.js
@@ -0,0 +1,31 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/reassign-fn-name-in-body-in-eval.case
+// - src/function-forms/expr-named/async-func-expr-named-no-strict.template
+/*---
+description: Reassignment of function name is silently ignored in non-strict mode code. (async function named expression in non-strict mode code)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async, noStrict]
+includes: [asyncHelpers.js]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+
+// increment callCount in case "body"
+let callCount = 0;
+let ref = async function BindingIdentifier() {
+ callCount++;
+ eval("BindingIdentifier = 1");
+ return BindingIdentifier;
+};
+
+asyncTest(async () => {
+ assert.sameValue(await ref(), ref);
+ assert.sameValue(callCount, 1, 'function invoked exactly once');
+});
+
diff --git a/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body.js b/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body.js
new file mode 100644
index 0000000000..c8d2fd0945
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body.js
@@ -0,0 +1,31 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/reassign-fn-name-in-body.case
+// - src/function-forms/expr-named/async-func-expr-named-no-strict.template
+/*---
+description: Reassignment of function name is silently ignored in non-strict mode code. (async function named expression in non-strict mode code)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async, noStrict]
+includes: [asyncHelpers.js]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+
+// increment callCount in case "body"
+let callCount = 0;
+let ref = async function BindingIdentifier() {
+ callCount++;
+ BindingIdentifier = 1;
+ return BindingIdentifier;
+};
+
+asyncTest(async () => {
+ assert.sameValue(await ref(), ref);
+ assert.sameValue(callCount, 1, 'function invoked exactly once');
+});
+
diff --git a/js/src/tests/test262/language/expressions/async-function/named-rest-param-strict-body.js b/js/src/tests/test262/language/expressions/async-function/named-rest-param-strict-body.js
new file mode 100644
index 0000000000..bd0e9b9a4e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-rest-param-strict-body.js
@@ -0,0 +1,110 @@
+// |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-func-expr-named.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (async function named expression)
+esid: sec-async-function-definitions
+features: [rest-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 function f(a,...rest) {
+ "use strict";
+});
diff --git a/js/src/tests/test262/language/expressions/async-function/named-rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/async-function/named-rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..94ee94d4cd
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-rest-params-trailing-comma-early-error.js
@@ -0,0 +1,36 @@
+// |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-func-expr-named.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async function named expression)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 function f(...a,) {
+
+});
diff --git a/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-arguments-from-parent-function.js b/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-arguments-from-parent-function.js
new file mode 100644
index 0000000000..95678677ae
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-arguments-from-parent-function.js
@@ -0,0 +1,31 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow-returns-arguments-from-parent-function.case
+// - src/async-functions/evaluation/async-expression-named.template
+/*---
+description: Async function returns an async function. (Named async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated, async]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+var asyncFn = async function asyncFn(x) {
+ let a = arguments;
+ return async () => a === arguments;
+};
+
+asyncFn().then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, true);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-newtarget.js b/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-newtarget.js
new file mode 100644
index 0000000000..c6ae92510f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-newtarget.js
@@ -0,0 +1,30 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow-returns-newtarget.case
+// - src/async-functions/evaluation/async-expression-named.template
+/*---
+description: Async function returns an async function. (Named async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated, async]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+var asyncFn = async function asyncFn(x) {
+ return async () => new.target;
+};
+
+asyncFn().then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, undefined);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow.js b/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow.js
new file mode 100644
index 0000000000..45f0ecf30f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow.js
@@ -0,0 +1,30 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-arrow.case
+// - src/async-functions/evaluation/async-expression-named.template
+/*---
+description: Async function returns an async function. (Named async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated, async]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+var asyncFn = async function asyncFn(x) {
+ return async () => x;
+};
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, 1);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-function/named-returns-async-function-returns-arguments-from-own-function.js b/js/src/tests/test262/language/expressions/async-function/named-returns-async-function-returns-arguments-from-own-function.js
new file mode 100644
index 0000000000..5b88b2786a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-returns-async-function-returns-arguments-from-own-function.js
@@ -0,0 +1,31 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function-returns-arguments-from-own-function.case
+// - src/async-functions/evaluation/async-expression-named.template
+/*---
+description: Async function returns an async function. (Named async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated, async]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+var asyncFn = async function asyncFn(x) {
+ let a = arguments;
+ return async function() { return a === arguments; };
+};
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, false);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-function/named-returns-async-function-returns-newtarget.js b/js/src/tests/test262/language/expressions/async-function/named-returns-async-function-returns-newtarget.js
new file mode 100644
index 0000000000..c4dc0fbc5a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-returns-async-function-returns-newtarget.js
@@ -0,0 +1,30 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function-returns-newtarget.case
+// - src/async-functions/evaluation/async-expression-named.template
+/*---
+description: Async function returns an async function. (Named async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated, async]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+var asyncFn = async function asyncFn(x) {
+ return async function() { return new.target; };
+};
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, undefined);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-function/named-returns-async-function.js b/js/src/tests/test262/language/expressions/async-function/named-returns-async-function.js
new file mode 100644
index 0000000000..0b181cbd92
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-returns-async-function.js
@@ -0,0 +1,30 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-functions/returns-async-function.case
+// - src/async-functions/evaluation/async-expression-named.template
+/*---
+description: Async function returns an async function. (Named async function expression)
+esid: prod-AsyncFunctionExpression
+features: [async-functions]
+flags: [generated, async]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+let count = 0;
+
+
+var asyncFn = async function asyncFn(x) {
+ return async function() { return x; };
+};
+
+asyncFn(1).then(retFn => {
+ count++;
+ return retFn();
+}).then(result => {
+ assert.sameValue(result, 1);
+ assert.sameValue(count, 1);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js b/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js
new file mode 100644
index 0000000000..323b1a09ac
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js
@@ -0,0 +1,41 @@
+// |reftest| async
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/function-forms/reassign-fn-name-in-body-in-arrow.case
+// - src/function-forms/expr-named/async-func-expr-named-strict-error.template
+/*---
+description: Reassignment of function name is silently ignored in non-strict mode code. (async function named expression in strict mode code)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async, onlyStrict]
+includes: [asyncHelpers.js]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+
+// increment callCount in case "body"
+let callCount = 0;
+let ref = async function BindingIdentifier() {
+ callCount++;
+ (() => {
+ BindingIdentifier = 1;
+ })();
+ return BindingIdentifier;
+};
+
+asyncTest(async () => {
+ let catchCount = 0;
+ try {
+ await ref()
+ } catch (error) {
+ catchCount++;
+ assert(error instanceof TypeError);
+ }
+ assert.sameValue(catchCount, 1);
+ assert.sameValue(callCount, 1);
+});
+
diff --git a/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js b/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js
new file mode 100644
index 0000000000..6f93a16f8d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js
@@ -0,0 +1,39 @@
+// |reftest| async
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/function-forms/reassign-fn-name-in-body-in-eval.case
+// - src/function-forms/expr-named/async-func-expr-named-strict-error.template
+/*---
+description: Reassignment of function name is silently ignored in non-strict mode code. (async function named expression in strict mode code)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async, onlyStrict]
+includes: [asyncHelpers.js]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+
+// increment callCount in case "body"
+let callCount = 0;
+let ref = async function BindingIdentifier() {
+ callCount++;
+ eval("BindingIdentifier = 1");
+ return BindingIdentifier;
+};
+
+asyncTest(async () => {
+ let catchCount = 0;
+ try {
+ await ref()
+ } catch (error) {
+ catchCount++;
+ assert(error instanceof TypeError);
+ }
+ assert.sameValue(catchCount, 1);
+ assert.sameValue(callCount, 1);
+});
+
diff --git a/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-strict.js b/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-strict.js
new file mode 100644
index 0000000000..c3392f7ffa
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-strict.js
@@ -0,0 +1,39 @@
+// |reftest| async
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/function-forms/reassign-fn-name-in-body.case
+// - src/function-forms/expr-named/async-func-expr-named-strict-error.template
+/*---
+description: Reassignment of function name is silently ignored in non-strict mode code. (async function named expression in strict mode code)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async, onlyStrict]
+includes: [asyncHelpers.js]
+info: |
+ Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+---*/
+
+// increment callCount in case "body"
+let callCount = 0;
+let ref = async function BindingIdentifier() {
+ callCount++;
+ BindingIdentifier = 1;
+ return BindingIdentifier;
+};
+
+asyncTest(async () => {
+ let catchCount = 0;
+ try {
+ await ref()
+ } catch (error) {
+ catchCount++;
+ assert(error instanceof TypeError);
+ }
+ assert.sameValue(catchCount, 1);
+ assert.sameValue(callCount, 1);
+});
+
diff --git a/js/src/tests/test262/language/expressions/async-function/named-unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/expressions/async-function/named-unscopables-with-in-nested-fn.js
new file mode 100644
index 0000000000..3092f4ad35
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-unscopables-with-in-nested-fn.js
@@ -0,0 +1,81 @@
+// |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-func-expr-named.template
+/*---
+description: Symbol.unscopables behavior across scope boundaries (async function named expression)
+esid: sec-async-function-definitions
+features: [globalThis, Symbol.unscopables, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ ...
+ 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;
+ref = async function ref(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, '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-function/named-unscopables-with.js b/js/src/tests/test262/language/expressions/async-function/named-unscopables-with.js
new file mode 100644
index 0000000000..2a135d058b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/named-unscopables-with.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/unscopables-with.case
+// - src/function-forms/default/async-func-expr-named.template
+/*---
+description: Symbol.unscopables behavior across scope boundaries (async function named expression)
+esid: sec-async-function-definitions
+features: [globalThis, Symbol.unscopables, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+
+ ...
+ 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;
+ref = async function ref(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, '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-function/nameless-array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-function/nameless-array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..ad0d2436cf
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-array-destructuring-param-strict-body.js
@@ -0,0 +1,110 @@
+// |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-func-expr-nameless.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async function nameless expression)
+esid: sec-async-function-definitions
+features: [rest-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 function([element]) {
+ "use strict";
+});
diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-abrupt.js
new file mode 100644
index 0000000000..37757c9856
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-abrupt.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/async-func-expr-nameless.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (async function nameless expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 = async function(_ = (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-function/nameless-dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..801f8fed40
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,64 @@
+// |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-func-expr-nameless.template
+/*---
+description: Use of initializer when argument value is not `undefined` (async function nameless expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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;
+ref = async function(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, '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-function/nameless-dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..f6dff99346
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-arg-val-undefined.js
@@ -0,0 +1,47 @@
+// |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-func-expr-nameless.template
+/*---
+description: Use of initializer when argument value is `undefined` (async function nameless expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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;
+ref = async function(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, 'function invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-duplicates.js
new file mode 100644
index 0000000000..89e91e917d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-duplicates.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/async-func-expr-nameless.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async function nameless expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 function(x = 0, x) {
+
+});
diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-later.js
new file mode 100644
index 0000000000..15b2f0ff8a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-later.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/async-func-expr-nameless.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (async function nameless expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 = async function(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-function/nameless-dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-prior.js
new file mode 100644
index 0000000000..eb63bfe585
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-prior.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/async-func-expr-nameless.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (async function nameless expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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;
+ref = async function(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, 'function invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-self.js
new file mode 100644
index 0000000000..fe9d4e4d23
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-self.js
@@ -0,0 +1,44 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/async-func-expr-nameless.template
+/*---
+description: Referencing a parameter from within its own initializer (async function nameless expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 = async function(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-function/nameless-dflt-params-rest.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-rest.js
new file mode 100644
index 0000000000..b9ac26fa93
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-rest.js
@@ -0,0 +1,43 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/async-func-expr-nameless.template
+/*---
+description: RestParameter does not support an initializer (async function nameless expression)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+
+(async function(...x = []) {
+
+});
diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..c000f723ff
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-trailing-comma.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/async-func-expr-nameless.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (async function nameless expression)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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;
+ref = async function(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+};
+
+ref(42, undefined, 1).then(() => {
+ assert.sameValue(callCount, 1, '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-function/nameless-eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/async-function/nameless-eval-var-scope-syntax-err.js
new file mode 100644
index 0000000000..6de089c5e4
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-eval-var-scope-syntax-err.js
@@ -0,0 +1,39 @@
+// |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-func-expr-nameless.template
+/*---
+description: sloppy direct eval in params introduces var (async function nameless expression in sloppy code)
+esid: sec-async-function-definitions
+features: [default-parameters, async-functions]
+flags: [generated, async, noStrict]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+
+ Runtime Semantics: IteratorBindingInitialization
+ FormalParameter : BindingElement
+
+ 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment.
+
+---*/
+
+
+var callCount = 0;
+var f = async function(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-function/nameless-object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-function/nameless-object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..379bce0a3c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-object-destructuring-param-strict-body.js
@@ -0,0 +1,110 @@
+// |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-func-expr-nameless.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async function nameless expression)
+esid: sec-async-function-definitions
+features: [rest-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 function({property}) {
+ "use strict";
+});
diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..de1e6354bd
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-multiple.js
@@ -0,0 +1,39 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/async-func-expr-nameless.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (async function nameless expression)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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;
+ref = async function(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+};
+
+ref(42, 39, 1).then(() => {
+ assert.sameValue(callCount, 1, '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-function/nameless-params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-single.js
new file mode 100644
index 0000000000..fc89ff49e5
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-single.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/async-func-expr-nameless.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (async function nameless expression)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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;
+ref = async function(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+};
+
+ref(42, 39).then(() => {
+ assert.sameValue(callCount, 1, '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-function/nameless-rest-param-strict-body.js b/js/src/tests/test262/language/expressions/async-function/nameless-rest-param-strict-body.js
new file mode 100644
index 0000000000..7765849e99
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-rest-param-strict-body.js
@@ -0,0 +1,110 @@
+// |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-func-expr-nameless.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (async function nameless expression)
+esid: sec-async-function-definitions
+features: [rest-parameters, async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 function(a,...rest) {
+ "use strict";
+});
diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/async-function/nameless-rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..56de8e63f9
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-rest-params-trailing-comma-early-error.js
@@ -0,0 +1,36 @@
+// |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-func-expr-nameless.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async function nameless expression)
+esid: sec-async-function-definitions
+features: [async-functions]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ 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 function(...a,) {
+
+});
diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with-in-nested-fn.js
new file mode 100644
index 0000000000..87739cc8c5
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with-in-nested-fn.js
@@ -0,0 +1,81 @@
+// |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-func-expr-nameless.template
+/*---
+description: Symbol.unscopables behavior across scope boundaries (async function nameless expression)
+esid: sec-async-function-definitions
+features: [globalThis, Symbol.unscopables, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ ...
+ 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;
+ref = async function(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, '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-function/nameless-unscopables-with.js b/js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with.js
new file mode 100644
index 0000000000..b80372c435
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with.js
@@ -0,0 +1,75 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/unscopables-with.case
+// - src/function-forms/default/async-func-expr-nameless.template
+/*---
+description: Symbol.unscopables behavior across scope boundaries (async function nameless expression)
+esid: sec-async-function-definitions
+features: [globalThis, Symbol.unscopables, async-functions]
+flags: [generated, noStrict, async]
+info: |
+ 14.6 Async Function Definitions
+
+ AsyncFunctionExpression :
+ async function ( FormalParameters ) { AsyncFunctionBody }
+
+
+ ...
+ 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;
+ref = async function(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, '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-function/shell.js b/js/src/tests/test262/language/expressions/async-function/shell.js
new file mode 100644
index 0000000000..ae18ad584d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/shell.js
@@ -0,0 +1,113 @@
+// GENERATED, DO NOT EDIT
+// file: asyncHelpers.js
+// Copyright (C) 2022 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ A collection of assertion and wrapper functions for testing asynchronous built-ins.
+defines: [asyncTest]
+---*/
+
+function asyncTest(testFunc) {
+ if (!Object.hasOwn(globalThis, "$DONE")) {
+ throw new Test262Error("asyncTest called without async flag");
+ }
+ if (typeof testFunc !== "function") {
+ $DONE(new Test262Error("asyncTest called with non-function argument"));
+ return;
+ }
+ try {
+ testFunc().then(
+ function () {
+ $DONE();
+ },
+ function (error) {
+ $DONE(error);
+ }
+ );
+ } catch (syncError) {
+ $DONE(syncError);
+ }
+}
+
+assert.throwsAsync = async function (expectedErrorConstructor, func, message) {
+ var innerThenable;
+ if (message === undefined) {
+ message = "";
+ } else {
+ message += " ";
+ }
+ if (typeof func === "function") {
+ try {
+ innerThenable = func();
+ if (
+ innerThenable === null ||
+ typeof innerThenable !== "object" ||
+ typeof innerThenable.then !== "function"
+ ) {
+ message +=
+ "Expected to obtain an inner promise that would reject with a" +
+ expectedErrorConstructor.name +
+ " but result was not a thenable";
+ throw new Test262Error(message);
+ }
+ } catch (thrown) {
+ message +=
+ "Expected a " +
+ expectedErrorConstructor.name +
+ " to be thrown asynchronously but an exception was thrown synchronously while obtaining the inner promise";
+ throw new Test262Error(message);
+ }
+ } else {
+ message +=
+ "assert.throwsAsync called with an argument that is not a function";
+ throw new Test262Error(message);
+ }
+
+ try {
+ return innerThenable.then(
+ function () {
+ message +=
+ "Expected a " +
+ expectedErrorConstructor.name +
+ " to be thrown asynchronously but no exception was thrown at all";
+ throw new Test262Error(message);
+ },
+ function (thrown) {
+ var expectedName, actualName;
+ if (typeof thrown !== "object" || thrown === null) {
+ message += "Thrown value was not an object!";
+ throw new Test262Error(message);
+ } else if (thrown.constructor !== expectedErrorConstructor) {
+ expectedName = expectedErrorConstructor.name;
+ actualName = thrown.constructor.name;
+ if (expectedName === actualName) {
+ message +=
+ "Expected a " +
+ expectedName +
+ " but got a different error constructor with the same name";
+ } else {
+ message +=
+ "Expected a " + expectedName + " but got a " + actualName;
+ }
+ throw new Test262Error(message);
+ }
+ }
+ );
+ } catch (thrown) {
+ if (typeof thrown !== "object" || thrown === null) {
+ message +=
+ "Expected a " +
+ expectedErrorConstructor.name +
+ " to be thrown asynchronously but innerThenable synchronously threw a value that was not an object ";
+ } else {
+ message +=
+ "Expected a " +
+ expectedErrorConstructor.name +
+ " to be thrown asynchronously but a " +
+ thrown.constructor.name +
+ " was thrown synchronously";
+ }
+ throw new Test262Error(message);
+ }
+};
diff --git a/js/src/tests/test262/language/expressions/async-function/syntax-expression-is-PrimaryExpression.js b/js/src/tests/test262/language/expressions/async-function/syntax-expression-is-PrimaryExpression.js
new file mode 100644
index 0000000000..705014ec22
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-function/syntax-expression-is-PrimaryExpression.js
@@ -0,0 +1,13 @@
+// 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 function expressions are PrimaryExpressions
+---*/
+
+(async function foo() { }.prototype)
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/async-function/try-reject-finally-reject.js b/js/src/tests/test262/language/expressions/async-function/try-reject-finally-reject.js
new file mode 100644
index 0000000000..ff5ad4c766
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-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 function() {
+ 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-function/try-reject-finally-return.js b/js/src/tests/test262/language/expressions/async-function/try-reject-finally-return.js
new file mode 100644
index 0000000000..0bddbe0241
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-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 function() {
+ 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-function/try-reject-finally-throw.js b/js/src/tests/test262/language/expressions/async-function/try-reject-finally-throw.js
new file mode 100644
index 0000000000..e787503ddf
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-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 function() {
+ 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-function/try-return-finally-reject.js b/js/src/tests/test262/language/expressions/async-function/try-return-finally-reject.js
new file mode 100644
index 0000000000..d9a29ea6cd
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-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 function() {
+ 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-function/try-return-finally-return.js b/js/src/tests/test262/language/expressions/async-function/try-return-finally-return.js
new file mode 100644
index 0000000000..bc73e9f9fb
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-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 function() {
+ 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-function/try-return-finally-throw.js b/js/src/tests/test262/language/expressions/async-function/try-return-finally-throw.js
new file mode 100644
index 0000000000..873569d12d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-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 function() {
+ 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-function/try-throw-finally-reject.js b/js/src/tests/test262/language/expressions/async-function/try-throw-finally-reject.js
new file mode 100644
index 0000000000..d2431f4cfb
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-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 function() {
+ 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-function/try-throw-finally-return.js b/js/src/tests/test262/language/expressions/async-function/try-throw-finally-return.js
new file mode 100644
index 0000000000..0ac681053e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-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 function() {
+ 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-function/try-throw-finally-throw.js b/js/src/tests/test262/language/expressions/async-function/try-throw-finally-throw.js
new file mode 100644
index 0000000000..ceebedd4f3
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/async-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 function() {
+ try {
+ throw "early-throw";
+ } finally {
+ throw "override";
+ }
+};
+
+f().then($DONE, function(value) {
+ assert.sameValue(value, "override", "Exception thrown in finally block");
+}).then($DONE, $DONE);