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

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

Issue 288013003: allow client to specify any combination of add/modified/removed (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge and address comments Created 6 years, 7 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/protocol.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.context; 5 library domain.context;
6 6
7 import 'package:analysis_server/src/analysis_server.dart'; 7 import 'package:analysis_server/src/analysis_server.dart';
8 import 'package:analysis_server/src/protocol.dart'; 8 import 'package:analysis_server/src/protocol.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/source.dart'; 10 import 'package:analyzer/src/generated/source.dart';
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 return response; 147 return response;
148 } 148 }
149 149
150 /** 150 /**
151 * Convert the given JSON object into a [ChangeSet], using the given 151 * Convert the given JSON object into a [ChangeSet], using the given
152 * [sourceFactory] to convert the embedded strings into sources. 152 * [sourceFactory] to convert the embedded strings into sources.
153 */ 153 */
154 ChangeSet createChangeSet(Request request, SourceFactory sourceFactory, 154 ChangeSet createChangeSet(Request request, SourceFactory sourceFactory,
155 RequestDatum jsonData) { 155 RequestDatum jsonData) {
156 ChangeSet changeSet = new ChangeSet(); 156 ChangeSet changeSet = new ChangeSet();
157 convertSources(request, sourceFactory, jsonData[ADDED_PARAM], (Source source ) { 157 if (jsonData.hasKey(ADDED_PARAM)) {
158 changeSet.addedSource(source); 158 convertSources(request, sourceFactory, jsonData[ADDED_PARAM], (Source sour ce) {
159 }); 159 changeSet.addedSource(source);
160 convertSources(request, sourceFactory, jsonData[MODIFIED_PARAM], (Source sou rce) { 160 });
161 changeSet.changedSource(source); 161 }
162 }); 162 if (jsonData.hasKey(MODIFIED_PARAM)) {
163 convertSources(request, sourceFactory, jsonData[REMOVED_PARAM], (Source sour ce) { 163 convertSources(request, sourceFactory, jsonData[MODIFIED_PARAM], (Source s ource) {
164 changeSet.removedSource(source); 164 changeSet.changedSource(source);
165 }); 165 });
166 }
167 if (jsonData.hasKey(REMOVED_PARAM)) {
168 convertSources(request, sourceFactory, jsonData[REMOVED_PARAM], (Source so urce) {
169 changeSet.removedSource(source);
170 });
171 }
166 return changeSet; 172 return changeSet;
167 } 173 }
168 174
169 /** 175 /**
170 * If the given [sources] is a list of strings, use the given [sourceFactory] 176 * If the given [sources] is a list of strings, use the given [sourceFactory]
171 * to convert each string into a source and pass the source to the given 177 * to convert each string into a source and pass the source to the given
172 * [handler]. Otherwise, throw an exception indicating that the data in the 178 * [handler]. Otherwise, throw an exception indicating that the data in the
173 * request was not valid. 179 * request was not valid.
174 */ 180 */
175 void convertSources(Request request, SourceFactory sourceFactory, RequestDatum sources, void handler(Source source)) { 181 void convertSources(Request request, SourceFactory sourceFactory, RequestDatum sources, void handler(Source source)) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 */ 264 */
259 AnalysisContext getAnalysisContext(Request request) { 265 AnalysisContext getAnalysisContext(Request request) {
260 String contextId = request.getRequiredParameter(CONTEXT_ID_PARAM).asString() ; 266 String contextId = request.getRequiredParameter(CONTEXT_ID_PARAM).asString() ;
261 AnalysisContext context = server.contextMap[contextId]; 267 AnalysisContext context = server.contextMap[contextId];
262 if (context == null) { 268 if (context == null) {
263 throw new RequestFailure(new Response.contextDoesNotExist(request)); 269 throw new RequestFailure(new Response.contextDoesNotExist(request));
264 } 270 }
265 return context; 271 return context;
266 } 272 }
267 } 273 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/protocol.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698