| 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 // Test for conflicting variable bindings. | 5 // Test for conflicting variable bindings. |
| 6 | 6 |
| 7 // Flags: --harmony-sloppy | 7 // Flags: --harmony-sloppy --harmony-sloppy-function |
| 8 | 8 |
| 9 function AssertEqualsStrictAndSloppy(value, code) { | 9 function AssertEqualsStrictAndSloppy(value, code) { |
| 10 assertEquals(value, eval("(function() {" + code + "})()")); | 10 assertEquals(value, eval("(function() {" + code + "})()")); |
| 11 assertEquals(value, eval("(function() { 'use strict'; " + code + "})()")); | 11 assertEquals(value, eval("(function() { 'use strict'; " + code + "})()")); |
| 12 assertEquals(value, eval("(function() { var x = 0; {" + code + "} })()")); | 12 assertEquals(value, eval("(function() { var x = 0; {" + code + "} })()")); |
| 13 assertEquals(value, eval("(function() { 'use strict'; var x = 0; {" | 13 assertEquals(value, eval("(function() { 'use strict'; var x = 0; {" |
| 14 + code + "} })()")); | 14 + code + "} })()")); |
| 15 } | 15 } |
| 16 | 16 |
| 17 function AssertThrowsStrictAndSloppy(code, error) { | 17 function AssertThrowsStrictAndSloppy(code, error) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 AssertThrowsStrictAndSloppy("class x { }; for (var x = 0; false;) { };", | 50 AssertThrowsStrictAndSloppy("class x { }; for (var x = 0; false;) { };", |
| 51 SyntaxError); | 51 SyntaxError); |
| 52 AssertThrowsStrictAndSloppy("for (var x = 0; false;) { }; class x { };", | 52 AssertThrowsStrictAndSloppy("for (var x = 0; false;) { }; class x { };", |
| 53 SyntaxError); | 53 SyntaxError); |
| 54 })(); | 54 })(); |
| 55 | 55 |
| 56 (function TestClassMutableBinding() { | 56 (function TestClassMutableBinding() { |
| 57 AssertEqualsStrictAndSloppy( | 57 AssertEqualsStrictAndSloppy( |
| 58 "x3", "class x { }; var y = x.name; x = 3; return y + x;") | 58 "x3", "class x { }; var y = x.name; x = 3; return y + x;") |
| 59 })(); | 59 })(); |
| OLD | NEW |