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

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

Issue 712333003: Revert "Classes: Add support for arguments in default constructor" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « src/runtime/runtime-object.cc ('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-classes 5 // Flags: --harmony-classes
6 6
7 (function TestBasics() { 7 (function TestBasics() {
8 var C = class C {} 8 var C = class C {}
9 assertEquals(typeof C, 'function'); 9 assertEquals(typeof C, 'function');
10 assertEquals(C.__proto__, Function.prototype); 10 assertEquals(C.__proto__, Function.prototype);
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 class Derived extends Base {} 617 class Derived extends Base {}
618 var object = new Derived; 618 var object = new Derived;
619 assertEquals(1, calls); 619 assertEquals(1, calls);
620 620
621 calls = 0; 621 calls = 0;
622 Derived(); 622 Derived();
623 assertEquals(1, calls); 623 assertEquals(1, calls);
624 })(); 624 })();
625 625
626 626
627 (function TestDefaultConstructorArguments() {
628 var args, self;
629 class Base {
630 constructor() {
631 self = this;
632 args = arguments;
633 }
634 }
635 class Derived extends Base {}
636
637 new Derived;
638 assertEquals(0, args.length);
639
640 new Derived(0, 1, 2);
641 assertEquals(3, args.length);
642 assertTrue(self instanceof Derived);
643
644 var arr = new Array(1e5);
645 var obj = {};
646 Derived.apply(obj, arr);
647 assertEquals(1e5, args.length);
648 assertEquals(obj, self);
649 })();
650
651
652 (function TestDefaultConstructorArguments2() {
653 var args;
654 class Base {
655 constructor(x, y) {
656 args = arguments;
657 }
658 }
659 class Derived extends Base {}
660
661 new Derived;
662 assertEquals(0, args.length);
663
664 new Derived(1);
665 assertEquals(1, args.length);
666 assertEquals(1, args[0]);
667
668 new Derived(1, 2, 3);
669 assertEquals(3, args.length);
670 assertEquals(1, args[0]);
671 assertEquals(2, args[1]);
672 assertEquals(3, args[2]);
673 })();
674
675
676 /* TODO(arv): Implement 627 /* TODO(arv): Implement
677 (function TestNameBindingInConstructor() { 628 (function TestNameBindingInConstructor() {
678 class C { 629 class C {
679 constructor() { 630 constructor() {
680 assertThrows(function() { 631 assertThrows(function() {
681 C = 42; 632 C = 42;
682 }, ReferenceError); 633 }, ReferenceError);
683 } 634 }
684 } 635 }
685 new C(); 636 new C();
686 })(); 637 })();
687 */ 638 */
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698