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

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

Issue 2946643002: Don't compute 'dart:core' LibraryElement during completion. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « pkg/analysis_server/lib/src/provisional/completion/dart/completion_dart.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7304c265d03eff025bf359b63f64d8eec2442ee6..f4331aaee8d356d0f86bacfd9eed3afb27ac8160 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
@@ -14,7 +14,6 @@ import 'package:analysis_server/src/services/completion/dart/common_usage_sorter
import 'package:analysis_server/src/services/completion/dart/contribution_sorter.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/standard_ast_factory.dart';
-import 'package:analyzer/dart/ast/standard_resolution_map.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
@@ -105,7 +104,10 @@ class DartCompletionRequestImpl implements DartCompletionRequest {
final AnalysisResult result;
@override
- final LibraryElement coreLib;
+ final ResourceProvider resourceProvider;
+
+ @override
+ final InterfaceType objectType;
@override
final Source source;
@@ -120,16 +122,8 @@ class DartCompletionRequestImpl implements DartCompletionRequest {
Source librarySource;
@override
- final ResourceProvider resourceProvider;
-
- @override
CompletionTarget target;
- /**
- * The [DartType] for Object in dart:core
- */
- InterfaceType _objectType;
-
OpType _opType;
final CompletionRequest _originalRequest;
@@ -139,7 +133,7 @@ class DartCompletionRequestImpl implements DartCompletionRequest {
DartCompletionRequestImpl._(
this.result,
this.resourceProvider,
- this.coreLib,
+ this.objectType,
this.librarySource,
this.source,
this.offset,
@@ -167,14 +161,6 @@ class DartCompletionRequestImpl implements DartCompletionRequest {
return null;
}
- @override
- InterfaceType get objectType {
- if (_objectType == null) {
- _objectType = coreLib.getType('Object').type;
- }
- return _objectType;
- }
-
OpType get opType {
if (_opType == null) {
_opType = new OpType.forCompletion(target, offset);
@@ -237,19 +223,14 @@ class DartCompletionRequestImpl implements DartCompletionRequest {
const BUILD_REQUEST_TAG = 'build DartCompletionRequest';
performance.logStartTime(BUILD_REQUEST_TAG);
- Source libSource;
- CompilationUnit unit;
- unit = request.result.unit;
- // TODO(scheglov) support for parts
- libSource = resolutionMap.elementDeclaredByCompilationUnit(unit).source;
-
- LibraryElement coreLib =
- await request.result.driver.getLibraryByUri('dart:core');
+ CompilationUnit unit = request.result.unit;
+ Source libSource = unit.element.library.source;
+ InterfaceType objectType = request.result.typeProvider.objectType;
DartCompletionRequestImpl dartRequest = new DartCompletionRequestImpl._(
request.result,
request.resourceProvider,
- coreLib,
+ objectType,
libSource,
request.source,
request.offset,
« no previous file with comments | « pkg/analysis_server/lib/src/provisional/completion/dart/completion_dart.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698