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

Unified Diff: pkg/analysis_server/lib/src/services/completion/dart/completion_manager.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/completion_manager.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
index 26a9af5c403832e3a88932ff2ccc955f2848742a..847b281cc9abf416c480081cc46d3a78021a6d51 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
@@ -19,6 +19,7 @@ import 'package:analysis_server/src/services/completion/dart/contribution_sorter
import 'package:analysis_server/src/services/completion/dart/optype.dart';
import 'package:analysis_server/src/services/search/search_engine.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';
@@ -179,7 +180,8 @@ class DartCompletionRequestImpl implements DartCompletionRequest {
@override
LibraryElement get coreLib {
if (result != null) {
- AnalysisContext context = result.unit.element.context;
+ AnalysisContext context =
+ resolutionMap.elementForCompilationUnit(result.unit).context;
_coreLib = context.typeProvider.objectType.element.library;
} else {
Source coreUri = sourceFactory.forUri('dart:core');
@@ -325,7 +327,8 @@ class DartCompletionRequestImpl implements DartCompletionRequest {
return _resolvedUnits;
}
if (result != null) {
- _resolvedUnits = result.unit.element.library.units;
+ _resolvedUnits =
+ resolutionMap.elementForCompilationUnit(result.unit).library.units;
return _resolvedUnits;
}
LibraryElement libElem = libraryElement;
@@ -396,7 +399,7 @@ class DartCompletionRequestImpl implements DartCompletionRequest {
if (request.context == null) {
unit = request.result.unit;
// TODO(scheglov) support for parts
- libSource = unit.element.source;
+ libSource = resolutionMap.elementForCompilationUnit(unit).source;
} else {
Source source = request.source;
AnalysisContext context = request.context;

Powered by Google App Engine
This is Rietveld 408576698