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

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

Issue 1381083004: Improving error messages when adding properties to non JSObject receiver in (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: removing unused branch Created 5 years, 2 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/objects.cc ('k') | test/mjsunit/messages.js » ('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 // Flags: --harmony-spread-calls --harmony-destructuring 6 // Flags: --harmony-spread-calls --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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 'use strict'; 1069 'use strict';
1070 var ex; 1070 var ex;
1071 assertEquals(42, this.ownReadOnly); 1071 assertEquals(42, this.ownReadOnly);
1072 try { 1072 try {
1073 super.ownReadOnly = 55; 1073 super.ownReadOnly = 55;
1074 } catch (e) { 1074 } catch (e) {
1075 ex = e; 1075 ex = e;
1076 } 1076 }
1077 assertInstanceof(ex, TypeError); 1077 assertInstanceof(ex, TypeError);
1078 assertEquals( 1078 assertEquals(
1079 "Cannot assign to read only property 'ownReadOnly' of #<Base>", 1079 "Cannot assign to read only property 'ownReadOnly' of object '#<Base>' ",
1080 ex.message); 1080 ex.message);
1081 assertEquals(42, this.ownReadOnly); 1081 assertEquals(42, this.ownReadOnly);
1082 1082
1083 ex = null; 1083 ex = null;
1084 assertEquals(15, this.ownReadonlyAccessor); 1084 assertEquals(15, this.ownReadonlyAccessor);
1085 try { 1085 try {
1086 super.ownReadonlyAccessor = 25; 1086 super.ownReadonlyAccessor = 25;
1087 } catch (e) { 1087 } catch (e) {
1088 ex = e; 1088 ex = e;
1089 } 1089 }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 var ex; 1316 var ex;
1317 assertEquals(42, this[ownReadOnly]); 1317 assertEquals(42, this[ownReadOnly]);
1318 try { 1318 try {
1319 super[ownReadOnly] = 55; 1319 super[ownReadOnly] = 55;
1320 } catch (e) { 1320 } catch (e) {
1321 ex = e; 1321 ex = e;
1322 } 1322 }
1323 assertInstanceof(ex, TypeError); 1323 assertInstanceof(ex, TypeError);
1324 assertEquals( 1324 assertEquals(
1325 "Cannot assign to read only property '" + ownReadOnly + 1325 "Cannot assign to read only property '" + ownReadOnly +
1326 "' of #<Base>", 1326 "' of object '#<Base>'",
1327 ex.message); 1327 ex.message);
1328 assertEquals(42, this[ownReadOnly]); 1328 assertEquals(42, this[ownReadOnly]);
1329 1329
1330 ex = null; 1330 ex = null;
1331 assertEquals(15, this[ownReadonlyAccessor]); 1331 assertEquals(15, this[ownReadonlyAccessor]);
1332 try { 1332 try {
1333 super[ownReadonlyAccessor] = 25; 1333 super[ownReadonlyAccessor] = 25;
1334 } catch (e) { 1334 } catch (e) {
1335 ex = e; 1335 ex = e;
1336 } 1336 }
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after
2250 } 2250 }
2251 class Derived extends Base { 2251 class Derived extends Base {
2252 constructor(x) { 2252 constructor(x) {
2253 let r = (() => super(...[x]))(); 2253 let r = (() => super(...[x]))();
2254 assertEquals(this, r); 2254 assertEquals(this, r);
2255 } 2255 }
2256 } 2256 }
2257 let d = new Derived(42); 2257 let d = new Derived(42);
2258 assertSame(42, d.x); 2258 assertSame(42, d.x);
2259 })(); 2259 })();
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698