Index: test/mjsunit/harmony/block-let-semantics.js |
diff --git a/test/mjsunit/harmony/block-let-semantics.js b/test/mjsunit/harmony/block-let-semantics.js |
index 198c3b4fb96803b415fdc65e0c69d3573eb23465..3819a9c6ec52f0035f3eeab95b0d084d004d40d5 100644 |
--- a/test/mjsunit/harmony/block-let-semantics.js |
+++ b/test/mjsunit/harmony/block-let-semantics.js |
@@ -81,13 +81,20 @@ TestAll('f()(); let x; function f() { return function() { x += 1; } }'); |
TestAll('f()(); let x; function f() { return function() { ++x; } }'); |
TestAll('f()(); let x; function f() { return function() { x++; } }'); |
-// Use in before initialization with a dynamic lookup. |
+// Use before initialization with a dynamic lookup. |
TestAll('eval("x + 1;"); let x;'); |
TestAll('eval("x = 1;"); let x;'); |
TestAll('eval("x += 1;"); let x;'); |
TestAll('eval("++x;"); let x;'); |
TestAll('eval("x++;"); let x;'); |
+// Use before initialization with check for eval-shadowed bindings. |
+TestAll('function f() { eval("var y = 2;"); x + 1; }; f(); let x;'); |
+TestAll('function f() { eval("var y = 2;"); x = 1; }; f(); let x;'); |
+TestAll('function f() { eval("var y = 2;"); x += 1; }; f(); let x;'); |
+TestAll('function f() { eval("var y = 2;"); ++x; }; f(); let x;'); |
+TestAll('function f() { eval("var y = 2;"); x++; }; f(); let x;'); |
+ |
// Test that variables introduced by function declarations are created and |
// initialized upon entering a function / block scope. |
function f() { |
@@ -136,3 +143,19 @@ function f2() { |
} |
assertEquals(5, n()); |
} |
+ |
+// Test that resolution of let bound variables works with scopes that call eval. |
+function outer() { |
+ function middle() { |
+ function inner() { |
+ return x; |
+ } |
+ eval("1 + 1"); |
+ return x + inner(); |
+ } |
+ |
+ let x = 1; |
+ return middle(); |
+} |
+ |
+assertEquals(2, outer()); |