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

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

Issue 638623002: Keyed stores to super where key is a name. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Stray edit Created 6 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 | Annotate | Revision Log
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 5 // Flags: --harmony-classes
6 6
7 7
8 (function TestSuperNamedLoads() { 8 (function TestSuperNamedLoads() {
9 function Base() { } 9 function Base() { }
10 function Derived() { 10 function Derived() {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 'use strict'; 221 'use strict';
222 assertEquals('foobar', super.x = 'foobar'); 222 assertEquals('foobar', super.x = 'foobar');
223 assertEquals('foobarabc', super.x += 'abc'); 223 assertEquals('foobarabc', super.x += 'abc');
224 }.toMethod(Derived.prototype); 224 }.toMethod(Derived.prototype);
225 d.testSetterStrict(); 225 d.testSetterStrict();
226 assertEquals('base', Base.prototype._x); 226 assertEquals('base', Base.prototype._x);
227 assertEquals('foobarabc', d._x); 227 assertEquals('foobarabc', d._x);
228 }()); 228 }());
229 229
230 230
231 (function TestSetterKeyed() {
232 var x = 'x';
233 function Base() {}
234 Base.prototype = {
235 constructor: Base,
236 get x() {
237 return this._x;
238 },
239 set x(v) {
240 this._x = v;
241 },
242 _x: 'base'
243 };
244
245 function Derived() {}
246 Derived.__proto__ = Base;
247 Derived.prototype = {
248 __proto__: Base.prototype,
249 constructor: Derived,
250 _x: 'derived'
251 };
252 Derived.prototype.testSetter = function() {
253 assertEquals('foobar', super[x] = 'foobar');
254 assertEquals('foobarabc', super[x] += 'abc');
255 }.toMethod(Derived.prototype);
256 var d = new Derived();
257 d.testSetter();
258 assertEquals('base', Base.prototype._x);
259 assertEquals('foobarabc', d._x);
260 d._x = '';
261 Derived.prototype.testSetterStrict = function() {
262 'use strict';
263 assertEquals('foobar', super[x] = 'foobar');
264 assertEquals('foobarabc', super[x] += 'abc');
265 }.toMethod(Derived.prototype);
266 d.testSetterStrict();
267 assertEquals('base', Base.prototype._x);
268 assertEquals('foobarabc', d._x);
269 }());
270
271
231 (function TestSetterDataProperties() { 272 (function TestSetterDataProperties() {
232 function Base() {} 273 function Base() {}
233 Base.prototype = { 274 Base.prototype = {
234 constructor: Base, 275 constructor: Base,
235 x: 'x from Base' 276 x: 'x from Base'
236 }; 277 };
237 278
238 function Derived() {} 279 function Derived() {}
239 Derived.prototype = { 280 Derived.prototype = {
240 __proto__: Base.prototype, 281 __proto__: Base.prototype,
241 constructor: Derived, 282 constructor: Derived,
242 }; 283 };
243 284
244 Derived.prototype.testSetter = function() { 285 Derived.prototype.testSetter = function() {
245 assertEquals('x from Base', super.x); 286 assertEquals('x from Base', super.x);
246 super.x = 'data property'; 287 super.x = 'data property';
247 assertEquals('x from Base', super.x); 288 assertEquals('x from Base', super.x);
248 assertEquals('data property', this.x); 289 assertEquals('data property', this.x);
249 }.toMethod(Derived.prototype); 290 }.toMethod(Derived.prototype);
250 291
251 new Derived().testSetter(); 292 new Derived().testSetter();
252 }()); 293 }());
253 294
254 295
296 (function TestKeyedSetterDataProperties() {
297 var x = 'x';
298 function Base() {}
299 Base.prototype = {
300 constructor: Base,
301 x: 'x from Base'
302 };
303
304 function Derived() {}
305 Derived.prototype = {
306 __proto__: Base.prototype,
307 constructor: Derived,
308 };
309
310 Derived.prototype.testSetter = function() {
311 assertEquals('x from Base', super[x]);
312 super[x] = 'data property';
313 assertEquals('x from Base', super[x]);
314 assertEquals('data property', this[x]);
315 }.toMethod(Derived.prototype);
316
317 new Derived().testSetter();
318 }());
319
320
255 (function TestAccessorsOnPrimitives() { 321 (function TestAccessorsOnPrimitives() {
256 var getCalled = 0; 322 var getCalled = 0;
257 var setCalled = 0; 323 var setCalled = 0;
258 function Base() {} 324 function Base() {}
259 Base.prototype = { 325 Base.prototype = {
260 constructor: Base, 326 constructor: Base,
261 get x() { 327 get x() {
262 getCalled++; 328 getCalled++;
263 return 1; 329 return 1;
264 }, 330 },
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 try { 401 try {
336 super.toString(); 402 super.toString();
337 } catch(e) { ex = e; } 403 } catch(e) { ex = e; }
338 404
339 assertTrue(ex instanceof TypeError); 405 assertTrue(ex instanceof TypeError);
340 } 406 }
341 f.toMethod(DerivedFromString.prototype).call(42); 407 f.toMethod(DerivedFromString.prototype).call(42);
342 }()); 408 }());
343 409
344 410
411 (function TestKeyedAccessorsOnPrimitives() {
412 var x = 'x';
413 var newProperty = 'newProperty';
414 var toString = 'toString';
415 var getCalled = 0;
416 var setCalled = 0;
417 function Base() {}
418 Base.prototype = {
419 constructor: Base,
420 get x() {
421 getCalled++;
422 return 1;
423 },
424 set x(v) {
425 setCalled++;
426 return v;
427 },
428 };
429
430 function Derived() {}
431 Derived.prototype = {
432 __proto__: Base.prototype,
433 constructor: Derived,
434 };
435 Derived.prototype.testSetter = function() {
436 setCalled = 0;
437 getCalled = 0;
438 assertEquals('object', typeof this);
439 assertTrue(this instanceof Number)
440 assertEquals(42, this.valueOf());
441 assertEquals(1, super[x]);
442 assertEquals(1, getCalled);
443 assertEquals(0, setCalled);
444
445 assertEquals(5, super[x] = 5);
446 assertEquals(1, getCalled);
447 assertEquals(1, setCalled);
448
449 assertEquals(6, super[x] += 5);
450 assertEquals(2, getCalled);
451 assertEquals(2, setCalled);
452
453 super[newProperty] = 15;
454 assertEquals(15, this[newProperty]);
455 assertEquals(undefined, super[newProperty]);
456 }.toMethod(Derived.prototype);
457
458 Derived.prototype.testSetterStrict = function() {
459 'use strict';
460 getCalled = 0;
461 setCalled = 0;
462 assertTrue(42 === this);
463
464 assertEquals(1, super[x]);
465 assertEquals(1, getCalled);
466 assertEquals(0, setCalled);
467
468 assertEquals(5, super[x] = 5);
469 assertEquals(1, getCalled);
470 assertEquals(1, setCalled);
471
472 assertEquals(6, super[x] += 5);
473 assertEquals(2, getCalled);
474 assertEquals(2, setCalled);
475
476 var ex;
477 try {
478 super[newProperty] = 15;
479 } catch (e) { ex = e; }
480 assertTrue(ex instanceof TypeError);
481 }.toMethod(Derived.prototype);
482
483 Derived.prototype.testSetter.call(42);
484 Derived.prototype.testSetterStrict.call(42);
485
486 function DerivedFromString() {}
487 DerivedFromString.prototype = Object.create(String.prototype);
488
489 function f() {
490 'use strict';
491 assertTrue(42 === this);
492 assertEquals(String.prototype.toString, super[toString]);
493 var ex;
494 try {
495 super[toString]();
496 } catch(e) { ex = e; }
497
498 assertTrue(ex instanceof TypeError);
499 }
500 f.toMethod(DerivedFromString.prototype).call(42);
501 }());
502
503
345 (function TestSetterUndefinedProperties() { 504 (function TestSetterUndefinedProperties() {
346 function Base() {} 505 function Base() {}
347 function Derived() {} 506 function Derived() {}
348 Derived.prototype = { __proto__ : Base.prototype }; 507 Derived.prototype = { __proto__ : Base.prototype };
349 Derived.prototype.mSloppy = function () { 508 Derived.prototype.mSloppy = function () {
350 assertEquals(undefined, super.x); 509 assertEquals(undefined, super.x);
351 assertEquals(undefined, this.x); 510 assertEquals(undefined, this.x);
352 super.x = 10; 511 super.x = 10;
353 assertEquals(10, this.x); 512 assertEquals(10, this.x);
354 assertEquals(undefined, super.x); 513 assertEquals(undefined, super.x);
355 }.toMethod(Derived.prototype); 514 }.toMethod(Derived.prototype);
356 515
357 Derived.prototype.mStrict = function () { 516 Derived.prototype.mStrict = function () {
358 'use strict'; 517 'use strict';
359 assertEquals(undefined, super.x); 518 assertEquals(undefined, super.x);
360 assertEquals(undefined, this.x); 519 assertEquals(undefined, this.x);
361 super.x = 10; 520 super.x = 10;
362 assertEquals(10, this.x); 521 assertEquals(10, this.x);
363 assertEquals(undefined, super.x); 522 assertEquals(undefined, super.x);
364 }.toMethod(Derived.prototype); 523 }.toMethod(Derived.prototype);
365 var d = new Derived(); 524 var d = new Derived();
366 d.mSloppy(); 525 d.mSloppy();
367 assertEquals(10, d.x); 526 assertEquals(10, d.x);
368 var d1 = new Derived(); 527 var d1 = new Derived();
369 d1.mStrict(); 528 d1.mStrict();
370 assertEquals(10, d.x); 529 assertEquals(10, d.x);
371 }()); 530 }());
372 531
373 532
533 (function TestKeyedSetterUndefinedProperties() {
534 var x = 'x';
535 function Base() {}
536 function Derived() {}
537 Derived.prototype = { __proto__ : Base.prototype };
538 Derived.prototype.mSloppy = function () {
539 assertEquals(undefined, super[x]);
540 assertEquals(undefined, this[x]);
541 super[x] = 10;
542 assertEquals(10, this[x]);
543 assertEquals(undefined, super[x]);
544 }.toMethod(Derived.prototype);
545
546 Derived.prototype.mStrict = function () {
547 'use strict';
548 assertEquals(undefined, super[x]);
549 assertEquals(undefined, this[x]);
550 super[x] = 10;
551 assertEquals(10, this[x]);
552 assertEquals(undefined, super[x]);
553 }.toMethod(Derived.prototype);
554 var d = new Derived();
555 d.mSloppy();
556 assertEquals(10, d.x);
557 var d1 = new Derived();
558 d1.mStrict();
559 assertEquals(10, d.x);
560 }());
561
562
374 (function TestSetterCreatingOwnProperties() { 563 (function TestSetterCreatingOwnProperties() {
375 function Base() {} 564 function Base() {}
376 function Derived() {} 565 function Derived() {}
377 Derived.prototype = { __proto__ : Base.prototype }; 566 Derived.prototype = { __proto__ : Base.prototype };
378 var setterCalled; 567 var setterCalled;
379 568
380 Derived.prototype.mSloppy = function() { 569 Derived.prototype.mSloppy = function() {
381 assertEquals(42, this.ownReadOnly); 570 assertEquals(42, this.ownReadOnly);
382 super.ownReadOnly = 55; 571 super.ownReadOnly = 55;
383 assertEquals(42, this.ownReadOnly); 572 assertEquals(42, this.ownReadOnly);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 Object.defineProperty(d, 'ownReadOnly', { value : 42, writable : false }); 607 Object.defineProperty(d, 'ownReadOnly', { value : 42, writable : false });
419 Object.defineProperty(d, 'ownSetter', 608 Object.defineProperty(d, 'ownSetter',
420 { set : function() { setterCalled++; } }); 609 { set : function() { setterCalled++; } });
421 Object.defineProperty(d, 'ownReadonlyAccessor', 610 Object.defineProperty(d, 'ownReadonlyAccessor',
422 { get : function() { return 15; }}); 611 { get : function() { return 15; }});
423 d.mSloppy(); 612 d.mSloppy();
424 d.mStrict(); 613 d.mStrict();
425 }()); 614 }());
426 615
427 616
617 (function TestKeyedSetterCreatingOwnProperties() {
618 var ownReadOnly = 'ownReadOnly';
619 var ownReadonlyAccessor = 'ownReadonlyAccessor';
620 var ownSetter = 'ownSetter';
621 function Base() {}
622 function Derived() {}
623 Derived.prototype = { __proto__ : Base.prototype };
624 var setterCalled;
625
626 Derived.prototype.mSloppy = function() {
627 assertEquals(42, this[ownReadOnly]);
628 super[ownReadOnly] = 55;
629 assertEquals(42, this[ownReadOnly]);
630
631 assertEquals(15, this[ownReadonlyAccessor]);
632 super[ownReadonlyAccessor] = 55;
633 assertEquals(15, this[ownReadonlyAccessor]);
634
635 setterCalled = 0;
636 super[ownSetter] = 42;
637 assertEquals(1, setterCalled);
638 }.toMethod(Derived.prototype);
639
640 Derived.prototype.mStrict = function() {
641 'use strict';
642 assertEquals(42, this[ownReadOnly]);
643 var ex;
644 try {
645 super[ownReadOnly] = 55;
646 } catch(e) { ex = e; }
647 assertTrue(ex instanceof TypeError);
648 assertEquals(42, this[ownReadOnly]);
649
650 assertEquals(15, this[ownReadonlyAccessor]);
651 ex = null;
652 try {
653 super[ownReadonlyAccessor] = 55;
654 } catch(e) { ex = e; }
655 assertTrue(ex instanceof TypeError);
656 assertEquals(15, this[ownReadonlyAccessor]);
657
658 setterCalled = 0;
659 super[ownSetter] = 42;
660 assertEquals(1, setterCalled);
661 }.toMethod(Derived.prototype);
662
663 var d = new Derived();
664 Object.defineProperty(d, 'ownReadOnly', { value : 42, writable : false });
665 Object.defineProperty(d, 'ownSetter',
666 { set : function() { setterCalled++; } });
667 Object.defineProperty(d, 'ownReadonlyAccessor',
668 { get : function() { return 15; }});
669 d.mSloppy();
670 d.mStrict();
671 }());
672
673
428 (function TestSetterNoProtoWalk() { 674 (function TestSetterNoProtoWalk() {
429 function Base() {} 675 function Base() {}
430 function Derived() {} 676 function Derived() {}
431 var getCalled; 677 var getCalled;
432 var setCalled; 678 var setCalled;
433 Derived.prototype = { 679 Derived.prototype = {
434 __proto__ : Base.prototype, 680 __proto__ : Base.prototype,
435 get x() { getCalled++; return 42; }, 681 get x() { getCalled++; return 42; },
436 set x(v) { setCalled++; } 682 set x(v) { setCalled++; }
437 }; 683 };
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 assertEquals(0, getCalled); 731 assertEquals(0, getCalled);
486 assertEquals(0, setCalled); 732 assertEquals(0, setCalled);
487 733
488 }.toMethod(Derived.prototype); 734 }.toMethod(Derived.prototype);
489 735
490 new Derived().mSloppy(); 736 new Derived().mSloppy();
491 new Derived().mStrict(); 737 new Derived().mStrict();
492 }()); 738 }());
493 739
494 740
741 (function TestKeyedSetterNoProtoWalk() {
742 var x = 'x';
743 function Base() {}
744 function Derived() {}
745 var getCalled;
746 var setCalled;
747 Derived.prototype = {
748 __proto__ : Base.prototype,
749 get x() { getCalled++; return 42; },
750 set x(v) { setCalled++; }
751 };
752
753 Derived.prototype.mSloppy = function() {
754 setCalled = 0;
755 getCalled = 0;
756 assertEquals(42, this[x]);
757 assertEquals(1, getCalled);
758 assertEquals(0, setCalled);
759
760 getCalled = 0;
761 setCalled = 0;
762 this[x] = 43;
763 assertEquals(0, getCalled);
764 assertEquals(1, setCalled);
765
766 getCalled = 0;
767 setCalled = 0;
768 super[x] = 15;
769 assertEquals(0, setCalled);
770 assertEquals(0, getCalled);
771
772 assertEquals(15, this[x]);
773 assertEquals(0, getCalled);
774 assertEquals(0, setCalled);
775
776 }.toMethod(Derived.prototype);
777
778 Derived.prototype.mStrict = function() {
779 'use strict';
780 setCalled = 0;
781 getCalled = 0;
782 assertEquals(42, this[x]);
783 assertEquals(1, getCalled);
784 assertEquals(0, setCalled);
785
786 getCalled = 0;
787 setCalled = 0;
788 this[x] = 43;
789 assertEquals(0, getCalled);
790 assertEquals(1, setCalled);
791
792 getCalled = 0;
793 setCalled = 0;
794 super[x] = 15;
795 assertEquals(0, setCalled);
796 assertEquals(0, getCalled);
797
798 assertEquals(15, this[x]);
799 assertEquals(0, getCalled);
800 assertEquals(0, setCalled);
801
802 }.toMethod(Derived.prototype);
803
804 new Derived().mSloppy();
805 new Derived().mStrict();
806 }());
807
808
495 (function TestSetterDoesNotReconfigure() { 809 (function TestSetterDoesNotReconfigure() {
496 function Base() {} 810 function Base() {}
497 function Derived() {} 811 function Derived() {}
498 812
499 Derived.prototype.mStrict = function (){ 813 Derived.prototype.mStrict = function (){
500 'use strict'; 814 'use strict';
501 super.nonEnumConfig = 5; 815 super.nonEnumConfig = 5;
502 var d1 = Object.getOwnPropertyDescriptor(this, 'nonEnumConfig'); 816 var d1 = Object.getOwnPropertyDescriptor(this, 'nonEnumConfig');
503 assertEquals(5, d1.value); 817 assertEquals(5, d1.value);
504 assertTrue(d1.configurable); 818 assertTrue(d1.configurable);
(...skipping 23 matching lines...) Expand all
528 var d = new Derived(); 842 var d = new Derived();
529 Object.defineProperty(d, 'nonEnumConfig', 843 Object.defineProperty(d, 'nonEnumConfig',
530 { value : 0, enumerable : false, configurable : true, writable : true }); 844 { value : 0, enumerable : false, configurable : true, writable : true });
531 Object.defineProperty(d, 'nonEnumNonConfig', 845 Object.defineProperty(d, 'nonEnumNonConfig',
532 { value : 0, enumerable : false, configurable : false, writable : true }); 846 { value : 0, enumerable : false, configurable : false, writable : true });
533 d.mStrict(); 847 d.mStrict();
534 d.mSloppy(); 848 d.mSloppy();
535 }()); 849 }());
536 850
537 851
852 (function TestKeyedSetterDoesNotReconfigure() {
853 var nonEnumConfig = 'nonEnumConfig';
854 var nonEnumNonConfig = 'nonEnumNonConfig';
855 function Base() {}
856 function Derived() {}
857
858 Derived.prototype.mStrict = function (){
859 'use strict';
860 super[nonEnumConfig] = 5;
861 var d1 = Object.getOwnPropertyDescriptor(this, 'nonEnumConfig');
862 assertEquals(5, d1.value);
863 assertTrue(d1.configurable);
864 assertFalse(d1.enumerable);
865
866 super[nonEnumNonConfig] = 5;
867 var d1 = Object.getOwnPropertyDescriptor(this, 'nonEnumNonConfig');
868 assertEquals(5, d1.value);
869 assertFalse(d1.configurable);
870 assertFalse(d1.enumerable);
871 }.toMethod(Derived.prototype);
872
873 Derived.prototype.mSloppy = function (){
874 super[nonEnumConfig] = 42;
875 var d1 = Object.getOwnPropertyDescriptor(this, 'nonEnumConfig');
876 assertEquals(42, d1.value);
877 assertTrue(d1.configurable);
878 assertFalse(d1.enumerable);
879
880 super[nonEnumNonConfig] = 42;
881 var d1 = Object.getOwnPropertyDescriptor(this, 'nonEnumNonConfig');
882 assertEquals(42, d1.value);
883 assertFalse(d1.configurable);
884 assertFalse(d1.enumerable);
885 }.toMethod(Derived.prototype);
886
887 var d = new Derived();
888 Object.defineProperty(d, 'nonEnumConfig',
889 { value : 0, enumerable : false, configurable : true, writable : true });
890 Object.defineProperty(d, 'nonEnumNonConfig',
891 { value : 0, enumerable : false, configurable : false, writable : true });
892 d.mStrict();
893 d.mSloppy();
894 }());
895
896
538 (function TestCountOperations() { 897 (function TestCountOperations() {
539 function Base() {} 898 function Base() {}
540 Base.prototype = { 899 Base.prototype = {
541 constructor: Base, 900 constructor: Base,
542 get x() { 901 get x() {
543 return this._x; 902 return this._x;
544 }, 903 },
545 set x(v) { 904 set x(v) {
546 this._x = v; 905 this._x = v;
547 }, 906 },
(...skipping 28 matching lines...) Expand all
576 assertEquals(4, super.x--); 935 assertEquals(4, super.x--);
577 assertEquals(3, super.x); 936 assertEquals(3, super.x);
578 assertEquals(2, --super.x); 937 assertEquals(2, --super.x);
579 assertEquals(2, super.x); 938 assertEquals(2, super.x);
580 assertEquals(2, this._x); 939 assertEquals(2, this._x);
581 }.toMethod(Derived.prototype); 940 }.toMethod(Derived.prototype);
582 new Derived().testCounts(); 941 new Derived().testCounts();
583 }()); 942 }());
584 943
585 944
945 (function TestKeyedCountOperations() {
946 var x = 'x';
947 function Base() {}
948 Base.prototype = {
949 constructor: Base,
950 get x() {
951 return this._x;
952 },
953 set x(v) {
954 this._x = v;
955 },
956 _x: 1
957 };
958
959 function Derived() {}
960 Derived.__proto__ = Base;
961 Derived.prototype = {
962 __proto__: Base.prototype,
963 constructor: Derived,
964 _x: 2
965 };
966
967 Derived.prototype.testCounts = function() {
968 assertEquals(2, this._x);
969 assertEquals(2, super[x]);
970 super[x]++;
971 assertEquals(3, super[x]);
972 ++super[x];
973 assertEquals(4, super[x]);
974 assertEquals(4, super[x]++);
975 assertEquals(5, super[x]);
976 assertEquals(6, ++super[x]);
977 assertEquals(6, super[x]);
978 assertEquals(6, this._x);
979
980 super[x]--;
981 assertEquals(5, super[x]);
982 --super[x];
983 assertEquals(4, super[x]);
984 assertEquals(4, super[x]--);
985 assertEquals(3, super[x]);
986 assertEquals(2, --super[x]);
987 assertEquals(2, super[x]);
988 assertEquals(2, this._x);
989 }.toMethod(Derived.prototype);
990 new Derived().testCounts();
991 }());
992
993
586 (function TestSuperCall() { 994 (function TestSuperCall() {
587 function Subclass(base, constructor) { 995 function Subclass(base, constructor) {
588 var homeObject = { __proto__ : base.prototype }; 996 var homeObject = { __proto__ : base.prototype };
589 var result = constructor.toMethod(homeObject); 997 var result = constructor.toMethod(homeObject);
590 homeObject.constructor = result; 998 homeObject.constructor = result;
591 result.prototype = homeObject; 999 result.prototype = homeObject;
592 return result; 1000 return result;
593 } 1001 }
594 1002
595 var baseCalled = 0; 1003 var baseCalled = 0;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 }()); 1049 }());
642 1050
643 1051
644 (function TestUnsupportedCases() { 1052 (function TestUnsupportedCases() {
645 function f1(x) { return super[x]; } 1053 function f1(x) { return super[x]; }
646 function f2(x) { super[x] = 5; } 1054 function f2(x) { super[x] = 5; }
647 var o = {}; 1055 var o = {};
648 assertThrows(function(){f1.toMethod(o)(15);}, ReferenceError); 1056 assertThrows(function(){f1.toMethod(o)(15);}, ReferenceError);
649 assertThrows(function(){f2.toMethod(o)(15);}, ReferenceError); 1057 assertThrows(function(){f2.toMethod(o)(15);}, ReferenceError);
650 }()); 1058 }());
OLDNEW
« src/runtime/runtime-classes.cc ('K') | « src/runtime/runtime-classes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698