Debian Codegraph @

js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-not-final-obj.js

raw
1 // |reftest| error:SyntaxError
2 // This file was procedurally generated from the following sources:
3 // - src/dstr-binding/ary-ptrn-rest-not-final-obj.case
4 // - src/dstr-binding/default/async-gen-meth.template
5 /*---
6 description: Rest element (object binding pattern) may not be followed by any element (async generator method)
7 esid: sec-asyncgenerator-definitions-propertydefinitionevaluation
8 features: [async-iteration]
9 flags: [generated]
10 negative:
11 phase: parse
12 type: SyntaxError
13 info: |
14 AsyncGeneratorMethod :
15 async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
16 { AsyncGeneratorBody }
17
18 1. Let propKey be the result of evaluating PropertyName.
19 2. ReturnIfAbrupt(propKey).
20 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
21 Otherwise let strict be false.
22 4. Let scope be the running execution context's LexicalEnvironment.
23 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
24 AsyncGeneratorBody, scope, strict).
25 [...]
26
27
28 13.3.3 Destructuring Binding Patterns
29 ArrayBindingPattern[Yield] :
30 [ Elisionopt BindingRestElement[?Yield]opt ]
31 [ BindingElementList[?Yield] ]
32 [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
33 ---*/
34 $DONOTEVALUATE();
35
36
37 var callCount = 0;
38 var obj = {
39 async *method([...{ x }, y]) {
40
41 callCount = callCount + 1;
42 }
43 };
44
45 obj.method([1, 2, 3]).next().then(() => {
46 assert.sameValue(callCount, 1, 'invoked exactly once');
47 }).then($DONE, $DONE);