Debian Codegraph @

js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-not-final-id.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-id.case
4 // - src/dstr-binding/default/try.template
5 /*---
6 description: Rest element (identifier) may not be followed by any element (try statement)
7 esid: sec-runtime-semantics-catchclauseevaluation
8 features: [destructuring-binding]
9 flags: [generated]
10 negative:
11 phase: parse
12 type: SyntaxError
13 info: |
14 Catch : catch ( CatchParameter ) Block
15
16 [...]
17 5. Let status be the result of performing BindingInitialization for
18 CatchParameter passing thrownValue and catchEnv as arguments.
19 [...]
20
21 13.3.3 Destructuring Binding Patterns
22 ArrayBindingPattern[Yield] :
23 [ Elisionopt BindingRestElement[?Yield]opt ]
24 [ BindingElementList[?Yield] ]
25 [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ]
26 ---*/
27 $DONOTEVALUATE();
28
29 var ranCatch = false;
30
31 try {
32 throw [1, 2, 3];
33 } catch ([...x, y]) {
34
35 ranCatch = true;
36 }
37
38 assert(ranCatch, 'executed `catch` block');