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

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

Issue 2311413002: Super property loads and stores should throw if [[Prototype]] is null (Closed)
Patch Set: Created 4 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 | « src/runtime/runtime-classes.cc ('k') | test/test262/test262.status » ('j') | 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: --allow-natives-syntax 5 // Flags: --allow-natives-syntax
6 6
7 (function TestSuperNamedLoads() { 7 (function TestSuperNamedLoads() {
8 function Base() { } 8 function Base() { }
9 function fBase() { } 9 function fBase() { }
10 Base.prototype = { 10 Base.prototype = {
(...skipping 2195 matching lines...) Expand 10 before | Expand all | Expand 10 after
2206 } 2206 }
2207 class Derived extends Base { 2207 class Derived extends Base {
2208 constructor(x) { 2208 constructor(x) {
2209 let r = (() => super(...[x]))(); 2209 let r = (() => super(...[x]))();
2210 assertEquals(this, r); 2210 assertEquals(this, r);
2211 } 2211 }
2212 } 2212 }
2213 let d = new Derived(42); 2213 let d = new Derived(42);
2214 assertSame(42, d.x); 2214 assertSame(42, d.x);
2215 })(); 2215 })();
2216
2217 (function TestNullSuperPropertyLoad() {
2218 var obj = {
2219 __proto__: null,
2220 named() { return super.x },
2221 keyed() { return super[5] }
2222 };
2223 assertThrows(obj.named, TypeError);
2224 assertThrows(obj.keyed, TypeError);
2225 class C extends null {
2226 named() { return super.x }
2227 keyed() { return super[5] }
2228 }
2229 assertThrows(C.prototype.named, TypeError);
2230 assertThrows(C.prototype.keyed, TypeError);
2231 })();
2232
2233 (function TestNullSuperPropertyStore() {
2234 var obj = {
2235 __proto__: null,
2236 named() { super.x = 42 },
2237 keyed() { super[5] = 42 }
2238 };
2239 assertThrows(obj.named, TypeError);
2240 assertThrows(obj.keyed, TypeError);
2241 class C extends null {
2242 named() { super.x = 42 }
2243 keyed() { super[5] = 42 }
2244 }
2245 assertThrows(C.prototype.named, TypeError);
2246 assertThrows(C.prototype.keyed, TypeError);
2247 })();
OLDNEW
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698