OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --harmony-sloppy-let --no-legacy-const | 5 // Flags: --harmony-sloppy-let |
6 | 6 |
7 | 7 |
8 function assertUndef(x) { | 8 function assertUndef(x) { |
9 assertEquals(undefined, x); | 9 assertEquals(undefined, x); |
10 } | 10 } |
11 | 11 |
12 | 12 |
13 // IfStatement [13.6.7] | 13 // IfStatement [13.6.7] |
14 | 14 |
15 assertUndef(eval('42; if (true) ; else 0;')); // ES5: 42 | 15 assertUndef(eval('42; if (true) ; else 0;')); // ES5: 42 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 assertUndef(eval("var x = 1;")); | 141 assertUndef(eval("var x = 1;")); |
142 assertEquals(1, eval("if (true) { 1; } else { 2; }")); | 142 assertEquals(1, eval("if (true) { 1; } else { 2; }")); |
143 assertEquals(2, eval("if (false) { 1; } else { 2; }")); | 143 assertEquals(2, eval("if (false) { 1; } else { 2; }")); |
144 assertUndef(eval("try{1; if (true) { 2; throw ''; } else { 2; }} catch(e){}")); | 144 assertUndef(eval("try{1; if (true) { 2; throw ''; } else { 2; }} catch(e){}")); |
145 assertEquals(2, eval("1; var i = 0; do { ++i; 2; } while(i!=1);")); | 145 assertEquals(2, eval("1; var i = 0; do { ++i; 2; } while(i!=1);")); |
146 assertUndef(eval( | 146 assertUndef(eval( |
147 "try{1; var i = 0; do { ++i; 2; throw ''; } while (i!=1);} catch(e){}")); | 147 "try{1; var i = 0; do { ++i; 2; throw ''; } while (i!=1);} catch(e){}")); |
148 assertUndef(eval("1; try{2; throwOnReturn();} catch(e){}")); | 148 assertUndef(eval("1; try{2; throwOnReturn();} catch(e){}")); |
149 assertUndef(eval("1; twoFunc();")); | 149 assertUndef(eval("1; twoFunc();")); |
150 assertEquals(2, eval("1; with ( { a: 0 } ) { 2; }")); | 150 assertEquals(2, eval("1; with ( { a: 0 } ) { 2; }")); |
OLD | NEW |