1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Flags: --harmony-scoping
11 let f = [undefined, undefined, undefined]
12 for (const x of [1,2,3]) {
14 f[x-1] = function() { return x; }
17 assertEquals(1, f[0]());
18 assertEquals(2, f[1]());
19 assertEquals(3, f[2]());
23 for (const x of [x, x+1, x+2]) {
30 for (const q of [q, q+1, q+2]) {
37 for (const x = 1; z < 2; z++) {
44 for (const x in [1,2,3]) {
47 assertEquals("012", s);
49 assertThrows("'use strict'; for (const x in [1,2,3]) { x++ }", TypeError);
54 for (const x of [1,2,3]) {
61 for (const x of [x, x+1, x+2]) {
68 for (const q of [q, q+1, q+2]) {
74 for (const x in [1,2,3]) {
77 assertEquals("012", s);