1/* Copyright JS Foundation and other contributors, http://js.foundation 2 * 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16'use strict'; 17try { 18 eval('for (var i = 0 in {}) {}'); 19 assert(false); 20} catch(e) { 21 assert(e instanceof SyntaxError); 22} 23 24try { 25 eval('for (var = i of {}) {}'); 26 assert(false); 27} catch (e) { 28 assert(e instanceof SyntaxError); 29} 30 31var reached = false; 32 33for (var i in {}) { 34 reached = true; 35} 36assert(!reached); 37 38for (var i of []) { 39 reached = true; 40} 41assert(!reached); 42 43for (let i in {}) { 44 reached = true; 45} 46assert(!reached); 47 48for (let i of []) { 49 reached = true; 50} 51assert(!reached); 52 53for (const i in {}) { 54 reached = true; 55} 56assert(!reached); 57 58for (const i of []) { 59 reached = true; 60} 61assert(!reached); 62