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

Side by Side Diff: test/mjsunit/harmony/super.js

Issue 1135243004: [es6] Support super.property in eval and arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git rebase Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-classes --allow-natives-syntax 5 // Flags: --harmony-classes --harmony-arrow-functions --allow-natives-syntax
6
6 7
7 (function TestSuperNamedLoads() { 8 (function TestSuperNamedLoads() {
8 function Base() { } 9 function Base() { }
9 function fBase() { } 10 function fBase() { }
10 Base.prototype = { 11 Base.prototype = {
11 f() { 12 f() {
12 return "Base " + this.toString(); 13 return "Base " + this.toString();
13 }, 14 },
14 x: 15, 15 x: 15,
15 toString() { 16 toString() {
(...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 2047
2047 (function TestExtendsObject() { 2048 (function TestExtendsObject() {
2048 'use strict'; 2049 'use strict';
2049 class F extends Object { } 2050 class F extends Object { }
2050 var f = new F(42); 2051 var f = new F(42);
2051 2052
2052 // TODO(dslomov,arv): Fix this. BUG=v8:3886. 2053 // TODO(dslomov,arv): Fix this. BUG=v8:3886.
2053 assertInstanceof(f, Number); 2054 assertInstanceof(f, Number);
2054 }()); 2055 }());
2055 2056
2057
2056 (function TestSuperCallErrorCases() { 2058 (function TestSuperCallErrorCases() {
2057 'use strict'; 2059 'use strict';
2058 class T extends Object { 2060 class T extends Object {
2059 constructor() { 2061 constructor() {
2060 super(); 2062 super();
2061 } 2063 }
2062 } 2064 }
2063 2065
2064 T.__proto__ = null; 2066 T.__proto__ = null;
2065 assertThrows(function() { new T(); }, TypeError); 2067 assertThrows(function() { new T(); }, TypeError);
2066 }()); 2068 }());
2069
2070
2071 (function TestSuperPropertyInEval() {
adamk 2015/05/26 19:32:33 Same name complaint.
2072 'use strict';
2073 let y = 3;
2074 class Base {
2075 m() { return 1; }
2076 get x() { return 2; }
2077 set y(v) { y = v; }
2078 }
2079 class Derived extends Base {
2080 eval() {
2081 assertSame(super.x, eval('super.x'));
2082 assertSame(super.m(), eval('super.m()'));
2083 // Global eval.
2084 assertThrows('super.x', SyntaxError);
2085 assertThrows('super.m()', SyntaxError);
2086 return eval('super.m()');
2087 }
2088 arrow() {
2089 assertSame(super.x, (() => super.x)());
2090 assertSame(super.m(), (() => super.m())());
2091 return (() => super.m())();
2092 }
2093 }
2094 let d = new Derived();
2095 assertSame(1, d.eval());
2096 assertSame(1, d.arrow());
2097 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698