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

Unified Diff: pkg/analysis_server/test/services/completion/completion_test_util.dart

Issue 902913002: fix completions in indexed expression (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/services/completion/completion_test_util.dart
diff --git a/pkg/analysis_server/test/services/completion/completion_test_util.dart b/pkg/analysis_server/test/services/completion/completion_test_util.dart
index 5f7375fbfe72f602fe0464e9bcad7ebcc90150a8..c1cbc10220ac756f9b36edf39ad99f9657436cae 100644
--- a/pkg/analysis_server/test/services/completion/completion_test_util.dart
+++ b/pkg/analysis_server/test/services/completion/completion_test_util.dart
@@ -114,8 +114,8 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
CompletionSuggestion assertSuggest(String completion,
{CompletionSuggestionKind csKind: CompletionSuggestionKind.INVOCATION,
- int relevance: DART_RELEVANCE_DEFAULT, protocol.ElementKind elemKind:
- null, bool isDeprecated: false, bool isPotential: false}) {
+ int relevance: DART_RELEVANCE_DEFAULT, protocol.ElementKind elemKind: null,
+ bool isDeprecated: false, bool isPotential: false}) {
CompletionSuggestion cs =
getSuggest(completion: completion, csKind: csKind, elemKind: elemKind);
if (cs == null) {
@@ -260,9 +260,8 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
}
CompletionSuggestion assertSuggestFunctionTypeAlias(String name,
- String returnType, bool isDeprecated, [int relevance =
- DART_RELEVANCE_DEFAULT, CompletionSuggestionKind kind =
- CompletionSuggestionKind.INVOCATION]) {
+ String returnType, bool isDeprecated, [int relevance = DART_RELEVANCE_DEFAULT,
+ CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) {
CompletionSuggestion cs = assertSuggest(
name,
csKind: kind,
@@ -673,8 +672,8 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
}
CompletionSuggestion assertSuggestInvocationGetter(String name,
- String returnType, {int relevance: DART_RELEVANCE_DEFAULT,
- bool isDeprecated: false}) {
+ String returnType, {int relevance: DART_RELEVANCE_DEFAULT, bool isDeprecated:
+ false}) {
if (computer is InvocationComputer) {
return assertSuggestGetter(
name,
@@ -1895,6 +1894,54 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
});
}
+ test_IndexExpression() {
+ // ExpressionStatement Block
+ addSource('/testA.dart', '''
+ int T1;
+ F1() { }
+ class A {int x;}''');
+ addTestSource('''
+ import "/testA.dart";
+ int T2;
+ F2() { }
+ class B {int x;}
+ class C {foo(){var f; {var x;} f[^]}}''');
+ computeFast();
+ return computeFull((bool result) {
+ assertNotSuggested('x');
+ assertSuggestLocalVariable('f', null);
+ assertSuggestLocalMethod('foo', 'C', null);
+ assertSuggestLocalClass('C');
+ assertSuggestLocalFunction('F2', null);
+ assertSuggestLocalTopLevelVar('T2', 'int');
+ assertSuggestImportedClass('A');
+ assertSuggestImportedFunction('F1', null);
+ // TODO (danrubel) getter is being suggested instead of top level var
+ //assertSuggestImportedTopLevelVar('T1', 'int');
+ });
+ }
+
+ test_IndexExpression2() {
+ // SimpleIdentifier IndexExpression ExpressionStatement Block
+ addSource('/testA.dart', '''
+ int T1;
+ F1() { }
+ class A {int x;}''');
+ addTestSource('''
+ import "/testA.dart";
+ int T2;
+ F2() { }
+ class B {int x;}
+ class C {foo(){var f; {var x;} f[T^]}}''');
+ computeFast();
+ return computeFull((bool result) {
+ // top level results are partially filtered based on first char
+ assertSuggestLocalTopLevelVar('T2', 'int');
+ // TODO (danrubel) getter is being suggested instead of top level var
+ //assertSuggestImportedTopLevelVar('T1', 'int');
+ });
+ }
+
test_InstanceCreationExpression_imported() {
// SimpleIdentifier TypeName ConstructorName InstanceCreationExpression
addSource('/testA.dart', '''

Powered by Google App Engine
This is Rietveld 408576698