meth-ary-ptrn-rest-not-final-ary.js (1926B)
1 // |reftest| error:SyntaxError 2 // This file was procedurally generated from the following sources: 3 // - src/dstr-binding/ary-ptrn-rest-not-final-ary.case 4 // - src/dstr-binding/default/meth.template 5 /*--- 6 description: Rest element (array binding pattern) may not be followed by any element (method) 7 esid: sec-runtime-semantics-definemethod 8 features: [destructuring-binding] 9 flags: [generated] 10 negative: 11 phase: parse 12 type: SyntaxError 13 info: | 14 MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } 15 16 [...] 17 6. Let closure be FunctionCreate(kind, StrictFormalParameters, 18 FunctionBody, scope, strict). If functionPrototype was passed as a 19 parameter then pass its value as the functionPrototype optional argument 20 of FunctionCreate. 21 [...] 22 23 9.2.1 [[Call]] ( thisArgument, argumentsList) 24 25 [...] 26 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). 27 [...] 28 29 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) 30 31 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). 32 [...] 33 34 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) 35 36 [...] 37 23. Let iteratorRecord be Record {[[iterator]]: 38 CreateListIterator(argumentsList), [[done]]: false}. 39 24. If hasDuplicates is true, then 40 [...] 41 25. Else, 42 b. Let formalStatus be IteratorBindingInitialization for formals with 43 iteratorRecord and env as arguments. 44 [...] 45 46 13.3.3 Destructuring Binding Patterns 47 ArrayBindingPattern[Yield] : 48 [ Elisionopt BindingRestElement[?Yield]opt ] 49 [ BindingElementList[?Yield] ] 50 [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] 51 ---*/ 52 $DONOTEVALUATE(); 53 54 var callCount = 0; 55 var obj = { 56 method([...[x], y]) { 57 58 callCount = callCount + 1; 59 } 60 }; 61 62 obj.method([1, 2, 3]); 63 assert.sameValue(callCount, 1, 'method invoked exactly once');