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

Unified Diff: test/cctest/test-decls.cc

Issue 745963002: harmony-scoping: Disallow cross-script assignment to const (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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/hydrogen.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-decls.cc
diff --git a/test/cctest/test-decls.cc b/test/cctest/test-decls.cc
index 05f8671f6328f4314c058e481078eb120bda3312..54f0429a5f587893059b52e3e756c7dd2a5bf85b 100644
--- a/test/cctest/test-decls.cc
+++ b/test/cctest/test-decls.cc
@@ -1136,3 +1136,26 @@ TEST(CrossScriptStoreICs) {
Number::New(CcTest::isolate(), 20));
}
}
+
+
+TEST(CrossScriptAssignmentToConst) {
+ i::FLAG_harmony_scoping = true;
+ i::FLAG_allow_natives_syntax = true;
+
+ HandleScope handle_scope(CcTest::isolate());
+
+ {
+ SimpleContext context;
+
+ context.Check("function f() { x = 27; }", EXPECT_RESULT,
+ Undefined(CcTest::isolate()));
+ context.Check("'use strict';const x = 1; x", EXPECT_RESULT,
+ Number::New(CcTest::isolate(), 1));
+ context.Check("f();", EXPECT_EXCEPTION);
+ context.Check("x", EXPECT_RESULT, Number::New(CcTest::isolate(), 1));
+ context.Check("f();", EXPECT_EXCEPTION);
+ context.Check("x", EXPECT_RESULT, Number::New(CcTest::isolate(), 1));
+ context.Check("%OptimizeFunctionOnNextCall(f);f();", EXPECT_EXCEPTION);
+ context.Check("x", EXPECT_RESULT, Number::New(CcTest::isolate(), 1));
+ }
+}
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698