| // Copyright (C) 2016 the V8 project authors. All rights reserved. |
| // This code is governed by the BSD license found in the LICENSE file. |
| /*--- |
| template: default |
| desc: Rest element containing an object binding pattern |
| info: | |
| 13.3.3.6 Runtime Semantics: IteratorBindingInitialization |
| |
| BindingRestElement : ... BindingPattern |
| |
| 1. Let A be ArrayCreate(0). |
| [...] |
| 3. Repeat |
| [...] |
| b. If iteratorRecord.[[done]] is true, then |
| i. Return the result of performing BindingInitialization of |
| BindingPattern with A and environment as the arguments. |
| [...] |
| ---*/ |
| |
| //- setup |
| let length = "outer"; |
| //- elems |
| [...{ 0: v, 1: w, 2: x, 3: y, length: z }] |
| //- vals |
| [7, 8, 9] |
| //- body |
| assert.sameValue(v, 7); |
| assert.sameValue(w, 8); |
| assert.sameValue(x, 9); |
| assert.sameValue(y, undefined); |
| assert.sameValue(z, 3); |
| |
| assert.sameValue(length, "outer", "the length prop is not set as a binding name"); |