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-default-parameters --harmony-destructuring-bind | |
6 | |
7 | 5 |
8 (function TestSloppyEvalScoping() { | 6 (function TestSloppyEvalScoping() { |
9 var x = 1; | 7 var x = 1; |
10 | 8 |
11 function f41({[eval("var x = 2; 'a'")]: w}, z = x) { return z; } | 9 function f41({[eval("var x = 2; 'a'")]: w}, z = x) { return z; } |
12 assertEquals(1, f41({})); | 10 assertEquals(1, f41({})); |
13 assertEquals(1, f41({a: 0})); | 11 assertEquals(1, f41({a: 0})); |
14 function f42({[eval("var x = 2; 'a'")]: w}, z = eval("x")) { return z; } | 12 function f42({[eval("var x = 2; 'a'")]: w}, z = eval("x")) { return z; } |
15 assertEquals(1, f42({})); | 13 assertEquals(1, f42({})); |
16 assertEquals(1, f42({a: 0})); | 14 assertEquals(1, f42({a: 0})); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 function f72({[eval("var x = 2; 'a'")]: w, b = eval("x")}) { return b; } | 101 function f72({[eval("var x = 2; 'a'")]: w, b = eval("x")}) { return b; } |
104 assertEquals(1, f72({})); | 102 assertEquals(1, f72({})); |
105 assertEquals(1, f72({a: 0})); | 103 assertEquals(1, f72({a: 0})); |
106 function f73({a: w = eval("var x = 2"), b = x}) { return b; } | 104 function f73({a: w = eval("var x = 2"), b = x}) { return b; } |
107 assertEquals(1, f73({})); | 105 assertEquals(1, f73({})); |
108 assertEquals(1, f73({a: 0})); | 106 assertEquals(1, f73({a: 0})); |
109 function f74({a: w = eval("var x = 2"), b = eval("x")}) { return b; } | 107 function f74({a: w = eval("var x = 2"), b = eval("x")}) { return b; } |
110 assertEquals(1, f74({})); | 108 assertEquals(1, f74({})); |
111 assertEquals(1, f74({a: 0})); | 109 assertEquals(1, f74({a: 0})); |
112 })(); | 110 })(); |
OLD | NEW |