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

Unified Diff: pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart

Issue 1789233002: Deprecate the generated element library and clean up imports (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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/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;
-}

Powered by Google App Engine
This is Rietveld 408576698