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

Side by Side Diff: pkg/analyzer/test/generated/incremental_resolver_test.dart

Issue 995853002: Fix for matching field formal parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('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 (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library engine.incremental_resolver_test; 5 library engine.incremental_resolver_test;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/element.dart'; 8 import 'package:analyzer/src/generated/element.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 class T { 582 class T {
583 List<int> A; 583 List<int> A;
584 } 584 }
585 ''', r''' 585 ''', r'''
586 class T { 586 class T {
587 List<String> A; 587 List<String> A;
588 } 588 }
589 '''); 589 ''');
590 } 590 }
591 591
592 void test_false_fieldFormalParameter_add() {
593 _assertDoesNotMatch(r'''
594 class A {
595 final field;
596 A(field);
597 }
598 ''', r'''
599 class A {
600 final field;
601 A(this.field);
602 }
603 ''');
604 }
605
606 void test_false_fieldFormalParameter_add_function() {
607 _assertDoesNotMatch(r'''
608 class A {
609 final field;
610 A(field(a));
611 }
612 ''', r'''
613 class A {
614 final field;
615 A(this.field(a));
616 }
617 ''');
618 }
619
620 void test_false_fieldFormalParameter_parameters_add() {
621 _assertDoesNotMatch(r'''
622 class A {
623 final field;
624 A(this.field(a));
625 }
626 ''', r'''
627 class A {
628 final field;
629 A(this.field(a, b));
630 }
631 ''');
632 }
633
634 void test_false_fieldFormalParameter_parameters_remove() {
635 _assertDoesNotMatch(r'''
636 class A {
637 final field;
638 A(this.field(a, b));
639 }
640 ''', r'''
641 class A {
642 final field;
643 A(this.field(a));
644 }
645 ''');
646 }
647
648 void test_false_fieldFormalParameter_parameters_typeEdit() {
649 _assertDoesNotMatch(r'''
650 class A {
651 final field;
652 A(this.field(int p));
653 }
654 ''', r'''
655 class A {
656 final field;
657 A(this.field(String p));
658 }
659 ''');
660 }
661
662 void test_false_fieldFormalParameter_remove_default() {
663 _assertDoesNotMatch(r'''
664 class A {
665 final field;
666 A([this.field = 0]);
667 }
668 ''', r'''
669 class A {
670 final field;
671 A([field = 0]);
672 }
673 ''');
674 }
675
676 void test_false_fieldFormalParameter_remove_function() {
677 _assertDoesNotMatch(r'''
678 class A {
679 final field;
680 A(this.field(a));
681 }
682 ''', r'''
683 class A {
684 final field;
685 A(field(a));
686 }
687 ''');
688 }
689
690 void test_false_fieldFormalParameter_remove_normal() {
691 _assertDoesNotMatch(r'''
692 class A {
693 final field;
694 A(this.field);
695 }
696 ''', r'''
697 class A {
698 final field;
699 A(field);
700 }
701 ''');
702 }
703
592 void test_false_fieldFormalParameterElement_wasSimple() { 704 void test_false_fieldFormalParameterElement_wasSimple() {
593 _assertDoesNotMatch(r''' 705 _assertDoesNotMatch(r'''
594 class A { 706 class A {
595 int field; 707 int field;
596 A(int field); 708 A(int field);
597 } 709 }
598 ''', r''' 710 ''', r'''
599 class A { 711 class A {
600 int field; 712 int field;
601 A(this.field); 713 A(this.field);
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 A(this.field); 1823 A(this.field);
1712 } 1824 }
1713 ''', r''' 1825 ''', r'''
1714 class A { 1826 class A {
1715 int field; 1827 int field;
1716 A(this.field); 1828 A(this.field);
1717 } 1829 }
1718 '''); 1830 ''');
1719 } 1831 }
1720 1832
1833 void test_true_fieldFormalParameter_function() {
1834 _assertMatches(r'''
1835 class A {
1836 final field;
1837 A(this.field(int a, String b));
1838 }
1839 ''', r'''
1840 class A {
1841 final field;
1842 A(this.field(int a, String b));
1843 }
1844 ''');
1845 }
1846
1721 void test_true_functionTypeAlias_list_reorder() { 1847 void test_true_functionTypeAlias_list_reorder() {
1722 _assertMatches(r''' 1848 _assertMatches(r'''
1723 typedef A(int pa); 1849 typedef A(int pa);
1724 typedef B(String pb); 1850 typedef B(String pb);
1725 typedef C(pc); 1851 typedef C(pc);
1726 ''', r''' 1852 ''', r'''
1727 typedef C(pc); 1853 typedef C(pc);
1728 typedef A(int pa); 1854 typedef A(int pa);
1729 typedef B(String pb); 1855 typedef B(String pb);
1730 '''); 1856 ''');
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2836 } 2962 }
2837 '''); 2963 ''');
2838 _updateAndValidate(r''' 2964 _updateAndValidate(r'''
2839 main() { 2965 main() {
2840 // edited comment text 2966 // edited comment text
2841 print(0); 2967 print(0);
2842 } 2968 }
2843 '''); 2969 ''');
2844 } 2970 }
2845 2971
2972 void test_endOfLineComment_localFunction_inTopLevelVariable() {
2973 _resolveUnit(r'''
2974 typedef int Binary(one, two, three);
2975
2976 int Global = f((a, b, c) {
2977 return 0; // Some comment
2978 });
2979 ''');
2980 _updateAndValidate(r'''
2981 typedef int Binary(one, two, three);
2982
2983 int Global = f((a, b, c) {
2984 return 0; // Some comment
2985 });
2986 ''');
2987 }
2988
2846 void test_endOfLineComment_outBody_add() { 2989 void test_endOfLineComment_outBody_add() {
2847 _resolveUnit(r''' 2990 _resolveUnit(r'''
2848 main() { 2991 main() {
2849 Object x; 2992 Object x;
2850 x.foo(); 2993 x.foo();
2851 } 2994 }
2852 '''); 2995 ''');
2853 _updateAndValidate(r''' 2996 _updateAndValidate(r'''
2854 // 000 2997 // 000
2855 main() { 2998 main() {
(...skipping 29 matching lines...) Expand all
2885 '''); 3028 ''');
2886 _updateAndValidate(r''' 3029 _updateAndValidate(r'''
2887 // 10 3030 // 10
2888 main() { 3031 main() {
2889 Object x; 3032 Object x;
2890 x.foo(); 3033 x.foo();
2891 } 3034 }
2892 ''', expectedSuccess: false); 3035 ''', expectedSuccess: false);
2893 } 3036 }
2894 3037
2895 void test_endOfLineComment_localFunction_inTopLevelVariable() {
2896 _resolveUnit(r'''
2897 typedef int Binary(one, two, three);
2898
2899 int Global = f((a, b, c) {
2900 return 0; // Some comment
2901 });
2902 ''');
2903 _updateAndValidate(r'''
2904 typedef int Binary(one, two, three);
2905
2906 int Global = f((a, b, c) {
2907 return 0; // Some comment
2908 });
2909 ''');
2910 }
2911
2912 void test_endOfLineComment_remove() { 3038 void test_endOfLineComment_remove() {
2913 _resolveUnit(r''' 3039 _resolveUnit(r'''
2914 main() { 3040 main() {
2915 // some comment 3041 // some comment
2916 print(0); 3042 print(0);
2917 } 3043 }
2918 '''); 3044 ''');
2919 _updateAndValidate(r''' 3045 _updateAndValidate(r'''
2920 main() { 3046 main() {
2921 print(0); 3047 print(0);
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
3806 return ResolutionContextBuilder.contextFor(node, listener).scope; 3932 return ResolutionContextBuilder.contextFor(node, listener).scope;
3807 } 3933 }
3808 } 3934 }
3809 3935
3810 class _Edit { 3936 class _Edit {
3811 final int offset; 3937 final int offset;
3812 final int length; 3938 final int length;
3813 final String replacement; 3939 final String replacement;
3814 _Edit(this.offset, this.length, this.replacement); 3940 _Edit(this.offset, this.length, this.replacement);
3815 } 3941 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698