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

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

Issue 1366063002: [es6] Remove left-overs from Function.prototype.toMethod. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « test/mjsunit/es6/toMethod.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-arrow-functions --allow-natives-syntax 5 // Flags: --harmony-arrow-functions --allow-natives-syntax
6 // Flags: --harmony-spreadcalls --harmony-destructuring 6 // Flags: --harmony-spreadcalls --harmony-destructuring
7 // Flags: --harmony-rest-parameters --harmony-sloppy 7 // Flags: --harmony-rest-parameters --harmony-sloppy
8 8
9 (function TestSuperNamedLoads() { 9 (function TestSuperNamedLoads() {
10 function Base() { } 10 function Base() { }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 assertEquals(27, this[x]); 74 assertEquals(27, this[x]);
75 return "Derived"; 75 return "Derived";
76 } 76 }
77 }; 77 };
78 78
79 assertEquals("Base this is Base", new Base().f()); 79 assertEquals("Base this is Base", new Base().f());
80 assertEquals("Derived", new Derived().f()); 80 assertEquals("Derived", new Derived().f());
81 }()); 81 }());
82 82
83 83
84 (function TestSuperNumericKeyedLoads() {
85 var x = 1;
86 var derivedDataProperty = 2;
87 var f = 3;
88
89 function Base() { }
90 function fBase() { return "Base " + this.toString(); }
91 Base.prototype[f] = %ToMethod(fBase, Base.prototype);
92 Base.prototype[x] = 15;
93 Base.prototype.toString = function() { return "this is Base"; };
94
95 function Derived() {
96 this[derivedDataProperty] = "xxx";
97 }
98 Derived.prototype = {
99 __proto__: Base.prototype,
100 toString() { return "this is Derived"; },
101 1: 27,
102 3() {
103 assertEquals("Base this is Derived", super[f]());
104 var a = super[x];
105 assertEquals(15, a);
106 assertEquals(15, super[x]);
107 assertEquals(27, this[x]);
108 return "Derived";
109 }
110 };
111
112 assertEquals("Base this is Base", new Base()[f]());
113 assertEquals("Derived", new Derived()[f]());
114 }());
115
116
117 (function TestSuperKeywordNonMethod() { 84 (function TestSuperKeywordNonMethod() {
118 'use strict'; 85 'use strict';
119 86
120 class C { 87 class C {
121 f() { 88 f() {
122 super.unknown(); 89 super.unknown();
123 } 90 }
124 } 91 }
125 92
126 assertThrows(function() { 93 assertThrows(function() {
(...skipping 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2283 } 2250 }
2284 class Derived extends Base { 2251 class Derived extends Base {
2285 constructor(x) { 2252 constructor(x) {
2286 let r = (() => super(...[x]))(); 2253 let r = (() => super(...[x]))();
2287 assertEquals(this, r); 2254 assertEquals(this, r);
2288 } 2255 }
2289 } 2256 }
2290 let d = new Derived(42); 2257 let d = new Derived(42);
2291 assertSame(42, d.x); 2258 assertSame(42, d.x);
2292 })(); 2259 })();
OLDNEW
« no previous file with comments | « test/mjsunit/es6/toMethod.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698