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); |
+})(); |