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

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

Issue 1244423003: [es6] Fix function context check for super and new.target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment; added test for super calls Created 5 years, 5 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/mjsunit/harmony/new-target.js ('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 ab572b056f262e39dcf522d090cc9667c19309dd..601addaa0ef4098ea2fa5ab7fa55f61916b30faa 100644
--- a/test/mjsunit/harmony/super.js
+++ b/test/mjsunit/harmony/super.js
@@ -3,7 +3,8 @@
// found in the LICENSE file.
// Flags: --harmony-arrow-functions --allow-natives-syntax
-// Flags: --harmony-spreadcalls
+// Flags: --harmony-spreadcalls --harmony-destructuring
+// Flags: --harmony-rest-parameters --harmony-sloppy
(function TestSuperNamedLoads() {
function Base() { }
@@ -2122,6 +2123,34 @@ TestKeyedSetterCreatingOwnPropertiesNonConfigurable(42, 43, 44);
})();
+(function TestSuperInOtherScopes() {
+ var p = {x: 99};
+ var o0 = {__proto__: p, f() { return eval("'use strict'; super.x") }};
+ assertEquals(p.x, o0.f());
+ var o1 = {__proto__: p, f() { with ({}) return super.x }};
+ assertEquals(p.x, o1.f());
+ var o2 = {__proto__: p, f({a}) { return super.x }};
+ assertEquals(p.x, o2.f({}));
+ var o3 = {__proto__: p, f(...a) { return super.x }};
+ assertEquals(p.x, o3.f());
+ var o4 = {__proto__: p, f() { 'use strict'; { let x; return super.x } }};
+ assertEquals(p.x, o4.f());
+})();
+
+
+(function TestSuperCallInOtherScopes() {
+ class C {constructor() { this.x = 99 }}
+ class D0 extends C {constructor() { eval("'use strict'; super()") }}
+ assertEquals(99, (new D0).x);
+ class D2 extends C {constructor({a}) { super() }}
+ assertEquals(99, (new D2({})).x);
+ class D3 extends C {constructor(...a) { super() }}
+ assertEquals(99, (new D3()).x);
+ class D4 extends C {constructor() { { let x; super() } }}
+ assertEquals(99, (new D4).x);
+})();
+
+
(function TestSuperCallInEval() {
'use strict';
class Base {
« no previous file with comments | « test/mjsunit/harmony/new-target.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698