| 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 f5581d7b02ec59af7337082e719311658b6d08e9..8bfc2c02f00727df4154f43f1210952a436b55e7 100644
|
| --- a/pkg/analysis_server/test/services/completion/completion_test_util.dart
|
| +++ b/pkg/analysis_server/test/services/completion/completion_test_util.dart
|
| @@ -6,8 +6,8 @@ library test.services.completion.util;
|
|
|
| import 'dart:async';
|
|
|
| -import 'package:analysis_server/src/protocol.dart' as protocol show Element,
|
| - ElementKind;
|
| +import 'package:analysis_server/src/protocol.dart' as protocol
|
| + show Element, ElementKind;
|
| import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind;
|
| import 'package:analysis_server/src/services/completion/common_usage_computer.dart';
|
| import 'package:analysis_server/src/services/completion/completion_manager.dart';
|
| @@ -62,13 +62,8 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| content.substring(completionOffset + 1);
|
| testSource = addSource(testFile, content);
|
| cache = new DartCompletionCache(context, testSource);
|
| - request = new DartCompletionRequest(
|
| - context,
|
| - searchEngine,
|
| - testSource,
|
| - completionOffset,
|
| - cache,
|
| - new CompletionPerformance());
|
| + request = new DartCompletionRequest(context, searchEngine, testSource,
|
| + completionOffset, cache, new CompletionPerformance());
|
| }
|
|
|
| void assertHasNoParameterInfo(CompletionSuggestion suggestion) {
|
| @@ -82,8 +77,7 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| expect(suggestion.parameterNames, isNotNull);
|
| expect(suggestion.parameterTypes, isNotNull);
|
| expect(suggestion.parameterNames.length, suggestion.parameterTypes.length);
|
| - expect(
|
| - suggestion.requiredParameterCount,
|
| + expect(suggestion.requiredParameterCount,
|
| lessThanOrEqualTo(suggestion.parameterNames.length));
|
| expect(suggestion.hasNamedParameters, isNotNull);
|
| }
|
| @@ -96,8 +90,7 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| return;
|
| }
|
| CompletionSuggestion suggestion = request.suggestions.firstWhere(
|
| - (CompletionSuggestion cs) => cs.kind == kind,
|
| - orElse: () => null);
|
| + (CompletionSuggestion cs) => cs.kind == kind, orElse: () => null);
|
| if (suggestion != null) {
|
| failedCompletion('did not expect completion: $completion\n $suggestion');
|
| }
|
| @@ -115,14 +108,14 @@ 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) {
|
| failedCompletion(
|
| - 'expected $completion $csKind $elemKind',
|
| - request.suggestions);
|
| + 'expected $completion $csKind $elemKind', request.suggestions);
|
| }
|
| expect(cs.kind, equals(csKind));
|
| if (isDeprecated) {
|
| @@ -137,18 +130,15 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| return cs;
|
| }
|
|
|
| - void assertSuggestArgumentList(List<String> paramNames,
|
| - List<String> paramTypes) {
|
| + void assertSuggestArgumentList(
|
| + List<String> paramNames, List<String> paramTypes) {
|
| CompletionSuggestionKind csKind = CompletionSuggestionKind.ARGUMENT_LIST;
|
| CompletionSuggestion cs = getSuggest(csKind: csKind);
|
| if (cs == null) {
|
| failedCompletion('expected completion $csKind', request.suggestions);
|
| }
|
| assertSuggestArgumentList_params(
|
| - paramNames,
|
| - paramTypes,
|
| - cs.parameterNames,
|
| - cs.parameterTypes);
|
| + paramNames, paramTypes, cs.parameterNames, cs.parameterTypes);
|
| expect(cs.relevance, DART_RELEVANCE_HIGH);
|
| }
|
|
|
| @@ -180,14 +170,12 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| fail(msg.toString());
|
| }
|
|
|
| - CompletionSuggestion assertSuggestClass(String name, {int relevance:
|
| - DART_RELEVANCE_DEFAULT, CompletionSuggestionKind kind:
|
| - CompletionSuggestionKind.INVOCATION, bool isDeprecated: false}) {
|
| - CompletionSuggestion cs = assertSuggest(
|
| - name,
|
| - csKind: kind,
|
| - relevance: relevance,
|
| - isDeprecated: isDeprecated);
|
| + CompletionSuggestion assertSuggestClass(String name,
|
| + {int relevance: DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION,
|
| + bool isDeprecated: false}) {
|
| + CompletionSuggestion cs = assertSuggest(name,
|
| + csKind: kind, relevance: relevance, isDeprecated: isDeprecated);
|
| protocol.Element element = cs.element;
|
| expect(element, isNotNull);
|
| expect(element.kind, equals(protocol.ElementKind.CLASS));
|
| @@ -198,9 +186,9 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| return cs;
|
| }
|
|
|
| - CompletionSuggestion assertSuggestClassTypeAlias(String name, [int relevance =
|
| - DART_RELEVANCE_DEFAULT, CompletionSuggestionKind kind =
|
| - CompletionSuggestionKind.INVOCATION]) {
|
| + CompletionSuggestion assertSuggestClassTypeAlias(String name,
|
| + [int relevance = DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) {
|
| CompletionSuggestion cs =
|
| assertSuggest(name, csKind: kind, relevance: relevance);
|
| protocol.Element element = cs.element;
|
| @@ -214,10 +202,10 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| }
|
|
|
| CompletionSuggestion assertSuggestField(String name, String type,
|
| - {int relevance: DART_RELEVANCE_DEFAULT, CompletionSuggestionKind kind:
|
| - CompletionSuggestionKind.INVOCATION, bool isDeprecated: false}) {
|
| - CompletionSuggestion cs = assertSuggest(
|
| - name,
|
| + {int relevance: DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION,
|
| + bool isDeprecated: false}) {
|
| + CompletionSuggestion cs = assertSuggest(name,
|
| csKind: kind,
|
| relevance: relevance,
|
| elemKind: protocol.ElementKind.FIELD,
|
| @@ -238,11 +226,8 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| CompletionSuggestion assertSuggestFunction(String name, String returnType,
|
| [bool isDeprecated = false, int relevance = DART_RELEVANCE_DEFAULT,
|
| CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) {
|
| - CompletionSuggestion cs = assertSuggest(
|
| - name,
|
| - csKind: kind,
|
| - relevance: relevance,
|
| - isDeprecated: isDeprecated);
|
| + CompletionSuggestion cs = assertSuggest(name,
|
| + csKind: kind, relevance: relevance, isDeprecated: isDeprecated);
|
| expect(cs.returnType, returnType != null ? returnType : 'dynamic');
|
| protocol.Element element = cs.element;
|
| expect(element, isNotNull);
|
| @@ -253,21 +238,18 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| expect(param, isNotNull);
|
| expect(param[0], equals('('));
|
| expect(param[param.length - 1], equals(')'));
|
| - expect(
|
| - element.returnType,
|
| + expect(element.returnType,
|
| equals(returnType != null ? returnType : 'dynamic'));
|
| assertHasParameterInfo(cs);
|
| return cs;
|
| }
|
|
|
| - CompletionSuggestion assertSuggestFunctionTypeAlias(String name,
|
| - String returnType, bool isDeprecated, [int relevance = DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestion assertSuggestFunctionTypeAlias(
|
| + String name, String returnType, bool isDeprecated,
|
| + [int relevance = DART_RELEVANCE_DEFAULT,
|
| CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) {
|
| - CompletionSuggestion cs = assertSuggest(
|
| - name,
|
| - csKind: kind,
|
| - relevance: relevance,
|
| - isDeprecated: isDeprecated);
|
| + CompletionSuggestion cs = assertSuggest(name,
|
| + csKind: kind, relevance: relevance, isDeprecated: isDeprecated);
|
| expect(cs.returnType, returnType != null ? returnType : 'dynamic');
|
| protocol.Element element = cs.element;
|
| expect(element, isNotNull);
|
| @@ -279,8 +261,7 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| // expect(param, isNotNull);
|
| // expect(param[0], equals('('));
|
| // expect(param[param.length - 1], equals(')'));
|
| - expect(
|
| - element.returnType,
|
| + expect(element.returnType,
|
| equals(returnType != null ? returnType : 'dynamic'));
|
| // TODO (danrubel) Determine why param info is missing
|
| // assertHasParameterInfo(cs);
|
| @@ -288,10 +269,10 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| }
|
|
|
| CompletionSuggestion assertSuggestGetter(String name, String returnType,
|
| - {int relevance: DART_RELEVANCE_DEFAULT, CompletionSuggestionKind kind:
|
| - CompletionSuggestionKind.INVOCATION, bool isDeprecated: false}) {
|
| - CompletionSuggestion cs = assertSuggest(
|
| - name,
|
| + {int relevance: DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION,
|
| + bool isDeprecated: false}) {
|
| + CompletionSuggestion cs = assertSuggest(name,
|
| csKind: kind,
|
| relevance: relevance,
|
| elemKind: protocol.ElementKind.GETTER,
|
| @@ -302,16 +283,15 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| expect(element.kind, equals(protocol.ElementKind.GETTER));
|
| expect(element.name, equals(name));
|
| expect(element.parameters, isNull);
|
| - expect(
|
| - element.returnType,
|
| + expect(element.returnType,
|
| equals(returnType != null ? returnType : 'dynamic'));
|
| assertHasNoParameterInfo(cs);
|
| return cs;
|
| }
|
|
|
| - CompletionSuggestion assertSuggestLabel(String name, [int relevance =
|
| - DART_RELEVANCE_DEFAULT, CompletionSuggestionKind kind =
|
| - CompletionSuggestionKind.IDENTIFIER]) {
|
| + CompletionSuggestion assertSuggestLabel(String name,
|
| + [int relevance = DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestionKind kind = CompletionSuggestionKind.IDENTIFIER]) {
|
| CompletionSuggestion cs =
|
| assertSuggest(name, csKind: kind, relevance: relevance);
|
| expect(cs.returnType, isNull);
|
| @@ -326,9 +306,9 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| return cs;
|
| }
|
|
|
| - CompletionSuggestion assertSuggestLibraryPrefix(String prefix, [int relevance
|
| - = DART_RELEVANCE_DEFAULT, CompletionSuggestionKind kind =
|
| - CompletionSuggestionKind.INVOCATION]) {
|
| + CompletionSuggestion assertSuggestLibraryPrefix(String prefix,
|
| + [int relevance = DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) {
|
| // Library prefix should only be suggested by ImportedComputer
|
| if (computer is ImportedComputer) {
|
| CompletionSuggestion cs =
|
| @@ -345,15 +325,13 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| }
|
| }
|
|
|
| - CompletionSuggestion assertSuggestMethod(String name, String declaringType,
|
| - String returnType, {int relevance: DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestion assertSuggestMethod(
|
| + String name, String declaringType, String returnType,
|
| + {int relevance: DART_RELEVANCE_DEFAULT,
|
| CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION,
|
| bool isDeprecated: false}) {
|
| - CompletionSuggestion cs = assertSuggest(
|
| - name,
|
| - csKind: kind,
|
| - relevance: relevance,
|
| - isDeprecated: isDeprecated);
|
| + CompletionSuggestion cs = assertSuggest(name,
|
| + csKind: kind, relevance: relevance, isDeprecated: isDeprecated);
|
| expect(cs.declaringType, equals(declaringType));
|
| expect(cs.returnType, returnType != null ? returnType : 'dynamic');
|
| protocol.Element element = cs.element;
|
| @@ -369,8 +347,8 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| return cs;
|
| }
|
|
|
| - CompletionSuggestion assertSuggestNamedConstructor(String name,
|
| - String returnType, [int relevance = DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestion assertSuggestNamedConstructor(
|
| + String name, String returnType, [int relevance = DART_RELEVANCE_DEFAULT,
|
| CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) {
|
| if (computer is InvocationComputer) {
|
| CompletionSuggestion cs =
|
| @@ -396,11 +374,10 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| - CompletionSuggestion assertSuggestSetter(String name, [int relevance =
|
| - DART_RELEVANCE_DEFAULT, CompletionSuggestionKind kind =
|
| - CompletionSuggestionKind.INVOCATION]) {
|
| - CompletionSuggestion cs = assertSuggest(
|
| - name,
|
| + CompletionSuggestion assertSuggestSetter(String name,
|
| + [int relevance = DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) {
|
| + CompletionSuggestion cs = assertSuggest(name,
|
| csKind: kind,
|
| relevance: relevance,
|
| elemKind: protocol.ElementKind.SETTER);
|
| @@ -419,8 +396,8 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| }
|
|
|
| CompletionSuggestion assertSuggestTopLevelVar(String name, String returnType,
|
| - [int relevance = DART_RELEVANCE_DEFAULT, CompletionSuggestionKind kind =
|
| - CompletionSuggestionKind.INVOCATION]) {
|
| + [int relevance = DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) {
|
| CompletionSuggestion cs =
|
| assertSuggest(name, csKind: kind, relevance: relevance);
|
| expect(cs.returnType, returnType != null ? returnType : 'dynamic');
|
| @@ -446,13 +423,8 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
|
|
| bool computeFast() {
|
| _computeFastCalled = true;
|
| - _completionManager = new DartCompletionManager(
|
| - context,
|
| - searchEngine,
|
| - testSource,
|
| - cache,
|
| - [computer],
|
| - new CommonUsageComputer({}));
|
| + _completionManager = new DartCompletionManager(context, searchEngine,
|
| + testSource, cache, [computer], new CommonUsageComputer({}));
|
| var result = _completionManager.computeFast(request);
|
| expect(request.replacementOffset, isNotNull);
|
| expect(request.replacementLength, isNotNull);
|
| @@ -518,10 +490,10 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| if (completions != null) {
|
| sb.write('\n found');
|
| completions.toList()
|
| - ..sort(suggestionComparator)
|
| - ..forEach((CompletionSuggestion suggestion) {
|
| - sb.write('\n ${suggestion.completion} -> $suggestion');
|
| - });
|
| + ..sort(suggestionComparator)
|
| + ..forEach((CompletionSuggestion suggestion) {
|
| + sb.write('\n ${suggestion.completion} -> $suggestion');
|
| + });
|
| }
|
| if (completionNode != null) {
|
| sb.write('\n in');
|
| @@ -535,7 +507,8 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| }
|
|
|
| CompletionSuggestion getSuggest({String completion: null,
|
| - CompletionSuggestionKind csKind: null, protocol.ElementKind elemKind: null}) {
|
| + CompletionSuggestionKind csKind: null,
|
| + protocol.ElementKind elemKind: null}) {
|
| CompletionSuggestion cs;
|
| request.suggestions.forEach((CompletionSuggestion s) {
|
| if (completion != null && completion != s.completion) {
|
| @@ -553,8 +526,7 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
|
| if (cs == null) {
|
| cs = s;
|
| } else {
|
| - failedCompletion(
|
| - 'expected exactly one $cs',
|
| + failedCompletion('expected exactly one $cs',
|
| request.suggestions.where((s) => s.completion == completion));
|
| }
|
| });
|
| @@ -586,9 +558,9 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| // Subclasses override
|
| }
|
|
|
| - CompletionSuggestion assertSuggestImportedClass(String name, [int relevance =
|
| - DART_RELEVANCE_DEFAULT, CompletionSuggestionKind kind =
|
| - CompletionSuggestionKind.INVOCATION]) {
|
| + CompletionSuggestion assertSuggestImportedClass(String name,
|
| + [int relevance = DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) {
|
| if (computer is ImportedComputer) {
|
| return assertSuggestClass(name, relevance: relevance, kind: kind);
|
| } else {
|
| @@ -601,56 +573,49 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| - CompletionSuggestion assertSuggestImportedFunction(String name,
|
| - String returnType, [bool isDeprecated = false, int relevance =
|
| - DART_RELEVANCE_DEFAULT, CompletionSuggestionKind kind =
|
| - CompletionSuggestionKind.INVOCATION]) {
|
| + CompletionSuggestion assertSuggestImportedFunction(
|
| + String name, String returnType, [bool isDeprecated = false,
|
| + int relevance = DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) {
|
| if (computer is ImportedComputer) {
|
| return assertSuggestFunction(
|
| - name,
|
| - returnType,
|
| - isDeprecated,
|
| - relevance,
|
| - kind);
|
| + name, returnType, isDeprecated, relevance, kind);
|
| } else {
|
| return assertNotSuggested(name);
|
| }
|
| }
|
|
|
| - CompletionSuggestion assertSuggestImportedFunctionTypeAlias(String name,
|
| - String returnType, [bool isDeprecated = false, int relevance =
|
| - DART_RELEVANCE_DEFAULT, CompletionSuggestionKind kind =
|
| - CompletionSuggestionKind.INVOCATION]) {
|
| + CompletionSuggestion assertSuggestImportedFunctionTypeAlias(
|
| + String name, String returnType, [bool isDeprecated = false,
|
| + int relevance = DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) {
|
| if (computer is ImportedComputer) {
|
| return assertSuggestFunctionTypeAlias(
|
| - name,
|
| - returnType,
|
| - isDeprecated,
|
| - relevance,
|
| - kind);
|
| + name, returnType, isDeprecated, relevance, kind);
|
| } else {
|
| return assertNotSuggested(name);
|
| }
|
| }
|
|
|
| - CompletionSuggestion assertSuggestImportedGetter(String name,
|
| - String returnType, {int relevance: DART_RELEVANCE_INHERITED_ACCESSOR}) {
|
| + CompletionSuggestion assertSuggestImportedGetter(
|
| + String name, String returnType,
|
| + {int relevance: DART_RELEVANCE_INHERITED_ACCESSOR}) {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| - CompletionSuggestion assertSuggestImportedMethod(String name,
|
| - String declaringType, String returnType, {int relevance:
|
| - DART_RELEVANCE_INHERITED_METHOD}) {
|
| + CompletionSuggestion assertSuggestImportedMethod(
|
| + String name, String declaringType, String returnType,
|
| + {int relevance: DART_RELEVANCE_INHERITED_METHOD}) {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| - CompletionSuggestion assertSuggestImportedSetter(String name, {int relevance:
|
| - DART_RELEVANCE_INHERITED_ACCESSOR}) {
|
| + CompletionSuggestion assertSuggestImportedSetter(String name,
|
| + {int relevance: DART_RELEVANCE_INHERITED_ACCESSOR}) {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| - CompletionSuggestion assertSuggestImportedTopLevelVar(String name,
|
| - String returnType, [int relevance = DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestion assertSuggestImportedTopLevelVar(
|
| + String name, String returnType, [int relevance = DART_RELEVANCE_DEFAULT,
|
| CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) {
|
| if (computer is ImportedComputer) {
|
| return assertSuggestTopLevelVar(name, returnType, relevance, kind);
|
| @@ -659,8 +624,8 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| }
|
| }
|
|
|
| - CompletionSuggestion assertSuggestInvocationClass(String name, [int relevance
|
| - = DART_RELEVANCE_DEFAULT]) {
|
| + CompletionSuggestion assertSuggestInvocationClass(String name,
|
| + [int relevance = DART_RELEVANCE_DEFAULT]) {
|
| if (computer is InvocationComputer) {
|
| return assertSuggestClass(name, relevance: relevance);
|
| } else {
|
| @@ -673,36 +638,30 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| - CompletionSuggestion assertSuggestInvocationGetter(String name,
|
| - String returnType, {int relevance: DART_RELEVANCE_DEFAULT, bool isDeprecated:
|
| - false}) {
|
| + CompletionSuggestion assertSuggestInvocationGetter(
|
| + String name, String returnType,
|
| + {int relevance: DART_RELEVANCE_DEFAULT, bool isDeprecated: false}) {
|
| if (computer is InvocationComputer) {
|
| - return assertSuggestGetter(
|
| - name,
|
| - returnType,
|
| - relevance: relevance,
|
| - isDeprecated: isDeprecated);
|
| + return assertSuggestGetter(name, returnType,
|
| + relevance: relevance, isDeprecated: isDeprecated);
|
| } else {
|
| return assertNotSuggested(name);
|
| }
|
| }
|
|
|
| - CompletionSuggestion assertSuggestInvocationMethod(String name,
|
| - String declaringType, String returnType, [int relevance =
|
| - DART_RELEVANCE_DEFAULT]) {
|
| + CompletionSuggestion assertSuggestInvocationMethod(
|
| + String name, String declaringType, String returnType,
|
| + [int relevance = DART_RELEVANCE_DEFAULT]) {
|
| if (computer is InvocationComputer) {
|
| - return assertSuggestMethod(
|
| - name,
|
| - declaringType,
|
| - returnType,
|
| + return assertSuggestMethod(name, declaringType, returnType,
|
| relevance: relevance);
|
| } else {
|
| return assertNotSuggested(name);
|
| }
|
| }
|
|
|
| - CompletionSuggestion assertSuggestInvocationSetter(String name, [int relevance
|
| - = DART_RELEVANCE_DEFAULT]) {
|
| + CompletionSuggestion assertSuggestInvocationSetter(String name,
|
| + [int relevance = DART_RELEVANCE_DEFAULT]) {
|
| if (computer is InvocationComputer) {
|
| return assertSuggestSetter(name);
|
| } else {
|
| @@ -710,8 +669,9 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| }
|
| }
|
|
|
| - CompletionSuggestion assertSuggestInvocationTopLevelVar(String name,
|
| - String returnType, [int relevance = DART_RELEVANCE_DEFAULT]) {
|
| + CompletionSuggestion assertSuggestInvocationTopLevelVar(
|
| + String name, String returnType,
|
| + [int relevance = DART_RELEVANCE_DEFAULT]) {
|
| if (computer is InvocationComputer) {
|
| return assertSuggestTopLevelVar(name, returnType, relevance);
|
| } else {
|
| @@ -719,8 +679,8 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| }
|
| }
|
|
|
| - CompletionSuggestion assertSuggestLocalClass(String name, {int relevance:
|
| - DART_RELEVANCE_DEFAULT, bool isDeprecated: false}) {
|
| + CompletionSuggestion assertSuggestLocalClass(String name,
|
| + {int relevance: DART_RELEVANCE_DEFAULT, bool isDeprecated: false}) {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| @@ -734,15 +694,15 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| - CompletionSuggestion assertSuggestLocalFunction(String name,
|
| - String returnType, {bool deprecated: false, int relevance:
|
| - DART_RELEVANCE_LOCAL_FUNCTION}) {
|
| + CompletionSuggestion assertSuggestLocalFunction(
|
| + String name, String returnType,
|
| + {bool deprecated: false, int relevance: DART_RELEVANCE_LOCAL_FUNCTION}) {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| - CompletionSuggestion assertSuggestLocalFunctionTypeAlias(String name,
|
| - String returnType, {bool deprecated: false, int relevance:
|
| - DART_RELEVANCE_DEFAULT}) {
|
| + CompletionSuggestion assertSuggestLocalFunctionTypeAlias(
|
| + String name, String returnType,
|
| + {bool deprecated: false, int relevance: DART_RELEVANCE_DEFAULT}) {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| @@ -751,37 +711,39 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| - CompletionSuggestion assertSuggestLocalMethod(String name,
|
| - String declaringType, String returnType, {int relevance:
|
| - DART_RELEVANCE_LOCAL_METHOD, bool deprecated: false}) {
|
| + CompletionSuggestion assertSuggestLocalMethod(
|
| + String name, String declaringType, String returnType,
|
| + {int relevance: DART_RELEVANCE_LOCAL_METHOD, bool deprecated: false}) {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| - CompletionSuggestion assertSuggestLocalSetter(String name, {int relevance:
|
| - DART_RELEVANCE_LOCAL_ACCESSOR}) {
|
| + CompletionSuggestion assertSuggestLocalSetter(String name,
|
| + {int relevance: DART_RELEVANCE_LOCAL_ACCESSOR}) {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| - CompletionSuggestion assertSuggestLocalTopLevelVar(String name,
|
| - String returnType, {int relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE}) {
|
| + CompletionSuggestion assertSuggestLocalTopLevelVar(
|
| + String name, String returnType,
|
| + {int relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE}) {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| - CompletionSuggestion assertSuggestLocalVariable(String name,
|
| - String returnType, {int relevance: DART_RELEVANCE_LOCAL_VARIABLE}) {
|
| + CompletionSuggestion assertSuggestLocalVariable(
|
| + String name, String returnType,
|
| + {int relevance: DART_RELEVANCE_LOCAL_VARIABLE}) {
|
| return assertNotSuggested(name);
|
| }
|
|
|
| - CompletionSuggestion assertSuggestNonLocalClass(String name, [int relevance =
|
| - DART_RELEVANCE_DEFAULT, CompletionSuggestionKind kind =
|
| - CompletionSuggestionKind.INVOCATION]) {
|
| + CompletionSuggestion assertSuggestNonLocalClass(String name,
|
| + [int relevance = DART_RELEVANCE_DEFAULT,
|
| + CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION]) {
|
| return assertSuggestImportedClass(name, relevance, kind);
|
| }
|
|
|
| Future computeFull(assertFunction(bool result), {bool fullAnalysis: true}) {
|
| - return super.computeFull(
|
| - assertFunction,
|
| - fullAnalysis: fullAnalysis).then(assertCachedCompute);
|
| + return super
|
| + .computeFull(assertFunction, fullAnalysis: fullAnalysis)
|
| + .then(assertCachedCompute);
|
| }
|
|
|
| test_ArgumentList() {
|
| @@ -1459,10 +1421,8 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| return computeFull((bool result) {
|
| expect(request.replacementOffset, completionOffset);
|
| expect(request.replacementLength, 0);
|
| - CompletionSuggestion suggestionA = assertSuggestLocalClass(
|
| - 'A',
|
| - relevance: DART_RELEVANCE_LOW,
|
| - isDeprecated: true);
|
| + CompletionSuggestion suggestionA = assertSuggestLocalClass('A',
|
| + relevance: DART_RELEVANCE_LOW, isDeprecated: true);
|
| if (suggestionA != null) {
|
| expect(suggestionA.element.isDeprecated, isTrue);
|
| expect(suggestionA.element.isPrivate, isFalse);
|
| @@ -2379,11 +2339,8 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| expect(methodA.element.isDeprecated, isFalse);
|
| expect(methodA.element.isPrivate, isFalse);
|
| }
|
| - CompletionSuggestion getterF = assertSuggestLocalGetter(
|
| - 'f',
|
| - 'X',
|
| - relevance: DART_RELEVANCE_LOW,
|
| - deprecated: true);
|
| + CompletionSuggestion getterF = assertSuggestLocalGetter('f', 'X',
|
| + relevance: DART_RELEVANCE_LOW, deprecated: true);
|
| if (getterF != null) {
|
| expect(getterF.element.isDeprecated, isTrue);
|
| expect(getterF.element.isPrivate, isFalse);
|
| @@ -2408,11 +2365,8 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| expect(methodA.element.isDeprecated, isFalse);
|
| expect(methodA.element.isPrivate, isTrue);
|
| }
|
| - CompletionSuggestion getterF = assertSuggestLocalField(
|
| - 'f',
|
| - 'X',
|
| - relevance: DART_RELEVANCE_LOW,
|
| - deprecated: true);
|
| + CompletionSuggestion getterF = assertSuggestLocalField('f', 'X',
|
| + relevance: DART_RELEVANCE_LOW, deprecated: true);
|
| if (getterF != null) {
|
| expect(getterF.element.isDeprecated, isTrue);
|
| expect(getterF.element.isPrivate, isFalse);
|
| @@ -2435,12 +2389,8 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
|
| return computeFull((bool result) {
|
| expect(request.replacementOffset, completionOffset);
|
| expect(request.replacementLength, 0);
|
| - CompletionSuggestion methodA = assertSuggestLocalMethod(
|
| - 'a',
|
| - 'A',
|
| - 'Z',
|
| - relevance: DART_RELEVANCE_LOW,
|
| - deprecated: true);
|
| + CompletionSuggestion methodA = assertSuggestLocalMethod('a', 'A', 'Z',
|
| + relevance: DART_RELEVANCE_LOW, deprecated: true);
|
| if (methodA != null) {
|
| expect(methodA.element.isDeprecated, isTrue);
|
| expect(methodA.element.isPrivate, isFalse);
|
|
|