OLD | NEW |
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 test.services.completion.util; | 5 library test.services.completion.util; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol | 9 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol |
10 show Element, ElementKind; | 10 show Element, ElementKind; |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 String elemFile, | 657 String elemFile, |
658 int elemOffset}) { | 658 int elemOffset}) { |
659 return assertNotSuggested(name); | 659 return assertNotSuggested(name); |
660 } | 660 } |
661 | 661 |
662 CompletionSuggestion assertSuggestLocalClassTypeAlias(String name, | 662 CompletionSuggestion assertSuggestLocalClassTypeAlias(String name, |
663 {int relevance: DART_RELEVANCE_DEFAULT}) { | 663 {int relevance: DART_RELEVANCE_DEFAULT}) { |
664 return assertNotSuggested(name); | 664 return assertNotSuggested(name); |
665 } | 665 } |
666 | 666 |
667 CompletionSuggestion assertSuggestLocalConstructor(String name, | |
668 {int elemOffset}) { | |
669 return assertNotSuggested(name); | |
670 } | |
671 | |
672 CompletionSuggestion assertSuggestLocalField(String name, String type, | 667 CompletionSuggestion assertSuggestLocalField(String name, String type, |
673 {int relevance: DART_RELEVANCE_LOCAL_FIELD, bool deprecated: false}) { | 668 {int relevance: DART_RELEVANCE_LOCAL_FIELD, bool deprecated: false}) { |
674 return assertNotSuggested(name); | 669 return assertNotSuggested(name); |
675 } | 670 } |
676 | 671 |
677 CompletionSuggestion assertSuggestLocalFunction( | 672 CompletionSuggestion assertSuggestLocalFunction( |
678 String name, String returnType, | 673 String name, String returnType, |
679 {bool deprecated: false, | 674 {bool deprecated: false, |
680 int relevance: DART_RELEVANCE_LOCAL_FUNCTION, | 675 int relevance: DART_RELEVANCE_LOCAL_FUNCTION, |
681 CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION}) { | 676 CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION}) { |
(...skipping 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3019 F2() { } | 3014 F2() { } |
3020 class B {B(this.x, [String boo]) { } int x;} | 3015 class B {B(this.x, [String boo]) { } int x;} |
3021 class C {foo(){var f; {var x;} new ^}}'''); | 3016 class C {foo(){var f; {var x;} new ^}}'''); |
3022 computeFast(); | 3017 computeFast(); |
3023 return computeFull((bool result) { | 3018 return computeFull((bool result) { |
3024 expect(request.replacementOffset, completionOffset); | 3019 expect(request.replacementOffset, completionOffset); |
3025 expect(request.replacementLength, 0); | 3020 expect(request.replacementLength, 0); |
3026 assertSuggestImportedConstructor('Object'); | 3021 assertSuggestImportedConstructor('Object'); |
3027 assertSuggestImportedConstructor('Future'); | 3022 assertSuggestImportedConstructor('Future'); |
3028 assertSuggestImportedConstructor('A'); | 3023 assertSuggestImportedConstructor('A'); |
3029 assertSuggestLocalConstructor('B'); | 3024 // Suggested by ConstructorContributor |
3030 assertSuggestLocalConstructor('C'); | 3025 assertNotSuggested('B'); |
| 3026 assertNotSuggested('C'); |
3031 assertNotSuggested('f'); | 3027 assertNotSuggested('f'); |
3032 assertNotSuggested('x'); | 3028 assertNotSuggested('x'); |
3033 assertNotSuggested('foo'); | 3029 assertNotSuggested('foo'); |
3034 assertNotSuggested('F1'); | 3030 assertNotSuggested('F1'); |
3035 assertNotSuggested('F2'); | 3031 assertNotSuggested('F2'); |
3036 assertNotSuggested('T1'); | 3032 assertNotSuggested('T1'); |
3037 assertNotSuggested('T2'); | 3033 assertNotSuggested('T2'); |
3038 }); | 3034 }); |
3039 } | 3035 } |
3040 | 3036 |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3745 class A { } | 3741 class A { } |
3746 var m;'''); | 3742 var m;'''); |
3747 addTestSource(''' | 3743 addTestSource(''' |
3748 part of libA; | 3744 part of libA; |
3749 class B { factory B.bar(int x) => null; } | 3745 class B { factory B.bar(int x) => null; } |
3750 main() {new ^}'''); | 3746 main() {new ^}'''); |
3751 computeFast(); | 3747 computeFast(); |
3752 return computeFull((bool result) { | 3748 return computeFull((bool result) { |
3753 expect(request.replacementOffset, completionOffset); | 3749 expect(request.replacementOffset, completionOffset); |
3754 expect(request.replacementLength, 0); | 3750 expect(request.replacementLength, 0); |
3755 assertSuggestLocalConstructor('B.bar'); | 3751 // Suggested by ConstructorContributor |
| 3752 assertNotSuggested('B.bar'); |
3756 assertSuggestImportedConstructor('Object'); | 3753 assertSuggestImportedConstructor('Object'); |
3757 assertSuggestImportedConstructor('X.c'); | 3754 assertSuggestImportedConstructor('X.c'); |
3758 assertNotSuggested('X._d'); | 3755 assertNotSuggested('X._d'); |
3759 assertSuggestImportedConstructor('A'); | 3756 assertSuggestImportedConstructor('A'); |
3760 assertNotSuggested('F1'); | 3757 assertNotSuggested('F1'); |
3761 assertNotSuggested('T1'); | 3758 assertNotSuggested('T1'); |
3762 assertNotSuggested('_d'); | 3759 assertNotSuggested('_d'); |
3763 assertNotSuggested('z'); | 3760 assertNotSuggested('z'); |
3764 assertNotSuggested('m'); | 3761 assertNotSuggested('m'); |
3765 }); | 3762 }); |
(...skipping 17 matching lines...) Expand all Loading... |
3783 library libA; | 3780 library libA; |
3784 import "/testB.dart"; | 3781 import "/testB.dart"; |
3785 part "/testA.dart"; | 3782 part "/testA.dart"; |
3786 class A { A({String boo: 'hoo'}) { } } | 3783 class A { A({String boo: 'hoo'}) { } } |
3787 main() {new ^} | 3784 main() {new ^} |
3788 var m;'''); | 3785 var m;'''); |
3789 computeFast(); | 3786 computeFast(); |
3790 return computeFull((bool result) { | 3787 return computeFull((bool result) { |
3791 expect(request.replacementOffset, completionOffset); | 3788 expect(request.replacementOffset, completionOffset); |
3792 expect(request.replacementLength, 0); | 3789 expect(request.replacementLength, 0); |
3793 assertSuggestLocalConstructor('A'); | 3790 // Suggested by ConstructorContributor |
| 3791 assertNotSuggested('A'); |
3794 assertSuggestImportedConstructor('Object'); | 3792 assertSuggestImportedConstructor('Object'); |
3795 assertSuggestImportedConstructor('X.c'); | 3793 assertSuggestImportedConstructor('X.c'); |
3796 assertNotSuggested('X._d'); | 3794 assertNotSuggested('X._d'); |
3797 assertSuggestImportedConstructor('B'); | 3795 assertSuggestImportedConstructor('B'); |
3798 assertNotSuggested('F1'); | 3796 assertNotSuggested('F1'); |
3799 assertNotSuggested('T1'); | 3797 assertNotSuggested('T1'); |
3800 assertNotSuggested('_d'); | 3798 assertNotSuggested('_d'); |
3801 assertNotSuggested('z'); | 3799 assertNotSuggested('z'); |
3802 assertNotSuggested('m'); | 3800 assertNotSuggested('m'); |
3803 }); | 3801 }); |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4669 assertNotSuggested('bar2'); | 4667 assertNotSuggested('bar2'); |
4670 assertNotSuggested('_B'); | 4668 assertNotSuggested('_B'); |
4671 assertSuggestLocalClass('Y'); | 4669 assertSuggestLocalClass('Y'); |
4672 assertSuggestLocalClass('C'); | 4670 assertSuggestLocalClass('C'); |
4673 assertSuggestLocalVariable('f', null); | 4671 assertSuggestLocalVariable('f', null); |
4674 assertNotSuggested('x'); | 4672 assertNotSuggested('x'); |
4675 assertNotSuggested('e'); | 4673 assertNotSuggested('e'); |
4676 }); | 4674 }); |
4677 } | 4675 } |
4678 } | 4676 } |
OLD | NEW |