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

Side by Side Diff: pkg/analysis_server/lib/src/domain_execution.dart

Issue 987663002: Fix for subscribing for notifications for files in packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments. Created 5 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library domain.execution; 5 library domain.execution;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analysis_server/src/analysis_server.dart'; 10 import 'package:analysis_server/src/analysis_server.dart';
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return new Response.invalidParameter(request, 'file', 107 return new Response.invalidParameter(request, 'file',
108 'Either file or uri must be provided, but not both'); 108 'Either file or uri must be provided, but not both');
109 } 109 }
110 Resource resource = server.resourceProvider.getResource(file); 110 Resource resource = server.resourceProvider.getResource(file);
111 if (!resource.exists) { 111 if (!resource.exists) {
112 return new Response.invalidParameter(request, 'file', 'Must exist'); 112 return new Response.invalidParameter(request, 'file', 'Must exist');
113 } else if (resource is! File) { 113 } else if (resource is! File) {
114 return new Response.invalidParameter( 114 return new Response.invalidParameter(
115 request, 'file', 'Must not refer to a directory'); 115 request, 'file', 'Must not refer to a directory');
116 } 116 }
117 Source source = server.getSource(file); 117 ContextSourcePair contextSource = server.getContextSourcePair(file);
118 Source source = contextSource.source;
118 uri = context.sourceFactory.restoreUri(source).toString(); 119 uri = context.sourceFactory.restoreUri(source).toString();
119 return new ExecutionMapUriResult(uri: uri).toResponse(request.id); 120 return new ExecutionMapUriResult(uri: uri).toResponse(request.id);
120 } else if (uri != null) { 121 } else if (uri != null) {
121 Source source = context.sourceFactory.forUri(uri); 122 Source source = context.sourceFactory.forUri(uri);
122 if (source == null) { 123 if (source == null) {
123 return new Response.invalidParameter(request, 'uri', 'Invalid URI'); 124 return new Response.invalidParameter(request, 'uri', 'Invalid URI');
124 } 125 }
125 file = source.fullName; 126 file = source.fullName;
126 return new ExecutionMapUriResult(file: file).toResponse(request.id); 127 return new ExecutionMapUriResult(file: file).toResponse(request.id);
127 } 128 }
(...skipping 22 matching lines...) Expand all
150 } 151 }
151 152
152 void _fileAnalyzed(ChangeNotice notice) { 153 void _fileAnalyzed(ChangeNotice notice) {
153 ServerPerformanceStatistics.executionNotifications.makeCurrentWhile(() { 154 ServerPerformanceStatistics.executionNotifications.makeCurrentWhile(() {
154 Source source = notice.source; 155 Source source = notice.source;
155 String filePath = source.fullName; 156 String filePath = source.fullName;
156 if (!_isInAnalysisRoot(filePath)) { 157 if (!_isInAnalysisRoot(filePath)) {
157 return; 158 return;
158 } 159 }
159 AnalysisContext context = server.getAnalysisContext(filePath); 160 AnalysisContext context = server.getAnalysisContext(filePath);
161 if (context == null) {
162 return;
163 }
160 if (AnalysisEngine.isDartFileName(filePath)) { 164 if (AnalysisEngine.isDartFileName(filePath)) {
161 ExecutableKind kind = ExecutableKind.NOT_EXECUTABLE; 165 ExecutableKind kind = ExecutableKind.NOT_EXECUTABLE;
162 if (context.isClientLibrary(source)) { 166 if (context.isClientLibrary(source)) {
163 kind = ExecutableKind.CLIENT; 167 kind = ExecutableKind.CLIENT;
164 if (context.isServerLibrary(source)) { 168 if (context.isServerLibrary(source)) {
165 kind = ExecutableKind.EITHER; 169 kind = ExecutableKind.EITHER;
166 } 170 }
167 } else if (context.isServerLibrary(source)) { 171 } else if (context.isServerLibrary(source)) {
168 kind = ExecutableKind.SERVER; 172 kind = ExecutableKind.SERVER;
169 } 173 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (_isInAnalysisRoot(filePath)) { 229 if (_isInAnalysisRoot(filePath)) {
226 server.sendNotification( 230 server.sendNotification(
227 new ExecutionLaunchDataParams(filePath, kind: kind).toNotification()); 231 new ExecutionLaunchDataParams(filePath, kind: kind).toNotification());
228 } 232 }
229 } 233 }
230 234
231 static List<String> _getFullNames(List<Source> sources) { 235 static List<String> _getFullNames(List<Source> sources) {
232 return sources.map((Source source) => source.fullName).toList(); 236 return sources.map((Source source) => source.fullName).toList();
233 } 237 }
234 } 238 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/domain_completion.dart ('k') | pkg/analysis_server/lib/src/edit/edit_domain.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698