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

Unified Diff: test/mjsunit/harmony/super.js

Issue 766663003: harmony-classes: Implement 'super(...)' call syntactic restriction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Patch for landing 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
Index: test/mjsunit/harmony/super.js
diff --git a/test/mjsunit/harmony/super.js b/test/mjsunit/harmony/super.js
index d972407520ecda11269608609d185b0cbbc38ca8..6dcc393cceb23a26232c0d458880f8952d45c1c9 100644
--- a/test/mjsunit/harmony/super.js
+++ b/test/mjsunit/harmony/super.js
@@ -1861,3 +1861,61 @@ function Subclass(base, constructor) {
T1.__proto = null;
assertThrows(function() { new T1(); }, TypeError);
}());
+
+
+(function TestSuperCallSyntacticRestriction() {
+ assertThrows(function() {
+ function C() {
+ var y;
+ super();
+ }
+ new C();
+ }, TypeError);
+ assertThrows(function() {
+ function C() {
+ super(this.x);
+ }
+ new C();
+ }, TypeError);
+ assertThrows(function() {
+ function C() {
+ super(this);
+ }
+ new C();
+ }, TypeError);
+ assertThrows(function() {
+ function C() {
+ super(1, 2, Object.getPrototypeOf(this));
+ }
+ new C();
+ }, TypeError);
+ assertThrows(function() {
+ function C() {
+ { super(1, 2); }
+ }; new C();
+ }, TypeError);
+ assertThrows(function() {
+ function C() {
+ if (1) super();
+ }; new C();
+ }, TypeError);
+
+ function C1() {
+ 'use strict';
+ super();
+ };
+ new C1();
+
+ function C2() {
+ ; 'use strict';;;;;
+ super();
+ };
+ new C2();
+
+ function C3() {
+ ; 'use strict';;;;;
+ // This is a comment.
+ super();
+ }
+ new C3();
+}());

Powered by Google App Engine
This is Rietveld 408576698