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

Side by Side Diff: pkg/analysis_server/test/services/completion/completion_test_util.dart

Issue 742163002: cache import suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge 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
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 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/src/protocol.dart' as protocol show Element, 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element,
10 ElementKind; 10 ElementKind;
11 import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind; 11 import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind;
12 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart'; 12 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart';
13 import 'package:analysis_server/src/services/completion/imported_computer.dart'; 13 import 'package:analysis_server/src/services/completion/imported_computer.dart';
14 import 'package:analysis_server/src/services/completion/invocation_computer.dart '; 14 import 'package:analysis_server/src/services/completion/invocation_computer.dart ';
15 import 'package:analysis_server/src/services/completion/local_computer.dart'; 15 import 'package:analysis_server/src/services/completion/local_computer.dart';
16 import 'package:analysis_server/src/services/index/index.dart'; 16 import 'package:analysis_server/src/services/index/index.dart';
17 import 'package:analysis_server/src/services/index/local_memory_index.dart'; 17 import 'package:analysis_server/src/services/index/local_memory_index.dart';
18 import 'package:analysis_server/src/services/search/search_engine_internal.dart' ; 18 import 'package:analysis_server/src/services/search/search_engine_internal.dart' ;
19 import 'package:analyzer/src/generated/ast.dart'; 19 import 'package:analyzer/src/generated/ast.dart';
20 import 'package:analyzer/src/generated/element.dart'; 20 import 'package:analyzer/src/generated/element.dart';
21 import 'package:analyzer/src/generated/engine.dart'; 21 import 'package:analyzer/src/generated/engine.dart';
22 import 'package:analyzer/src/generated/source.dart'; 22 import 'package:analyzer/src/generated/source.dart';
23 import 'package:unittest/unittest.dart'; 23 import 'package:unittest/unittest.dart';
24 24
25 import '../../abstract_context.dart'; 25 import '../../abstract_context.dart';
26 26
27 class AbstractCompletionTest extends AbstractContextTest { 27 abstract class AbstractCompletionTest extends AbstractContextTest {
28 Index index; 28 Index index;
29 SearchEngineImpl searchEngine; 29 SearchEngineImpl searchEngine;
30 DartCompletionComputer computer; 30 DartCompletionComputer computer;
31 String testFile = '/completionTest.dart'; 31 String testFile = '/completionTest.dart';
32 Source testSource; 32 Source testSource;
33 CompilationUnit testUnit; 33 CompilationUnit testUnit;
34 int completionOffset; 34 int completionOffset;
35 AstNode completionNode; 35 AstNode completionNode;
36 bool _computeFastCalled = false; 36 bool _computeFastCalled = false;
37 DartCompletionRequest request; 37 DartCompletionRequest request;
38 DartCompletionCache cache;
38 39
39 void addResolvedUnit(String file, String code) { 40 void addResolvedUnit(String file, String code) {
40 Source source = addSource(file, code); 41 Source source = addSource(file, code);
41 CompilationUnit unit = resolveLibraryUnit(source); 42 CompilationUnit unit = resolveLibraryUnit(source);
42 index.indexUnit(context, unit); 43 index.indexUnit(context, unit);
43 } 44 }
44 45
45 void addTestSource(String content) { 46 void addTestSource(String content) {
46 expect(completionOffset, isNull, reason: 'Call addTestUnit exactly once'); 47 expect(completionOffset, isNull, reason: 'Call addTestUnit exactly once');
47 completionOffset = content.indexOf('^'); 48 completionOffset = content.indexOf('^');
48 expect(completionOffset, isNot(equals(-1)), reason: 'missing ^'); 49 expect(completionOffset, isNot(equals(-1)), reason: 'missing ^');
49 int nextOffset = content.indexOf('^', completionOffset + 1); 50 int nextOffset = content.indexOf('^', completionOffset + 1);
50 expect(nextOffset, equals(-1), reason: 'too many ^'); 51 expect(nextOffset, equals(-1), reason: 'too many ^');
51 content = content.substring(0, completionOffset) + 52 content = content.substring(0, completionOffset) +
52 content.substring(completionOffset + 1); 53 content.substring(completionOffset + 1);
53 testSource = addSource(testFile, content); 54 testSource = addSource(testFile, content);
54 request = 55 cache = new DartCompletionCache(context, testSource);
55 new DartCompletionRequest(context, searchEngine, testSource, completionO ffset); 56 request = new DartCompletionRequest(
57 context,
58 searchEngine,
59 testSource,
60 completionOffset,
61 cache);
56 } 62 }
57 63
58 void assertNoSuggestions({CompletionSuggestionKind kind: null}) { 64 void assertNoSuggestions({CompletionSuggestionKind kind: null}) {
59 if (kind == null) { 65 if (kind == null) {
60 if (request.suggestions.length > 0) { 66 if (request.suggestions.length > 0) {
61 failedCompletion('Expected no suggestions', request.suggestions); 67 failedCompletion('Expected no suggestions', request.suggestions);
62 } 68 }
63 return; 69 return;
64 } 70 }
65 CompletionSuggestion suggestion = request.suggestions.firstWhere( 71 CompletionSuggestion suggestion = request.suggestions.firstWhere(
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 bool computeFast() { 408 bool computeFast() {
403 _computeFastCalled = true; 409 _computeFastCalled = true;
404 testUnit = context.parseCompilationUnit(testSource); 410 testUnit = context.parseCompilationUnit(testSource);
405 completionNode = 411 completionNode =
406 new NodeLocator.con1(completionOffset).searchWithin(testUnit); 412 new NodeLocator.con1(completionOffset).searchWithin(testUnit);
407 request.unit = testUnit; 413 request.unit = testUnit;
408 request.node = completionNode; 414 request.node = completionNode;
409 return computer.computeFast(request); 415 return computer.computeFast(request);
410 } 416 }
411 417
412 Future<bool> computeFull([bool fullAnalysis = false]) { 418 Future computeFull(assertFunction(bool result), {bool fullAnalysis: true}) {
413 if (!_computeFastCalled) { 419 if (!_computeFastCalled) {
414 expect(computeFast(), isFalse); 420 expect(computeFast(), isFalse);
415 } 421 }
416 422
417 // Index SDK 423 // Index SDK
418 for (Source librarySource in context.librarySources) { 424 for (Source librarySource in context.librarySources) {
419 CompilationUnit unit = 425 CompilationUnit unit =
420 context.getResolvedCompilationUnit2(librarySource, librarySource); 426 context.getResolvedCompilationUnit2(librarySource, librarySource);
421 if (unit != null) { 427 if (unit != null) {
422 index.indexUnit(context, unit); 428 index.indexUnit(context, unit);
(...skipping 26 matching lines...) Expand all
449 break; 455 break;
450 } 456 }
451 } 457 }
452 } 458 }
453 459
454 result = context.performAnalysisTask(); 460 result = context.performAnalysisTask();
455 } 461 }
456 if (!resolved) { 462 if (!resolved) {
457 fail('expected unit to be resolved'); 463 fail('expected unit to be resolved');
458 } 464 }
459 return computer.computeFull(request); 465 return computer.computeFull(request).then(assertFunction);
460 } 466 }
461 467
462 void failedCompletion(String message, 468 void failedCompletion(String message,
463 [Iterable<CompletionSuggestion> completions]) { 469 [Iterable<CompletionSuggestion> completions]) {
464 StringBuffer sb = new StringBuffer(message); 470 StringBuffer sb = new StringBuffer(message);
465 if (completions != null) { 471 if (completions != null) {
466 sb.write('\n found'); 472 sb.write('\n found');
467 completions.toList() 473 completions.toList()
468 ..sort((CompletionSuggestion s1, CompletionSuggestion s2) { 474 ..sort((CompletionSuggestion s1, CompletionSuggestion s2) {
469 String c1 = s1.completion.toLowerCase(); 475 String c1 = s1.completion.toLowerCase();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 } 516 }
511 }); 517 });
512 return cs; 518 return cs;
513 } 519 }
514 520
515 @override 521 @override
516 void setUp() { 522 void setUp() {
517 super.setUp(); 523 super.setUp();
518 index = createLocalMemoryIndex(); 524 index = createLocalMemoryIndex();
519 searchEngine = new SearchEngineImpl(index); 525 searchEngine = new SearchEngineImpl(index);
526 setUpComputer();
520 } 527 }
528
529 void setUpComputer();
521 } 530 }
522 531
523 /** 532 /**
524 * Common tests for `ImportedTypeComputerTest`, `InvocationComputerTest`, 533 * Common tests for `ImportedTypeComputerTest`, `InvocationComputerTest`,
525 * and `LocalComputerTest`. 534 * and `LocalComputerTest`.
526 */ 535 */
527 class AbstractSelectorSuggestionTest extends AbstractCompletionTest { 536 abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
537
538 /**
539 * Assert that the ImportedComputer uses cached results to produce identical
540 * suggestions to the original set of suggestions.
541 */
542 void assertCachedCompute(_) {
543 // Subclasses override
544 }
528 545
529 CompletionSuggestion assertLocalSuggestMethod(String name, 546 CompletionSuggestion assertLocalSuggestMethod(String name,
530 String declaringType, String returnType, [CompletionRelevance relevance = 547 String declaringType, String returnType, [CompletionRelevance relevance =
531 CompletionRelevance.DEFAULT]) { 548 CompletionRelevance.DEFAULT]) {
532 if (computer is LocalComputer) { 549 if (computer is LocalComputer) {
533 return assertSuggestMethod(name, declaringType, returnType, relevance); 550 return assertSuggestMethod(name, declaringType, returnType, relevance);
534 } else { 551 } else {
535 return assertNotSuggested(name); 552 return assertNotSuggested(name);
536 } 553 }
537 } 554 }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 CompletionSuggestion assertSuggestLocalTopLevelVar(String name, 741 CompletionSuggestion assertSuggestLocalTopLevelVar(String name,
725 String returnType, [CompletionRelevance relevance = 742 String returnType, [CompletionRelevance relevance =
726 CompletionRelevance.DEFAULT]) { 743 CompletionRelevance.DEFAULT]) {
727 if (computer is LocalComputer) { 744 if (computer is LocalComputer) {
728 return assertSuggestTopLevelVar(name, returnType, relevance); 745 return assertSuggestTopLevelVar(name, returnType, relevance);
729 } else { 746 } else {
730 return assertNotSuggested(name); 747 return assertNotSuggested(name);
731 } 748 }
732 } 749 }
733 750
751 Future computeFull(assertFunction(bool result), {bool fullAnalysis: true}) {
752 return super.computeFull(
753 assertFunction,
754 fullAnalysis: fullAnalysis).then(assertCachedCompute);
755 }
756
734 test_ArgumentList() { 757 test_ArgumentList() {
735 // ArgumentList MethodInvocation ExpressionStatement Block 758 // ArgumentList MethodInvocation ExpressionStatement Block
736 addSource('/libA.dart', ''' 759 addSource('/libA.dart', '''
737 library A; 760 library A;
738 bool hasLength(int expected) { } 761 bool hasLength(int expected) { }
739 void baz() { }'''); 762 void baz() { }''');
740 addTestSource(''' 763 addTestSource('''
741 import '/libA.dart' 764 import '/libA.dart';
742 class B { } 765 class B { }
743 String bar() => true; 766 String bar() => true;
744 void main() {expect(^)}'''); 767 void main() {expect(^)}''');
745 computeFast(); 768 computeFast();
746 return computeFull(true).then((_) { 769 return computeFull((bool result) {
747 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); 770 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
748 assertSuggestLocalFunction('bar', 'String'); 771 assertSuggestLocalFunction('bar', 'String');
749 assertSuggestImportedFunction('hasLength', 'bool'); 772 assertSuggestImportedFunction('hasLength', 'bool');
750 assertSuggestImportedFunction('identical', 'bool'); 773 assertSuggestImportedFunction('identical', 'bool');
751 assertSuggestLocalClass('B'); 774 assertSuggestLocalClass('B');
752 assertSuggestImportedClass('Object'); 775 assertSuggestImportedClass('Object');
753 assertNotSuggested('main'); 776 assertNotSuggested('main');
754 assertNotSuggested('baz'); 777 assertNotSuggested('baz');
755 assertNotSuggested('print'); 778 assertNotSuggested('print');
756 }); 779 });
757 } 780 }
758 781
759 test_ArgumentList_imported_function() { 782 test_ArgumentList_imported_function() {
760 // ArgumentList MethodInvocation ExpressionStatement Block 783 // ArgumentList MethodInvocation ExpressionStatement Block
761 addSource('/libA.dart', ''' 784 addSource('/libA.dart', '''
762 library A; 785 library A;
763 bool hasLength(int expected) { } 786 bool hasLength(int expected) { }
764 expect(arg) { } 787 expect(arg) { }
765 void baz() { }'''); 788 void baz() { }''');
766 addTestSource(''' 789 addTestSource('''
767 import '/libA.dart' 790 import '/libA.dart'
768 class B { } 791 class B { }
769 String bar() => true; 792 String bar() => true;
770 void main() {expect(^)}'''); 793 void main() {expect(^)}''');
771 computeFast(); 794 computeFast();
772 return computeFull(true).then((_) { 795 return computeFull((bool result) {
773 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); 796 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
774 assertSuggestLocalFunction('bar', 'String'); 797 assertSuggestLocalFunction('bar', 'String');
775 assertSuggestImportedFunction('hasLength', 'bool'); 798 assertSuggestImportedFunction('hasLength', 'bool');
776 assertSuggestImportedFunction('identical', 'bool'); 799 assertSuggestImportedFunction('identical', 'bool');
777 assertSuggestLocalClass('B'); 800 assertSuggestLocalClass('B');
778 assertSuggestImportedClass('Object'); 801 assertSuggestImportedClass('Object');
779 assertNotSuggested('main'); 802 assertNotSuggested('main');
780 assertNotSuggested('baz'); 803 assertNotSuggested('baz');
781 assertNotSuggested('print'); 804 assertNotSuggested('print');
782 }); 805 });
783 } 806 }
784 807
785 test_ArgumentList_local_function() { 808 test_ArgumentList_local_function() {
786 // ArgumentList MethodInvocation ExpressionStatement Block 809 // ArgumentList MethodInvocation ExpressionStatement Block
787 addSource('/libA.dart', ''' 810 addSource('/libA.dart', '''
788 library A; 811 library A;
789 bool hasLength(int expected) { } 812 bool hasLength(int expected) { }
790 void baz() { }'''); 813 void baz() { }''');
791 addTestSource(''' 814 addTestSource('''
792 import '/libA.dart' 815 import '/libA.dart'
793 expect(arg) { } 816 expect(arg) { }
794 class B { } 817 class B { }
795 String bar() => true; 818 String bar() => true;
796 void main() {expect(^)}'''); 819 void main() {expect(^)}''');
797 computeFast(); 820 computeFast();
798 return computeFull(true).then((_) { 821 return computeFull((bool result) {
799 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); 822 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
800 assertSuggestLocalFunction('bar', 'String'); 823 assertSuggestLocalFunction('bar', 'String');
801 assertSuggestImportedFunction('hasLength', 'bool'); 824 assertSuggestImportedFunction('hasLength', 'bool');
802 assertSuggestImportedFunction('identical', 'bool'); 825 assertSuggestImportedFunction('identical', 'bool');
803 assertSuggestLocalClass('B'); 826 assertSuggestLocalClass('B');
804 assertSuggestImportedClass('Object'); 827 assertSuggestImportedClass('Object');
805 assertNotSuggested('main'); 828 assertNotSuggested('main');
806 assertNotSuggested('baz'); 829 assertNotSuggested('baz');
807 assertNotSuggested('print'); 830 assertNotSuggested('print');
808 }); 831 });
809 } 832 }
810 833
811 test_ArgumentList_local_method() { 834 test_ArgumentList_local_method() {
812 // ArgumentList MethodInvocation ExpressionStatement Block 835 // ArgumentList MethodInvocation ExpressionStatement Block
813 addSource('/libA.dart', ''' 836 addSource('/libA.dart', '''
814 library A; 837 library A;
815 bool hasLength(int expected) { } 838 bool hasLength(int expected) { }
816 void baz() { }'''); 839 void baz() { }''');
817 addTestSource(''' 840 addTestSource('''
818 import '/libA.dart' 841 import '/libA.dart'
819 class B { 842 class B {
820 expect(arg) { } 843 expect(arg) { }
821 void foo() {expect(^)}} 844 void foo() {expect(^)}}
822 String bar() => true;'''); 845 String bar() => true;''');
823 computeFast(); 846 computeFast();
824 return computeFull(true).then((_) { 847 return computeFull((bool result) {
825 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); 848 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
826 assertSuggestLocalFunction('bar', 'String'); 849 assertSuggestLocalFunction('bar', 'String');
827 assertSuggestImportedFunction('hasLength', 'bool'); 850 assertSuggestImportedFunction('hasLength', 'bool');
828 assertSuggestImportedFunction('identical', 'bool'); 851 assertSuggestImportedFunction('identical', 'bool');
829 assertSuggestLocalClass('B'); 852 assertSuggestLocalClass('B');
830 assertSuggestImportedClass('Object'); 853 assertSuggestImportedClass('Object');
831 assertNotSuggested('main'); 854 assertNotSuggested('main');
832 assertNotSuggested('baz'); 855 assertNotSuggested('baz');
833 assertNotSuggested('print'); 856 assertNotSuggested('print');
834 }); 857 });
835 } 858 }
836 859
837 test_ArgumentList_namedParam() { 860 test_ArgumentList_namedParam() {
838 // SimpleIdentifier NamedExpression ArgumentList MethodInvocation 861 // SimpleIdentifier NamedExpression ArgumentList MethodInvocation
839 // ExpressionStatement 862 // ExpressionStatement
840 addSource('/libA.dart', ''' 863 addSource('/libA.dart', '''
841 library A; 864 library A;
842 bool hasLength(int expected) { }'''); 865 bool hasLength(int expected) { }''');
843 addTestSource(''' 866 addTestSource('''
844 import '/libA.dart' 867 import '/libA.dart'
845 String bar() => true; 868 String bar() => true;
846 void main() {expect(foo: ^)}'''); 869 void main() {expect(foo: ^)}''');
847 computeFast(); 870 computeFast();
848 return computeFull(true).then((_) { 871 return computeFull((bool result) {
849 assertSuggestLocalFunction('bar', 'String'); 872 assertSuggestLocalFunction('bar', 'String');
850 assertSuggestImportedFunction('hasLength', 'bool'); 873 assertSuggestImportedFunction('hasLength', 'bool');
851 assertNotSuggested('main'); 874 assertNotSuggested('main');
852 }); 875 });
853 } 876 }
854 877
855 test_AssignmentExpression_name() { 878 test_AssignmentExpression_name() {
856 // SimpleIdentifier VariableDeclaration VariableDeclarationList 879 // SimpleIdentifier VariableDeclaration VariableDeclarationList
857 // VariableDeclarationStatement Block 880 // VariableDeclarationStatement Block
858 addTestSource('class A {} main() {int a; int ^b = 1;}'); 881 addTestSource('class A {} main() {int a; int ^b = 1;}');
859 computeFast(); 882 computeFast();
860 return computeFull(true).then((_) { 883 return computeFull((bool result) {
861 assertNoSuggestions(); 884 assertNoSuggestions();
862 }); 885 });
863 } 886 }
864 887
865 test_AssignmentExpression_RHS() { 888 test_AssignmentExpression_RHS() {
866 // SimpleIdentifier VariableDeclaration VariableDeclarationList 889 // SimpleIdentifier VariableDeclaration VariableDeclarationList
867 // VariableDeclarationStatement Block 890 // VariableDeclarationStatement Block
868 addTestSource('class A {} main() {int a; int b = ^}'); 891 addTestSource('class A {} main() {int a; int b = ^}');
869 computeFast(); 892 computeFast();
870 return computeFull(true).then((_) { 893 return computeFull((bool result) {
871 assertSuggestLocalVariable('a', 'int'); 894 assertSuggestLocalVariable('a', 'int');
872 assertSuggestLocalFunction('main', null); 895 assertSuggestLocalFunction('main', null);
873 assertSuggestLocalClass('A'); 896 assertSuggestLocalClass('A');
874 assertSuggestImportedClass('Object'); 897 assertSuggestImportedClass('Object');
875 }); 898 });
876 } 899 }
877 900
878 test_AssignmentExpression_type() { 901 test_AssignmentExpression_type() {
879 // SimpleIdentifier TypeName VariableDeclarationList 902 // SimpleIdentifier TypeName VariableDeclarationList
880 // VariableDeclarationStatement Block 903 // VariableDeclarationStatement Block
881 addTestSource('class A {} main() {int a; int^ b = 1;}'); 904 addTestSource('class A {} main() {int a; int^ b = 1;}');
882 computeFast(); 905 computeFast();
883 return computeFull(true).then((_) { 906 return computeFull((bool result) {
884 assertSuggestLocalClass('A'); 907 assertSuggestLocalClass('A');
885 assertSuggestImportedClass('int'); 908 assertSuggestImportedClass('int');
886 assertNotSuggested('a'); 909 assertNotSuggested('a');
887 assertNotSuggested('main'); 910 assertNotSuggested('main');
888 }); 911 });
889 } 912 }
890 913
891 test_AwaitExpression() { 914 test_AwaitExpression() {
892 // SimpleIdentifier AwaitExpression ExpressionStatement 915 // SimpleIdentifier AwaitExpression ExpressionStatement
893 addTestSource(''' 916 addTestSource('''
894 class A {int x; int y() => 0;} 917 class A {int x; int y() => 0;}
895 main(){A a; await ^}'''); 918 main(){A a; await ^}''');
896 computeFast(); 919 computeFast();
897 return computeFull(true).then((_) { 920 return computeFull((bool result) {
898 assertSuggestLocalVariable('a', 'A'); 921 assertSuggestLocalVariable('a', 'A');
899 assertSuggestLocalFunction('main', null); 922 assertSuggestLocalFunction('main', null);
900 assertSuggestLocalClass('A'); 923 assertSuggestLocalClass('A');
901 assertSuggestImportedClass('Object'); 924 assertSuggestImportedClass('Object');
902 }); 925 });
903 } 926 }
904 927
905 test_BinaryExpression_LHS() { 928 test_BinaryExpression_LHS() {
906 // SimpleIdentifier BinaryExpression VariableDeclaration 929 // SimpleIdentifier BinaryExpression VariableDeclaration
907 // VariableDeclarationList VariableDeclarationStatement 930 // VariableDeclarationList VariableDeclarationStatement
908 addTestSource('main() {int a = 1, b = ^ + 2;}'); 931 addTestSource('main() {int a = 1, b = ^ + 2;}');
909 computeFast(); 932 computeFast();
910 return computeFull(true).then((_) { 933 return computeFull((bool result) {
911 assertSuggestLocalVariable('a', 'int'); 934 assertSuggestLocalVariable('a', 'int');
912 assertSuggestImportedClass('Object'); 935 assertSuggestImportedClass('Object');
913 assertNotSuggested('b'); 936 assertNotSuggested('b');
914 }); 937 });
915 } 938 }
916 939
917 test_BinaryExpression_RHS() { 940 test_BinaryExpression_RHS() {
918 // SimpleIdentifier BinaryExpression VariableDeclaration 941 // SimpleIdentifier BinaryExpression VariableDeclaration
919 // VariableDeclarationList VariableDeclarationStatement 942 // VariableDeclarationList VariableDeclarationStatement
920 addTestSource('main() {int a = 1, b = 2 + ^;}'); 943 addTestSource('main() {int a = 1, b = 2 + ^;}');
921 computeFast(); 944 computeFast();
922 return computeFull(true).then((_) { 945 return computeFull((bool result) {
923 assertSuggestLocalVariable('a', 'int'); 946 assertSuggestLocalVariable('a', 'int');
924 assertSuggestImportedClass('Object'); 947 assertSuggestImportedClass('Object');
925 assertNotSuggested('b'); 948 assertNotSuggested('b');
926 assertNotSuggested('=='); 949 assertNotSuggested('==');
927 }); 950 });
928 } 951 }
929 952
930 test_Block() { 953 test_Block() {
931 // Block BlockFunctionBody MethodDeclaration 954 // Block BlockFunctionBody MethodDeclaration
932 addSource('/testAB.dart', ''' 955 addSource('/testAB.dart', '''
(...skipping 18 matching lines...) Expand all
951 import "/testAB.dart"; 974 import "/testAB.dart";
952 import "/testCD.dart" hide D; 975 import "/testCD.dart" hide D;
953 import "/testEEF.dart" show EE; 976 import "/testEEF.dart" show EE;
954 import "/testG.dart" as g; 977 import "/testG.dart" as g;
955 int T5; 978 int T5;
956 var _T6; 979 var _T6;
957 Z D2() {int x;} 980 Z D2() {int x;}
958 class X {a() {var f; {var x;} ^ var r;} void b() { }} 981 class X {a() {var f; {var x;} ^ var r;} void b() { }}
959 class Z { }'''); 982 class Z { }''');
960 computeFast(); 983 computeFast();
961 return computeFull(true).then((_) { 984 return computeFull((bool result) {
962 985
963 assertSuggestLocalClass('X'); 986 assertSuggestLocalClass('X');
964 assertSuggestLocalClass('Z'); 987 assertSuggestLocalClass('Z');
965 assertLocalSuggestMethod('a', 'X', null); 988 assertLocalSuggestMethod('a', 'X', null);
966 assertLocalSuggestMethod('b', 'X', 'void'); 989 assertLocalSuggestMethod('b', 'X', 'void');
967 assertSuggestLocalVariable('f', null); 990 assertSuggestLocalVariable('f', null);
968 // Don't suggest locals out of scope 991 // Don't suggest locals out of scope
969 assertNotSuggested('r'); 992 assertNotSuggested('r');
970 assertNotSuggested('x'); 993 assertNotSuggested('x');
971 994
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 addSource('/testB.dart', ''' 1029 addSource('/testB.dart', '''
1007 lib B; 1030 lib B;
1008 class F { var f1; f2() { } } 1031 class F { var f1; f2() { } }
1009 class E extends F { var e1; e2() { } } 1032 class E extends F { var e1; e2() { } }
1010 class I { int i1; i2() { } } 1033 class I { int i1; i2() { } }
1011 class M { var m1; int m2() { } }'''); 1034 class M { var m1; int m2() { } }''');
1012 addTestSource(''' 1035 addTestSource('''
1013 import "/testB.dart"; 1036 import "/testB.dart";
1014 class A extends E implements I with M {a() {^}}'''); 1037 class A extends E implements I with M {a() {^}}''');
1015 computeFast(); 1038 computeFast();
1016 return computeFull(true).then((_) { 1039 return computeFull((bool result) {
1017 assertSuggestImportedGetter('e1', null); 1040 assertSuggestImportedGetter('e1', null);
1018 assertSuggestImportedGetter('f1', null); 1041 assertSuggestImportedGetter('f1', null);
1019 assertSuggestImportedGetter('i1', 'int'); 1042 assertSuggestImportedGetter('i1', 'int');
1020 assertSuggestImportedGetter('m1', null); 1043 assertSuggestImportedGetter('m1', null);
1021 //TODO (danrubel) include declared type in suggestion 1044 //TODO (danrubel) include declared type in suggestion
1022 assertSuggestImportedMethod('e2', null, null); 1045 assertSuggestImportedMethod('e2', null, null);
1023 assertSuggestImportedMethod('f2', null, null); 1046 assertSuggestImportedMethod('f2', null, null);
1024 assertSuggestImportedMethod('i2', null, null); 1047 assertSuggestImportedMethod('i2', null, null);
1025 //assertSuggestImportedMethod('m2', null, null); 1048 //assertSuggestImportedMethod('m2', null, null);
1026 assertNotSuggested('=='); 1049 assertNotSuggested('==');
1027 }); 1050 });
1028 } 1051 }
1029 1052
1030 test_Block_inherited_local() { 1053 test_Block_inherited_local() {
1031 // Block BlockFunctionBody MethodDeclaration ClassDeclaration 1054 // Block BlockFunctionBody MethodDeclaration ClassDeclaration
1032 addTestSource(''' 1055 addTestSource('''
1033 class F { var f1; f2() { } } 1056 class F { var f1; f2() { } }
1034 class E extends F { var e1; e2() { } } 1057 class E extends F { var e1; e2() { } }
1035 class I { int i1; i2() { } } 1058 class I { int i1; i2() { } }
1036 class M { var m1; int m2() { } } 1059 class M { var m1; int m2() { } }
1037 class A extends E implements I with M {a() {^}}'''); 1060 class A extends E implements I with M {a() {^}}''');
1038 computeFast(); 1061 computeFast();
1039 return computeFull(true).then((_) { 1062 return computeFull((bool result) {
1040 assertSuggestLocalGetter('e1', null); 1063 assertSuggestLocalGetter('e1', null);
1041 assertSuggestLocalGetter('f1', null); 1064 assertSuggestLocalGetter('f1', null);
1042 assertSuggestLocalGetter('i1', 'int'); 1065 assertSuggestLocalGetter('i1', 'int');
1043 assertSuggestLocalGetter('m1', null); 1066 assertSuggestLocalGetter('m1', null);
1044 assertSuggestLocalMethod('e2', 'E', null); 1067 assertSuggestLocalMethod('e2', 'E', null);
1045 assertSuggestLocalMethod('f2', 'F', null); 1068 assertSuggestLocalMethod('f2', 'F', null);
1046 assertSuggestLocalMethod('i2', 'I', null); 1069 assertSuggestLocalMethod('i2', 'I', null);
1047 assertSuggestLocalMethod('m2', 'M', 'int'); 1070 assertSuggestLocalMethod('m2', 'M', 'int');
1048 }); 1071 });
1049 } 1072 }
1050 1073
1051 test_CascadeExpression_selector1() { 1074 test_CascadeExpression_selector1() {
1052 // PropertyAccess CascadeExpression ExpressionStatement Block 1075 // PropertyAccess CascadeExpression ExpressionStatement Block
1053 addSource('/testB.dart', ''' 1076 addSource('/testB.dart', '''
1054 class B { }'''); 1077 class B { }''');
1055 addTestSource(''' 1078 addTestSource('''
1056 import "/testB.dart"; 1079 import "/testB.dart";
1057 class A {var b; X _c;} 1080 class A {var b; X _c;}
1058 class X{} 1081 class X{}
1059 // looks like a cascade to the parser 1082 // looks like a cascade to the parser
1060 // but the user is trying to get completions for a non-cascade 1083 // but the user is trying to get completions for a non-cascade
1061 main() {A a; a.^.z}'''); 1084 main() {A a; a.^.z}''');
1062 computeFast(); 1085 computeFast();
1063 return computeFull(true).then((_) { 1086 return computeFull((bool result) {
1064 assertSuggestInvocationGetter('b', null); 1087 assertSuggestInvocationGetter('b', null);
1065 assertSuggestInvocationGetter('_c', 'X'); 1088 assertSuggestInvocationGetter('_c', 'X');
1066 assertNotSuggested('Object'); 1089 assertNotSuggested('Object');
1067 assertNotSuggested('A'); 1090 assertNotSuggested('A');
1068 assertNotSuggested('B'); 1091 assertNotSuggested('B');
1069 assertNotSuggested('X'); 1092 assertNotSuggested('X');
1070 assertNotSuggested('z'); 1093 assertNotSuggested('z');
1071 assertNotSuggested('=='); 1094 assertNotSuggested('==');
1072 }); 1095 });
1073 } 1096 }
1074 1097
1075 test_CascadeExpression_selector2() { 1098 test_CascadeExpression_selector2() {
1076 // SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement 1099 // SimpleIdentifier PropertyAccess CascadeExpression ExpressionStatement
1077 addSource('/testB.dart', ''' 1100 addSource('/testB.dart', '''
1078 class B { }'''); 1101 class B { }''');
1079 addTestSource(''' 1102 addTestSource('''
1080 import "/testB.dart"; 1103 import "/testB.dart";
1081 class A {var b; X _c;} 1104 class A {var b; X _c;}
1082 class X{} 1105 class X{}
1083 main() {A a; a..^z}'''); 1106 main() {A a; a..^z}''');
1084 computeFast(); 1107 computeFast();
1085 return computeFull(true).then((_) { 1108 return computeFull((bool result) {
1086 assertSuggestInvocationGetter('b', null); 1109 assertSuggestInvocationGetter('b', null);
1087 assertSuggestInvocationGetter('_c', 'X'); 1110 assertSuggestInvocationGetter('_c', 'X');
1088 assertNotSuggested('Object'); 1111 assertNotSuggested('Object');
1089 assertNotSuggested('A'); 1112 assertNotSuggested('A');
1090 assertNotSuggested('B'); 1113 assertNotSuggested('B');
1091 assertNotSuggested('X'); 1114 assertNotSuggested('X');
1092 assertNotSuggested('z'); 1115 assertNotSuggested('z');
1093 assertNotSuggested('=='); 1116 assertNotSuggested('==');
1094 }); 1117 });
1095 } 1118 }
1096 1119
1097 test_CascadeExpression_selector2_withTrailingReturn() { 1120 test_CascadeExpression_selector2_withTrailingReturn() {
1098 // PropertyAccess CascadeExpression ExpressionStatement Block 1121 // PropertyAccess CascadeExpression ExpressionStatement Block
1099 addSource('/testB.dart', ''' 1122 addSource('/testB.dart', '''
1100 class B { }'''); 1123 class B { }''');
1101 addTestSource(''' 1124 addTestSource('''
1102 import "/testB.dart"; 1125 import "/testB.dart";
1103 class A {var b; X _c;} 1126 class A {var b; X _c;}
1104 class X{} 1127 class X{}
1105 main() {A a; a..^ return}'''); 1128 main() {A a; a..^ return}''');
1106 computeFast(); 1129 computeFast();
1107 return computeFull(true).then((_) { 1130 return computeFull((bool result) {
1108 assertSuggestInvocationGetter('b', null); 1131 assertSuggestInvocationGetter('b', null);
1109 assertSuggestInvocationGetter('_c', 'X'); 1132 assertSuggestInvocationGetter('_c', 'X');
1110 assertNotSuggested('Object'); 1133 assertNotSuggested('Object');
1111 assertNotSuggested('A'); 1134 assertNotSuggested('A');
1112 assertNotSuggested('B'); 1135 assertNotSuggested('B');
1113 assertNotSuggested('X'); 1136 assertNotSuggested('X');
1114 assertNotSuggested('z'); 1137 assertNotSuggested('z');
1115 assertNotSuggested('=='); 1138 assertNotSuggested('==');
1116 }); 1139 });
1117 } 1140 }
1118 1141
1119 test_CascadeExpression_target() { 1142 test_CascadeExpression_target() {
1120 // SimpleIdentifier CascadeExpression ExpressionStatement 1143 // SimpleIdentifier CascadeExpression ExpressionStatement
1121 addTestSource(''' 1144 addTestSource('''
1122 class A {var b; X _c;} 1145 class A {var b; X _c;}
1123 class X{} 1146 class X{}
1124 main() {A a; a^..b}'''); 1147 main() {A a; a^..b}''');
1125 computeFast(); 1148 computeFast();
1126 return computeFull(true).then((_) { 1149 return computeFull((bool result) {
1127 assertNotSuggested('b'); 1150 assertNotSuggested('b');
1128 assertNotSuggested('_c'); 1151 assertNotSuggested('_c');
1129 assertSuggestLocalVariable('a', 'A'); 1152 assertSuggestLocalVariable('a', 'A');
1130 assertSuggestLocalClass('A'); 1153 assertSuggestLocalClass('A');
1131 assertSuggestLocalClass('X'); 1154 assertSuggestLocalClass('X');
1132 assertSuggestImportedClass('Object'); 1155 assertSuggestImportedClass('Object');
1133 assertNotSuggested('=='); 1156 assertNotSuggested('==');
1134 }); 1157 });
1135 } 1158 }
1136 1159
1137 test_CatchClause_typed() { 1160 test_CatchClause_typed() {
1138 // Block CatchClause TryStatement 1161 // Block CatchClause TryStatement
1139 addTestSource('class A {a() {try{var x;} on E catch (e) {^}}}'); 1162 addTestSource('class A {a() {try{var x;} on E catch (e) {^}}}');
1140 computeFast(); 1163 computeFast();
1141 return computeFull(true).then((_) { 1164 return computeFull((bool result) {
1142 assertSuggestParameter('e', 'E'); 1165 assertSuggestParameter('e', 'E');
1143 assertSuggestLocalMethod('a', 'A', null); 1166 assertSuggestLocalMethod('a', 'A', null);
1144 assertSuggestImportedClass('Object'); 1167 assertSuggestImportedClass('Object');
1145 assertNotSuggested('x'); 1168 assertNotSuggested('x');
1146 }); 1169 });
1147 } 1170 }
1148 1171
1149 test_CatchClause_untyped() { 1172 test_CatchClause_untyped() {
1150 // Block CatchClause TryStatement 1173 // Block CatchClause TryStatement
1151 addTestSource('class A {a() {try{var x;} catch (e, s) {^}}}'); 1174 addTestSource('class A {a() {try{var x;} catch (e, s) {^}}}');
1152 computeFast(); 1175 computeFast();
1153 return computeFull(true).then((_) { 1176 return computeFull((bool result) {
1154 assertSuggestParameter('e', null); 1177 assertSuggestParameter('e', null);
1155 assertSuggestParameter('s', 'StackTrace'); 1178 assertSuggestParameter('s', 'StackTrace');
1156 assertSuggestLocalMethod('a', 'A', null); 1179 assertSuggestLocalMethod('a', 'A', null);
1157 assertSuggestImportedClass('Object'); 1180 assertSuggestImportedClass('Object');
1158 assertNotSuggested('x'); 1181 assertNotSuggested('x');
1159 }); 1182 });
1160 } 1183 }
1161 1184
1162 test_ClassDeclaration_body() { 1185 test_ClassDeclaration_body() {
1163 // ClassDeclaration CompilationUnit 1186 // ClassDeclaration CompilationUnit
1164 addSource('/testB.dart', ''' 1187 addSource('/testB.dart', '''
1165 class B { }'''); 1188 class B { }''');
1166 addTestSource(''' 1189 addTestSource('''
1167 import "testB.dart" as x; 1190 import "testB.dart" as x;
1168 @deprecated class A {^} 1191 @deprecated class A {^}
1169 class _B {} 1192 class _B {}
1170 A T;'''); 1193 A T;''');
1171 computeFast(); 1194 computeFast();
1172 return computeFull(true).then((_) { 1195 return computeFull((bool result) {
1173 CompletionSuggestion suggestionA = 1196 CompletionSuggestion suggestionA =
1174 assertSuggestLocalClass('A', CompletionRelevance.LOW); 1197 assertSuggestLocalClass('A', CompletionRelevance.LOW);
1175 if (suggestionA != null) { 1198 if (suggestionA != null) {
1176 expect(suggestionA.element.isDeprecated, isTrue); 1199 expect(suggestionA.element.isDeprecated, isTrue);
1177 expect(suggestionA.element.isPrivate, isFalse); 1200 expect(suggestionA.element.isPrivate, isFalse);
1178 } 1201 }
1179 CompletionSuggestion suggestionB = assertSuggestLocalClass('_B'); 1202 CompletionSuggestion suggestionB = assertSuggestLocalClass('_B');
1180 if (suggestionB != null) { 1203 if (suggestionB != null) {
1181 expect(suggestionB.element.isDeprecated, isFalse); 1204 expect(suggestionB.element.isDeprecated, isFalse);
1182 expect(suggestionB.element.isPrivate, isTrue); 1205 expect(suggestionB.element.isPrivate, isTrue);
(...skipping 21 matching lines...) Expand all
1204 PB F1() => new PB(); 1227 PB F1() => new PB();
1205 class PB { }'''); 1228 class PB { }''');
1206 addSource('/testCD.dart', ''' 1229 addSource('/testCD.dart', '''
1207 class C { } 1230 class C { }
1208 class D { }'''); 1231 class D { }''');
1209 addTestSource(''' 1232 addTestSource('''
1210 import "/testAB.dart" hide ^; 1233 import "/testAB.dart" hide ^;
1211 import "/testCD.dart"; 1234 import "/testCD.dart";
1212 class X {}'''); 1235 class X {}''');
1213 computeFast(); 1236 computeFast();
1214 return computeFull(true).then((_) { 1237 return computeFull((bool result) {
1215 assertNoSuggestions(); 1238 assertNoSuggestions();
1216 }); 1239 });
1217 } 1240 }
1218 1241
1219 test_Combinator_show() { 1242 test_Combinator_show() {
1220 // SimpleIdentifier HideCombinator ImportDirective 1243 // SimpleIdentifier HideCombinator ImportDirective
1221 addSource('/testAB.dart', ''' 1244 addSource('/testAB.dart', '''
1222 library libAB; 1245 library libAB;
1223 part '/partAB.dart'; 1246 part '/partAB.dart';
1224 class A { } 1247 class A { }
1225 class B { }'''); 1248 class B { }''');
1226 addSource('/partAB.dart', ''' 1249 addSource('/partAB.dart', '''
1227 part of libAB; 1250 part of libAB;
1228 var T1; 1251 var T1;
1229 PB F1() => new PB(); 1252 PB F1() => new PB();
1230 typedef PB2 F2(int blat); 1253 typedef PB2 F2(int blat);
1231 class Clz = Object with Object; 1254 class Clz = Object with Object;
1232 class PB { }'''); 1255 class PB { }''');
1233 addSource('/testCD.dart', ''' 1256 addSource('/testCD.dart', '''
1234 class C { } 1257 class C { }
1235 class D { }'''); 1258 class D { }''');
1236 addTestSource(''' 1259 addTestSource('''
1237 import "/testAB.dart" show ^; 1260 import "/testAB.dart" show ^;
1238 import "/testCD.dart"; 1261 import "/testCD.dart";
1239 class X {}'''); 1262 class X {}''');
1240 computeFast(); 1263 computeFast();
1241 return computeFull(true).then((_) { 1264 return computeFull((bool result) {
1242 assertNoSuggestions(); 1265 assertNoSuggestions();
1243 }); 1266 });
1244 } 1267 }
1245 1268
1246 test_ConstructorName_importedClass() { 1269 test_ConstructorName_importedClass() {
1247 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName 1270 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
1248 // InstanceCreationExpression 1271 // InstanceCreationExpression
1249 addSource('/testB.dart', ''' 1272 addSource('/testB.dart', '''
1250 lib B; 1273 lib B;
1251 int T1; 1274 int T1;
1252 F1() { } 1275 F1() { }
1253 class X {X.c(); X._d(); z() {}}'''); 1276 class X {X.c(); X._d(); z() {}}''');
1254 addTestSource(''' 1277 addTestSource('''
1255 import "/testB.dart"; 1278 import "/testB.dart";
1256 var m; 1279 var m;
1257 main() {new X.^}'''); 1280 main() {new X.^}''');
1258 computeFast(); 1281 computeFast();
1259 return computeFull(true).then((_) { 1282 return computeFull((bool result) {
1260 assertSuggestNamedConstructor('c', 'X'); 1283 assertSuggestNamedConstructor('c', 'X');
1261 assertNotSuggested('F1'); 1284 assertNotSuggested('F1');
1262 assertNotSuggested('T1'); 1285 assertNotSuggested('T1');
1263 assertNotSuggested('_d'); 1286 assertNotSuggested('_d');
1264 assertNotSuggested('z'); 1287 assertNotSuggested('z');
1265 assertNotSuggested('m'); 1288 assertNotSuggested('m');
1266 }); 1289 });
1267 } 1290 }
1268 1291
1269 test_ConstructorName_localClass() { 1292 test_ConstructorName_localClass() {
1270 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName 1293 // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
1271 // InstanceCreationExpression 1294 // InstanceCreationExpression
1272 addTestSource(''' 1295 addTestSource('''
1273 int T1; 1296 int T1;
1274 F1() { } 1297 F1() { }
1275 class X {X.c(); X._d(); z() {}} 1298 class X {X.c(); X._d(); z() {}}
1276 main() {new X.^}'''); 1299 main() {new X.^}''');
1277 computeFast(); 1300 computeFast();
1278 return computeFull(true).then((_) { 1301 return computeFull((bool result) {
1279 assertSuggestNamedConstructor('c', 'X'); 1302 assertSuggestNamedConstructor('c', 'X');
1280 assertSuggestNamedConstructor('_d', 'X'); 1303 assertSuggestNamedConstructor('_d', 'X');
1281 assertNotSuggested('F1'); 1304 assertNotSuggested('F1');
1282 assertNotSuggested('T1'); 1305 assertNotSuggested('T1');
1283 assertNotSuggested('z'); 1306 assertNotSuggested('z');
1284 assertNotSuggested('m'); 1307 assertNotSuggested('m');
1285 }); 1308 });
1286 } 1309 }
1287 1310
1288 test_ExpressionStatement_identifier() { 1311 test_ExpressionStatement_identifier() {
1289 // SimpleIdentifier ExpressionStatement Block 1312 // SimpleIdentifier ExpressionStatement Block
1290 addSource('/testA.dart', ''' 1313 addSource('/testA.dart', '''
1291 _B F1() { } 1314 _B F1() { }
1292 class A {int x;} 1315 class A {int x;}
1293 class _B { }'''); 1316 class _B { }''');
1294 addTestSource(''' 1317 addTestSource('''
1295 import "/testA.dart"; 1318 import "/testA.dart";
1296 typedef int F2(int blat); 1319 typedef int F2(int blat);
1297 class Clz = Object with Object; 1320 class Clz = Object with Object;
1298 class C {foo(){O^} void bar() {}}'''); 1321 class C {foo(){O^} void bar() {}}''');
1299 computeFast(); 1322 computeFast();
1300 return computeFull(true).then((_) { 1323 return computeFull((bool result) {
1301 assertSuggestImportedClass('A'); 1324 assertSuggestImportedClass('A');
1302 assertSuggestImportedFunction('F1', '_B', false); 1325 assertSuggestImportedFunction('F1', '_B', false);
1303 assertSuggestLocalClass('C'); 1326 assertSuggestLocalClass('C');
1304 assertSuggestLocalMethod('foo', 'C', null); 1327 assertSuggestLocalMethod('foo', 'C', null);
1305 assertSuggestLocalMethod('bar', 'C', 'void'); 1328 assertSuggestLocalMethod('bar', 'C', 'void');
1306 assertSuggestLocalFunctionTypeAlias('F2', 'int'); 1329 assertSuggestLocalFunctionTypeAlias('F2', 'int');
1307 assertSuggestLocalClassTypeAlias('Clz'); 1330 assertSuggestLocalClassTypeAlias('Clz');
1308 assertSuggestLocalClass('C'); 1331 assertSuggestLocalClass('C');
1309 assertNotSuggested('x'); 1332 assertNotSuggested('x');
1310 assertNotSuggested('_B'); 1333 assertNotSuggested('_B');
1311 }); 1334 });
1312 } 1335 }
1313 1336
1314 test_ExpressionStatement_name() { 1337 test_ExpressionStatement_name() {
1315 // ExpressionStatement Block BlockFunctionBody MethodDeclaration 1338 // ExpressionStatement Block BlockFunctionBody MethodDeclaration
1316 addSource('/testA.dart', ''' 1339 addSource('/testA.dart', '''
1317 B T1; 1340 B T1;
1318 class B{}'''); 1341 class B{}''');
1319 addTestSource(''' 1342 addTestSource('''
1320 import "/testA.dart"; 1343 import "/testA.dart";
1321 class C {a() {C ^}}'''); 1344 class C {a() {C ^}}''');
1322 computeFast(); 1345 computeFast();
1323 return computeFull(true).then((_) { 1346 return computeFull((bool result) {
1324 assertNoSuggestions(); 1347 assertNoSuggestions();
1325 }); 1348 });
1326 } 1349 }
1327 1350
1328 test_FieldDeclaration_name_typed() { 1351 test_FieldDeclaration_name_typed() {
1329 // SimpleIdentifier VariableDeclaration VariableDeclarationList 1352 // SimpleIdentifier VariableDeclaration VariableDeclarationList
1330 // FieldDeclaration 1353 // FieldDeclaration
1331 addSource('/testA.dart', 'class A { }'); 1354 addSource('/testA.dart', 'class A { }');
1332 addTestSource(''' 1355 addTestSource('''
1333 import "/testA.dart"; 1356 import "/testA.dart";
1334 class C {A ^}'''); 1357 class C {A ^}''');
1335 computeFast(); 1358 computeFast();
1336 return computeFull(true).then((_) { 1359 return computeFull((bool result) {
1337 assertNoSuggestions(); 1360 assertNoSuggestions();
1338 }); 1361 });
1339 } 1362 }
1340 1363
1341 test_FieldDeclaration_name_var() { 1364 test_FieldDeclaration_name_var() {
1342 // SimpleIdentifier VariableDeclaration VariableDeclarationList 1365 // SimpleIdentifier VariableDeclaration VariableDeclarationList
1343 // FieldDeclaration 1366 // FieldDeclaration
1344 addSource('/testA.dart', 'class A { }'); 1367 addSource('/testA.dart', 'class A { }');
1345 addTestSource(''' 1368 addTestSource('''
1346 import "/testA.dart"; 1369 import "/testA.dart";
1347 class C {var ^}'''); 1370 class C {var ^}''');
1348 computeFast(); 1371 computeFast();
1349 return computeFull(true).then((_) { 1372 return computeFull((bool result) {
1350 assertNoSuggestions(); 1373 assertNoSuggestions();
1351 }); 1374 });
1352 } 1375 }
1353 1376
1354 test_ForEachStatement_body_typed() { 1377 test_ForEachStatement_body_typed() {
1355 // Block ForEachStatement 1378 // Block ForEachStatement
1356 addTestSource('main(args) {for (int foo in bar) {^}}'); 1379 addTestSource('main(args) {for (int foo in bar) {^}}');
1357 computeFast(); 1380 computeFast();
1358 return computeFull(true).then((_) { 1381 return computeFull((bool result) {
1359 assertSuggestLocalVariable('foo', 'int'); 1382 assertSuggestLocalVariable('foo', 'int');
1360 assertSuggestImportedClass('Object'); 1383 assertSuggestImportedClass('Object');
1361 }); 1384 });
1362 } 1385 }
1363 1386
1364 test_ForEachStatement_body_untyped() { 1387 test_ForEachStatement_body_untyped() {
1365 // Block ForEachStatement 1388 // Block ForEachStatement
1366 addTestSource('main(args) {for (foo in bar) {^}}'); 1389 addTestSource('main(args) {for (foo in bar) {^}}');
1367 computeFast(); 1390 computeFast();
1368 return computeFull(true).then((_) { 1391 return computeFull((bool result) {
1369 assertSuggestLocalVariable('foo', null); 1392 assertSuggestLocalVariable('foo', null);
1370 assertSuggestImportedClass('Object'); 1393 assertSuggestImportedClass('Object');
1371 }); 1394 });
1372 } 1395 }
1373 1396
1374 test_FormalParameterList() { 1397 test_FormalParameterList() {
1375 // FormalParameterList MethodDeclaration 1398 // FormalParameterList MethodDeclaration
1376 addTestSource(''' 1399 addTestSource('''
1377 foo() { } 1400 foo() { }
1378 void bar() { } 1401 void bar() { }
1379 class A {a(^) { }}'''); 1402 class A {a(^) { }}''');
1380 computeFast(); 1403 computeFast();
1381 return computeFull(true).then((_) { 1404 return computeFull((bool result) {
1382 assertSuggestLocalFunction('foo', null); 1405 assertSuggestLocalFunction('foo', null);
1383 assertSuggestLocalMethod('a', 'A', null); 1406 assertSuggestLocalMethod('a', 'A', null);
1384 assertSuggestLocalClass('A'); 1407 assertSuggestLocalClass('A');
1385 assertSuggestImportedClass('String'); 1408 assertSuggestImportedClass('String');
1386 assertSuggestImportedFunction('identical', 'bool'); 1409 assertSuggestImportedFunction('identical', 'bool');
1387 assertNotSuggested('bar'); 1410 assertNotSuggested('bar');
1388 }); 1411 });
1389 } 1412 }
1390 1413
1391 test_ForStatement_body() { 1414 test_ForStatement_body() {
1392 // Block ForStatement 1415 // Block ForStatement
1393 addTestSource('main(args) {for (int i; i < 10; ++i) {^}}'); 1416 addTestSource('main(args) {for (int i; i < 10; ++i) {^}}');
1394 computeFast(); 1417 computeFast();
1395 return computeFull(true).then((_) { 1418 return computeFull((bool result) {
1396 assertSuggestLocalVariable('i', 'int'); 1419 assertSuggestLocalVariable('i', 'int');
1397 assertSuggestImportedClass('Object'); 1420 assertSuggestImportedClass('Object');
1398 }); 1421 });
1399 } 1422 }
1400 1423
1401 test_ForStatement_condition() { 1424 test_ForStatement_condition() {
1402 // SimpleIdentifier ForStatement 1425 // SimpleIdentifier ForStatement
1403 addTestSource('main() {for (int index = 0; i^)}'); 1426 addTestSource('main() {for (int index = 0; i^)}');
1404 computeFast(); 1427 computeFast();
1405 return computeFull(true).then((_) { 1428 return computeFull((bool result) {
1406 assertSuggestLocalVariable('index', 'int'); 1429 assertSuggestLocalVariable('index', 'int');
1407 }); 1430 });
1408 } 1431 }
1409 1432
1410 test_ForStatement_initializer() { 1433 test_ForStatement_initializer() {
1411 // SimpleIdentifier ForStatement 1434 // SimpleIdentifier ForStatement
1412 addTestSource('main() {List a; for (^)}'); 1435 addTestSource('main() {List a; for (^)}');
1413 computeFast(); 1436 computeFast();
1414 return computeFull(true).then((_) { 1437 return computeFull((bool result) {
1415 assertSuggestLocalVariable('a', 'List'); 1438 assertSuggestLocalVariable('a', 'List');
1416 assertSuggestImportedClass('Object'); 1439 assertSuggestImportedClass('Object');
1417 assertSuggestImportedClass('int'); 1440 assertSuggestImportedClass('int');
1418 }); 1441 });
1419 } 1442 }
1420 1443
1421 test_ForStatement_updaters() { 1444 test_ForStatement_updaters() {
1422 // SimpleIdentifier ForStatement 1445 // SimpleIdentifier ForStatement
1423 addTestSource('main() {for (int index = 0; index < 10; i^)}'); 1446 addTestSource('main() {for (int index = 0; index < 10; i^)}');
1424 computeFast(); 1447 computeFast();
1425 return computeFull(true).then((_) { 1448 return computeFull((bool result) {
1426 assertSuggestLocalVariable('index', 'int'); 1449 assertSuggestLocalVariable('index', 'int');
1427 }); 1450 });
1428 } 1451 }
1429 1452
1430 test_ForStatement_updaters_prefix_expression() { 1453 test_ForStatement_updaters_prefix_expression() {
1431 // SimpleIdentifier PrefixExpression ForStatement 1454 // SimpleIdentifier PrefixExpression ForStatement
1432 addTestSource(''' 1455 addTestSource('''
1433 void bar() { } 1456 void bar() { }
1434 main() {for (int index = 0; index < 10; ++i^)}'''); 1457 main() {for (int index = 0; index < 10; ++i^)}''');
1435 computeFast(); 1458 computeFast();
1436 return computeFull(true).then((_) { 1459 return computeFull((bool result) {
1437 assertSuggestLocalVariable('index', 'int'); 1460 assertSuggestLocalVariable('index', 'int');
1438 assertSuggestLocalFunction('main', null); 1461 assertSuggestLocalFunction('main', null);
1439 assertNotSuggested('bar'); 1462 assertNotSuggested('bar');
1440 }); 1463 });
1441 } 1464 }
1442 1465
1443 test_FunctionExpression_body_function() { 1466 test_FunctionExpression_body_function() {
1444 // Block BlockFunctionBody FunctionExpression 1467 // Block BlockFunctionBody FunctionExpression
1445 addTestSource(''' 1468 addTestSource('''
1446 void bar() { } 1469 void bar() { }
1447 String foo(List args) {x.then((R b) {^});}'''); 1470 String foo(List args) {x.then((R b) {^});}''');
1448 computeFast(); 1471 computeFast();
1449 return computeFull(true).then((_) { 1472 return computeFull((bool result) {
1450 var f = assertSuggestLocalFunction('foo', 'String', false); 1473 var f = assertSuggestLocalFunction('foo', 'String', false);
1451 if (f != null) { 1474 if (f != null) {
1452 expect(f.element.isPrivate, isFalse); 1475 expect(f.element.isPrivate, isFalse);
1453 } 1476 }
1454 assertSuggestLocalFunction('bar', 'void'); 1477 assertSuggestLocalFunction('bar', 'void');
1455 assertSuggestParameter('args', 'List'); 1478 assertSuggestParameter('args', 'List');
1456 assertSuggestParameter('b', 'R'); 1479 assertSuggestParameter('b', 'R');
1457 assertSuggestImportedClass('Object'); 1480 assertSuggestImportedClass('Object');
1458 }); 1481 });
1459 } 1482 }
1460 1483
1461 test_IfStatement_condition() { 1484 test_IfStatement_condition() {
1462 // SimpleIdentifier IfStatement Block BlockFunctionBody 1485 // SimpleIdentifier IfStatement Block BlockFunctionBody
1463 addTestSource(''' 1486 addTestSource('''
1464 class A {int x; int y() => 0;} 1487 class A {int x; int y() => 0;}
1465 main(){var a; if (^)}'''); 1488 main(){var a; if (^)}''');
1466 computeFast(); 1489 computeFast();
1467 return computeFull(true).then((_) { 1490 return computeFull((bool result) {
1468 assertSuggestLocalVariable('a', null); 1491 assertSuggestLocalVariable('a', null);
1469 assertSuggestLocalFunction('main', null); 1492 assertSuggestLocalFunction('main', null);
1470 assertSuggestLocalClass('A'); 1493 assertSuggestLocalClass('A');
1471 assertSuggestImportedClass('Object'); 1494 assertSuggestImportedClass('Object');
1472 }); 1495 });
1473 } 1496 }
1474 1497
1475 test_ImportDirective_dart() { 1498 test_ImportDirective_dart() {
1476 // SimpleStringLiteral ImportDirective 1499 // SimpleStringLiteral ImportDirective
1477 addTestSource(''' 1500 addTestSource('''
1478 import "dart^"; 1501 import "dart^";
1479 main() {}'''); 1502 main() {}''');
1480 computeFast(); 1503 computeFast();
1481 return computeFull(true).then((_) { 1504 return computeFull((bool result) {
1482 assertNoSuggestions(); 1505 assertNoSuggestions();
1483 }); 1506 });
1484 } 1507 }
1485 1508
1486 test_InstanceCreationExpression_imported() { 1509 test_InstanceCreationExpression_imported() {
1487 // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression 1510 // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
1488 addSource('/testA.dart', ''' 1511 addSource('/testA.dart', '''
1489 int T1; 1512 int T1;
1490 F1() { } 1513 F1() { }
1491 class A {int x;}'''); 1514 class A {int x;}''');
1492 addTestSource(''' 1515 addTestSource('''
1493 import "/testA.dart"; 1516 import "/testA.dart";
1494 int T2; 1517 int T2;
1495 F2() { } 1518 F2() { }
1496 class B {int x;} 1519 class B {int x;}
1497 class C {foo(){var f; {var x;} new ^}}'''); 1520 class C {foo(){var f; {var x;} new ^}}''');
1498 computeFast(); 1521 computeFast();
1499 return computeFull(true).then((_) { 1522 return computeFull((bool result) {
1500 assertSuggestImportedClass('Object'); 1523 assertSuggestImportedClass('Object');
1501 assertSuggestImportedClass('A'); 1524 assertSuggestImportedClass('A');
1502 assertSuggestLocalClass('B'); 1525 assertSuggestLocalClass('B');
1503 assertSuggestLocalClass('C'); 1526 assertSuggestLocalClass('C');
1504 assertNotSuggested('f'); 1527 assertNotSuggested('f');
1505 assertNotSuggested('x'); 1528 assertNotSuggested('x');
1506 assertNotSuggested('foo'); 1529 assertNotSuggested('foo');
1507 assertNotSuggested('F1'); 1530 assertNotSuggested('F1');
1508 assertNotSuggested('F2'); 1531 assertNotSuggested('F2');
1509 assertNotSuggested('T1'); 1532 assertNotSuggested('T1');
1510 assertNotSuggested('T2'); 1533 assertNotSuggested('T2');
1511 }); 1534 });
1512 } 1535 }
1513 1536
1514 test_InterpolationExpression() { 1537 test_InterpolationExpression() {
1515 // SimpleIdentifier InterpolationExpression StringInterpolation 1538 // SimpleIdentifier InterpolationExpression StringInterpolation
1516 addTestSource('main() {String name; print("hello \$^");}'); 1539 addTestSource('main() {String name; print("hello \$^");}');
1517 computeFast(); 1540 computeFast();
1518 return computeFull(true).then((_) { 1541 return computeFull((bool result) {
1519 assertSuggestLocalVariable('name', 'String'); 1542 assertSuggestLocalVariable('name', 'String');
1520 assertSuggestImportedClass('Object'); 1543 assertSuggestImportedClass('Object');
1521 }); 1544 });
1522 } 1545 }
1523 1546
1524 test_InterpolationExpression_block() { 1547 test_InterpolationExpression_block() {
1525 // SimpleIdentifier InterpolationExpression StringInterpolation 1548 // SimpleIdentifier InterpolationExpression StringInterpolation
1526 addTestSource('main() {String name; print("hello \${n^}");}'); 1549 addTestSource('main() {String name; print("hello \${n^}");}');
1527 computeFast(); 1550 computeFast();
1528 return computeFull(true).then((_) { 1551 return computeFull((bool result) {
1529 assertSuggestLocalVariable('name', 'String'); 1552 assertSuggestLocalVariable('name', 'String');
1530 assertSuggestImportedClass('Object'); 1553 assertSuggestImportedClass('Object');
1531 }); 1554 });
1532 } 1555 }
1533 1556
1534 test_InterpolationExpression_prefix_selector() { 1557 test_InterpolationExpression_prefix_selector() {
1535 // SimpleIdentifier PrefixedIdentifier InterpolationExpression 1558 // SimpleIdentifier PrefixedIdentifier InterpolationExpression
1536 addTestSource('main() {String name; print("hello \${name.^}");}'); 1559 addTestSource('main() {String name; print("hello \${name.^}");}');
1537 computeFast(); 1560 computeFast();
1538 return computeFull(true).then((_) { 1561 return computeFull((bool result) {
1539 assertSuggestInvocationGetter('length', 'int'); 1562 assertSuggestInvocationGetter('length', 'int');
1540 assertNotSuggested('name'); 1563 assertNotSuggested('name');
1541 assertNotSuggested('Object'); 1564 assertNotSuggested('Object');
1542 assertNotSuggested('=='); 1565 assertNotSuggested('==');
1543 }); 1566 });
1544 } 1567 }
1545 1568
1546 test_InterpolationExpression_prefix_target() { 1569 test_InterpolationExpression_prefix_target() {
1547 // SimpleIdentifier PrefixedIdentifier InterpolationExpression 1570 // SimpleIdentifier PrefixedIdentifier InterpolationExpression
1548 addTestSource('main() {String name; print("hello \${nam^e.length}");}'); 1571 addTestSource('main() {String name; print("hello \${nam^e.length}");}');
1549 computeFast(); 1572 computeFast();
1550 return computeFull(true).then((_) { 1573 return computeFull((bool result) {
1551 assertSuggestLocalVariable('name', 'String'); 1574 assertSuggestLocalVariable('name', 'String');
1552 assertSuggestImportedClass('Object'); 1575 assertSuggestImportedClass('Object');
1553 assertNotSuggested('length'); 1576 assertNotSuggested('length');
1554 }); 1577 });
1555 } 1578 }
1556 1579
1557 test_IsExpression() { 1580 test_IsExpression() {
1558 // SimpleIdentifier TypeName IsExpression IfStatement 1581 // SimpleIdentifier TypeName IsExpression IfStatement
1559 addSource('/testB.dart', ''' 1582 addSource('/testB.dart', '''
1560 lib B; 1583 lib B;
1561 foo() { } 1584 foo() { }
1562 class X {X.c(); X._d(); z() {}}'''); 1585 class X {X.c(); X._d(); z() {}}''');
1563 addTestSource(''' 1586 addTestSource('''
1564 import "/testB.dart"; 1587 import "/testB.dart";
1565 class Y {Y.c(); Y._d(); z() {}} 1588 class Y {Y.c(); Y._d(); z() {}}
1566 main() {var x; if (x is ^) { }}'''); 1589 main() {var x; if (x is ^) { }}''');
1567 computeFast(); 1590 computeFast();
1568 return computeFull(true).then((_) { 1591 return computeFull((bool result) {
1569 assertSuggestImportedClass('X'); 1592 assertSuggestImportedClass('X');
1570 assertSuggestLocalClass('Y'); 1593 assertSuggestLocalClass('Y');
1571 assertNotSuggested('x'); 1594 assertNotSuggested('x');
1572 assertNotSuggested('main'); 1595 assertNotSuggested('main');
1573 assertNotSuggested('foo'); 1596 assertNotSuggested('foo');
1574 }); 1597 });
1575 } 1598 }
1576 1599
1577 test_IsExpression_target() { 1600 test_IsExpression_target() {
1578 // IfStatement Block BlockFunctionBody 1601 // IfStatement Block BlockFunctionBody
1579 addTestSource(''' 1602 addTestSource('''
1580 foo() { } 1603 foo() { }
1581 void bar() { } 1604 void bar() { }
1582 class A {int x; int y() => 0;} 1605 class A {int x; int y() => 0;}
1583 main(){var a; if (^ is A)}'''); 1606 main(){var a; if (^ is A)}''');
1584 computeFast(); 1607 computeFast();
1585 return computeFull(true).then((_) { 1608 return computeFull((bool result) {
1586 assertSuggestLocalVariable('a', null); 1609 assertSuggestLocalVariable('a', null);
1587 assertSuggestLocalFunction('main', null); 1610 assertSuggestLocalFunction('main', null);
1588 assertSuggestLocalFunction('foo', null); 1611 assertSuggestLocalFunction('foo', null);
1589 assertNotSuggested('bar'); 1612 assertNotSuggested('bar');
1590 assertSuggestLocalClass('A'); 1613 assertSuggestLocalClass('A');
1591 assertSuggestImportedClass('Object'); 1614 assertSuggestImportedClass('Object');
1592 }); 1615 });
1593 } 1616 }
1594 1617
1595 test_IsExpression_type() { 1618 test_IsExpression_type() {
1596 // SimpleIdentifier TypeName IsExpression IfStatement 1619 // SimpleIdentifier TypeName IsExpression IfStatement
1597 addTestSource(''' 1620 addTestSource('''
1598 class A {int x; int y() => 0;} 1621 class A {int x; int y() => 0;}
1599 main(){var a; if (a is ^)}'''); 1622 main(){var a; if (a is ^)}''');
1600 computeFast(); 1623 computeFast();
1601 return computeFull(true).then((_) { 1624 return computeFull((bool result) {
1602 assertNotSuggested('a'); 1625 assertNotSuggested('a');
1603 assertNotSuggested('main'); 1626 assertNotSuggested('main');
1604 assertSuggestLocalClass('A'); 1627 assertSuggestLocalClass('A');
1605 assertSuggestImportedClass('Object'); 1628 assertSuggestImportedClass('Object');
1606 }); 1629 });
1607 } 1630 }
1608 1631
1609 test_Literal_string() { 1632 test_Literal_string() {
1610 // SimpleStringLiteral ExpressionStatement Block 1633 // SimpleStringLiteral ExpressionStatement Block
1611 addTestSource('class A {a() {"hel^lo"}}'); 1634 addTestSource('class A {a() {"hel^lo"}}');
1612 computeFast(); 1635 computeFast();
1613 return computeFull(true).then((_) { 1636 return computeFull((bool result) {
1614 assertNoSuggestions(); 1637 assertNoSuggestions();
1615 }); 1638 });
1616 } 1639 }
1617 1640
1618 test_MethodDeclaration_body_getters() { 1641 test_MethodDeclaration_body_getters() {
1619 // Block BlockFunctionBody MethodDeclaration 1642 // Block BlockFunctionBody MethodDeclaration
1620 addTestSource('class A {@deprecated X get f => 0; Z a() {^} get _g => 1;}'); 1643 addTestSource('class A {@deprecated X get f => 0; Z a() {^} get _g => 1;}');
1621 computeFast(); 1644 computeFast();
1622 return computeFull(true).then((_) { 1645 return computeFull((bool result) {
1623 CompletionSuggestion methodA = assertSuggestLocalMethod('a', 'A', 'Z'); 1646 CompletionSuggestion methodA = assertSuggestLocalMethod('a', 'A', 'Z');
1624 if (methodA != null) { 1647 if (methodA != null) {
1625 expect(methodA.element.isDeprecated, isFalse); 1648 expect(methodA.element.isDeprecated, isFalse);
1626 expect(methodA.element.isPrivate, isFalse); 1649 expect(methodA.element.isPrivate, isFalse);
1627 } 1650 }
1628 CompletionSuggestion getterF = 1651 CompletionSuggestion getterF =
1629 assertSuggestLocalGetter('f', 'X', CompletionRelevance.LOW); 1652 assertSuggestLocalGetter('f', 'X', CompletionRelevance.LOW);
1630 if (getterF != null) { 1653 if (getterF != null) {
1631 expect(getterF.element.isDeprecated, isTrue); 1654 expect(getterF.element.isDeprecated, isTrue);
1632 expect(getterF.element.isPrivate, isFalse); 1655 expect(getterF.element.isPrivate, isFalse);
1633 } 1656 }
1634 CompletionSuggestion getterG = assertSuggestLocalGetter('_g', null); 1657 CompletionSuggestion getterG = assertSuggestLocalGetter('_g', null);
1635 if (getterG != null) { 1658 if (getterG != null) {
1636 expect(getterG.element.isDeprecated, isFalse); 1659 expect(getterG.element.isDeprecated, isFalse);
1637 expect(getterG.element.isPrivate, isTrue); 1660 expect(getterG.element.isPrivate, isTrue);
1638 } 1661 }
1639 }); 1662 });
1640 } 1663 }
1641 1664
1642 test_MethodDeclaration_members() { 1665 test_MethodDeclaration_members() {
1643 // Block BlockFunctionBody MethodDeclaration 1666 // Block BlockFunctionBody MethodDeclaration
1644 addTestSource('class A {@deprecated X f; Z _a() {^} var _g;}'); 1667 addTestSource('class A {@deprecated X f; Z _a() {^} var _g;}');
1645 computeFast(); 1668 computeFast();
1646 return computeFull(true).then((_) { 1669 return computeFull((bool result) {
1647 CompletionSuggestion methodA = assertSuggestLocalMethod('_a', 'A', 'Z'); 1670 CompletionSuggestion methodA = assertSuggestLocalMethod('_a', 'A', 'Z');
1648 if (methodA != null) { 1671 if (methodA != null) {
1649 expect(methodA.element.isDeprecated, isFalse); 1672 expect(methodA.element.isDeprecated, isFalse);
1650 expect(methodA.element.isPrivate, isTrue); 1673 expect(methodA.element.isPrivate, isTrue);
1651 } 1674 }
1652 CompletionSuggestion getterF = 1675 CompletionSuggestion getterF =
1653 assertSuggestLocalGetter('f', 'X', CompletionRelevance.LOW); 1676 assertSuggestLocalGetter('f', 'X', CompletionRelevance.LOW);
1654 if (getterF != null) { 1677 if (getterF != null) {
1655 expect(getterF.element.isDeprecated, isTrue); 1678 expect(getterF.element.isDeprecated, isTrue);
1656 expect(getterF.element.isPrivate, isFalse); 1679 expect(getterF.element.isPrivate, isFalse);
1657 } 1680 }
1658 CompletionSuggestion getterG = assertSuggestLocalGetter('_g', null); 1681 CompletionSuggestion getterG = assertSuggestLocalGetter('_g', null);
1659 if (getterG != null) { 1682 if (getterG != null) {
1660 expect(getterG.element.isDeprecated, isFalse); 1683 expect(getterG.element.isDeprecated, isFalse);
1661 expect(getterG.element.isPrivate, isTrue); 1684 expect(getterG.element.isPrivate, isTrue);
1662 } 1685 }
1663 assertSuggestImportedClass('bool'); 1686 assertSuggestImportedClass('bool');
1664 }); 1687 });
1665 } 1688 }
1666 1689
1667 test_MethodDeclaration_parameters_named() { 1690 test_MethodDeclaration_parameters_named() {
1668 // Block BlockFunctionBody MethodDeclaration 1691 // Block BlockFunctionBody MethodDeclaration
1669 addTestSource('class A {@deprecated Z a(X x, _, b, {y: boo}) {^}}'); 1692 addTestSource('class A {@deprecated Z a(X x, _, b, {y: boo}) {^}}');
1670 computeFast(); 1693 computeFast();
1671 return computeFull(true).then((_) { 1694 return computeFull((bool result) {
1672 CompletionSuggestion methodA = 1695 CompletionSuggestion methodA =
1673 assertSuggestLocalMethod('a', 'A', 'Z', CompletionRelevance.LOW); 1696 assertSuggestLocalMethod('a', 'A', 'Z', CompletionRelevance.LOW);
1674 if (methodA != null) { 1697 if (methodA != null) {
1675 expect(methodA.element.isDeprecated, isTrue); 1698 expect(methodA.element.isDeprecated, isTrue);
1676 expect(methodA.element.isPrivate, isFalse); 1699 expect(methodA.element.isPrivate, isFalse);
1677 } 1700 }
1678 assertSuggestParameter('x', 'X'); 1701 assertSuggestParameter('x', 'X');
1679 assertSuggestParameter('y', null); 1702 assertSuggestParameter('y', null);
1680 assertSuggestParameter('b', null); 1703 assertSuggestParameter('b', null);
1681 assertSuggestImportedClass('int'); 1704 assertSuggestImportedClass('int');
1682 assertNotSuggested('_'); 1705 assertNotSuggested('_');
1683 }); 1706 });
1684 } 1707 }
1685 1708
1686 test_MethodDeclaration_parameters_positional() { 1709 test_MethodDeclaration_parameters_positional() {
1687 // Block BlockFunctionBody MethodDeclaration 1710 // Block BlockFunctionBody MethodDeclaration
1688 addTestSource(''' 1711 addTestSource('''
1689 foo() { } 1712 foo() { }
1690 void bar() { } 1713 void bar() { }
1691 class A {Z a(X x, [int y=1]) {^}}'''); 1714 class A {Z a(X x, [int y=1]) {^}}''');
1692 computeFast(); 1715 computeFast();
1693 return computeFull(true).then((_) { 1716 return computeFull((bool result) {
1694 assertSuggestLocalFunction('foo', null); 1717 assertSuggestLocalFunction('foo', null);
1695 assertSuggestLocalFunction('bar', 'void'); 1718 assertSuggestLocalFunction('bar', 'void');
1696 assertSuggestLocalMethod('a', 'A', 'Z'); 1719 assertSuggestLocalMethod('a', 'A', 'Z');
1697 assertSuggestParameter('x', 'X'); 1720 assertSuggestParameter('x', 'X');
1698 assertSuggestParameter('y', 'int'); 1721 assertSuggestParameter('y', 'int');
1699 assertSuggestImportedClass('String'); 1722 assertSuggestImportedClass('String');
1700 }); 1723 });
1701 } 1724 }
1702 1725
1703 test_MethodInvocation_no_semicolon() { 1726 test_MethodInvocation_no_semicolon() {
1704 // MethodInvocation ExpressionStatement Block 1727 // MethodInvocation ExpressionStatement Block
1705 addTestSource(''' 1728 addTestSource('''
1706 main() { } 1729 main() { }
1707 class I {X get f => new A();get _g => new A();} 1730 class I {X get f => new A();get _g => new A();}
1708 class A implements I { 1731 class A implements I {
1709 var b; X _c; 1732 var b; X _c;
1710 X get d => new A();get _e => new A(); 1733 X get d => new A();get _e => new A();
1711 // no semicolon between completion point and next statement 1734 // no semicolon between completion point and next statement
1712 set s1(I x) {} set _s2(I x) {x.^ m(null);} 1735 set s1(I x) {} set _s2(I x) {x.^ m(null);}
1713 m(X x) {} I _n(X x) {}} 1736 m(X x) {} I _n(X x) {}}
1714 class X{}'''); 1737 class X{}''');
1715 computeFast(); 1738 computeFast();
1716 return computeFull(true).then((_) { 1739 return computeFull((bool result) {
1717 assertSuggestInvocationGetter('f', 'X'); 1740 assertSuggestInvocationGetter('f', 'X');
1718 assertSuggestInvocationGetter('_g', null); 1741 assertSuggestInvocationGetter('_g', null);
1719 assertNotSuggested('b'); 1742 assertNotSuggested('b');
1720 assertNotSuggested('_c'); 1743 assertNotSuggested('_c');
1721 assertNotSuggested('d'); 1744 assertNotSuggested('d');
1722 assertNotSuggested('_e'); 1745 assertNotSuggested('_e');
1723 assertNotSuggested('s1'); 1746 assertNotSuggested('s1');
1724 assertNotSuggested('_s2'); 1747 assertNotSuggested('_s2');
1725 assertNotSuggested('m'); 1748 assertNotSuggested('m');
1726 assertNotSuggested('_n'); 1749 assertNotSuggested('_n');
(...skipping 20 matching lines...) Expand all
1747 set s1(I x) {} set _s2(I x) {} 1770 set s1(I x) {} set _s2(I x) {}
1748 m(X x) {} I _n(X x) {}} 1771 m(X x) {} I _n(X x) {}}
1749 class X{}'''); 1772 class X{}''');
1750 addTestSource(''' 1773 addTestSource('''
1751 import "/testB.dart"; 1774 import "/testB.dart";
1752 class A extends B { 1775 class A extends B {
1753 static const String scA = 'foo'; 1776 static const String scA = 'foo';
1754 w() { }} 1777 w() { }}
1755 main() {A.^}'''); 1778 main() {A.^}''');
1756 computeFast(); 1779 computeFast();
1757 return computeFull(true).then((_) { 1780 return computeFull((bool result) {
1758 assertSuggestInvocationGetter('scA', 'String'); 1781 assertSuggestInvocationGetter('scA', 'String');
1759 assertSuggestInvocationGetter('scB', 'int'); 1782 assertSuggestInvocationGetter('scB', 'int');
1760 assertSuggestInvocationGetter('scI', null); 1783 assertSuggestInvocationGetter('scI', null);
1761 assertNotSuggested('b'); 1784 assertNotSuggested('b');
1762 assertNotSuggested('_c'); 1785 assertNotSuggested('_c');
1763 assertNotSuggested('d'); 1786 assertNotSuggested('d');
1764 assertNotSuggested('_e'); 1787 assertNotSuggested('_e');
1765 assertNotSuggested('f'); 1788 assertNotSuggested('f');
1766 assertNotSuggested('_g'); 1789 assertNotSuggested('_g');
1767 assertNotSuggested('s1'); 1790 assertNotSuggested('s1');
(...skipping 18 matching lines...) Expand all
1786 static const int sc = 12; 1809 static const int sc = 12;
1787 @deprecated var b; X _c; 1810 @deprecated var b; X _c;
1788 X get d => new A();get _e => new A(); 1811 X get d => new A();get _e => new A();
1789 set s1(I x) {} set _s2(I x) {} 1812 set s1(I x) {} set _s2(I x) {}
1790 m(X x) {} I _n(X x) {}} 1813 m(X x) {} I _n(X x) {}}
1791 class X{}'''); 1814 class X{}''');
1792 addTestSource(''' 1815 addTestSource('''
1793 import "/testB.dart"; 1816 import "/testB.dart";
1794 main() {A a; a.^}'''); 1817 main() {A a; a.^}''');
1795 computeFast(); 1818 computeFast();
1796 return computeFull(true).then((_) { 1819 return computeFull((bool result) {
1797 assertSuggestInvocationGetter('sc', 'int'); 1820 assertSuggestInvocationGetter('sc', 'int');
1798 assertSuggestInvocationGetter('b', null, isDeprecated: true); 1821 assertSuggestInvocationGetter('b', null, isDeprecated: true);
1799 assertNotSuggested('_c'); 1822 assertNotSuggested('_c');
1800 assertSuggestInvocationGetter('d', 'X'); 1823 assertSuggestInvocationGetter('d', 'X');
1801 assertNotSuggested('_e'); 1824 assertNotSuggested('_e');
1802 assertSuggestInvocationGetter('f', 'X'); 1825 assertSuggestInvocationGetter('f', 'X');
1803 assertNotSuggested('_g'); 1826 assertNotSuggested('_g');
1804 assertSuggestInvocationSetter('s1'); 1827 assertSuggestInvocationSetter('s1');
1805 assertNotSuggested('_s2'); 1828 assertNotSuggested('_s2');
1806 assertSuggestInvocationMethod('m', 'A', null); 1829 assertSuggestInvocationMethod('m', 'A', null);
(...skipping 12 matching lines...) Expand all
1819 main() {A a; a.^} 1842 main() {A a; a.^}
1820 class I {X get f => new A();get _g => new A();} 1843 class I {X get f => new A();get _g => new A();}
1821 class A implements I { 1844 class A implements I {
1822 static const int sc = 12; 1845 static const int sc = 12;
1823 var b; X _c; 1846 var b; X _c;
1824 X get d => new A();get _e => new A(); 1847 X get d => new A();get _e => new A();
1825 set s1(I x) {} set _s2(I x) {} 1848 set s1(I x) {} set _s2(I x) {}
1826 m(X x) {} I _n(X x) {}} 1849 m(X x) {} I _n(X x) {}}
1827 class X{}'''); 1850 class X{}''');
1828 computeFast(); 1851 computeFast();
1829 return computeFull(true).then((_) { 1852 return computeFull((bool result) {
1830 assertSuggestInvocationGetter('sc', 'int'); 1853 assertSuggestInvocationGetter('sc', 'int');
1831 assertSuggestInvocationGetter('b', null); 1854 assertSuggestInvocationGetter('b', null);
1832 assertSuggestInvocationGetter('_c', 'X'); 1855 assertSuggestInvocationGetter('_c', 'X');
1833 assertSuggestInvocationGetter('d', 'X'); 1856 assertSuggestInvocationGetter('d', 'X');
1834 assertSuggestInvocationGetter('_e', null); 1857 assertSuggestInvocationGetter('_e', null);
1835 assertSuggestInvocationGetter('f', 'X'); 1858 assertSuggestInvocationGetter('f', 'X');
1836 assertSuggestInvocationGetter('_g', null); 1859 assertSuggestInvocationGetter('_g', null);
1837 assertSuggestInvocationSetter('s1'); 1860 assertSuggestInvocationSetter('s1');
1838 assertSuggestInvocationSetter('_s2'); 1861 assertSuggestInvocationSetter('_s2');
1839 assertSuggestInvocationMethod('m', 'A', null); 1862 assertSuggestInvocationMethod('m', 'A', null);
(...skipping 12 matching lines...) Expand all
1852 lib B; 1875 lib B;
1853 var T1; 1876 var T1;
1854 class X { } 1877 class X { }
1855 class Y { }'''); 1878 class Y { }''');
1856 addTestSource(''' 1879 addTestSource('''
1857 import "/testB.dart" as b; 1880 import "/testB.dart" as b;
1858 var T2; 1881 var T2;
1859 class A { } 1882 class A { }
1860 main() {b.^}'''); 1883 main() {b.^}''');
1861 computeFast(); 1884 computeFast();
1862 return computeFull(true).then((_) { 1885 return computeFull((bool result) {
1863 assertSuggestInvocationClass('X'); 1886 assertSuggestInvocationClass('X');
1864 assertSuggestInvocationClass('Y'); 1887 assertSuggestInvocationClass('Y');
1865 assertSuggestInvocationTopLevelVar('T1', null); 1888 assertSuggestInvocationTopLevelVar('T1', null);
1866 assertNotSuggested('T2'); 1889 assertNotSuggested('T2');
1867 assertNotSuggested('Object'); 1890 assertNotSuggested('Object');
1868 assertNotSuggested('b'); 1891 assertNotSuggested('b');
1869 assertNotSuggested('A'); 1892 assertNotSuggested('A');
1870 assertNotSuggested('=='); 1893 assertNotSuggested('==');
1871 }); 1894 });
1872 } 1895 }
1873 1896
1874 test_PrefixedIdentifier_parameter() { 1897 test_PrefixedIdentifier_parameter() {
1875 // SimpleIdentifier PrefixedIdentifier ExpressionStatement 1898 // SimpleIdentifier PrefixedIdentifier ExpressionStatement
1876 addSource('/testB.dart', ''' 1899 addSource('/testB.dart', '''
1877 lib B; 1900 lib B;
1878 class _W {M y; var _z;} 1901 class _W {M y; var _z;}
1879 class X extends _W {} 1902 class X extends _W {}
1880 class M{}'''); 1903 class M{}''');
1881 addTestSource(''' 1904 addTestSource('''
1882 import "/testB.dart"; 1905 import "/testB.dart";
1883 foo(X x) {x.^}'''); 1906 foo(X x) {x.^}''');
1884 computeFast(); 1907 computeFast();
1885 return computeFull(true).then((_) { 1908 return computeFull((bool result) {
1886 assertSuggestInvocationGetter('y', 'M'); 1909 assertSuggestInvocationGetter('y', 'M');
1887 assertNotSuggested('_z'); 1910 assertNotSuggested('_z');
1888 assertNotSuggested('=='); 1911 assertNotSuggested('==');
1889 }); 1912 });
1890 } 1913 }
1891 1914
1892 test_PrefixedIdentifier_prefix() { 1915 test_PrefixedIdentifier_prefix() {
1893 // SimpleIdentifier PrefixedIdentifier ExpressionStatement 1916 // SimpleIdentifier PrefixedIdentifier ExpressionStatement
1894 addSource('/testA.dart', ''' 1917 addSource('/testA.dart', '''
1895 class A {static int bar = 10;} 1918 class A {static int bar = 10;}
1896 _B() {}'''); 1919 _B() {}''');
1897 addTestSource(''' 1920 addTestSource('''
1898 import "/testA.dart"; 1921 import "/testA.dart";
1899 class X {foo(){A^.bar}}'''); 1922 class X {foo(){A^.bar}}''');
1900 computeFast(); 1923 computeFast();
1901 return computeFull(true).then((_) { 1924 return computeFull((bool result) {
1902 assertSuggestImportedClass('A'); 1925 assertSuggestImportedClass('A');
1903 assertSuggestLocalClass('X'); 1926 assertSuggestLocalClass('X');
1904 assertSuggestLocalMethod('foo', 'X', null); 1927 assertSuggestLocalMethod('foo', 'X', null);
1905 assertNotSuggested('bar'); 1928 assertNotSuggested('bar');
1906 assertNotSuggested('_B'); 1929 assertNotSuggested('_B');
1907 }); 1930 });
1908 } 1931 }
1909 1932
1910 test_PrefixedIdentifier_propertyAccess() { 1933 test_PrefixedIdentifier_propertyAccess() {
1911 // PrefixedIdentifier ExpressionStatement Block BlockFunctionBody 1934 // PrefixedIdentifier ExpressionStatement Block BlockFunctionBody
1912 addTestSource('class A {String x; int get foo {x.^}'); 1935 addTestSource('class A {String x; int get foo {x.^}');
1913 computeFast(); 1936 computeFast();
1914 return computeFull(true).then((_) { 1937 return computeFull((bool result) {
1915 assertSuggestInvocationGetter('isEmpty', 'bool'); 1938 assertSuggestInvocationGetter('isEmpty', 'bool');
1916 assertSuggestInvocationMethod('compareTo', 'Comparable', 'int'); 1939 assertSuggestInvocationMethod('compareTo', 'Comparable', 'int');
1917 }); 1940 });
1918 } 1941 }
1919 1942
1920 test_PropertyAccess_expression() { 1943 test_PropertyAccess_expression() {
1921 // SimpleIdentifier MethodInvocation PropertyAccess ExpressionStatement 1944 // SimpleIdentifier MethodInvocation PropertyAccess ExpressionStatement
1922 addTestSource('class A {a() {"hello".to^String().length}}'); 1945 addTestSource('class A {a() {"hello".to^String().length}}');
1923 computeFast(); 1946 computeFast();
1924 return computeFull(true).then((_) { 1947 return computeFull((bool result) {
1925 assertSuggestInvocationGetter('length', 'int'); 1948 assertSuggestInvocationGetter('length', 'int');
1926 assertNotSuggested('A'); 1949 assertNotSuggested('A');
1927 assertNotSuggested('a'); 1950 assertNotSuggested('a');
1928 assertNotSuggested('Object'); 1951 assertNotSuggested('Object');
1929 assertNotSuggested('=='); 1952 assertNotSuggested('==');
1930 }); 1953 });
1931 } 1954 }
1932 1955
1933 test_PropertyAccess_selector() { 1956 test_PropertyAccess_selector() {
1934 // SimpleIdentifier PropertyAccess ExpressionStatement Block 1957 // SimpleIdentifier PropertyAccess ExpressionStatement Block
1935 addTestSource('class A {a() {"hello".length.^}}'); 1958 addTestSource('class A {a() {"hello".length.^}}');
1936 computeFast(); 1959 computeFast();
1937 return computeFull(true).then((_) { 1960 return computeFull((bool result) {
1938 assertSuggestInvocationGetter('isEven', 'bool'); 1961 assertSuggestInvocationGetter('isEven', 'bool');
1939 assertNotSuggested('A'); 1962 assertNotSuggested('A');
1940 assertNotSuggested('a'); 1963 assertNotSuggested('a');
1941 assertNotSuggested('Object'); 1964 assertNotSuggested('Object');
1942 assertNotSuggested('=='); 1965 assertNotSuggested('==');
1943 }); 1966 });
1944 } 1967 }
1945 1968
1946 test_TopLevelVariableDeclaration_typed_name() { 1969 test_TopLevelVariableDeclaration_typed_name() {
1947 // SimpleIdentifier VariableDeclaration VariableDeclarationList 1970 // SimpleIdentifier VariableDeclaration VariableDeclarationList
1948 // TopLevelVariableDeclaration 1971 // TopLevelVariableDeclaration
1949 addTestSource('class A {} B ^'); 1972 addTestSource('class A {} B ^');
1950 computeFast(); 1973 computeFast();
1951 return computeFull(true).then((_) { 1974 return computeFull((bool result) {
1952 assertNoSuggestions(); 1975 assertNoSuggestions();
1953 }); 1976 });
1954 } 1977 }
1955 1978
1956 test_TopLevelVariableDeclaration_untyped_name() { 1979 test_TopLevelVariableDeclaration_untyped_name() {
1957 // SimpleIdentifier VariableDeclaration VariableDeclarationList 1980 // SimpleIdentifier VariableDeclaration VariableDeclarationList
1958 // TopLevelVariableDeclaration 1981 // TopLevelVariableDeclaration
1959 addTestSource('class A {} var ^'); 1982 addTestSource('class A {} var ^');
1960 computeFast(); 1983 computeFast();
1961 return computeFull(true).then((_) { 1984 return computeFull((bool result) {
1962 assertNoSuggestions(); 1985 assertNoSuggestions();
1963 }); 1986 });
1964 } 1987 }
1965 1988
1966 test_VariableDeclaration_name() { 1989 test_VariableDeclaration_name() {
1967 // SimpleIdentifier VariableDeclaration VariableDeclarationList 1990 // SimpleIdentifier VariableDeclaration VariableDeclarationList
1968 // VariableDeclarationStatement Block 1991 // VariableDeclarationStatement Block
1969 addSource('/testB.dart', ''' 1992 addSource('/testB.dart', '''
1970 lib B; 1993 lib B;
1971 foo() { } 1994 foo() { }
1972 class _B { } 1995 class _B { }
1973 class X {X.c(); X._d(); z() {}}'''); 1996 class X {X.c(); X._d(); z() {}}''');
1974 addTestSource(''' 1997 addTestSource('''
1975 import "/testB.dart"; 1998 import "/testB.dart";
1976 class Y {Y.c(); Y._d(); z() {}} 1999 class Y {Y.c(); Y._d(); z() {}}
1977 main() {var ^}'''); 2000 main() {var ^}''');
1978 computeFast(); 2001 computeFast();
1979 return computeFull(true).then((_) { 2002 return computeFull((bool result) {
1980 assertNoSuggestions(); 2003 assertNoSuggestions();
1981 }); 2004 });
1982 } 2005 }
1983 2006
1984 test_VariableDeclarationStatement_RHS() { 2007 test_VariableDeclarationStatement_RHS() {
1985 // SimpleIdentifier VariableDeclaration VariableDeclarationList 2008 // SimpleIdentifier VariableDeclaration VariableDeclarationList
1986 // VariableDeclarationStatement 2009 // VariableDeclarationStatement
1987 addSource('/testB.dart', ''' 2010 addSource('/testB.dart', '''
1988 lib B; 2011 lib B;
1989 foo() { } 2012 foo() { }
1990 class _B { } 2013 class _B { }
1991 class X {X.c(); X._d(); z() {}}'''); 2014 class X {X.c(); X._d(); z() {}}''');
1992 addTestSource(''' 2015 addTestSource('''
1993 import "/testB.dart"; 2016 import "/testB.dart";
1994 class Y {Y.c(); Y._d(); z() {}} 2017 class Y {Y.c(); Y._d(); z() {}}
1995 class C {bar(){var f; {var x;} var e = ^}}'''); 2018 class C {bar(){var f; {var x;} var e = ^}}''');
1996 computeFast(); 2019 computeFast();
1997 return computeFull(true).then((_) { 2020 return computeFull((bool result) {
1998 assertSuggestImportedClass('X'); 2021 assertSuggestImportedClass('X');
1999 assertNotSuggested('_B'); 2022 assertNotSuggested('_B');
2000 assertSuggestLocalClass('Y'); 2023 assertSuggestLocalClass('Y');
2001 assertSuggestLocalClass('C'); 2024 assertSuggestLocalClass('C');
2002 assertSuggestLocalVariable('f', null); 2025 assertSuggestLocalVariable('f', null);
2003 assertNotSuggested('x'); 2026 assertNotSuggested('x');
2004 assertNotSuggested('e'); 2027 assertNotSuggested('e');
2005 }); 2028 });
2006 } 2029 }
2007 2030
2008 test_VariableDeclarationStatement_RHS_missing_semicolon() { 2031 test_VariableDeclarationStatement_RHS_missing_semicolon() {
2009 // VariableDeclaration VariableDeclarationList 2032 // VariableDeclaration VariableDeclarationList
2010 // VariableDeclarationStatement 2033 // VariableDeclarationStatement
2011 addSource('/testB.dart', ''' 2034 addSource('/testB.dart', '''
2012 lib B; 2035 lib B;
2013 foo1() { } 2036 foo1() { }
2014 void bar1() { } 2037 void bar1() { }
2015 class _B { } 2038 class _B { }
2016 class X {X.c(); X._d(); z() {}}'''); 2039 class X {X.c(); X._d(); z() {}}''');
2017 addTestSource(''' 2040 addTestSource('''
2018 import "/testB.dart"; 2041 import "/testB.dart";
2019 foo2() { } 2042 foo2() { }
2020 void bar2() { } 2043 void bar2() { }
2021 class Y {Y.c(); Y._d(); z() {}} 2044 class Y {Y.c(); Y._d(); z() {}}
2022 class C {bar(){var f; {var x;} var e = ^ var g}}'''); 2045 class C {bar(){var f; {var x;} var e = ^ var g}}''');
2023 computeFast(); 2046 computeFast();
2024 return computeFull(true).then((_) { 2047 return computeFull((bool result) {
2025 assertSuggestImportedClass('X'); 2048 assertSuggestImportedClass('X');
2026 assertSuggestImportedFunction('foo1', null); 2049 assertSuggestImportedFunction('foo1', null);
2027 assertNotSuggested('bar1'); 2050 assertNotSuggested('bar1');
2028 assertSuggestLocalFunction('foo2', null); 2051 assertSuggestLocalFunction('foo2', null);
2029 assertNotSuggested('bar2'); 2052 assertNotSuggested('bar2');
2030 assertNotSuggested('_B'); 2053 assertNotSuggested('_B');
2031 assertSuggestLocalClass('Y'); 2054 assertSuggestLocalClass('Y');
2032 assertSuggestLocalClass('C'); 2055 assertSuggestLocalClass('C');
2033 assertSuggestLocalVariable('f', null); 2056 assertSuggestLocalVariable('f', null);
2034 assertNotSuggested('x'); 2057 assertNotSuggested('x');
2035 assertNotSuggested('e'); 2058 assertNotSuggested('e');
2036 }); 2059 });
2037 } 2060 }
2038 } 2061 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698