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

Unified Diff: test/mjsunit/harmony/new-target.js

Issue 1290013002: [es6] Make assignment to new.target an early ReferenceError (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add a few more tests Created 5 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 | « test/message/new-target-prefix-op.out ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/new-target.js
diff --git a/test/mjsunit/harmony/new-target.js b/test/mjsunit/harmony/new-target.js
index fa5b37282018d2615a83dc05cfff0f4738aefa38..a1f020b00546bfa54c740fb17da35261aec8231d 100644
--- a/test/mjsunit/harmony/new-target.js
+++ b/test/mjsunit/harmony/new-target.js
@@ -384,3 +384,15 @@
function f6() { with ({'new.target': 42}) return new.target }
assertSame(f6, new f6);
})();
+
+
+(function TestEarlyErrors() {
+ assertThrows(function() { Function("new.target = 42"); }, ReferenceError);
+ assertThrows(function() { Function("var foo = 1; new.target = foo = 42"); }, ReferenceError);
+ assertThrows(function() { Function("var foo = 1; foo = new.target = 42"); }, ReferenceError);
+ assertThrows(function() { Function("new.target--"); }, ReferenceError);
+ assertThrows(function() { Function("--new.target"); }, ReferenceError);
+ assertThrows(function() { Function("(new.target)++"); }, ReferenceError);
+ assertThrows(function() { Function("++(new.target)"); }, ReferenceError);
+ assertThrows(function() { Function("for (new.target of {});"); }, ReferenceError);
+})();
« no previous file with comments | « test/message/new-target-prefix-op.out ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698