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

Unified Diff: test/mjsunit/es6/block-eval-var-over-let.js

Issue 2206483004: Sloppy eval declarations should not shadow lexical function declarations (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « src/runtime/runtime-scopes.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/block-eval-var-over-let.js
diff --git a/test/mjsunit/es6/block-eval-var-over-let.js b/test/mjsunit/es6/block-eval-var-over-let.js
index 3dc8c47c209d32227bc5322b6279004f5eb308fb..e16d7a02a69a774a720daaa1415c9e6f981077eb 100644
--- a/test/mjsunit/es6/block-eval-var-over-let.js
+++ b/test/mjsunit/es6/block-eval-var-over-let.js
@@ -61,6 +61,23 @@ assertDoesNotThrow(function() {
eval('var x');
});
+// The same should work for lexical function declarations:
+// If the const is in its own block scope, with the eval, throws
+assertThrows(function() {
+ {
+ function x() {}
+ eval('var x');
+ }
+}, SyntaxError);
+
+// If the eval is in its own block scope, throws
+assertThrows(function() {
+ {
+ function y() {}
+ { eval('var y'); }
+ }
+}, SyntaxError);
+
// In global scope
let caught = false;
try {
« no previous file with comments | « src/runtime/runtime-scopes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698