Index: pkg/analysis_server/lib/src/edit/edit_domain.dart |
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart |
index b2a990f39f735ef799a76df0c82b7b67995f7ad8..8caa2c079cd26706ae60ea555b4ea15f31726b79 100644 |
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart |
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart |
@@ -24,6 +24,7 @@ import 'package:analysis_server/src/services/correction/status.dart'; |
import 'package:analysis_server/src/services/refactoring/refactoring.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/element/element.dart'; |
import 'package:analyzer/error/error.dart' as engine; |
import 'package:analyzer/file_system/file_system.dart'; |
@@ -143,11 +144,13 @@ class EditDomainHandler implements RequestHandler { |
AnalysisResult result = await server.getAnalysisResult(params.file); |
if (result != null) { |
CompilationUnit unit = result.unit; |
+ CompilationUnitElement compilationUnitElement = |
+ resolutionMap.elementForCompilationUnit(unit); |
DartAssistContext dartAssistContext = new _DartAssistContextForValues( |
- unit.element.source, |
+ compilationUnitElement.source, |
params.offset, |
params.length, |
- unit.element.context, |
+ compilationUnitElement.context, |
unit); |
try { |
AssistProcessor processor = new AssistProcessor(dartAssistContext); |
@@ -189,7 +192,10 @@ class EditDomainHandler implements RequestHandler { |
int errorLine = lineInfo.getLocation(error.offset).lineNumber; |
if (errorLine == requestLine) { |
var context = new _DartFixContextImpl( |
- server.resourceProvider, unit.element.context, unit, error); |
+ server.resourceProvider, |
+ resolutionMap.elementForCompilationUnit(unit).context, |
+ unit, |
+ error); |
List<Fix> fixes = |
await new DefaultFixContributor().internalComputeFixes(context); |
if (fixes.isNotEmpty) { |
@@ -214,8 +220,11 @@ class EditDomainHandler implements RequestHandler { |
for (engine.AnalysisError error in errorInfo.errors) { |
int errorLine = lineInfo.getLocation(error.offset).lineNumber; |
if (errorLine == requestLine) { |
- List<Fix> fixes = await computeFixes(server.serverPlugin, |
- server.resourceProvider, unit.element.context, error); |
+ List<Fix> fixes = await computeFixes( |
+ server.serverPlugin, |
+ server.resourceProvider, |
+ resolutionMap.elementForCompilationUnit(unit).context, |
+ error); |
if (fixes.isNotEmpty) { |
AnalysisError serverError = |
newAnalysisError_fromEngine(lineInfo, error); |
@@ -296,8 +305,10 @@ class EditDomainHandler implements RequestHandler { |
return; |
} |
// prepare context |
- engine.AnalysisContext context = unit.element.context; |
- Source source = unit.element.source; |
+ CompilationUnitElement compilationUnitElement = |
+ resolutionMap.elementForCompilationUnit(unit); |
+ engine.AnalysisContext context = compilationUnitElement.context; |
+ Source source = compilationUnitElement.source; |
errors = context.computeErrors(source); |
// prepare code |
fileStamp = context.getModificationStamp(source); |