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

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

Issue 2551023005: Prepare for decoupling analyzer ASTs from element model. (Closed)
Patch Set: Address review comments Created 4 years 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/local_reference_contributor.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
index 01298f865156ee5ce6a744c93b2412730ddbbb20..2d3bdd1fcfce69223dcbc2c192770ea70fad638d 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
@@ -17,6 +17,7 @@ import 'package:analysis_server/src/services/completion/dart/optype.dart';
import 'package:analysis_server/src/services/correction/strings.dart';
import 'package:analysis_server/src/utilities/documentation.dart';
import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/element/element.dart';
@@ -520,8 +521,10 @@ class _LocalVisitor extends LocalDeclarationVisitor {
{bool isAbstract: false,
bool isDeprecated: false,
int relevance: DART_RELEVANCE_DEFAULT}) {
- relevance = optype.returnValueSuggestionsFilter(
- enumDeclaration.element?.type, relevance);
+ ClassElement classElement =
+ resolutionMap.elementDeclaredByEnumDeclaration(enumDeclaration);
+ relevance =
+ optype.returnValueSuggestionsFilter(classElement?.type, relevance);
if (relevance != null) {
_addLocalSuggestion_enumConstant(constantDeclaration, enumDeclaration,
isAbstract: isAbstract,

Powered by Google App Engine
This is Rietveld 408576698