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

Unified Diff: test/mjsunit/strict-mode-eval.js

Issue 2185223002: Fix not throwing error when redefine eval or arguments in strict mode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: update&rebase 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
« test/cctest/test-parsing.cc ('K') | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/strict-mode-eval.js
diff --git a/test/mjsunit/strict-mode-eval.js b/test/mjsunit/strict-mode-eval.js
index 391daaa37c6fdb996faa8878492c2eea4ed2abc3..d06e83997a5174e5986683774771d35db32c38f2 100644
--- a/test/mjsunit/strict-mode-eval.js
+++ b/test/mjsunit/strict-mode-eval.js
@@ -31,6 +31,8 @@ var code1 = "function f(eval) {}";
var code2 = "function f(a, a) {}";
var code3 = "var x = '\\020;'";
var code4 = "function arguments() {}";
+var code5 = "(() => { function a({ eval = false } = {}) {} })()";
+var code6 = "function f() { var {eval} = {}; }"
// Verify the code compiles just fine in non-strict mode
// (using aliased eval to force non-strict mode)
@@ -40,6 +42,8 @@ eval_alias(code1);
eval_alias(code2);
eval_alias(code3);
eval_alias(code4);
+eval_alias(code5);
+eval_alias(code6);
function strict1() {
var exception = false;
@@ -80,6 +84,30 @@ function strict1() {
assertInstanceof(e, SyntaxError);
}
assertTrue(exception);
+
+ function strict5() {
+ var exception = false;
+ try {
+ eval(code5);
+ } catch (e) {
+ exception = true;
+ assertInstanceof(e, SyntaxError);
+ }
+ assertTrue(exception);
+
+ function strict6() {
+ var exception = false;
+ try {
+ eval(code6);
+ } catch (e) {
+ exception = true;
+ assertInstanceof(e, SyntaxError);
+ }
+ assertTrue(exception);
+ }
+ strict6();
+ }
+ strict5();
}
strict4();
}
« test/cctest/test-parsing.cc ('K') | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698