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

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

Issue 1168513004: [es6] Super call in arrows and eval (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Push this_function earlier Created 5 years, 7 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 | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/super.js
diff --git a/test/mjsunit/harmony/super.js b/test/mjsunit/harmony/super.js
index 1af7ab2e234f97b3d48ef94935ab908a5cef034a..87fceafb299bceffd8fead995e1e4a45f03705c7 100644
--- a/test/mjsunit/harmony/super.js
+++ b/test/mjsunit/harmony/super.js
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// Flags: --harmony-classes --harmony-arrow-functions --allow-natives-syntax
-
+// Flags: --harmony-spreadcalls
(function TestSuperNamedLoads() {
function Base() { }
@@ -2107,3 +2107,99 @@ TestKeyedSetterCreatingOwnPropertiesNonConfigurable(42, 43, 44);
let d = new Derived();
assertSame(1, d.arrow());
})();
+
+
+(function TestSuperCallInEval() {
+ 'use strict';
+ class Base {
+ constructor(x) {
+ this.x = x;
+ }
+ }
+ class Derived extends Base {
+ constructor(x) {
+ eval('super(x)');
+ }
+ }
+ let d = new Derived(42);
+ assertSame(42, d.x);
+})();
+
+
+(function TestSuperCallInArrow() {
+ 'use strict';
+ class Base {
+ constructor(x) {
+ this.x = x;
+ }
+ }
+ class Derived extends Base {
+ constructor(x) {
+ (() => super(x))();
+ }
+ }
+ let d = new Derived(42);
+ assertSame(42, d.x);
+})();
+
+
+(function TestSuperCallEscapes() {
+ 'use strict';
+ class Base {
+ constructor(x) {
+ this.x = x;
+ }
+ }
+
+ let f;
+ class Derived extends Base {
+ constructor() {
+ f = () => super(2);
+ }
+ }
+ assertThrows(function() {
+ new Derived();
+ }, ReferenceError);
+
+ let o = f();
+ assertEquals(2, o.x);
+ assertInstanceof(o, Derived);
+
+ assertThrows(function() {
+ f();
+ }, ReferenceError);
+})();
+
+
+(function TestSuperCallSpreadInEval() {
+ 'use strict';
+ class Base {
+ constructor(x) {
+ this.x = x;
+ }
+ }
+ class Derived extends Base {
+ constructor(x) {
+ eval('super(...[x])');
+ }
+ }
+ let d = new Derived(42);
+ assertSame(42, d.x);
+})();
+
+
+(function TestSuperCallSpreadInArrow() {
+ 'use strict';
+ class Base {
+ constructor(x) {
+ this.x = x;
+ }
+ }
+ class Derived extends Base {
+ constructor(x) {
+ (() => super(...[x]))();
+ }
+ }
+ let d = new Derived(42);
+ assertSame(42, d.x);
+})();
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698