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

Side by Side Diff: tests/compiler/dart2js/resolver_test.dart

Issue 10920066: issue 4817 fixed. Implemented raw strings with 'r' instead of '@' for dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased. Marked raw_string_test as pass for dart2js-ff and dart2dart Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #import('dart:uri'); 5 #import('dart:uri');
6 6
7 #import("../../../lib/compiler/implementation/leg.dart"); 7 #import("../../../lib/compiler/implementation/leg.dart");
8 #import("../../../lib/compiler/implementation/elements/elements.dart"); 8 #import("../../../lib/compiler/implementation/elements/elements.dart");
9 #import("../../../lib/compiler/implementation/tree/tree.dart"); 9 #import("../../../lib/compiler/implementation/tree/tree.dart");
10 #import("../../../lib/compiler/implementation/scanner/scannerlib.dart"); 10 #import("../../../lib/compiler/implementation/scanner/scannerlib.dart");
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 A() : foo(); 656 A() : foo();
657 }"""; 657 }""";
658 resolveConstructor(script, "A a = new A();", "A", "A", 0, 658 resolveConstructor(script, "A a = new A();", "A", "A", 0,
659 [], [MessageKind.CONSTRUCTOR_CALL_EXPECTED]); 659 [], [MessageKind.CONSTRUCTOR_CALL_EXPECTED]);
660 660
661 script = """class A { 661 script = """class A {
662 int i; 662 int i;
663 A.a() : this.b(0); 663 A.a() : this.b(0);
664 A.b(int i); 664 A.b(int i);
665 }"""; 665 }""";
666 resolveConstructor(script, "A a = new A.a();", "A", @"A$a", 1, 666 resolveConstructor(script, "A a = new A.a();", "A", r"A$a", 1,
667 [], []); 667 [], []);
668 668
669 script = """class A { 669 script = """class A {
670 int i; 670 int i;
671 A.a() : i = 42, this(0); 671 A.a() : i = 42, this(0);
672 A(int i); 672 A(int i);
673 }"""; 673 }""";
674 resolveConstructor(script, "A a = new A.a();", "A", @"A$a", 2, 674 resolveConstructor(script, "A a = new A.a();", "A", r"A$a", 2,
675 [], [MessageKind.REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER]); 675 [], [MessageKind.REDIRECTING_CONSTRUCTOR_HAS_INITIALIZER]);
676 676
677 script = """class A { 677 script = """class A {
678 int i; 678 int i;
679 A(i); 679 A(i);
680 } 680 }
681 class B extends A { 681 class B extends A {
682 B() : super(0); 682 B() : super(0);
683 }"""; 683 }""";
684 resolveConstructor(script, "B a = new B();", "B", "B", 1, 684 resolveConstructor(script, "B a = new B();", "B", "B", 1,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 736
737 checkMemberResolved(compiler, className, memberName) { 737 checkMemberResolved(compiler, className, memberName) {
738 Element memberElement = findElement(compiler, className) 738 Element memberElement = findElement(compiler, className)
739 .lookupLocalMember(memberName); 739 .lookupLocalMember(memberName);
740 Expect.isNotNull(memberElement); 740 Expect.isNotNull(memberElement);
741 Expect.isNotNull( 741 Expect.isNotNull(
742 compiler.enqueuer.resolution.getCachedElements(memberElement)); 742 compiler.enqueuer.resolution.getCachedElements(memberElement));
743 } 743 }
744 744
745 testToString() { 745 testToString() {
746 final script = @"class C { toString() => 'C'; } main() { '${new C()}'; }"; 746 final script = r"class C { toString() => 'C'; } main() { '${new C()}'; }";
747 final compiler = compileScript(script); 747 final compiler = compileScript(script);
748 748
749 checkMemberResolved(compiler, 'C', buildSourceString('toString')); 749 checkMemberResolved(compiler, 'C', buildSourceString('toString'));
750 } 750 }
751 751
752 operatorName(op, isUnary) { 752 operatorName(op, isUnary) {
753 return Elements.constructOperatorName(new SourceString(op), isUnary); 753 return Elements.constructOperatorName(new SourceString(op), isUnary);
754 } 754 }
755 755
756 testIndexedOperator() { 756 testIndexedOperator() {
757 final script = @""" 757 final script = r"""
758 class C { 758 class C {
759 operator[](ix) => ix; 759 operator[](ix) => ix;
760 operator[]=(ix, v) {} 760 operator[]=(ix, v) {}
761 } 761 }
762 main() { var c = new C(); c[0]++; }"""; 762 main() { var c = new C(); c[0]++; }""";
763 final compiler = compileScript(script); 763 final compiler = compileScript(script);
764 764
765 checkMemberResolved(compiler, 'C', operatorName('[]', false)); 765 checkMemberResolved(compiler, 'C', operatorName('[]', false));
766 checkMemberResolved(compiler, 'C', operatorName('[]=', false)); 766 checkMemberResolved(compiler, 'C', operatorName('[]=', false));
767 } 767 }
768 768
769 testIncrementsAndDecrements() { 769 testIncrementsAndDecrements() {
770 final script = @""" 770 final script = r"""
771 class A { operator+(o)=>null; } 771 class A { operator+(o)=>null; }
772 class B { operator+(o)=>null; } 772 class B { operator+(o)=>null; }
773 class C { operator-(o)=>null; } 773 class C { operator-(o)=>null; }
774 class D { operator-(o)=>null; } 774 class D { operator-(o)=>null; }
775 main() { 775 main() {
776 var a = new A(); 776 var a = new A();
777 a++; 777 a++;
778 var b = new B(); 778 var b = new B();
779 ++b; 779 ++b;
780 var c = new C(); 780 var c = new C();
781 c--; 781 c--;
782 var d = new D(); 782 var d = new D();
783 --d; 783 --d;
784 }"""; 784 }""";
785 final compiler = compileScript(script); 785 final compiler = compileScript(script);
786 786
787 checkMemberResolved(compiler, 'A', operatorName('+', false)); 787 checkMemberResolved(compiler, 'A', operatorName('+', false));
788 checkMemberResolved(compiler, 'B', operatorName('+', false)); 788 checkMemberResolved(compiler, 'B', operatorName('+', false));
789 checkMemberResolved(compiler, 'C', operatorName('-', false)); 789 checkMemberResolved(compiler, 'C', operatorName('-', false));
790 checkMemberResolved(compiler, 'D', operatorName('-', false)); 790 checkMemberResolved(compiler, 'D', operatorName('-', false));
791 } 791 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/redundant_phi_eliminator_test.dart ('k') | tests/compiler/dart2js/return_type_inferer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698