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

Unified Diff: pkg/analysis_server/lib/src/domain_execution.dart

Issue 2682983002: Fix for 'execution.mapUri' with the new analysis driver. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | pkg/analysis_server/test/integration/execution/map_uri_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/domain_execution.dart
diff --git a/pkg/analysis_server/lib/src/domain_execution.dart b/pkg/analysis_server/lib/src/domain_execution.dart
index 5524426b524ff7fc894c73fbca4ede5fe3837b6d..a65e0499dba94b60af9e8d5aacf4e994c2673b43 100644
--- a/pkg/analysis_server/lib/src/domain_execution.dart
+++ b/pkg/analysis_server/lib/src/domain_execution.dart
@@ -97,10 +97,22 @@ class ExecutionDomainHandler implements RequestHandler {
return new Response.invalidParameter(request, 'id',
'There is no execution context with an id of $contextId');
}
- AnalysisContext context = server.getContainingContext(path);
- if (context == null) {
- return new Response.invalidExecutionContext(request, contextId);
+
+ SourceFactory sourceFactory;
+ if (server.options.enableNewAnalysisDriver) {
+ var driver = server.getAnalysisDriver(path);
+ if (driver == null) {
+ return new Response.invalidExecutionContext(request, contextId);
+ }
+ sourceFactory = driver.sourceFactory;
+ } else {
+ AnalysisContext context = server.getContainingContext(path);
+ if (context == null) {
+ return new Response.invalidExecutionContext(request, contextId);
+ }
+ sourceFactory = context.sourceFactory;
}
+
String file = params.file;
String uri = params.uri;
if (file != null) {
@@ -120,11 +132,11 @@ class ExecutionDomainHandler implements RequestHandler {
if (source.uriKind != UriKind.FILE_URI) {
uri = source.uri.toString();
} else {
- uri = context.sourceFactory.restoreUri(source).toString();
+ uri = sourceFactory.restoreUri(source).toString();
}
return new ExecutionMapUriResult(uri: uri).toResponse(request.id);
} else if (uri != null) {
- Source source = context.sourceFactory.forUri(uri);
+ Source source = sourceFactory.forUri(uri);
if (source == null) {
return new Response.invalidParameter(request, 'uri', 'Invalid URI');
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/integration/execution/map_uri_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698