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 --harmony-sloppy-let --harmony-sloppy-function | |
6 | |
7 // Var-let conflict in a function throws, even if the var is in an eval | 5 // Var-let conflict in a function throws, even if the var is in an eval |
8 | 6 |
9 // Throws at the top level of a function | 7 // Throws at the top level of a function |
10 assertThrows(function() { | 8 assertThrows(function() { |
11 let x = 1; | 9 let x = 1; |
12 eval('var x'); | 10 eval('var x'); |
13 }, TypeError); | 11 }, TypeError); |
14 | 12 |
15 // If the eval is in its own block scope, throws | 13 // If the eval is in its own block scope, throws |
16 assertThrows(function() { | 14 assertThrows(function() { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 { | 132 { |
135 let x = 1; | 133 let x = 1; |
136 eval('{ function x() {} }'); | 134 eval('{ function x() {} }'); |
137 } | 135 } |
138 })(); | 136 })(); |
139 } catch (e) { | 137 } catch (e) { |
140 caught = true; | 138 caught = true; |
141 } | 139 } |
142 // TODO(littledan): switch to assertTrue when bug is fixed | 140 // TODO(littledan): switch to assertTrue when bug is fixed |
143 assertTrue(caught); | 141 assertTrue(caught); |
OLD | NEW |