| Index: pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart
|
| diff --git a/pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart
|
| index bf1633e80977a8fb7e448af69968dad9b33fa589..0e32978e9c1cad941d18c70e91808514fe4f3a0d 100644
|
| --- a/pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart
|
| +++ b/pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart
|
| @@ -11,13 +11,40 @@ import 'package:analysis_server/src/provisional/completion/dart/completion_targe
|
| import 'package:analysis_server/src/services/completion/dart/completion_manager.dart';
|
| import 'package:analysis_server/src/services/completion/dart/optype.dart';
|
| import 'package:analysis_server/src/services/completion/dart/suggestion_builder.dart';
|
| +import 'package:analyzer/dart/element/element.dart';
|
| +import 'package:analyzer/dart/element/type.dart';
|
| import 'package:analyzer/src/generated/ast.dart';
|
| -import 'package:analyzer/src/generated/element.dart';
|
|
|
| import '../../../protocol_server.dart'
|
| show CompletionSuggestion, CompletionSuggestionKind;
|
|
|
| /**
|
| + * Return the class containing the target
|
| + * or `null` if the target is in a static method or field
|
| + * or not in a class.
|
| + */
|
| +ClassDeclaration _enclosingClass(CompletionTarget target) {
|
| + AstNode node = target.containingNode;
|
| + while (node != null) {
|
| + if (node is ClassDeclaration) {
|
| + return node;
|
| + }
|
| + if (node is MethodDeclaration) {
|
| + if (node.isStatic) {
|
| + return null;
|
| + }
|
| + }
|
| + if (node is FieldDeclaration) {
|
| + if (node.isStatic) {
|
| + return null;
|
| + }
|
| + }
|
| + node = node.parent;
|
| + }
|
| + return null;
|
| +}
|
| +
|
| +/**
|
| * A contributor for calculating suggestions for inherited references.
|
| */
|
| class InheritedReferenceContributor extends DartCompletionContributor
|
| @@ -76,29 +103,3 @@ class InheritedReferenceContributor extends DartCompletionContributor
|
| return suggestions;
|
| }
|
| }
|
| -
|
| -/**
|
| - * Return the class containing the target
|
| - * or `null` if the target is in a static method or field
|
| - * or not in a class.
|
| - */
|
| -ClassDeclaration _enclosingClass(CompletionTarget target) {
|
| - AstNode node = target.containingNode;
|
| - while (node != null) {
|
| - if (node is ClassDeclaration) {
|
| - return node;
|
| - }
|
| - if (node is MethodDeclaration) {
|
| - if (node.isStatic) {
|
| - return null;
|
| - }
|
| - }
|
| - if (node is FieldDeclaration) {
|
| - if (node.isStatic) {
|
| - return null;
|
| - }
|
| - }
|
| - node = node.parent;
|
| - }
|
| - return null;
|
| -}
|
|
|