Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Unified Diff: test/mjsunit/harmony/block-let-semantics-sloppy.js

Issue 1214733013: [es6] Enforce TDZ checks for let/const in StoreLookupSlot (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/runtime/runtime-scopes.cc ('K') | « test/mjsunit/es6/block-let-semantics.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/block-let-semantics-sloppy.js
diff --git a/test/mjsunit/harmony/block-let-semantics-sloppy.js b/test/mjsunit/harmony/block-let-semantics-sloppy.js
index 4a90a2fcd8ec3e6783e2256a1dc1c241ba4e7438..35aad30b1b1de55d24a0233263c2c855514468ab 100644
--- a/test/mjsunit/harmony/block-let-semantics-sloppy.js
+++ b/test/mjsunit/harmony/block-let-semantics-sloppy.js
@@ -85,21 +85,22 @@ TestAll('f()(); let x; function f() { return function() { ++x; } }');
TestAll('f()(); let x; function f() { return function() { x++; } }');
TestAll('f()(); const x = 1; function f() { return function() { return x; } }');
-// 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;');
-TestAll('eval("x"); const x = 1;');
-
-// Use before initialization with check for eval-shadowed bindings.
-TestAll('function f() { eval("var y = 2;"); x + 1; }; f(); let x;');
-// TODO(arv): https://code.google.com/p/v8/issues/detail?id=4284
-// 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;');
+for (var kw of ['let', 'const']) {
+ // Use before initialization with a dynamic lookup.
+ TestAll(`eval("x"); ${kw} x = 2;`);
+ TestAll(`eval("x + 1;"); ${kw} x = 2;`);
+ TestAll(`eval("x = 1;"); ${kw} x = 2;`);
+ TestAll(`eval("x += 1;"); ${kw} x = 2;`);
+ TestAll(`eval("++x;"); ${kw} x = 2;`);
+ TestAll(`eval("x++;"); ${kw} x = 2;`);
+
+ // Use before initialization with check for eval-shadowed bindings.
+ TestAll(`function f() { eval("var y = 2;"); x + 1; }; f(); ${kw} x = 2;`);
+ TestAll(`function f() { eval("var y = 2;"); x = 1; }; f(); ${kw} x = 2;`);
+ TestAll(`function f() { eval("var y = 2;"); x += 1; }; f(); ${kw} x = 2;`);
+ TestAll(`function f() { eval("var y = 2;"); ++x; }; f(); ${kw} x = 2;`);
+ TestAll(`function f() { eval("var y = 2;"); x++; }; f(); ${kw} x = 2;`);
+}
// Test that variables introduced by function declarations are created and
// initialized upon entering a function / block scope.
« src/runtime/runtime-scopes.cc ('K') | « test/mjsunit/es6/block-let-semantics.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698