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

Side by Side Diff: pkg/analysis_server/lib/protocol/protocol_generated.dart

Issue 2844273003: Unify the server and plugin versions of the generators (Closed)
Patch Set: add missed files Created 3 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 // This file has been automatically generated. Please do not edit it manually. 5 // This file has been automatically generated. Please do not edit it manually.
6 // To regenerate the file, use the script 6 // To regenerate the file, use the script
7 // "pkg/analysis_server/tool/spec/generate_files". 7 // "pkg/analysis_server/tool/spec/generate_files".
8 8
9 part of analysis_server.plugin.protocol.protocol; 9 import 'dart:convert' hide JsonDecoder;
10
11 import 'package:analyzer/src/generated/utilities_general.dart';
12 import 'package:analysis_server/protocol/protocol.dart';
13 import 'package:analysis_server/src/protocol/protocol_internal.dart';
10 14
11 /** 15 /**
12 * server.getVersion params 16 * AddContentOverlay
13 *
14 * Clients may not extend, implement or mix-in this class.
15 */
16 class ServerGetVersionParams {
17 Request toRequest(String id) {
18 return new Request(id, "server.getVersion", null);
19 }
20
21 @override
22 bool operator ==(other) {
23 if (other is ServerGetVersionParams) {
24 return true;
25 }
26 return false;
27 }
28
29 @override
30 int get hashCode {
31 return 55877452;
32 }
33 }
34
35 /**
36 * server.getVersion result
37 * 17 *
38 * { 18 * {
39 * "version": String 19 * "type": "add"
20 * "content": String
40 * } 21 * }
41 * 22 *
42 * Clients may not extend, implement or mix-in this class. 23 * Clients may not extend, implement or mix-in this class.
43 */ 24 */
44 class ServerGetVersionResult implements HasToJson { 25 class AddContentOverlay implements HasToJson {
45 String _version; 26 String _content;
46 27
47 /** 28 /**
48 * The version number of the analysis server. 29 * The new content of the file.
49 */ 30 */
50 String get version => _version; 31 String get content => _content;
51 32
52 /** 33 /**
53 * The version number of the analysis server. 34 * The new content of the file.
54 */ 35 */
55 void set version(String value) { 36 void set content(String value) {
56 assert(value != null); 37 assert(value != null);
57 this._version = value; 38 this._content = value;
58 } 39 }
59 40
60 ServerGetVersionResult(String version) { 41 AddContentOverlay(String content) {
61 this.version = version; 42 this.content = content;
62 } 43 }
63 44
64 factory ServerGetVersionResult.fromJson( 45 factory AddContentOverlay.fromJson(
65 JsonDecoder jsonDecoder, String jsonPath, Object json) { 46 JsonDecoder jsonDecoder, String jsonPath, Object json) {
66 if (json == null) { 47 if (json == null) {
67 json = {}; 48 json = {};
68 } 49 }
69 if (json is Map) { 50 if (json is Map) {
70 String version; 51 if (json["type"] != "add") {
71 if (json.containsKey("version")) { 52 throw jsonDecoder.mismatch(jsonPath, "equal " + "add", json);
72 version = 53 }
73 jsonDecoder.decodeString(jsonPath + ".version", json["version"]); 54 String content;
55 if (json.containsKey("content")) {
56 content =
57 jsonDecoder.decodeString(jsonPath + ".content", json["content"]);
74 } else { 58 } else {
75 throw jsonDecoder.missingKey(jsonPath, "version"); 59 throw jsonDecoder.mismatch(jsonPath, "content");
76 } 60 }
77 return new ServerGetVersionResult(version); 61 return new AddContentOverlay(content);
78 } else { 62 } else {
79 throw jsonDecoder.mismatch(jsonPath, "server.getVersion result", json); 63 throw jsonDecoder.mismatch(jsonPath, "AddContentOverlay", json);
80 } 64 }
81 } 65 }
82 66
83 factory ServerGetVersionResult.fromResponse(Response response) { 67 @override
84 return new ServerGetVersionResult.fromJson(
85 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
86 "result",
87 response._result);
88 }
89
90 Map<String, dynamic> toJson() { 68 Map<String, dynamic> toJson() {
91 Map<String, dynamic> result = {}; 69 Map<String, dynamic> result = {};
92 result["version"] = version; 70 result["type"] = "add";
71 result["content"] = content;
93 return result; 72 return result;
94 } 73 }
95 74
96 Response toResponse(String id) {
97 return new Response(id, result: toJson());
98 }
99
100 @override 75 @override
101 String toString() => JSON.encode(toJson()); 76 String toString() => JSON.encode(toJson());
102 77
103 @override 78 @override
104 bool operator ==(other) { 79 bool operator ==(other) {
105 if (other is ServerGetVersionResult) { 80 if (other is AddContentOverlay) {
106 return version == other.version; 81 return content == other.content;
107 } 82 }
108 return false; 83 return false;
109 } 84 }
110 85
111 @override 86 @override
112 int get hashCode { 87 int get hashCode {
113 int hash = 0; 88 int hash = 0;
114 hash = JenkinsSmiHash.combine(hash, version.hashCode); 89 hash = JenkinsSmiHash.combine(hash, 704418402);
90 hash = JenkinsSmiHash.combine(hash, content.hashCode);
115 return JenkinsSmiHash.finish(hash); 91 return JenkinsSmiHash.finish(hash);
116 } 92 }
117 } 93 }
118 94
119 /** 95 /**
120 * server.shutdown params 96 * analysis.analyzedFiles params
121 *
122 * Clients may not extend, implement or mix-in this class.
123 */
124 class ServerShutdownParams {
125 Request toRequest(String id) {
126 return new Request(id, "server.shutdown", null);
127 }
128
129 @override
130 bool operator ==(other) {
131 if (other is ServerShutdownParams) {
132 return true;
133 }
134 return false;
135 }
136
137 @override
138 int get hashCode {
139 return 366630911;
140 }
141 }
142
143 /**
144 * server.shutdown result
145 *
146 * Clients may not extend, implement or mix-in this class.
147 */
148 class ServerShutdownResult {
149 Response toResponse(String id) {
150 return new Response(id, result: null);
151 }
152
153 @override
154 bool operator ==(other) {
155 if (other is ServerShutdownResult) {
156 return true;
157 }
158 return false;
159 }
160
161 @override
162 int get hashCode {
163 return 193626532;
164 }
165 }
166
167 /**
168 * server.setSubscriptions params
169 * 97 *
170 * { 98 * {
171 * "subscriptions": List<ServerService> 99 * "directories": List<FilePath>
172 * } 100 * }
173 * 101 *
174 * Clients may not extend, implement or mix-in this class. 102 * Clients may not extend, implement or mix-in this class.
175 */ 103 */
176 class ServerSetSubscriptionsParams implements HasToJson { 104 class AnalysisAnalyzedFilesParams implements HasToJson {
177 List<ServerService> _subscriptions; 105 List<String> _directories;
178 106
179 /** 107 /**
180 * A list of the services being subscribed to. 108 * A list of the paths of the files that are being analyzed.
181 */ 109 */
182 List<ServerService> get subscriptions => _subscriptions; 110 List<String> get directories => _directories;
183 111
184 /** 112 /**
185 * A list of the services being subscribed to. 113 * A list of the paths of the files that are being analyzed.
186 */ 114 */
187 void set subscriptions(List<ServerService> value) { 115 void set directories(List<String> value) {
188 assert(value != null); 116 assert(value != null);
189 this._subscriptions = value; 117 this._directories = value;
190 } 118 }
191 119
192 ServerSetSubscriptionsParams(List<ServerService> subscriptions) { 120 AnalysisAnalyzedFilesParams(List<String> directories) {
193 this.subscriptions = subscriptions; 121 this.directories = directories;
194 } 122 }
195 123
196 factory ServerSetSubscriptionsParams.fromJson( 124 factory AnalysisAnalyzedFilesParams.fromJson(
197 JsonDecoder jsonDecoder, String jsonPath, Object json) { 125 JsonDecoder jsonDecoder, String jsonPath, Object json) {
198 if (json == null) { 126 if (json == null) {
199 json = {}; 127 json = {};
200 } 128 }
201 if (json is Map) { 129 if (json is Map) {
202 List<ServerService> subscriptions; 130 List<String> directories;
203 if (json.containsKey("subscriptions")) { 131 if (json.containsKey("directories")) {
204 subscriptions = jsonDecoder.decodeList( 132 directories = jsonDecoder.decodeList(jsonPath + ".directories",
205 jsonPath + ".subscriptions", 133 json["directories"], jsonDecoder.decodeString);
206 json["subscriptions"],
207 (String jsonPath, Object json) =>
208 new ServerService.fromJson(jsonDecoder, jsonPath, json));
209 } else { 134 } else {
210 throw jsonDecoder.missingKey(jsonPath, "subscriptions"); 135 throw jsonDecoder.mismatch(jsonPath, "directories");
211 } 136 }
212 return new ServerSetSubscriptionsParams(subscriptions); 137 return new AnalysisAnalyzedFilesParams(directories);
213 } else { 138 } else {
214 throw jsonDecoder.mismatch( 139 throw jsonDecoder.mismatch(
215 jsonPath, "server.setSubscriptions params", json); 140 jsonPath, "analysis.analyzedFiles params", json);
216 } 141 }
217 } 142 }
218 143
219 factory ServerSetSubscriptionsParams.fromRequest(Request request) { 144 factory AnalysisAnalyzedFilesParams.fromNotification(
220 return new ServerSetSubscriptionsParams.fromJson( 145 Notification notification) {
221 new RequestDecoder(request), "params", request._params); 146 return new AnalysisAnalyzedFilesParams.fromJson(
147 new ResponseDecoder(null), "params", notification.params);
222 } 148 }
223 149
150 @override
224 Map<String, dynamic> toJson() { 151 Map<String, dynamic> toJson() {
225 Map<String, dynamic> result = {}; 152 Map<String, dynamic> result = {};
226 result["subscriptions"] = 153 result["directories"] = directories;
227 subscriptions.map((ServerService value) => value.toJson()).toList();
228 return result; 154 return result;
229 } 155 }
230 156
231 Request toRequest(String id) { 157 Notification toNotification() {
232 return new Request(id, "server.setSubscriptions", toJson()); 158 return new Notification("analysis.analyzedFiles", toJson());
233 } 159 }
234 160
235 @override 161 @override
236 String toString() => JSON.encode(toJson()); 162 String toString() => JSON.encode(toJson());
237 163
238 @override 164 @override
239 bool operator ==(other) { 165 bool operator ==(other) {
240 if (other is ServerSetSubscriptionsParams) { 166 if (other is AnalysisAnalyzedFilesParams) {
241 return listEqual(subscriptions, other.subscriptions, 167 return listEqual(
242 (ServerService a, ServerService b) => a == b); 168 directories, other.directories, (String a, String b) => a == b);
243 } 169 }
244 return false; 170 return false;
245 } 171 }
246 172
247 @override 173 @override
248 int get hashCode { 174 int get hashCode {
249 int hash = 0; 175 int hash = 0;
250 hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode); 176 hash = JenkinsSmiHash.combine(hash, directories.hashCode);
251 return JenkinsSmiHash.finish(hash); 177 return JenkinsSmiHash.finish(hash);
252 } 178 }
253 } 179 }
254 180
255 /** 181 /**
256 * server.setSubscriptions result 182 * AnalysisError
257 *
258 * Clients may not extend, implement or mix-in this class.
259 */
260 class ServerSetSubscriptionsResult {
261 Response toResponse(String id) {
262 return new Response(id, result: null);
263 }
264
265 @override
266 bool operator ==(other) {
267 if (other is ServerSetSubscriptionsResult) {
268 return true;
269 }
270 return false;
271 }
272
273 @override
274 int get hashCode {
275 return 748820900;
276 }
277 }
278
279 /**
280 * server.connected params
281 * 183 *
282 * { 184 * {
283 * "version": String 185 * "severity": AnalysisErrorSeverity
284 * "pid": int 186 * "type": AnalysisErrorType
285 * "sessionId": optional String 187 * "location": Location
188 * "message": String
189 * "correction": optional String
190 * "code": String
191 * "hasFix": optional bool
286 * } 192 * }
287 * 193 *
288 * Clients may not extend, implement or mix-in this class. 194 * Clients may not extend, implement or mix-in this class.
289 */ 195 */
290 class ServerConnectedParams implements HasToJson { 196 class AnalysisError implements HasToJson {
291 String _version; 197 AnalysisErrorSeverity _severity;
292 198
293 int _pid; 199 AnalysisErrorType _type;
294 200
295 String _sessionId; 201 Location _location;
296 202
297 /** 203 String _message;
298 * The version number of the analysis server. 204
299 */ 205 String _correction;
300 String get version => _version; 206
301 207 String _code;
302 /** 208
303 * The version number of the analysis server. 209 bool _hasFix;
304 */ 210
305 void set version(String value) { 211 /**
306 assert(value != null); 212 * The severity of the error.
307 this._version = value; 213 */
308 } 214 AnalysisErrorSeverity get severity => _severity;
309 215
310 /** 216 /**
311 * The process id of the analysis server process. 217 * The severity of the error.
312 */ 218 */
313 int get pid => _pid; 219 void set severity(AnalysisErrorSeverity value) {
314 220 assert(value != null);
315 /** 221 this._severity = value;
316 * The process id of the analysis server process. 222 }
317 */ 223
318 void set pid(int value) { 224 /**
319 assert(value != null); 225 * The type of the error.
320 this._pid = value; 226 */
321 } 227 AnalysisErrorType get type => _type;
322 228
323 /** 229 /**
324 * The session id for this session. 230 * The type of the error.
325 */ 231 */
326 String get sessionId => _sessionId; 232 void set type(AnalysisErrorType value) {
327 233 assert(value != null);
328 /** 234 this._type = value;
329 * The session id for this session. 235 }
330 */ 236
331 void set sessionId(String value) { 237 /**
332 this._sessionId = value; 238 * The location associated with the error.
333 } 239 */
334 240 Location get location => _location;
335 ServerConnectedParams(String version, int pid, {String sessionId}) { 241
336 this.version = version; 242 /**
337 this.pid = pid; 243 * The location associated with the error.
338 this.sessionId = sessionId; 244 */
339 } 245 void set location(Location value) {
340 246 assert(value != null);
341 factory ServerConnectedParams.fromJson( 247 this._location = value;
248 }
249
250 /**
251 * The message to be displayed for this error. The message should indicate
252 * what is wrong with the code and why it is wrong.
253 */
254 String get message => _message;
255
256 /**
257 * The message to be displayed for this error. The message should indicate
258 * what is wrong with the code and why it is wrong.
259 */
260 void set message(String value) {
261 assert(value != null);
262 this._message = value;
263 }
264
265 /**
266 * The correction message to be displayed for this error. The correction
267 * message should indicate how the user can fix the error. The field is
268 * omitted if there is no correction message associated with the error code.
269 */
270 String get correction => _correction;
271
272 /**
273 * The correction message to be displayed for this error. The correction
274 * message should indicate how the user can fix the error. The field is
275 * omitted if there is no correction message associated with the error code.
276 */
277 void set correction(String value) {
278 this._correction = value;
279 }
280
281 /**
282 * The name, as a string, of the error code associated with this error.
283 */
284 String get code => _code;
285
286 /**
287 * The name, as a string, of the error code associated with this error.
288 */
289 void set code(String value) {
290 assert(value != null);
291 this._code = value;
292 }
293
294 /**
295 * A hint to indicate to interested clients that this error has an associated
296 * fix (or fixes). The absence of this field implies there are not known to
297 * be fixes. Note that since the operation to calculate whether fixes apply
298 * needs to be performant it is possible that complicated tests will be
299 * skipped and a false negative returned. For this reason, this attribute
300 * should be treated as a "hint". Despite the possibility of false negatives,
301 * no false positives should be returned. If a client sees this flag set they
302 * can proceed with the confidence that there are in fact associated fixes.
303 */
304 bool get hasFix => _hasFix;
305
306 /**
307 * A hint to indicate to interested clients that this error has an associated
308 * fix (or fixes). The absence of this field implies there are not known to
309 * be fixes. Note that since the operation to calculate whether fixes apply
310 * needs to be performant it is possible that complicated tests will be
311 * skipped and a false negative returned. For this reason, this attribute
312 * should be treated as a "hint". Despite the possibility of false negatives,
313 * no false positives should be returned. If a client sees this flag set they
314 * can proceed with the confidence that there are in fact associated fixes.
315 */
316 void set hasFix(bool value) {
317 this._hasFix = value;
318 }
319
320 AnalysisError(AnalysisErrorSeverity severity, AnalysisErrorType type,
321 Location location, String message, String code,
322 {String correction, bool hasFix}) {
323 this.severity = severity;
324 this.type = type;
325 this.location = location;
326 this.message = message;
327 this.correction = correction;
328 this.code = code;
329 this.hasFix = hasFix;
330 }
331
332 factory AnalysisError.fromJson(
342 JsonDecoder jsonDecoder, String jsonPath, Object json) { 333 JsonDecoder jsonDecoder, String jsonPath, Object json) {
343 if (json == null) { 334 if (json == null) {
344 json = {}; 335 json = {};
345 } 336 }
346 if (json is Map) { 337 if (json is Map) {
347 String version; 338 AnalysisErrorSeverity severity;
348 if (json.containsKey("version")) { 339 if (json.containsKey("severity")) {
349 version = 340 severity = new AnalysisErrorSeverity.fromJson(
350 jsonDecoder.decodeString(jsonPath + ".version", json["version"]); 341 jsonDecoder, jsonPath + ".severity", json["severity"]);
351 } else { 342 } else {
352 throw jsonDecoder.missingKey(jsonPath, "version"); 343 throw jsonDecoder.mismatch(jsonPath, "severity");
353 } 344 }
354 int pid; 345 AnalysisErrorType type;
355 if (json.containsKey("pid")) { 346 if (json.containsKey("type")) {
356 pid = jsonDecoder.decodeInt(jsonPath + ".pid", json["pid"]); 347 type = new AnalysisErrorType.fromJson(
357 } else { 348 jsonDecoder, jsonPath + ".type", json["type"]);
358 throw jsonDecoder.missingKey(jsonPath, "pid"); 349 } else {
359 } 350 throw jsonDecoder.mismatch(jsonPath, "type");
360 String sessionId; 351 }
361 if (json.containsKey("sessionId")) { 352 Location location;
362 sessionId = jsonDecoder.decodeString( 353 if (json.containsKey("location")) {
363 jsonPath + ".sessionId", json["sessionId"]); 354 location = new Location.fromJson(
364 } 355 jsonDecoder, jsonPath + ".location", json["location"]);
365 return new ServerConnectedParams(version, pid, sessionId: sessionId); 356 } else {
366 } else { 357 throw jsonDecoder.mismatch(jsonPath, "location");
367 throw jsonDecoder.mismatch(jsonPath, "server.connected params", json);
368 }
369 }
370
371 factory ServerConnectedParams.fromNotification(Notification notification) {
372 return new ServerConnectedParams.fromJson(
373 new ResponseDecoder(null), "params", notification._params);
374 }
375
376 Map<String, dynamic> toJson() {
377 Map<String, dynamic> result = {};
378 result["version"] = version;
379 result["pid"] = pid;
380 if (sessionId != null) {
381 result["sessionId"] = sessionId;
382 }
383 return result;
384 }
385
386 Notification toNotification() {
387 return new Notification("server.connected", toJson());
388 }
389
390 @override
391 String toString() => JSON.encode(toJson());
392
393 @override
394 bool operator ==(other) {
395 if (other is ServerConnectedParams) {
396 return version == other.version &&
397 pid == other.pid &&
398 sessionId == other.sessionId;
399 }
400 return false;
401 }
402
403 @override
404 int get hashCode {
405 int hash = 0;
406 hash = JenkinsSmiHash.combine(hash, version.hashCode);
407 hash = JenkinsSmiHash.combine(hash, pid.hashCode);
408 hash = JenkinsSmiHash.combine(hash, sessionId.hashCode);
409 return JenkinsSmiHash.finish(hash);
410 }
411 }
412
413 /**
414 * server.error params
415 *
416 * {
417 * "isFatal": bool
418 * "message": String
419 * "stackTrace": String
420 * }
421 *
422 * Clients may not extend, implement or mix-in this class.
423 */
424 class ServerErrorParams implements HasToJson {
425 bool _isFatal;
426
427 String _message;
428
429 String _stackTrace;
430
431 /**
432 * True if the error is a fatal error, meaning that the server will shutdown
433 * automatically after sending this notification.
434 */
435 bool get isFatal => _isFatal;
436
437 /**
438 * True if the error is a fatal error, meaning that the server will shutdown
439 * automatically after sending this notification.
440 */
441 void set isFatal(bool value) {
442 assert(value != null);
443 this._isFatal = value;
444 }
445
446 /**
447 * The error message indicating what kind of error was encountered.
448 */
449 String get message => _message;
450
451 /**
452 * The error message indicating what kind of error was encountered.
453 */
454 void set message(String value) {
455 assert(value != null);
456 this._message = value;
457 }
458
459 /**
460 * The stack trace associated with the generation of the error, used for
461 * debugging the server.
462 */
463 String get stackTrace => _stackTrace;
464
465 /**
466 * The stack trace associated with the generation of the error, used for
467 * debugging the server.
468 */
469 void set stackTrace(String value) {
470 assert(value != null);
471 this._stackTrace = value;
472 }
473
474 ServerErrorParams(bool isFatal, String message, String stackTrace) {
475 this.isFatal = isFatal;
476 this.message = message;
477 this.stackTrace = stackTrace;
478 }
479
480 factory ServerErrorParams.fromJson(
481 JsonDecoder jsonDecoder, String jsonPath, Object json) {
482 if (json == null) {
483 json = {};
484 }
485 if (json is Map) {
486 bool isFatal;
487 if (json.containsKey("isFatal")) {
488 isFatal =
489 jsonDecoder.decodeBool(jsonPath + ".isFatal", json["isFatal"]);
490 } else {
491 throw jsonDecoder.missingKey(jsonPath, "isFatal");
492 } 358 }
493 String message; 359 String message;
494 if (json.containsKey("message")) { 360 if (json.containsKey("message")) {
495 message = 361 message =
496 jsonDecoder.decodeString(jsonPath + ".message", json["message"]); 362 jsonDecoder.decodeString(jsonPath + ".message", json["message"]);
497 } else { 363 } else {
498 throw jsonDecoder.missingKey(jsonPath, "message"); 364 throw jsonDecoder.mismatch(jsonPath, "message");
499 } 365 }
500 String stackTrace; 366 String correction;
501 if (json.containsKey("stackTrace")) { 367 if (json.containsKey("correction")) {
502 stackTrace = jsonDecoder.decodeString( 368 correction = jsonDecoder.decodeString(
503 jsonPath + ".stackTrace", json["stackTrace"]); 369 jsonPath + ".correction", json["correction"]);
504 } else { 370 }
505 throw jsonDecoder.missingKey(jsonPath, "stackTrace"); 371 String code;
506 } 372 if (json.containsKey("code")) {
507 return new ServerErrorParams(isFatal, message, stackTrace); 373 code = jsonDecoder.decodeString(jsonPath + ".code", json["code"]);
374 } else {
375 throw jsonDecoder.mismatch(jsonPath, "code");
376 }
377 bool hasFix;
378 if (json.containsKey("hasFix")) {
379 hasFix = jsonDecoder.decodeBool(jsonPath + ".hasFix", json["hasFix"]);
380 }
381 return new AnalysisError(severity, type, location, message, code,
382 correction: correction, hasFix: hasFix);
508 } else { 383 } else {
509 throw jsonDecoder.mismatch(jsonPath, "server.error params", json); 384 throw jsonDecoder.mismatch(jsonPath, "AnalysisError", json);
510 } 385 }
511 } 386 }
512 387
513 factory ServerErrorParams.fromNotification(Notification notification) { 388 @override
514 return new ServerErrorParams.fromJson(
515 new ResponseDecoder(null), "params", notification._params);
516 }
517
518 Map<String, dynamic> toJson() { 389 Map<String, dynamic> toJson() {
519 Map<String, dynamic> result = {}; 390 Map<String, dynamic> result = {};
520 result["isFatal"] = isFatal; 391 result["severity"] = severity.toJson();
392 result["type"] = type.toJson();
393 result["location"] = location.toJson();
521 result["message"] = message; 394 result["message"] = message;
522 result["stackTrace"] = stackTrace; 395 if (correction != null) {
396 result["correction"] = correction;
397 }
398 result["code"] = code;
399 if (hasFix != null) {
400 result["hasFix"] = hasFix;
401 }
523 return result; 402 return result;
524 } 403 }
525 404
526 Notification toNotification() {
527 return new Notification("server.error", toJson());
528 }
529
530 @override 405 @override
531 String toString() => JSON.encode(toJson()); 406 String toString() => JSON.encode(toJson());
532 407
533 @override 408 @override
534 bool operator ==(other) { 409 bool operator ==(other) {
535 if (other is ServerErrorParams) { 410 if (other is AnalysisError) {
536 return isFatal == other.isFatal && 411 return severity == other.severity &&
412 type == other.type &&
413 location == other.location &&
537 message == other.message && 414 message == other.message &&
538 stackTrace == other.stackTrace; 415 correction == other.correction &&
416 code == other.code &&
417 hasFix == other.hasFix;
539 } 418 }
540 return false; 419 return false;
541 } 420 }
542 421
543 @override 422 @override
544 int get hashCode { 423 int get hashCode {
545 int hash = 0; 424 int hash = 0;
546 hash = JenkinsSmiHash.combine(hash, isFatal.hashCode); 425 hash = JenkinsSmiHash.combine(hash, severity.hashCode);
426 hash = JenkinsSmiHash.combine(hash, type.hashCode);
427 hash = JenkinsSmiHash.combine(hash, location.hashCode);
547 hash = JenkinsSmiHash.combine(hash, message.hashCode); 428 hash = JenkinsSmiHash.combine(hash, message.hashCode);
548 hash = JenkinsSmiHash.combine(hash, stackTrace.hashCode); 429 hash = JenkinsSmiHash.combine(hash, correction.hashCode);
430 hash = JenkinsSmiHash.combine(hash, code.hashCode);
431 hash = JenkinsSmiHash.combine(hash, hasFix.hashCode);
549 return JenkinsSmiHash.finish(hash); 432 return JenkinsSmiHash.finish(hash);
550 } 433 }
551 } 434 }
552 435
553 /** 436 /**
554 * server.status params 437 * AnalysisErrorFixes
555 * 438 *
556 * { 439 * {
557 * "analysis": optional AnalysisStatus 440 * "error": AnalysisError
558 * "pub": optional PubStatus 441 * "fixes": List<SourceChange>
559 * } 442 * }
560 * 443 *
561 * Clients may not extend, implement or mix-in this class. 444 * Clients may not extend, implement or mix-in this class.
562 */ 445 */
563 class ServerStatusParams implements HasToJson { 446 class AnalysisErrorFixes implements HasToJson {
564 AnalysisStatus _analysis; 447 AnalysisError _error;
565 448
566 PubStatus _pub; 449 List<SourceChange> _fixes;
567 450
568 /** 451 /**
569 * The current status of analysis, including whether analysis is being 452 * The error with which the fixes are associated.
570 * performed and if so what is being analyzed.
571 */ 453 */
572 AnalysisStatus get analysis => _analysis; 454 AnalysisError get error => _error;
573 455
574 /** 456 /**
575 * The current status of analysis, including whether analysis is being 457 * The error with which the fixes are associated.
576 * performed and if so what is being analyzed.
577 */ 458 */
578 void set analysis(AnalysisStatus value) { 459 void set error(AnalysisError value) {
579 this._analysis = value; 460 assert(value != null);
461 this._error = value;
580 } 462 }
581 463
582 /** 464 /**
583 * The current status of pub execution, indicating whether we are currently 465 * The fixes associated with the error.
584 * running pub.
585 */ 466 */
586 PubStatus get pub => _pub; 467 List<SourceChange> get fixes => _fixes;
587 468
588 /** 469 /**
589 * The current status of pub execution, indicating whether we are currently 470 * The fixes associated with the error.
590 * running pub.
591 */ 471 */
592 void set pub(PubStatus value) { 472 void set fixes(List<SourceChange> value) {
593 this._pub = value; 473 assert(value != null);
474 this._fixes = value;
594 } 475 }
595 476
596 ServerStatusParams({AnalysisStatus analysis, PubStatus pub}) { 477 AnalysisErrorFixes(AnalysisError error, {List<SourceChange> fixes}) {
597 this.analysis = analysis; 478 this.error = error;
598 this.pub = pub; 479 if (fixes == null) {
480 this.fixes = <SourceChange>[];
481 } else {
482 this.fixes = fixes;
483 }
599 } 484 }
600 485
601 factory ServerStatusParams.fromJson( 486 factory AnalysisErrorFixes.fromJson(
602 JsonDecoder jsonDecoder, String jsonPath, Object json) { 487 JsonDecoder jsonDecoder, String jsonPath, Object json) {
603 if (json == null) { 488 if (json == null) {
604 json = {}; 489 json = {};
605 } 490 }
606 if (json is Map) { 491 if (json is Map) {
607 AnalysisStatus analysis; 492 AnalysisError error;
608 if (json.containsKey("analysis")) { 493 if (json.containsKey("error")) {
609 analysis = new AnalysisStatus.fromJson( 494 error = new AnalysisError.fromJson(
610 jsonDecoder, jsonPath + ".analysis", json["analysis"]); 495 jsonDecoder, jsonPath + ".error", json["error"]);
496 } else {
497 throw jsonDecoder.mismatch(jsonPath, "error");
611 } 498 }
612 PubStatus pub; 499 List<SourceChange> fixes;
613 if (json.containsKey("pub")) { 500 if (json.containsKey("fixes")) {
614 pub = 501 fixes = jsonDecoder.decodeList(
615 new PubStatus.fromJson(jsonDecoder, jsonPath + ".pub", json["pub"]); 502 jsonPath + ".fixes",
503 json["fixes"],
504 (String jsonPath, Object json) =>
505 new SourceChange.fromJson(jsonDecoder, jsonPath, json));
506 } else {
507 throw jsonDecoder.mismatch(jsonPath, "fixes");
616 } 508 }
617 return new ServerStatusParams(analysis: analysis, pub: pub); 509 return new AnalysisErrorFixes(error, fixes: fixes);
618 } else { 510 } else {
619 throw jsonDecoder.mismatch(jsonPath, "server.status params", json); 511 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorFixes", json);
620 } 512 }
621 } 513 }
622 514
623 factory ServerStatusParams.fromNotification(Notification notification) { 515 @override
624 return new ServerStatusParams.fromJson(
625 new ResponseDecoder(null), "params", notification._params);
626 }
627
628 Map<String, dynamic> toJson() { 516 Map<String, dynamic> toJson() {
629 Map<String, dynamic> result = {}; 517 Map<String, dynamic> result = {};
630 if (analysis != null) { 518 result["error"] = error.toJson();
631 result["analysis"] = analysis.toJson(); 519 result["fixes"] =
632 } 520 fixes.map((SourceChange value) => value.toJson()).toList();
633 if (pub != null) {
634 result["pub"] = pub.toJson();
635 }
636 return result; 521 return result;
637 } 522 }
638 523
639 Notification toNotification() {
640 return new Notification("server.status", toJson());
641 }
642
643 @override 524 @override
644 String toString() => JSON.encode(toJson()); 525 String toString() => JSON.encode(toJson());
645 526
646 @override 527 @override
647 bool operator ==(other) { 528 bool operator ==(other) {
648 if (other is ServerStatusParams) { 529 if (other is AnalysisErrorFixes) {
649 return analysis == other.analysis && pub == other.pub; 530 return error == other.error &&
531 listEqual(
532 fixes, other.fixes, (SourceChange a, SourceChange b) => a == b);
650 } 533 }
651 return false; 534 return false;
652 } 535 }
653 536
654 @override 537 @override
655 int get hashCode { 538 int get hashCode {
656 int hash = 0; 539 int hash = 0;
657 hash = JenkinsSmiHash.combine(hash, analysis.hashCode); 540 hash = JenkinsSmiHash.combine(hash, error.hashCode);
658 hash = JenkinsSmiHash.combine(hash, pub.hashCode); 541 hash = JenkinsSmiHash.combine(hash, fixes.hashCode);
659 return JenkinsSmiHash.finish(hash); 542 return JenkinsSmiHash.finish(hash);
660 } 543 }
661 } 544 }
662 545
663 /** 546 /**
664 * analysis.getErrors params 547 * AnalysisErrorSeverity
665 * 548 *
666 * { 549 * enum {
667 * "file": FilePath 550 * INFO
551 * WARNING
552 * ERROR
668 * } 553 * }
669 * 554 *
670 * Clients may not extend, implement or mix-in this class. 555 * Clients may not extend, implement or mix-in this class.
671 */ 556 */
672 class AnalysisGetErrorsParams implements HasToJson { 557 class AnalysisErrorSeverity implements Enum {
673 String _file; 558 static const AnalysisErrorSeverity INFO =
559 const AnalysisErrorSeverity._("INFO");
560
561 static const AnalysisErrorSeverity WARNING =
562 const AnalysisErrorSeverity._("WARNING");
563
564 static const AnalysisErrorSeverity ERROR =
565 const AnalysisErrorSeverity._("ERROR");
674 566
675 /** 567 /**
676 * The file for which errors are being requested. 568 * A list containing all of the enum values that are defined.
677 */ 569 */
678 String get file => _file; 570 static const List<AnalysisErrorSeverity> VALUES =
571 const <AnalysisErrorSeverity>[INFO, WARNING, ERROR];
679 572
680 /** 573 @override
681 * The file for which errors are being requested. 574 final String name;
682 */ 575
683 void set file(String value) { 576 const AnalysisErrorSeverity._(this.name);
684 assert(value != null); 577
685 this._file = value; 578 factory AnalysisErrorSeverity(String name) {
579 switch (name) {
580 case "INFO":
581 return INFO;
582 case "WARNING":
583 return WARNING;
584 case "ERROR":
585 return ERROR;
586 }
587 throw new Exception('Illegal enum value: $name');
686 } 588 }
687 589
688 AnalysisGetErrorsParams(String file) { 590 factory AnalysisErrorSeverity.fromJson(
689 this.file = file;
690 }
691
692 factory AnalysisGetErrorsParams.fromJson(
693 JsonDecoder jsonDecoder, String jsonPath, Object json) { 591 JsonDecoder jsonDecoder, String jsonPath, Object json) {
694 if (json == null) { 592 if (json is String) {
695 json = {}; 593 try {
594 return new AnalysisErrorSeverity(json);
595 } catch (_) {
596 // Fall through
597 }
696 } 598 }
697 if (json is Map) { 599 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorSeverity", json);
698 String file;
699 if (json.containsKey("file")) {
700 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
701 } else {
702 throw jsonDecoder.missingKey(jsonPath, "file");
703 }
704 return new AnalysisGetErrorsParams(file);
705 } else {
706 throw jsonDecoder.mismatch(jsonPath, "analysis.getErrors params", json);
707 }
708 }
709
710 factory AnalysisGetErrorsParams.fromRequest(Request request) {
711 return new AnalysisGetErrorsParams.fromJson(
712 new RequestDecoder(request), "params", request._params);
713 }
714
715 Map<String, dynamic> toJson() {
716 Map<String, dynamic> result = {};
717 result["file"] = file;
718 return result;
719 }
720
721 Request toRequest(String id) {
722 return new Request(id, "analysis.getErrors", toJson());
723 } 600 }
724 601
725 @override 602 @override
726 String toString() => JSON.encode(toJson()); 603 String toString() => "AnalysisErrorSeverity.$name";
604
605 String toJson() => name;
606 }
607
608 /**
609 * AnalysisErrorType
610 *
611 * enum {
612 * CHECKED_MODE_COMPILE_TIME_ERROR
613 * COMPILE_TIME_ERROR
614 * HINT
615 * LINT
616 * STATIC_TYPE_WARNING
617 * STATIC_WARNING
618 * SYNTACTIC_ERROR
619 * TODO
620 * }
621 *
622 * Clients may not extend, implement or mix-in this class.
623 */
624 class AnalysisErrorType implements Enum {
625 static const AnalysisErrorType CHECKED_MODE_COMPILE_TIME_ERROR =
626 const AnalysisErrorType._("CHECKED_MODE_COMPILE_TIME_ERROR");
627
628 static const AnalysisErrorType COMPILE_TIME_ERROR =
629 const AnalysisErrorType._("COMPILE_TIME_ERROR");
630
631 static const AnalysisErrorType HINT = const AnalysisErrorType._("HINT");
632
633 static const AnalysisErrorType LINT = const AnalysisErrorType._("LINT");
634
635 static const AnalysisErrorType STATIC_TYPE_WARNING =
636 const AnalysisErrorType._("STATIC_TYPE_WARNING");
637
638 static const AnalysisErrorType STATIC_WARNING =
639 const AnalysisErrorType._("STATIC_WARNING");
640
641 static const AnalysisErrorType SYNTACTIC_ERROR =
642 const AnalysisErrorType._("SYNTACTIC_ERROR");
643
644 static const AnalysisErrorType TODO = const AnalysisErrorType._("TODO");
645
646 /**
647 * A list containing all of the enum values that are defined.
648 */
649 static const List<AnalysisErrorType> VALUES = const <AnalysisErrorType>[
650 CHECKED_MODE_COMPILE_TIME_ERROR,
651 COMPILE_TIME_ERROR,
652 HINT,
653 LINT,
654 STATIC_TYPE_WARNING,
655 STATIC_WARNING,
656 SYNTACTIC_ERROR,
657 TODO
658 ];
727 659
728 @override 660 @override
729 bool operator ==(other) { 661 final String name;
730 if (other is AnalysisGetErrorsParams) { 662
731 return file == other.file; 663 const AnalysisErrorType._(this.name);
664
665 factory AnalysisErrorType(String name) {
666 switch (name) {
667 case "CHECKED_MODE_COMPILE_TIME_ERROR":
668 return CHECKED_MODE_COMPILE_TIME_ERROR;
669 case "COMPILE_TIME_ERROR":
670 return COMPILE_TIME_ERROR;
671 case "HINT":
672 return HINT;
673 case "LINT":
674 return LINT;
675 case "STATIC_TYPE_WARNING":
676 return STATIC_TYPE_WARNING;
677 case "STATIC_WARNING":
678 return STATIC_WARNING;
679 case "SYNTACTIC_ERROR":
680 return SYNTACTIC_ERROR;
681 case "TODO":
682 return TODO;
732 } 683 }
733 return false; 684 throw new Exception('Illegal enum value: $name');
685 }
686
687 factory AnalysisErrorType.fromJson(
688 JsonDecoder jsonDecoder, String jsonPath, Object json) {
689 if (json is String) {
690 try {
691 return new AnalysisErrorType(json);
692 } catch (_) {
693 // Fall through
694 }
695 }
696 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorType", json);
734 } 697 }
735 698
736 @override 699 @override
737 int get hashCode { 700 String toString() => "AnalysisErrorType.$name";
738 int hash = 0; 701
739 hash = JenkinsSmiHash.combine(hash, file.hashCode); 702 String toJson() => name;
740 return JenkinsSmiHash.finish(hash);
741 }
742 } 703 }
743 704
744 /** 705 /**
745 * analysis.getErrors result 706 * analysis.errors params
746 * 707 *
747 * { 708 * {
709 * "file": FilePath
748 * "errors": List<AnalysisError> 710 * "errors": List<AnalysisError>
749 * } 711 * }
750 * 712 *
751 * Clients may not extend, implement or mix-in this class. 713 * Clients may not extend, implement or mix-in this class.
752 */ 714 */
753 class AnalysisGetErrorsResult implements HasToJson { 715 class AnalysisErrorsParams implements HasToJson {
716 String _file;
717
754 List<AnalysisError> _errors; 718 List<AnalysisError> _errors;
755 719
756 /** 720 /**
757 * The errors associated with the file. 721 * The file containing the errors.
758 */
759 List<AnalysisError> get errors => _errors;
760
761 /**
762 * The errors associated with the file.
763 */
764 void set errors(List<AnalysisError> value) {
765 assert(value != null);
766 this._errors = value;
767 }
768
769 AnalysisGetErrorsResult(List<AnalysisError> errors) {
770 this.errors = errors;
771 }
772
773 factory AnalysisGetErrorsResult.fromJson(
774 JsonDecoder jsonDecoder, String jsonPath, Object json) {
775 if (json == null) {
776 json = {};
777 }
778 if (json is Map) {
779 List<AnalysisError> errors;
780 if (json.containsKey("errors")) {
781 errors = jsonDecoder.decodeList(
782 jsonPath + ".errors",
783 json["errors"],
784 (String jsonPath, Object json) =>
785 new AnalysisError.fromJson(jsonDecoder, jsonPath, json));
786 } else {
787 throw jsonDecoder.missingKey(jsonPath, "errors");
788 }
789 return new AnalysisGetErrorsResult(errors);
790 } else {
791 throw jsonDecoder.mismatch(jsonPath, "analysis.getErrors result", json);
792 }
793 }
794
795 factory AnalysisGetErrorsResult.fromResponse(Response response) {
796 return new AnalysisGetErrorsResult.fromJson(
797 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
798 "result",
799 response._result);
800 }
801
802 Map<String, dynamic> toJson() {
803 Map<String, dynamic> result = {};
804 result["errors"] =
805 errors.map((AnalysisError value) => value.toJson()).toList();
806 return result;
807 }
808
809 Response toResponse(String id) {
810 return new Response(id, result: toJson());
811 }
812
813 @override
814 String toString() => JSON.encode(toJson());
815
816 @override
817 bool operator ==(other) {
818 if (other is AnalysisGetErrorsResult) {
819 return listEqual(
820 errors, other.errors, (AnalysisError a, AnalysisError b) => a == b);
821 }
822 return false;
823 }
824
825 @override
826 int get hashCode {
827 int hash = 0;
828 hash = JenkinsSmiHash.combine(hash, errors.hashCode);
829 return JenkinsSmiHash.finish(hash);
830 }
831 }
832
833 /**
834 * analysis.getHover params
835 *
836 * {
837 * "file": FilePath
838 * "offset": int
839 * }
840 *
841 * Clients may not extend, implement or mix-in this class.
842 */
843 class AnalysisGetHoverParams implements HasToJson {
844 String _file;
845
846 int _offset;
847
848 /**
849 * The file in which hover information is being requested.
850 */ 722 */
851 String get file => _file; 723 String get file => _file;
852 724
853 /** 725 /**
854 * The file in which hover information is being requested. 726 * The file containing the errors.
855 */ 727 */
856 void set file(String value) { 728 void set file(String value) {
857 assert(value != null); 729 assert(value != null);
858 this._file = value; 730 this._file = value;
859 } 731 }
860 732
861 /** 733 /**
862 * The offset for which hover information is being requested. 734 * The errors contained in the file.
863 */ 735 */
864 int get offset => _offset; 736 List<AnalysisError> get errors => _errors;
865 737
866 /** 738 /**
867 * The offset for which hover information is being requested. 739 * The errors contained in the file.
868 */ 740 */
869 void set offset(int value) { 741 void set errors(List<AnalysisError> value) {
870 assert(value != null); 742 assert(value != null);
871 this._offset = value; 743 this._errors = value;
872 } 744 }
873 745
874 AnalysisGetHoverParams(String file, int offset) { 746 AnalysisErrorsParams(String file, List<AnalysisError> errors) {
875 this.file = file; 747 this.file = file;
876 this.offset = offset; 748 this.errors = errors;
877 } 749 }
878 750
879 factory AnalysisGetHoverParams.fromJson( 751 factory AnalysisErrorsParams.fromJson(
880 JsonDecoder jsonDecoder, String jsonPath, Object json) { 752 JsonDecoder jsonDecoder, String jsonPath, Object json) {
881 if (json == null) { 753 if (json == null) {
882 json = {}; 754 json = {};
883 } 755 }
884 if (json is Map) { 756 if (json is Map) {
885 String file; 757 String file;
886 if (json.containsKey("file")) { 758 if (json.containsKey("file")) {
887 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 759 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
888 } else { 760 } else {
889 throw jsonDecoder.missingKey(jsonPath, "file"); 761 throw jsonDecoder.mismatch(jsonPath, "file");
890 } 762 }
891 int offset; 763 List<AnalysisError> errors;
892 if (json.containsKey("offset")) { 764 if (json.containsKey("errors")) {
893 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 765 errors = jsonDecoder.decodeList(
766 jsonPath + ".errors",
767 json["errors"],
768 (String jsonPath, Object json) =>
769 new AnalysisError.fromJson(jsonDecoder, jsonPath, json));
894 } else { 770 } else {
895 throw jsonDecoder.missingKey(jsonPath, "offset"); 771 throw jsonDecoder.mismatch(jsonPath, "errors");
896 } 772 }
897 return new AnalysisGetHoverParams(file, offset); 773 return new AnalysisErrorsParams(file, errors);
898 } else { 774 } else {
899 throw jsonDecoder.mismatch(jsonPath, "analysis.getHover params", json); 775 throw jsonDecoder.mismatch(jsonPath, "analysis.errors params", json);
900 } 776 }
901 } 777 }
902 778
903 factory AnalysisGetHoverParams.fromRequest(Request request) { 779 factory AnalysisErrorsParams.fromNotification(Notification notification) {
904 return new AnalysisGetHoverParams.fromJson( 780 return new AnalysisErrorsParams.fromJson(
905 new RequestDecoder(request), "params", request._params); 781 new ResponseDecoder(null), "params", notification.params);
906 } 782 }
907 783
784 @override
908 Map<String, dynamic> toJson() { 785 Map<String, dynamic> toJson() {
909 Map<String, dynamic> result = {}; 786 Map<String, dynamic> result = {};
910 result["file"] = file; 787 result["file"] = file;
911 result["offset"] = offset; 788 result["errors"] =
789 errors.map((AnalysisError value) => value.toJson()).toList();
912 return result; 790 return result;
913 } 791 }
914 792
915 Request toRequest(String id) { 793 Notification toNotification() {
916 return new Request(id, "analysis.getHover", toJson()); 794 return new Notification("analysis.errors", toJson());
917 } 795 }
918 796
919 @override 797 @override
920 String toString() => JSON.encode(toJson()); 798 String toString() => JSON.encode(toJson());
921 799
922 @override 800 @override
923 bool operator ==(other) { 801 bool operator ==(other) {
924 if (other is AnalysisGetHoverParams) { 802 if (other is AnalysisErrorsParams) {
925 return file == other.file && offset == other.offset; 803 return file == other.file &&
804 listEqual(errors, other.errors,
805 (AnalysisError a, AnalysisError b) => a == b);
926 } 806 }
927 return false; 807 return false;
928 } 808 }
929 809
930 @override 810 @override
931 int get hashCode { 811 int get hashCode {
932 int hash = 0; 812 int hash = 0;
933 hash = JenkinsSmiHash.combine(hash, file.hashCode); 813 hash = JenkinsSmiHash.combine(hash, file.hashCode);
934 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 814 hash = JenkinsSmiHash.combine(hash, errors.hashCode);
935 return JenkinsSmiHash.finish(hash); 815 return JenkinsSmiHash.finish(hash);
936 } 816 }
937 } 817 }
938 818
939 /** 819 /**
940 * analysis.getHover result 820 * analysis.flushResults params
941 * 821 *
942 * { 822 * {
943 * "hovers": List<HoverInformation> 823 * "files": List<FilePath>
944 * } 824 * }
945 * 825 *
946 * Clients may not extend, implement or mix-in this class. 826 * Clients may not extend, implement or mix-in this class.
947 */ 827 */
948 class AnalysisGetHoverResult implements HasToJson { 828 class AnalysisFlushResultsParams implements HasToJson {
949 List<HoverInformation> _hovers; 829 List<String> _files;
950 830
951 /** 831 /**
952 * The hover information associated with the location. The list will be empty 832 * The files that are no longer being analyzed.
953 * if no information could be determined for the location. The list can
954 * contain multiple items if the file is being analyzed in multiple contexts
955 * in conflicting ways (such as a part that is included in multiple
956 * libraries).
957 */ 833 */
958 List<HoverInformation> get hovers => _hovers; 834 List<String> get files => _files;
959 835
960 /** 836 /**
961 * The hover information associated with the location. The list will be empty 837 * The files that are no longer being analyzed.
962 * if no information could be determined for the location. The list can
963 * contain multiple items if the file is being analyzed in multiple contexts
964 * in conflicting ways (such as a part that is included in multiple
965 * libraries).
966 */ 838 */
967 void set hovers(List<HoverInformation> value) { 839 void set files(List<String> value) {
968 assert(value != null); 840 assert(value != null);
969 this._hovers = value; 841 this._files = value;
970 } 842 }
971 843
972 AnalysisGetHoverResult(List<HoverInformation> hovers) { 844 AnalysisFlushResultsParams(List<String> files) {
973 this.hovers = hovers; 845 this.files = files;
974 } 846 }
975 847
976 factory AnalysisGetHoverResult.fromJson( 848 factory AnalysisFlushResultsParams.fromJson(
977 JsonDecoder jsonDecoder, String jsonPath, Object json) { 849 JsonDecoder jsonDecoder, String jsonPath, Object json) {
978 if (json == null) { 850 if (json == null) {
979 json = {}; 851 json = {};
980 } 852 }
981 if (json is Map) { 853 if (json is Map) {
982 List<HoverInformation> hovers; 854 List<String> files;
983 if (json.containsKey("hovers")) { 855 if (json.containsKey("files")) {
984 hovers = jsonDecoder.decodeList( 856 files = jsonDecoder.decodeList(
985 jsonPath + ".hovers", 857 jsonPath + ".files", json["files"], jsonDecoder.decodeString);
986 json["hovers"],
987 (String jsonPath, Object json) =>
988 new HoverInformation.fromJson(jsonDecoder, jsonPath, json));
989 } else { 858 } else {
990 throw jsonDecoder.missingKey(jsonPath, "hovers"); 859 throw jsonDecoder.mismatch(jsonPath, "files");
991 } 860 }
992 return new AnalysisGetHoverResult(hovers); 861 return new AnalysisFlushResultsParams(files);
993 } else { 862 } else {
994 throw jsonDecoder.mismatch(jsonPath, "analysis.getHover result", json); 863 throw jsonDecoder.mismatch(
864 jsonPath, "analysis.flushResults params", json);
995 } 865 }
996 } 866 }
997 867
998 factory AnalysisGetHoverResult.fromResponse(Response response) { 868 factory AnalysisFlushResultsParams.fromNotification(
999 return new AnalysisGetHoverResult.fromJson( 869 Notification notification) {
1000 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), 870 return new AnalysisFlushResultsParams.fromJson(
1001 "result", 871 new ResponseDecoder(null), "params", notification.params);
1002 response._result);
1003 } 872 }
1004 873
874 @override
1005 Map<String, dynamic> toJson() { 875 Map<String, dynamic> toJson() {
1006 Map<String, dynamic> result = {}; 876 Map<String, dynamic> result = {};
1007 result["hovers"] = 877 result["files"] = files;
1008 hovers.map((HoverInformation value) => value.toJson()).toList();
1009 return result; 878 return result;
1010 } 879 }
1011 880
1012 Response toResponse(String id) { 881 Notification toNotification() {
1013 return new Response(id, result: toJson()); 882 return new Notification("analysis.flushResults", toJson());
1014 } 883 }
1015 884
1016 @override 885 @override
1017 String toString() => JSON.encode(toJson()); 886 String toString() => JSON.encode(toJson());
1018 887
1019 @override 888 @override
1020 bool operator ==(other) { 889 bool operator ==(other) {
1021 if (other is AnalysisGetHoverResult) { 890 if (other is AnalysisFlushResultsParams) {
1022 return listEqual(hovers, other.hovers, 891 return listEqual(files, other.files, (String a, String b) => a == b);
1023 (HoverInformation a, HoverInformation b) => a == b);
1024 } 892 }
1025 return false; 893 return false;
1026 } 894 }
1027 895
1028 @override 896 @override
1029 int get hashCode { 897 int get hashCode {
1030 int hash = 0; 898 int hash = 0;
1031 hash = JenkinsSmiHash.combine(hash, hovers.hashCode); 899 hash = JenkinsSmiHash.combine(hash, files.hashCode);
1032 return JenkinsSmiHash.finish(hash); 900 return JenkinsSmiHash.finish(hash);
1033 } 901 }
1034 } 902 }
1035 903
1036 /** 904 /**
1037 * analysis.getReachableSources params 905 * analysis.folding params
1038 * 906 *
1039 * { 907 * {
1040 * "file": FilePath 908 * "file": FilePath
909 * "regions": List<FoldingRegion>
1041 * } 910 * }
1042 * 911 *
1043 * Clients may not extend, implement or mix-in this class. 912 * Clients may not extend, implement or mix-in this class.
1044 */ 913 */
1045 class AnalysisGetReachableSourcesParams implements HasToJson { 914 class AnalysisFoldingParams implements HasToJson {
1046 String _file; 915 String _file;
1047 916
917 List<FoldingRegion> _regions;
918
1048 /** 919 /**
1049 * The file for which reachable source information is being requested. 920 * The file containing the folding regions.
1050 */ 921 */
1051 String get file => _file; 922 String get file => _file;
1052 923
1053 /** 924 /**
1054 * The file for which reachable source information is being requested. 925 * The file containing the folding regions.
1055 */ 926 */
1056 void set file(String value) { 927 void set file(String value) {
1057 assert(value != null); 928 assert(value != null);
1058 this._file = value; 929 this._file = value;
1059 } 930 }
1060 931
1061 AnalysisGetReachableSourcesParams(String file) { 932 /**
1062 this.file = file; 933 * The folding regions contained in the file.
934 */
935 List<FoldingRegion> get regions => _regions;
936
937 /**
938 * The folding regions contained in the file.
939 */
940 void set regions(List<FoldingRegion> value) {
941 assert(value != null);
942 this._regions = value;
1063 } 943 }
1064 944
1065 factory AnalysisGetReachableSourcesParams.fromJson( 945 AnalysisFoldingParams(String file, List<FoldingRegion> regions) {
946 this.file = file;
947 this.regions = regions;
948 }
949
950 factory AnalysisFoldingParams.fromJson(
1066 JsonDecoder jsonDecoder, String jsonPath, Object json) { 951 JsonDecoder jsonDecoder, String jsonPath, Object json) {
1067 if (json == null) { 952 if (json == null) {
1068 json = {}; 953 json = {};
1069 } 954 }
1070 if (json is Map) { 955 if (json is Map) {
1071 String file; 956 String file;
1072 if (json.containsKey("file")) { 957 if (json.containsKey("file")) {
1073 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 958 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
1074 } else { 959 } else {
1075 throw jsonDecoder.missingKey(jsonPath, "file"); 960 throw jsonDecoder.mismatch(jsonPath, "file");
1076 } 961 }
1077 return new AnalysisGetReachableSourcesParams(file); 962 List<FoldingRegion> regions;
963 if (json.containsKey("regions")) {
964 regions = jsonDecoder.decodeList(
965 jsonPath + ".regions",
966 json["regions"],
967 (String jsonPath, Object json) =>
968 new FoldingRegion.fromJson(jsonDecoder, jsonPath, json));
969 } else {
970 throw jsonDecoder.mismatch(jsonPath, "regions");
971 }
972 return new AnalysisFoldingParams(file, regions);
1078 } else { 973 } else {
1079 throw jsonDecoder.mismatch( 974 throw jsonDecoder.mismatch(jsonPath, "analysis.folding params", json);
1080 jsonPath, "analysis.getReachableSources params", json);
1081 } 975 }
1082 } 976 }
1083 977
1084 factory AnalysisGetReachableSourcesParams.fromRequest(Request request) { 978 factory AnalysisFoldingParams.fromNotification(Notification notification) {
1085 return new AnalysisGetReachableSourcesParams.fromJson( 979 return new AnalysisFoldingParams.fromJson(
1086 new RequestDecoder(request), "params", request._params); 980 new ResponseDecoder(null), "params", notification.params);
1087 } 981 }
1088 982
983 @override
1089 Map<String, dynamic> toJson() { 984 Map<String, dynamic> toJson() {
1090 Map<String, dynamic> result = {}; 985 Map<String, dynamic> result = {};
1091 result["file"] = file; 986 result["file"] = file;
987 result["regions"] =
988 regions.map((FoldingRegion value) => value.toJson()).toList();
1092 return result; 989 return result;
1093 } 990 }
1094 991
1095 Request toRequest(String id) { 992 Notification toNotification() {
1096 return new Request(id, "analysis.getReachableSources", toJson()); 993 return new Notification("analysis.folding", toJson());
1097 } 994 }
1098 995
1099 @override 996 @override
1100 String toString() => JSON.encode(toJson()); 997 String toString() => JSON.encode(toJson());
1101 998
1102 @override 999 @override
1103 bool operator ==(other) { 1000 bool operator ==(other) {
1104 if (other is AnalysisGetReachableSourcesParams) { 1001 if (other is AnalysisFoldingParams) {
1105 return file == other.file; 1002 return file == other.file &&
1003 listEqual(regions, other.regions,
1004 (FoldingRegion a, FoldingRegion b) => a == b);
1106 } 1005 }
1107 return false; 1006 return false;
1108 } 1007 }
1109 1008
1110 @override 1009 @override
1111 int get hashCode { 1010 int get hashCode {
1112 int hash = 0; 1011 int hash = 0;
1113 hash = JenkinsSmiHash.combine(hash, file.hashCode); 1012 hash = JenkinsSmiHash.combine(hash, file.hashCode);
1013 hash = JenkinsSmiHash.combine(hash, regions.hashCode);
1114 return JenkinsSmiHash.finish(hash); 1014 return JenkinsSmiHash.finish(hash);
1115 } 1015 }
1116 } 1016 }
1117 1017
1118 /** 1018 /**
1119 * analysis.getReachableSources result 1019 * analysis.getErrors params
1120 * 1020 *
1121 * { 1021 * {
1122 * "sources": Map<String, List<String>> 1022 * "file": FilePath
1123 * } 1023 * }
1124 * 1024 *
1125 * Clients may not extend, implement or mix-in this class. 1025 * Clients may not extend, implement or mix-in this class.
1126 */ 1026 */
1127 class AnalysisGetReachableSourcesResult implements HasToJson { 1027 class AnalysisGetErrorsParams implements RequestParams {
1128 Map<String, List<String>> _sources; 1028 String _file;
1129 1029
1130 /** 1030 /**
1131 * A mapping from source URIs to directly reachable source URIs. For example, 1031 * The file for which errors are being requested.
1132 * a file "foo.dart" that imports "bar.dart" would have the corresponding
1133 * mapping { "file:///foo.dart" : ["file:///bar.dart"] }. If "bar.dart" has
1134 * further imports (or exports) there will be a mapping from the URI
1135 * "file:///bar.dart" to them. To check if a specific URI is reachable from a
1136 * given file, clients can check for its presence in the resulting key set.
1137 */ 1032 */
1138 Map<String, List<String>> get sources => _sources; 1033 String get file => _file;
1139 1034
1140 /** 1035 /**
1141 * A mapping from source URIs to directly reachable source URIs. For example, 1036 * The file for which errors are being requested.
1142 * a file "foo.dart" that imports "bar.dart" would have the corresponding
1143 * mapping { "file:///foo.dart" : ["file:///bar.dart"] }. If "bar.dart" has
1144 * further imports (or exports) there will be a mapping from the URI
1145 * "file:///bar.dart" to them. To check if a specific URI is reachable from a
1146 * given file, clients can check for its presence in the resulting key set.
1147 */ 1037 */
1148 void set sources(Map<String, List<String>> value) { 1038 void set file(String value) {
1149 assert(value != null); 1039 assert(value != null);
1150 this._sources = value; 1040 this._file = value;
1151 } 1041 }
1152 1042
1153 AnalysisGetReachableSourcesResult(Map<String, List<String>> sources) { 1043 AnalysisGetErrorsParams(String file) {
1154 this.sources = sources; 1044 this.file = file;
1155 } 1045 }
1156 1046
1157 factory AnalysisGetReachableSourcesResult.fromJson( 1047 factory AnalysisGetErrorsParams.fromJson(
1158 JsonDecoder jsonDecoder, String jsonPath, Object json) { 1048 JsonDecoder jsonDecoder, String jsonPath, Object json) {
1159 if (json == null) { 1049 if (json == null) {
1160 json = {}; 1050 json = {};
1161 } 1051 }
1162 if (json is Map) { 1052 if (json is Map) {
1163 Map<String, List<String>> sources; 1053 String file;
1164 if (json.containsKey("sources")) { 1054 if (json.containsKey("file")) {
1165 sources = jsonDecoder.decodeMap(jsonPath + ".sources", json["sources"], 1055 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
1166 valueDecoder: (String jsonPath, Object json) => jsonDecoder
1167 .decodeList(jsonPath, json, jsonDecoder.decodeString));
1168 } else { 1056 } else {
1169 throw jsonDecoder.missingKey(jsonPath, "sources"); 1057 throw jsonDecoder.mismatch(jsonPath, "file");
1170 } 1058 }
1171 return new AnalysisGetReachableSourcesResult(sources); 1059 return new AnalysisGetErrorsParams(file);
1172 } else { 1060 } else {
1173 throw jsonDecoder.mismatch( 1061 throw jsonDecoder.mismatch(jsonPath, "analysis.getErrors params", json);
1174 jsonPath, "analysis.getReachableSources result", json);
1175 } 1062 }
1176 } 1063 }
1177 1064
1178 factory AnalysisGetReachableSourcesResult.fromResponse(Response response) { 1065 factory AnalysisGetErrorsParams.fromRequest(Request request) {
1179 return new AnalysisGetReachableSourcesResult.fromJson( 1066 return new AnalysisGetErrorsParams.fromJson(
1180 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), 1067 new RequestDecoder(request), "params", request.params);
1181 "result",
1182 response._result);
1183 } 1068 }
1184 1069
1070 @override
1185 Map<String, dynamic> toJson() { 1071 Map<String, dynamic> toJson() {
1186 Map<String, dynamic> result = {}; 1072 Map<String, dynamic> result = {};
1187 result["sources"] = sources; 1073 result["file"] = file;
1188 return result; 1074 return result;
1189 } 1075 }
1190 1076
1191 Response toResponse(String id) { 1077 @override
1192 return new Response(id, result: toJson()); 1078 Request toRequest(String id) {
1079 return new Request(id, "analysis.getErrors", toJson());
1193 } 1080 }
1194 1081
1195 @override 1082 @override
1196 String toString() => JSON.encode(toJson()); 1083 String toString() => JSON.encode(toJson());
1197 1084
1198 @override 1085 @override
1199 bool operator ==(other) { 1086 bool operator ==(other) {
1200 if (other is AnalysisGetReachableSourcesResult) { 1087 if (other is AnalysisGetErrorsParams) {
1201 return mapEqual( 1088 return file == other.file;
1202 sources,
1203 other.sources,
1204 (List<String> a, List<String> b) =>
1205 listEqual(a, b, (String a, String b) => a == b));
1206 } 1089 }
1207 return false; 1090 return false;
1208 } 1091 }
1209 1092
1210 @override 1093 @override
1211 int get hashCode { 1094 int get hashCode {
1212 int hash = 0; 1095 int hash = 0;
1213 hash = JenkinsSmiHash.combine(hash, sources.hashCode); 1096 hash = JenkinsSmiHash.combine(hash, file.hashCode);
1214 return JenkinsSmiHash.finish(hash); 1097 return JenkinsSmiHash.finish(hash);
1215 } 1098 }
1216 } 1099 }
1217 1100
1218 /** 1101 /**
1219 * analysis.getLibraryDependencies params 1102 * analysis.getErrors result
1220 *
1221 * Clients may not extend, implement or mix-in this class.
1222 */
1223 class AnalysisGetLibraryDependenciesParams {
1224 Request toRequest(String id) {
1225 return new Request(id, "analysis.getLibraryDependencies", null);
1226 }
1227
1228 @override
1229 bool operator ==(other) {
1230 if (other is AnalysisGetLibraryDependenciesParams) {
1231 return true;
1232 }
1233 return false;
1234 }
1235
1236 @override
1237 int get hashCode {
1238 return 246577680;
1239 }
1240 }
1241
1242 /**
1243 * analysis.getLibraryDependencies result
1244 * 1103 *
1245 * { 1104 * {
1246 * "libraries": List<FilePath> 1105 * "errors": List<AnalysisError>
1247 * "packageMap": Map<String, Map<String, List<FilePath>>>
1248 * } 1106 * }
1249 * 1107 *
1250 * Clients may not extend, implement or mix-in this class. 1108 * Clients may not extend, implement or mix-in this class.
1251 */ 1109 */
1252 class AnalysisGetLibraryDependenciesResult implements HasToJson { 1110 class AnalysisGetErrorsResult implements ResponseResult {
1253 List<String> _libraries; 1111 List<AnalysisError> _errors;
1254
1255 Map<String, Map<String, List<String>>> _packageMap;
1256 1112
1257 /** 1113 /**
1258 * A list of the paths of library elements referenced by files in existing 1114 * The errors associated with the file.
1259 * analysis roots.
1260 */ 1115 */
1261 List<String> get libraries => _libraries; 1116 List<AnalysisError> get errors => _errors;
1262 1117
1263 /** 1118 /**
1264 * A list of the paths of library elements referenced by files in existing 1119 * The errors associated with the file.
1265 * analysis roots.
1266 */ 1120 */
1267 void set libraries(List<String> value) { 1121 void set errors(List<AnalysisError> value) {
1268 assert(value != null); 1122 assert(value != null);
1269 this._libraries = value; 1123 this._errors = value;
1270 } 1124 }
1271 1125
1272 /** 1126 AnalysisGetErrorsResult(List<AnalysisError> errors) {
1273 * A mapping from context source roots to package maps which map package 1127 this.errors = errors;
1274 * names to source directories for use in client-side package URI resolution.
1275 */
1276 Map<String, Map<String, List<String>>> get packageMap => _packageMap;
1277
1278 /**
1279 * A mapping from context source roots to package maps which map package
1280 * names to source directories for use in client-side package URI resolution.
1281 */
1282 void set packageMap(Map<String, Map<String, List<String>>> value) {
1283 assert(value != null);
1284 this._packageMap = value;
1285 } 1128 }
1286 1129
1287 AnalysisGetLibraryDependenciesResult(List<String> libraries, 1130 factory AnalysisGetErrorsResult.fromJson(
1288 Map<String, Map<String, List<String>>> packageMap) {
1289 this.libraries = libraries;
1290 this.packageMap = packageMap;
1291 }
1292
1293 factory AnalysisGetLibraryDependenciesResult.fromJson(
1294 JsonDecoder jsonDecoder, String jsonPath, Object json) { 1131 JsonDecoder jsonDecoder, String jsonPath, Object json) {
1295 if (json == null) { 1132 if (json == null) {
1296 json = {}; 1133 json = {};
1297 } 1134 }
1298 if (json is Map) { 1135 if (json is Map) {
1299 List<String> libraries; 1136 List<AnalysisError> errors;
1300 if (json.containsKey("libraries")) { 1137 if (json.containsKey("errors")) {
1301 libraries = jsonDecoder.decodeList(jsonPath + ".libraries", 1138 errors = jsonDecoder.decodeList(
1302 json["libraries"], jsonDecoder.decodeString); 1139 jsonPath + ".errors",
1140 json["errors"],
1141 (String jsonPath, Object json) =>
1142 new AnalysisError.fromJson(jsonDecoder, jsonPath, json));
1303 } else { 1143 } else {
1304 throw jsonDecoder.missingKey(jsonPath, "libraries"); 1144 throw jsonDecoder.mismatch(jsonPath, "errors");
1305 } 1145 }
1306 Map<String, Map<String, List<String>>> packageMap; 1146 return new AnalysisGetErrorsResult(errors);
1307 if (json.containsKey("packageMap")) {
1308 packageMap = jsonDecoder.decodeMap(
1309 jsonPath + ".packageMap", json["packageMap"],
1310 valueDecoder: (String jsonPath, Object json) =>
1311 jsonDecoder.decodeMap(jsonPath, json,
1312 valueDecoder: (String jsonPath, Object json) => jsonDecoder
1313 .decodeList(jsonPath, json, jsonDecoder.decodeString)));
1314 } else {
1315 throw jsonDecoder.missingKey(jsonPath, "packageMap");
1316 }
1317 return new AnalysisGetLibraryDependenciesResult(libraries, packageMap);
1318 } else { 1147 } else {
1319 throw jsonDecoder.mismatch( 1148 throw jsonDecoder.mismatch(jsonPath, "analysis.getErrors result", json);
1320 jsonPath, "analysis.getLibraryDependencies result", json);
1321 } 1149 }
1322 } 1150 }
1323 1151
1324 factory AnalysisGetLibraryDependenciesResult.fromResponse(Response response) { 1152 factory AnalysisGetErrorsResult.fromResponse(Response response) {
1325 return new AnalysisGetLibraryDependenciesResult.fromJson( 1153 return new AnalysisGetErrorsResult.fromJson(
1326 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), 1154 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
1327 "result", 1155 "result",
1328 response._result); 1156 response.result);
1329 } 1157 }
1330 1158
1159 @override
1331 Map<String, dynamic> toJson() { 1160 Map<String, dynamic> toJson() {
1332 Map<String, dynamic> result = {}; 1161 Map<String, dynamic> result = {};
1333 result["libraries"] = libraries; 1162 result["errors"] =
1334 result["packageMap"] = packageMap; 1163 errors.map((AnalysisError value) => value.toJson()).toList();
1335 return result; 1164 return result;
1336 } 1165 }
1337 1166
1167 @override
1338 Response toResponse(String id) { 1168 Response toResponse(String id) {
1339 return new Response(id, result: toJson()); 1169 return new Response(id, result: toJson());
1340 } 1170 }
1341 1171
1342 @override 1172 @override
1343 String toString() => JSON.encode(toJson()); 1173 String toString() => JSON.encode(toJson());
1344 1174
1345 @override 1175 @override
1346 bool operator ==(other) { 1176 bool operator ==(other) {
1347 if (other is AnalysisGetLibraryDependenciesResult) { 1177 if (other is AnalysisGetErrorsResult) {
1348 return listEqual( 1178 return listEqual(
1349 libraries, other.libraries, (String a, String b) => a == b) && 1179 errors, other.errors, (AnalysisError a, AnalysisError b) => a == b);
1350 mapEqual(
1351 packageMap,
1352 other.packageMap,
1353 (Map<String, List<String>> a, Map<String, List<String>> b) =>
1354 mapEqual(
1355 a,
1356 b,
1357 (List<String> a, List<String> b) =>
1358 listEqual(a, b, (String a, String b) => a == b)));
1359 } 1180 }
1360 return false; 1181 return false;
1361 } 1182 }
1362 1183
1363 @override 1184 @override
1364 int get hashCode { 1185 int get hashCode {
1365 int hash = 0; 1186 int hash = 0;
1366 hash = JenkinsSmiHash.combine(hash, libraries.hashCode); 1187 hash = JenkinsSmiHash.combine(hash, errors.hashCode);
1367 hash = JenkinsSmiHash.combine(hash, packageMap.hashCode);
1368 return JenkinsSmiHash.finish(hash); 1188 return JenkinsSmiHash.finish(hash);
1369 } 1189 }
1370 } 1190 }
1371 1191
1372 /** 1192 /**
1373 * analysis.getNavigation params 1193 * analysis.getHover params
1374 * 1194 *
1375 * { 1195 * {
1376 * "file": FilePath 1196 * "file": FilePath
1377 * "offset": int 1197 * "offset": int
1378 * "length": int
1379 * } 1198 * }
1380 * 1199 *
1381 * Clients may not extend, implement or mix-in this class. 1200 * Clients may not extend, implement or mix-in this class.
1382 */ 1201 */
1383 class AnalysisGetNavigationParams implements HasToJson { 1202 class AnalysisGetHoverParams implements RequestParams {
1384 String _file; 1203 String _file;
1385 1204
1386 int _offset; 1205 int _offset;
1387 1206
1388 int _length;
1389
1390 /** 1207 /**
1391 * The file in which navigation information is being requested. 1208 * The file in which hover information is being requested.
1392 */ 1209 */
1393 String get file => _file; 1210 String get file => _file;
1394 1211
1395 /** 1212 /**
1396 * The file in which navigation information is being requested. 1213 * The file in which hover information is being requested.
1397 */ 1214 */
1398 void set file(String value) { 1215 void set file(String value) {
1399 assert(value != null); 1216 assert(value != null);
1400 this._file = value; 1217 this._file = value;
1401 } 1218 }
1402 1219
1403 /** 1220 /**
1404 * The offset of the region for which navigation information is being 1221 * The offset for which hover information is being requested.
1405 * requested.
1406 */ 1222 */
1407 int get offset => _offset; 1223 int get offset => _offset;
1408 1224
1409 /** 1225 /**
1410 * The offset of the region for which navigation information is being 1226 * The offset for which hover information is being requested.
1411 * requested.
1412 */ 1227 */
1413 void set offset(int value) { 1228 void set offset(int value) {
1414 assert(value != null); 1229 assert(value != null);
1415 this._offset = value; 1230 this._offset = value;
1416 } 1231 }
1417 1232
1418 /** 1233 AnalysisGetHoverParams(String file, int offset) {
1419 * The length of the region for which navigation information is being 1234 this.file = file;
1420 * requested. 1235 this.offset = offset;
1421 */
1422 int get length => _length;
1423
1424 /**
1425 * The length of the region for which navigation information is being
1426 * requested.
1427 */
1428 void set length(int value) {
1429 assert(value != null);
1430 this._length = value;
1431 } 1236 }
1432 1237
1433 AnalysisGetNavigationParams(String file, int offset, int length) { 1238 factory AnalysisGetHoverParams.fromJson(
1434 this.file = file;
1435 this.offset = offset;
1436 this.length = length;
1437 }
1438
1439 factory AnalysisGetNavigationParams.fromJson(
1440 JsonDecoder jsonDecoder, String jsonPath, Object json) { 1239 JsonDecoder jsonDecoder, String jsonPath, Object json) {
1441 if (json == null) { 1240 if (json == null) {
1442 json = {}; 1241 json = {};
1443 } 1242 }
1444 if (json is Map) { 1243 if (json is Map) {
1445 String file; 1244 String file;
1446 if (json.containsKey("file")) { 1245 if (json.containsKey("file")) {
1447 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 1246 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
1448 } else { 1247 } else {
1449 throw jsonDecoder.missingKey(jsonPath, "file"); 1248 throw jsonDecoder.mismatch(jsonPath, "file");
1450 } 1249 }
1451 int offset; 1250 int offset;
1452 if (json.containsKey("offset")) { 1251 if (json.containsKey("offset")) {
1453 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 1252 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
1454 } else { 1253 } else {
1455 throw jsonDecoder.missingKey(jsonPath, "offset"); 1254 throw jsonDecoder.mismatch(jsonPath, "offset");
1456 } 1255 }
1457 int length; 1256 return new AnalysisGetHoverParams(file, offset);
1458 if (json.containsKey("length")) {
1459 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
1460 } else {
1461 throw jsonDecoder.missingKey(jsonPath, "length");
1462 }
1463 return new AnalysisGetNavigationParams(file, offset, length);
1464 } else { 1257 } else {
1465 throw jsonDecoder.mismatch( 1258 throw jsonDecoder.mismatch(jsonPath, "analysis.getHover params", json);
1466 jsonPath, "analysis.getNavigation params", json);
1467 } 1259 }
1468 } 1260 }
1469 1261
1470 factory AnalysisGetNavigationParams.fromRequest(Request request) { 1262 factory AnalysisGetHoverParams.fromRequest(Request request) {
1471 return new AnalysisGetNavigationParams.fromJson( 1263 return new AnalysisGetHoverParams.fromJson(
1472 new RequestDecoder(request), "params", request._params); 1264 new RequestDecoder(request), "params", request.params);
1473 } 1265 }
1474 1266
1267 @override
1475 Map<String, dynamic> toJson() { 1268 Map<String, dynamic> toJson() {
1476 Map<String, dynamic> result = {}; 1269 Map<String, dynamic> result = {};
1477 result["file"] = file; 1270 result["file"] = file;
1478 result["offset"] = offset; 1271 result["offset"] = offset;
1479 result["length"] = length;
1480 return result; 1272 return result;
1481 } 1273 }
1482 1274
1275 @override
1483 Request toRequest(String id) { 1276 Request toRequest(String id) {
1484 return new Request(id, "analysis.getNavigation", toJson()); 1277 return new Request(id, "analysis.getHover", toJson());
1485 } 1278 }
1486 1279
1487 @override 1280 @override
1488 String toString() => JSON.encode(toJson()); 1281 String toString() => JSON.encode(toJson());
1489 1282
1490 @override 1283 @override
1491 bool operator ==(other) { 1284 bool operator ==(other) {
1492 if (other is AnalysisGetNavigationParams) { 1285 if (other is AnalysisGetHoverParams) {
1493 return file == other.file && 1286 return file == other.file && offset == other.offset;
1494 offset == other.offset &&
1495 length == other.length;
1496 } 1287 }
1497 return false; 1288 return false;
1498 } 1289 }
1499 1290
1500 @override 1291 @override
1501 int get hashCode { 1292 int get hashCode {
1502 int hash = 0; 1293 int hash = 0;
1503 hash = JenkinsSmiHash.combine(hash, file.hashCode); 1294 hash = JenkinsSmiHash.combine(hash, file.hashCode);
1504 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 1295 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
1505 hash = JenkinsSmiHash.combine(hash, length.hashCode);
1506 return JenkinsSmiHash.finish(hash); 1296 return JenkinsSmiHash.finish(hash);
1507 } 1297 }
1508 } 1298 }
1509 1299
1510 /** 1300 /**
1511 * analysis.getNavigation result 1301 * analysis.getHover result
1512 * 1302 *
1513 * { 1303 * {
1514 * "files": List<FilePath> 1304 * "hovers": List<HoverInformation>
1515 * "targets": List<NavigationTarget>
1516 * "regions": List<NavigationRegion>
1517 * } 1305 * }
1518 * 1306 *
1519 * Clients may not extend, implement or mix-in this class. 1307 * Clients may not extend, implement or mix-in this class.
1520 */ 1308 */
1521 class AnalysisGetNavigationResult implements HasToJson { 1309 class AnalysisGetHoverResult implements ResponseResult {
1522 List<String> _files; 1310 List<HoverInformation> _hovers;
1523
1524 List<NavigationTarget> _targets;
1525
1526 List<NavigationRegion> _regions;
1527 1311
1528 /** 1312 /**
1529 * A list of the paths of files that are referenced by the navigation 1313 * The hover information associated with the location. The list will be empty
1530 * targets. 1314 * if no information could be determined for the location. The list can
1315 * contain multiple items if the file is being analyzed in multiple contexts
1316 * in conflicting ways (such as a part that is included in multiple
1317 * libraries).
1531 */ 1318 */
1532 List<String> get files => _files; 1319 List<HoverInformation> get hovers => _hovers;
1533 1320
1534 /** 1321 /**
1535 * A list of the paths of files that are referenced by the navigation 1322 * The hover information associated with the location. The list will be empty
1536 * targets. 1323 * if no information could be determined for the location. The list can
1324 * contain multiple items if the file is being analyzed in multiple contexts
1325 * in conflicting ways (such as a part that is included in multiple
1326 * libraries).
1537 */ 1327 */
1538 void set files(List<String> value) { 1328 void set hovers(List<HoverInformation> value) {
1539 assert(value != null); 1329 assert(value != null);
1540 this._files = value; 1330 this._hovers = value;
1541 } 1331 }
1542 1332
1543 /** 1333 AnalysisGetHoverResult(List<HoverInformation> hovers) {
1544 * A list of the navigation targets that are referenced by the navigation 1334 this.hovers = hovers;
1545 * regions.
1546 */
1547 List<NavigationTarget> get targets => _targets;
1548
1549 /**
1550 * A list of the navigation targets that are referenced by the navigation
1551 * regions.
1552 */
1553 void set targets(List<NavigationTarget> value) {
1554 assert(value != null);
1555 this._targets = value;
1556 } 1335 }
1557 1336
1558 /** 1337 factory AnalysisGetHoverResult.fromJson(
1559 * A list of the navigation regions within the requested region of the file.
1560 */
1561 List<NavigationRegion> get regions => _regions;
1562
1563 /**
1564 * A list of the navigation regions within the requested region of the file.
1565 */
1566 void set regions(List<NavigationRegion> value) {
1567 assert(value != null);
1568 this._regions = value;
1569 }
1570
1571 AnalysisGetNavigationResult(List<String> files,
1572 List<NavigationTarget> targets, List<NavigationRegion> regions) {
1573 this.files = files;
1574 this.targets = targets;
1575 this.regions = regions;
1576 }
1577
1578 factory AnalysisGetNavigationResult.fromJson(
1579 JsonDecoder jsonDecoder, String jsonPath, Object json) { 1338 JsonDecoder jsonDecoder, String jsonPath, Object json) {
1580 if (json == null) { 1339 if (json == null) {
1581 json = {}; 1340 json = {};
1582 } 1341 }
1583 if (json is Map) { 1342 if (json is Map) {
1584 List<String> files; 1343 List<HoverInformation> hovers;
1585 if (json.containsKey("files")) { 1344 if (json.containsKey("hovers")) {
1586 files = jsonDecoder.decodeList( 1345 hovers = jsonDecoder.decodeList(
1587 jsonPath + ".files", json["files"], jsonDecoder.decodeString); 1346 jsonPath + ".hovers",
1347 json["hovers"],
1348 (String jsonPath, Object json) =>
1349 new HoverInformation.fromJson(jsonDecoder, jsonPath, json));
1588 } else { 1350 } else {
1589 throw jsonDecoder.missingKey(jsonPath, "files"); 1351 throw jsonDecoder.mismatch(jsonPath, "hovers");
1590 } 1352 }
1591 List<NavigationTarget> targets; 1353 return new AnalysisGetHoverResult(hovers);
1592 if (json.containsKey("targets")) {
1593 targets = jsonDecoder.decodeList(
1594 jsonPath + ".targets",
1595 json["targets"],
1596 (String jsonPath, Object json) =>
1597 new NavigationTarget.fromJson(jsonDecoder, jsonPath, json));
1598 } else {
1599 throw jsonDecoder.missingKey(jsonPath, "targets");
1600 }
1601 List<NavigationRegion> regions;
1602 if (json.containsKey("regions")) {
1603 regions = jsonDecoder.decodeList(
1604 jsonPath + ".regions",
1605 json["regions"],
1606 (String jsonPath, Object json) =>
1607 new NavigationRegion.fromJson(jsonDecoder, jsonPath, json));
1608 } else {
1609 throw jsonDecoder.missingKey(jsonPath, "regions");
1610 }
1611 return new AnalysisGetNavigationResult(files, targets, regions);
1612 } else { 1354 } else {
1613 throw jsonDecoder.mismatch( 1355 throw jsonDecoder.mismatch(jsonPath, "analysis.getHover result", json);
1614 jsonPath, "analysis.getNavigation result", json);
1615 } 1356 }
1616 } 1357 }
1617 1358
1618 factory AnalysisGetNavigationResult.fromResponse(Response response) { 1359 factory AnalysisGetHoverResult.fromResponse(Response response) {
1619 return new AnalysisGetNavigationResult.fromJson( 1360 return new AnalysisGetHoverResult.fromJson(
1620 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), 1361 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
1621 "result", 1362 "result",
1622 response._result); 1363 response.result);
1623 } 1364 }
1624 1365
1366 @override
1625 Map<String, dynamic> toJson() { 1367 Map<String, dynamic> toJson() {
1626 Map<String, dynamic> result = {}; 1368 Map<String, dynamic> result = {};
1627 result["files"] = files; 1369 result["hovers"] =
1628 result["targets"] = 1370 hovers.map((HoverInformation value) => value.toJson()).toList();
1629 targets.map((NavigationTarget value) => value.toJson()).toList();
1630 result["regions"] =
1631 regions.map((NavigationRegion value) => value.toJson()).toList();
1632 return result; 1371 return result;
1633 } 1372 }
1634 1373
1374 @override
1635 Response toResponse(String id) { 1375 Response toResponse(String id) {
1636 return new Response(id, result: toJson()); 1376 return new Response(id, result: toJson());
1637 } 1377 }
1638 1378
1639 @override 1379 @override
1640 String toString() => JSON.encode(toJson()); 1380 String toString() => JSON.encode(toJson());
1641 1381
1642 @override 1382 @override
1643 bool operator ==(other) { 1383 bool operator ==(other) {
1644 if (other is AnalysisGetNavigationResult) { 1384 if (other is AnalysisGetHoverResult) {
1645 return listEqual(files, other.files, (String a, String b) => a == b) && 1385 return listEqual(hovers, other.hovers,
1646 listEqual(targets, other.targets, 1386 (HoverInformation a, HoverInformation b) => a == b);
1647 (NavigationTarget a, NavigationTarget b) => a == b) &&
1648 listEqual(regions, other.regions,
1649 (NavigationRegion a, NavigationRegion b) => a == b);
1650 } 1387 }
1651 return false; 1388 return false;
1652 } 1389 }
1653 1390
1654 @override 1391 @override
1655 int get hashCode { 1392 int get hashCode {
1656 int hash = 0; 1393 int hash = 0;
1657 hash = JenkinsSmiHash.combine(hash, files.hashCode); 1394 hash = JenkinsSmiHash.combine(hash, hovers.hashCode);
1658 hash = JenkinsSmiHash.combine(hash, targets.hashCode);
1659 hash = JenkinsSmiHash.combine(hash, regions.hashCode);
1660 return JenkinsSmiHash.finish(hash); 1395 return JenkinsSmiHash.finish(hash);
1661 } 1396 }
1662 } 1397 }
1663 1398
1664 /** 1399 /**
1665 * analysis.reanalyze params 1400 * analysis.getLibraryDependencies params
1666 *
1667 * {
1668 * "roots": optional List<FilePath>
1669 * }
1670 * 1401 *
1671 * Clients may not extend, implement or mix-in this class. 1402 * Clients may not extend, implement or mix-in this class.
1672 */ 1403 */
1673 class AnalysisReanalyzeParams implements HasToJson { 1404 class AnalysisGetLibraryDependenciesParams implements RequestParams {
1674 List<String> _roots; 1405 @override
1675 1406 Map<String, dynamic> toJson() => <String, dynamic>{};
1676 /**
1677 * A list of the analysis roots that are to be re-analyzed.
1678 */
1679 List<String> get roots => _roots;
1680
1681 /**
1682 * A list of the analysis roots that are to be re-analyzed.
1683 */
1684 void set roots(List<String> value) {
1685 this._roots = value;
1686 }
1687
1688 AnalysisReanalyzeParams({List<String> roots}) {
1689 this.roots = roots;
1690 }
1691
1692 factory AnalysisReanalyzeParams.fromJson(
1693 JsonDecoder jsonDecoder, String jsonPath, Object json) {
1694 if (json == null) {
1695 json = {};
1696 }
1697 if (json is Map) {
1698 List<String> roots;
1699 if (json.containsKey("roots")) {
1700 roots = jsonDecoder.decodeList(
1701 jsonPath + ".roots", json["roots"], jsonDecoder.decodeString);
1702 }
1703 return new AnalysisReanalyzeParams(roots: roots);
1704 } else {
1705 throw jsonDecoder.mismatch(jsonPath, "analysis.reanalyze params", json);
1706 }
1707 }
1708
1709 factory AnalysisReanalyzeParams.fromRequest(Request request) {
1710 return new AnalysisReanalyzeParams.fromJson(
1711 new RequestDecoder(request), "params", request._params);
1712 }
1713
1714 Map<String, dynamic> toJson() {
1715 Map<String, dynamic> result = {};
1716 if (roots != null) {
1717 result["roots"] = roots;
1718 }
1719 return result;
1720 }
1721
1722 Request toRequest(String id) {
1723 return new Request(id, "analysis.reanalyze", toJson());
1724 }
1725 1407
1726 @override 1408 @override
1727 String toString() => JSON.encode(toJson()); 1409 Request toRequest(String id) {
1728 1410 return new Request(id, "analysis.getLibraryDependencies", null);
1729 @override
1730 bool operator ==(other) {
1731 if (other is AnalysisReanalyzeParams) {
1732 return listEqual(roots, other.roots, (String a, String b) => a == b);
1733 }
1734 return false;
1735 }
1736
1737 @override
1738 int get hashCode {
1739 int hash = 0;
1740 hash = JenkinsSmiHash.combine(hash, roots.hashCode);
1741 return JenkinsSmiHash.finish(hash);
1742 }
1743 }
1744
1745 /**
1746 * analysis.reanalyze result
1747 *
1748 * Clients may not extend, implement or mix-in this class.
1749 */
1750 class AnalysisReanalyzeResult {
1751 Response toResponse(String id) {
1752 return new Response(id, result: null);
1753 } 1411 }
1754 1412
1755 @override 1413 @override
1756 bool operator ==(other) { 1414 bool operator ==(other) {
1757 if (other is AnalysisReanalyzeResult) { 1415 if (other is AnalysisGetLibraryDependenciesParams) {
1758 return true; 1416 return true;
1759 } 1417 }
1760 return false; 1418 return false;
1761 } 1419 }
1762 1420
1763 @override 1421 @override
1764 int get hashCode { 1422 int get hashCode {
1765 return 846803925; 1423 return 246577680;
1766 } 1424 }
1767 } 1425 }
1768 1426
1769 /** 1427 /**
1770 * analysis.setAnalysisRoots params 1428 * analysis.getLibraryDependencies result
1771 * 1429 *
1772 * { 1430 * {
1773 * "included": List<FilePath> 1431 * "libraries": List<FilePath>
1774 * "excluded": List<FilePath> 1432 * "packageMap": Map<String, Map<String, List<FilePath>>>
1775 * "packageRoots": optional Map<FilePath, FilePath>
1776 * } 1433 * }
1777 * 1434 *
1778 * Clients may not extend, implement or mix-in this class. 1435 * Clients may not extend, implement or mix-in this class.
1779 */ 1436 */
1780 class AnalysisSetAnalysisRootsParams implements HasToJson { 1437 class AnalysisGetLibraryDependenciesResult implements ResponseResult {
1781 List<String> _included; 1438 List<String> _libraries;
1782 1439
1783 List<String> _excluded; 1440 Map<String, Map<String, List<String>>> _packageMap;
1784
1785 Map<String, String> _packageRoots;
1786 1441
1787 /** 1442 /**
1788 * A list of the files and directories that should be analyzed. 1443 * A list of the paths of library elements referenced by files in existing
1444 * analysis roots.
1789 */ 1445 */
1790 List<String> get included => _included; 1446 List<String> get libraries => _libraries;
1791 1447
1792 /** 1448 /**
1793 * A list of the files and directories that should be analyzed. 1449 * A list of the paths of library elements referenced by files in existing
1450 * analysis roots.
1794 */ 1451 */
1795 void set included(List<String> value) { 1452 void set libraries(List<String> value) {
1796 assert(value != null); 1453 assert(value != null);
1797 this._included = value; 1454 this._libraries = value;
1798 } 1455 }
1799 1456
1800 /** 1457 /**
1801 * A list of the files and directories within the included directories that 1458 * A mapping from context source roots to package maps which map package
1802 * should not be analyzed. 1459 * names to source directories for use in client-side package URI resolution.
1803 */ 1460 */
1804 List<String> get excluded => _excluded; 1461 Map<String, Map<String, List<String>>> get packageMap => _packageMap;
1805 1462
1806 /** 1463 /**
1807 * A list of the files and directories within the included directories that 1464 * A mapping from context source roots to package maps which map package
1808 * should not be analyzed. 1465 * names to source directories for use in client-side package URI resolution.
1809 */ 1466 */
1810 void set excluded(List<String> value) { 1467 void set packageMap(Map<String, Map<String, List<String>>> value) {
1811 assert(value != null); 1468 assert(value != null);
1812 this._excluded = value; 1469 this._packageMap = value;
1813 } 1470 }
1814 1471
1815 /** 1472 AnalysisGetLibraryDependenciesResult(List<String> libraries,
1816 * A mapping from source directories to package roots that should override 1473 Map<String, Map<String, List<String>>> packageMap) {
1817 * the normal package: URI resolution mechanism. 1474 this.libraries = libraries;
1818 * 1475 this.packageMap = packageMap;
1819 * If a package root is a directory, then the analyzer will behave as though
1820 * the associated source directory in the map contains a special pubspec.yaml
1821 * file which resolves any package: URI to the corresponding path within that
1822 * package root directory. The effect is the same as specifying the package
1823 * root directory as a "--package_root" parameter to the Dart VM when
1824 * executing any Dart file inside the source directory.
1825 *
1826 * If a package root is a file, then the analyzer will behave as though that
1827 * file is a ".packages" file in the source directory. The effect is the same
1828 * as specifying the file as a "--packages" parameter to the Dart VM when
1829 * executing any Dart file inside the source directory.
1830 *
1831 * Files in any directories that are not overridden by this mapping have
1832 * their package: URI's resolved using the normal pubspec.yaml mechanism. If
1833 * this field is absent, or the empty map is specified, that indicates that
1834 * the normal pubspec.yaml mechanism should always be used.
1835 */
1836 Map<String, String> get packageRoots => _packageRoots;
1837
1838 /**
1839 * A mapping from source directories to package roots that should override
1840 * the normal package: URI resolution mechanism.
1841 *
1842 * If a package root is a directory, then the analyzer will behave as though
1843 * the associated source directory in the map contains a special pubspec.yaml
1844 * file which resolves any package: URI to the corresponding path within that
1845 * package root directory. The effect is the same as specifying the package
1846 * root directory as a "--package_root" parameter to the Dart VM when
1847 * executing any Dart file inside the source directory.
1848 *
1849 * If a package root is a file, then the analyzer will behave as though that
1850 * file is a ".packages" file in the source directory. The effect is the same
1851 * as specifying the file as a "--packages" parameter to the Dart VM when
1852 * executing any Dart file inside the source directory.
1853 *
1854 * Files in any directories that are not overridden by this mapping have
1855 * their package: URI's resolved using the normal pubspec.yaml mechanism. If
1856 * this field is absent, or the empty map is specified, that indicates that
1857 * the normal pubspec.yaml mechanism should always be used.
1858 */
1859 void set packageRoots(Map<String, String> value) {
1860 this._packageRoots = value;
1861 } 1476 }
1862 1477
1863 AnalysisSetAnalysisRootsParams(List<String> included, List<String> excluded, 1478 factory AnalysisGetLibraryDependenciesResult.fromJson(
1864 {Map<String, String> packageRoots}) {
1865 this.included = included;
1866 this.excluded = excluded;
1867 this.packageRoots = packageRoots;
1868 }
1869
1870 factory AnalysisSetAnalysisRootsParams.fromJson(
1871 JsonDecoder jsonDecoder, String jsonPath, Object json) { 1479 JsonDecoder jsonDecoder, String jsonPath, Object json) {
1872 if (json == null) { 1480 if (json == null) {
1873 json = {}; 1481 json = {};
1874 } 1482 }
1875 if (json is Map) { 1483 if (json is Map) {
1876 List<String> included; 1484 List<String> libraries;
1877 if (json.containsKey("included")) { 1485 if (json.containsKey("libraries")) {
1878 included = jsonDecoder.decodeList( 1486 libraries = jsonDecoder.decodeList(jsonPath + ".libraries",
1879 jsonPath + ".included", json["included"], jsonDecoder.decodeString); 1487 json["libraries"], jsonDecoder.decodeString);
1880 } else { 1488 } else {
1881 throw jsonDecoder.missingKey(jsonPath, "included"); 1489 throw jsonDecoder.mismatch(jsonPath, "libraries");
1882 } 1490 }
1883 List<String> excluded; 1491 Map<String, Map<String, List<String>>> packageMap;
1884 if (json.containsKey("excluded")) { 1492 if (json.containsKey("packageMap")) {
1885 excluded = jsonDecoder.decodeList( 1493 packageMap = jsonDecoder.decodeMap(
1886 jsonPath + ".excluded", json["excluded"], jsonDecoder.decodeString); 1494 jsonPath + ".packageMap", json["packageMap"],
1495 valueDecoder: (String jsonPath, Object json) =>
1496 jsonDecoder.decodeMap(jsonPath, json,
1497 valueDecoder: (String jsonPath, Object json) => jsonDecoder
1498 .decodeList(jsonPath, json, jsonDecoder.decodeString)));
1887 } else { 1499 } else {
1888 throw jsonDecoder.missingKey(jsonPath, "excluded"); 1500 throw jsonDecoder.mismatch(jsonPath, "packageMap");
1889 } 1501 }
1890 Map<String, String> packageRoots; 1502 return new AnalysisGetLibraryDependenciesResult(libraries, packageMap);
1891 if (json.containsKey("packageRoots")) {
1892 packageRoots = jsonDecoder.decodeMap(
1893 jsonPath + ".packageRoots", json["packageRoots"],
1894 valueDecoder: jsonDecoder.decodeString);
1895 }
1896 return new AnalysisSetAnalysisRootsParams(included, excluded,
1897 packageRoots: packageRoots);
1898 } else { 1503 } else {
1899 throw jsonDecoder.mismatch( 1504 throw jsonDecoder.mismatch(
1900 jsonPath, "analysis.setAnalysisRoots params", json); 1505 jsonPath, "analysis.getLibraryDependencies result", json);
1901 } 1506 }
1902 } 1507 }
1903 1508
1904 factory AnalysisSetAnalysisRootsParams.fromRequest(Request request) { 1509 factory AnalysisGetLibraryDependenciesResult.fromResponse(Response response) {
1905 return new AnalysisSetAnalysisRootsParams.fromJson( 1510 return new AnalysisGetLibraryDependenciesResult.fromJson(
1906 new RequestDecoder(request), "params", request._params); 1511 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
1512 "result",
1513 response.result);
1907 } 1514 }
1908 1515
1516 @override
1909 Map<String, dynamic> toJson() { 1517 Map<String, dynamic> toJson() {
1910 Map<String, dynamic> result = {}; 1518 Map<String, dynamic> result = {};
1911 result["included"] = included; 1519 result["libraries"] = libraries;
1912 result["excluded"] = excluded; 1520 result["packageMap"] = packageMap;
1913 if (packageRoots != null) {
1914 result["packageRoots"] = packageRoots;
1915 }
1916 return result; 1521 return result;
1917 } 1522 }
1918 1523
1919 Request toRequest(String id) { 1524 @override
1920 return new Request(id, "analysis.setAnalysisRoots", toJson()); 1525 Response toResponse(String id) {
1526 return new Response(id, result: toJson());
1921 } 1527 }
1922 1528
1923 @override 1529 @override
1924 String toString() => JSON.encode(toJson()); 1530 String toString() => JSON.encode(toJson());
1925 1531
1926 @override 1532 @override
1927 bool operator ==(other) { 1533 bool operator ==(other) {
1928 if (other is AnalysisSetAnalysisRootsParams) { 1534 if (other is AnalysisGetLibraryDependenciesResult) {
1929 return listEqual( 1535 return listEqual(
1930 included, other.included, (String a, String b) => a == b) && 1536 libraries, other.libraries, (String a, String b) => a == b) &&
1931 listEqual(excluded, other.excluded, (String a, String b) => a == b) &&
1932 mapEqual( 1537 mapEqual(
1933 packageRoots, other.packageRoots, (String a, String b) => a == b); 1538 packageMap,
1539 other.packageMap,
1540 (Map<String, List<String>> a, Map<String, List<String>> b) =>
1541 mapEqual(
1542 a,
1543 b,
1544 (List<String> a, List<String> b) =>
1545 listEqual(a, b, (String a, String b) => a == b)));
1934 } 1546 }
1935 return false; 1547 return false;
1936 } 1548 }
1937 1549
1938 @override 1550 @override
1939 int get hashCode { 1551 int get hashCode {
1940 int hash = 0; 1552 int hash = 0;
1941 hash = JenkinsSmiHash.combine(hash, included.hashCode); 1553 hash = JenkinsSmiHash.combine(hash, libraries.hashCode);
1942 hash = JenkinsSmiHash.combine(hash, excluded.hashCode); 1554 hash = JenkinsSmiHash.combine(hash, packageMap.hashCode);
1943 hash = JenkinsSmiHash.combine(hash, packageRoots.hashCode);
1944 return JenkinsSmiHash.finish(hash); 1555 return JenkinsSmiHash.finish(hash);
1945 } 1556 }
1946 } 1557 }
1947 1558
1948 /** 1559 /**
1949 * analysis.setAnalysisRoots result 1560 * analysis.getNavigation params
1950 *
1951 * Clients may not extend, implement or mix-in this class.
1952 */
1953 class AnalysisSetAnalysisRootsResult {
1954 Response toResponse(String id) {
1955 return new Response(id, result: null);
1956 }
1957
1958 @override
1959 bool operator ==(other) {
1960 if (other is AnalysisSetAnalysisRootsResult) {
1961 return true;
1962 }
1963 return false;
1964 }
1965
1966 @override
1967 int get hashCode {
1968 return 866004753;
1969 }
1970 }
1971
1972 /**
1973 * analysis.setGeneralSubscriptions params
1974 * 1561 *
1975 * { 1562 * {
1976 * "subscriptions": List<GeneralAnalysisService> 1563 * "file": FilePath
1564 * "offset": int
1565 * "length": int
1977 * } 1566 * }
1978 * 1567 *
1979 * Clients may not extend, implement or mix-in this class. 1568 * Clients may not extend, implement or mix-in this class.
1980 */ 1569 */
1981 class AnalysisSetGeneralSubscriptionsParams implements HasToJson { 1570 class AnalysisGetNavigationParams implements RequestParams {
1982 List<GeneralAnalysisService> _subscriptions; 1571 String _file;
1572
1573 int _offset;
1574
1575 int _length;
1983 1576
1984 /** 1577 /**
1985 * A list of the services being subscribed to. 1578 * The file in which navigation information is being requested.
1986 */ 1579 */
1987 List<GeneralAnalysisService> get subscriptions => _subscriptions; 1580 String get file => _file;
1988 1581
1989 /** 1582 /**
1990 * A list of the services being subscribed to. 1583 * The file in which navigation information is being requested.
1991 */ 1584 */
1992 void set subscriptions(List<GeneralAnalysisService> value) { 1585 void set file(String value) {
1993 assert(value != null); 1586 assert(value != null);
1994 this._subscriptions = value; 1587 this._file = value;
1995 } 1588 }
1996 1589
1997 AnalysisSetGeneralSubscriptionsParams( 1590 /**
1998 List<GeneralAnalysisService> subscriptions) { 1591 * The offset of the region for which navigation information is being
1999 this.subscriptions = subscriptions; 1592 * requested.
1593 */
1594 int get offset => _offset;
1595
1596 /**
1597 * The offset of the region for which navigation information is being
1598 * requested.
1599 */
1600 void set offset(int value) {
1601 assert(value != null);
1602 this._offset = value;
2000 } 1603 }
2001 1604
2002 factory AnalysisSetGeneralSubscriptionsParams.fromJson( 1605 /**
1606 * The length of the region for which navigation information is being
1607 * requested.
1608 */
1609 int get length => _length;
1610
1611 /**
1612 * The length of the region for which navigation information is being
1613 * requested.
1614 */
1615 void set length(int value) {
1616 assert(value != null);
1617 this._length = value;
1618 }
1619
1620 AnalysisGetNavigationParams(String file, int offset, int length) {
1621 this.file = file;
1622 this.offset = offset;
1623 this.length = length;
1624 }
1625
1626 factory AnalysisGetNavigationParams.fromJson(
2003 JsonDecoder jsonDecoder, String jsonPath, Object json) { 1627 JsonDecoder jsonDecoder, String jsonPath, Object json) {
2004 if (json == null) { 1628 if (json == null) {
2005 json = {}; 1629 json = {};
2006 } 1630 }
2007 if (json is Map) { 1631 if (json is Map) {
2008 List<GeneralAnalysisService> subscriptions; 1632 String file;
2009 if (json.containsKey("subscriptions")) { 1633 if (json.containsKey("file")) {
2010 subscriptions = jsonDecoder.decodeList( 1634 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
2011 jsonPath + ".subscriptions",
2012 json["subscriptions"],
2013 (String jsonPath, Object json) =>
2014 new GeneralAnalysisService.fromJson(
2015 jsonDecoder, jsonPath, json));
2016 } else { 1635 } else {
2017 throw jsonDecoder.missingKey(jsonPath, "subscriptions"); 1636 throw jsonDecoder.mismatch(jsonPath, "file");
2018 } 1637 }
2019 return new AnalysisSetGeneralSubscriptionsParams(subscriptions); 1638 int offset;
1639 if (json.containsKey("offset")) {
1640 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
1641 } else {
1642 throw jsonDecoder.mismatch(jsonPath, "offset");
1643 }
1644 int length;
1645 if (json.containsKey("length")) {
1646 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
1647 } else {
1648 throw jsonDecoder.mismatch(jsonPath, "length");
1649 }
1650 return new AnalysisGetNavigationParams(file, offset, length);
2020 } else { 1651 } else {
2021 throw jsonDecoder.mismatch( 1652 throw jsonDecoder.mismatch(
2022 jsonPath, "analysis.setGeneralSubscriptions params", json); 1653 jsonPath, "analysis.getNavigation params", json);
2023 } 1654 }
2024 } 1655 }
2025 1656
2026 factory AnalysisSetGeneralSubscriptionsParams.fromRequest(Request request) { 1657 factory AnalysisGetNavigationParams.fromRequest(Request request) {
2027 return new AnalysisSetGeneralSubscriptionsParams.fromJson( 1658 return new AnalysisGetNavigationParams.fromJson(
2028 new RequestDecoder(request), "params", request._params); 1659 new RequestDecoder(request), "params", request.params);
2029 } 1660 }
2030 1661
1662 @override
2031 Map<String, dynamic> toJson() { 1663 Map<String, dynamic> toJson() {
2032 Map<String, dynamic> result = {}; 1664 Map<String, dynamic> result = {};
2033 result["subscriptions"] = subscriptions 1665 result["file"] = file;
2034 .map((GeneralAnalysisService value) => value.toJson()) 1666 result["offset"] = offset;
2035 .toList(); 1667 result["length"] = length;
2036 return result; 1668 return result;
2037 } 1669 }
2038 1670
1671 @override
2039 Request toRequest(String id) { 1672 Request toRequest(String id) {
2040 return new Request(id, "analysis.setGeneralSubscriptions", toJson()); 1673 return new Request(id, "analysis.getNavigation", toJson());
2041 } 1674 }
2042 1675
2043 @override 1676 @override
2044 String toString() => JSON.encode(toJson()); 1677 String toString() => JSON.encode(toJson());
2045 1678
2046 @override 1679 @override
2047 bool operator ==(other) { 1680 bool operator ==(other) {
2048 if (other is AnalysisSetGeneralSubscriptionsParams) { 1681 if (other is AnalysisGetNavigationParams) {
2049 return listEqual(subscriptions, other.subscriptions, 1682 return file == other.file &&
2050 (GeneralAnalysisService a, GeneralAnalysisService b) => a == b); 1683 offset == other.offset &&
1684 length == other.length;
2051 } 1685 }
2052 return false; 1686 return false;
2053 } 1687 }
2054 1688
2055 @override 1689 @override
2056 int get hashCode { 1690 int get hashCode {
2057 int hash = 0; 1691 int hash = 0;
2058 hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode); 1692 hash = JenkinsSmiHash.combine(hash, file.hashCode);
1693 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
1694 hash = JenkinsSmiHash.combine(hash, length.hashCode);
2059 return JenkinsSmiHash.finish(hash); 1695 return JenkinsSmiHash.finish(hash);
2060 } 1696 }
2061 } 1697 }
2062 1698
2063 /** 1699 /**
2064 * analysis.setGeneralSubscriptions result 1700 * analysis.getNavigation result
2065 *
2066 * Clients may not extend, implement or mix-in this class.
2067 */
2068 class AnalysisSetGeneralSubscriptionsResult {
2069 Response toResponse(String id) {
2070 return new Response(id, result: null);
2071 }
2072
2073 @override
2074 bool operator ==(other) {
2075 if (other is AnalysisSetGeneralSubscriptionsResult) {
2076 return true;
2077 }
2078 return false;
2079 }
2080
2081 @override
2082 int get hashCode {
2083 return 386759562;
2084 }
2085 }
2086
2087 /**
2088 * analysis.setPriorityFiles params
2089 * 1701 *
2090 * { 1702 * {
2091 * "files": List<FilePath> 1703 * "files": List<FilePath>
1704 * "targets": List<NavigationTarget>
1705 * "regions": List<NavigationRegion>
2092 * } 1706 * }
2093 * 1707 *
2094 * Clients may not extend, implement or mix-in this class. 1708 * Clients may not extend, implement or mix-in this class.
2095 */ 1709 */
2096 class AnalysisSetPriorityFilesParams implements HasToJson { 1710 class AnalysisGetNavigationResult implements ResponseResult {
2097 List<String> _files; 1711 List<String> _files;
2098 1712
1713 List<NavigationTarget> _targets;
1714
1715 List<NavigationRegion> _regions;
1716
2099 /** 1717 /**
2100 * The files that are to be a priority for analysis. 1718 * A list of the paths of files that are referenced by the navigation
1719 * targets.
2101 */ 1720 */
2102 List<String> get files => _files; 1721 List<String> get files => _files;
2103 1722
2104 /** 1723 /**
2105 * The files that are to be a priority for analysis. 1724 * A list of the paths of files that are referenced by the navigation
1725 * targets.
2106 */ 1726 */
2107 void set files(List<String> value) { 1727 void set files(List<String> value) {
2108 assert(value != null); 1728 assert(value != null);
2109 this._files = value; 1729 this._files = value;
2110 } 1730 }
2111 1731
2112 AnalysisSetPriorityFilesParams(List<String> files) { 1732 /**
2113 this.files = files; 1733 * A list of the navigation targets that are referenced by the navigation
1734 * regions.
1735 */
1736 List<NavigationTarget> get targets => _targets;
1737
1738 /**
1739 * A list of the navigation targets that are referenced by the navigation
1740 * regions.
1741 */
1742 void set targets(List<NavigationTarget> value) {
1743 assert(value != null);
1744 this._targets = value;
2114 } 1745 }
2115 1746
2116 factory AnalysisSetPriorityFilesParams.fromJson( 1747 /**
1748 * A list of the navigation regions within the requested region of the file.
1749 */
1750 List<NavigationRegion> get regions => _regions;
1751
1752 /**
1753 * A list of the navigation regions within the requested region of the file.
1754 */
1755 void set regions(List<NavigationRegion> value) {
1756 assert(value != null);
1757 this._regions = value;
1758 }
1759
1760 AnalysisGetNavigationResult(List<String> files,
1761 List<NavigationTarget> targets, List<NavigationRegion> regions) {
1762 this.files = files;
1763 this.targets = targets;
1764 this.regions = regions;
1765 }
1766
1767 factory AnalysisGetNavigationResult.fromJson(
2117 JsonDecoder jsonDecoder, String jsonPath, Object json) { 1768 JsonDecoder jsonDecoder, String jsonPath, Object json) {
2118 if (json == null) { 1769 if (json == null) {
2119 json = {}; 1770 json = {};
2120 } 1771 }
2121 if (json is Map) { 1772 if (json is Map) {
2122 List<String> files; 1773 List<String> files;
2123 if (json.containsKey("files")) { 1774 if (json.containsKey("files")) {
2124 files = jsonDecoder.decodeList( 1775 files = jsonDecoder.decodeList(
2125 jsonPath + ".files", json["files"], jsonDecoder.decodeString); 1776 jsonPath + ".files", json["files"], jsonDecoder.decodeString);
2126 } else { 1777 } else {
2127 throw jsonDecoder.missingKey(jsonPath, "files"); 1778 throw jsonDecoder.mismatch(jsonPath, "files");
2128 } 1779 }
2129 return new AnalysisSetPriorityFilesParams(files); 1780 List<NavigationTarget> targets;
1781 if (json.containsKey("targets")) {
1782 targets = jsonDecoder.decodeList(
1783 jsonPath + ".targets",
1784 json["targets"],
1785 (String jsonPath, Object json) =>
1786 new NavigationTarget.fromJson(jsonDecoder, jsonPath, json));
1787 } else {
1788 throw jsonDecoder.mismatch(jsonPath, "targets");
1789 }
1790 List<NavigationRegion> regions;
1791 if (json.containsKey("regions")) {
1792 regions = jsonDecoder.decodeList(
1793 jsonPath + ".regions",
1794 json["regions"],
1795 (String jsonPath, Object json) =>
1796 new NavigationRegion.fromJson(jsonDecoder, jsonPath, json));
1797 } else {
1798 throw jsonDecoder.mismatch(jsonPath, "regions");
1799 }
1800 return new AnalysisGetNavigationResult(files, targets, regions);
2130 } else { 1801 } else {
2131 throw jsonDecoder.mismatch( 1802 throw jsonDecoder.mismatch(
2132 jsonPath, "analysis.setPriorityFiles params", json); 1803 jsonPath, "analysis.getNavigation result", json);
2133 } 1804 }
2134 } 1805 }
2135 1806
2136 factory AnalysisSetPriorityFilesParams.fromRequest(Request request) { 1807 factory AnalysisGetNavigationResult.fromResponse(Response response) {
2137 return new AnalysisSetPriorityFilesParams.fromJson( 1808 return new AnalysisGetNavigationResult.fromJson(
2138 new RequestDecoder(request), "params", request._params); 1809 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
1810 "result",
1811 response.result);
2139 } 1812 }
2140 1813
1814 @override
2141 Map<String, dynamic> toJson() { 1815 Map<String, dynamic> toJson() {
2142 Map<String, dynamic> result = {}; 1816 Map<String, dynamic> result = {};
2143 result["files"] = files; 1817 result["files"] = files;
1818 result["targets"] =
1819 targets.map((NavigationTarget value) => value.toJson()).toList();
1820 result["regions"] =
1821 regions.map((NavigationRegion value) => value.toJson()).toList();
2144 return result; 1822 return result;
2145 } 1823 }
2146 1824
2147 Request toRequest(String id) { 1825 @override
2148 return new Request(id, "analysis.setPriorityFiles", toJson()); 1826 Response toResponse(String id) {
1827 return new Response(id, result: toJson());
2149 } 1828 }
2150 1829
2151 @override 1830 @override
2152 String toString() => JSON.encode(toJson()); 1831 String toString() => JSON.encode(toJson());
2153 1832
2154 @override 1833 @override
2155 bool operator ==(other) { 1834 bool operator ==(other) {
2156 if (other is AnalysisSetPriorityFilesParams) { 1835 if (other is AnalysisGetNavigationResult) {
2157 return listEqual(files, other.files, (String a, String b) => a == b); 1836 return listEqual(files, other.files, (String a, String b) => a == b) &&
1837 listEqual(targets, other.targets,
1838 (NavigationTarget a, NavigationTarget b) => a == b) &&
1839 listEqual(regions, other.regions,
1840 (NavigationRegion a, NavigationRegion b) => a == b);
2158 } 1841 }
2159 return false; 1842 return false;
2160 } 1843 }
2161 1844
2162 @override 1845 @override
2163 int get hashCode { 1846 int get hashCode {
2164 int hash = 0; 1847 int hash = 0;
2165 hash = JenkinsSmiHash.combine(hash, files.hashCode); 1848 hash = JenkinsSmiHash.combine(hash, files.hashCode);
1849 hash = JenkinsSmiHash.combine(hash, targets.hashCode);
1850 hash = JenkinsSmiHash.combine(hash, regions.hashCode);
2166 return JenkinsSmiHash.finish(hash); 1851 return JenkinsSmiHash.finish(hash);
2167 } 1852 }
2168 } 1853 }
2169 1854
2170 /** 1855 /**
2171 * analysis.setPriorityFiles result 1856 * analysis.getReachableSources params
2172 *
2173 * Clients may not extend, implement or mix-in this class.
2174 */
2175 class AnalysisSetPriorityFilesResult {
2176 Response toResponse(String id) {
2177 return new Response(id, result: null);
2178 }
2179
2180 @override
2181 bool operator ==(other) {
2182 if (other is AnalysisSetPriorityFilesResult) {
2183 return true;
2184 }
2185 return false;
2186 }
2187
2188 @override
2189 int get hashCode {
2190 return 330050055;
2191 }
2192 }
2193
2194 /**
2195 * analysis.setSubscriptions params
2196 * 1857 *
2197 * { 1858 * {
2198 * "subscriptions": Map<AnalysisService, List<FilePath>> 1859 * "file": FilePath
2199 * } 1860 * }
2200 * 1861 *
2201 * Clients may not extend, implement or mix-in this class. 1862 * Clients may not extend, implement or mix-in this class.
2202 */ 1863 */
2203 class AnalysisSetSubscriptionsParams implements HasToJson { 1864 class AnalysisGetReachableSourcesParams implements RequestParams {
2204 Map<AnalysisService, List<String>> _subscriptions; 1865 String _file;
2205 1866
2206 /** 1867 /**
2207 * A table mapping services to a list of the files being subscribed to the 1868 * The file for which reachable source information is being requested.
2208 * service.
2209 */ 1869 */
2210 Map<AnalysisService, List<String>> get subscriptions => _subscriptions; 1870 String get file => _file;
2211 1871
2212 /** 1872 /**
2213 * A table mapping services to a list of the files being subscribed to the 1873 * The file for which reachable source information is being requested.
2214 * service.
2215 */ 1874 */
2216 void set subscriptions(Map<AnalysisService, List<String>> value) { 1875 void set file(String value) {
2217 assert(value != null); 1876 assert(value != null);
2218 this._subscriptions = value; 1877 this._file = value;
2219 } 1878 }
2220 1879
2221 AnalysisSetSubscriptionsParams( 1880 AnalysisGetReachableSourcesParams(String file) {
2222 Map<AnalysisService, List<String>> subscriptions) { 1881 this.file = file;
2223 this.subscriptions = subscriptions;
2224 } 1882 }
2225 1883
2226 factory AnalysisSetSubscriptionsParams.fromJson( 1884 factory AnalysisGetReachableSourcesParams.fromJson(
2227 JsonDecoder jsonDecoder, String jsonPath, Object json) { 1885 JsonDecoder jsonDecoder, String jsonPath, Object json) {
2228 if (json == null) { 1886 if (json == null) {
2229 json = {}; 1887 json = {};
2230 } 1888 }
2231 if (json is Map) { 1889 if (json is Map) {
2232 Map<AnalysisService, List<String>> subscriptions; 1890 String file;
2233 if (json.containsKey("subscriptions")) { 1891 if (json.containsKey("file")) {
2234 subscriptions = jsonDecoder.decodeMap( 1892 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
2235 jsonPath + ".subscriptions", json["subscriptions"],
2236 keyDecoder: (String jsonPath, Object json) =>
2237 new AnalysisService.fromJson(jsonDecoder, jsonPath, json),
2238 valueDecoder: (String jsonPath, Object json) => jsonDecoder
2239 .decodeList(jsonPath, json, jsonDecoder.decodeString));
2240 } else { 1893 } else {
2241 throw jsonDecoder.missingKey(jsonPath, "subscriptions"); 1894 throw jsonDecoder.mismatch(jsonPath, "file");
2242 } 1895 }
2243 return new AnalysisSetSubscriptionsParams(subscriptions); 1896 return new AnalysisGetReachableSourcesParams(file);
2244 } else { 1897 } else {
2245 throw jsonDecoder.mismatch( 1898 throw jsonDecoder.mismatch(
2246 jsonPath, "analysis.setSubscriptions params", json); 1899 jsonPath, "analysis.getReachableSources params", json);
2247 } 1900 }
2248 } 1901 }
2249 1902
2250 factory AnalysisSetSubscriptionsParams.fromRequest(Request request) { 1903 factory AnalysisGetReachableSourcesParams.fromRequest(Request request) {
2251 return new AnalysisSetSubscriptionsParams.fromJson( 1904 return new AnalysisGetReachableSourcesParams.fromJson(
2252 new RequestDecoder(request), "params", request._params); 1905 new RequestDecoder(request), "params", request.params);
2253 } 1906 }
2254 1907
1908 @override
2255 Map<String, dynamic> toJson() { 1909 Map<String, dynamic> toJson() {
2256 Map<String, dynamic> result = {}; 1910 Map<String, dynamic> result = {};
2257 result["subscriptions"] = mapMap(subscriptions, 1911 result["file"] = file;
2258 keyCallback: (AnalysisService value) => value.toJson());
2259 return result; 1912 return result;
2260 } 1913 }
2261 1914
1915 @override
2262 Request toRequest(String id) { 1916 Request toRequest(String id) {
2263 return new Request(id, "analysis.setSubscriptions", toJson()); 1917 return new Request(id, "analysis.getReachableSources", toJson());
2264 } 1918 }
2265 1919
2266 @override 1920 @override
2267 String toString() => JSON.encode(toJson()); 1921 String toString() => JSON.encode(toJson());
2268 1922
2269 @override 1923 @override
2270 bool operator ==(other) { 1924 bool operator ==(other) {
2271 if (other is AnalysisSetSubscriptionsParams) { 1925 if (other is AnalysisGetReachableSourcesParams) {
2272 return mapEqual( 1926 return file == other.file;
2273 subscriptions,
2274 other.subscriptions,
2275 (List<String> a, List<String> b) =>
2276 listEqual(a, b, (String a, String b) => a == b));
2277 } 1927 }
2278 return false; 1928 return false;
2279 } 1929 }
2280 1930
2281 @override 1931 @override
2282 int get hashCode { 1932 int get hashCode {
2283 int hash = 0; 1933 int hash = 0;
2284 hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode); 1934 hash = JenkinsSmiHash.combine(hash, file.hashCode);
2285 return JenkinsSmiHash.finish(hash); 1935 return JenkinsSmiHash.finish(hash);
2286 } 1936 }
2287 } 1937 }
2288 1938
2289 /** 1939 /**
2290 * analysis.setSubscriptions result 1940 * analysis.getReachableSources result
2291 *
2292 * Clients may not extend, implement or mix-in this class.
2293 */
2294 class AnalysisSetSubscriptionsResult {
2295 Response toResponse(String id) {
2296 return new Response(id, result: null);
2297 }
2298
2299 @override
2300 bool operator ==(other) {
2301 if (other is AnalysisSetSubscriptionsResult) {
2302 return true;
2303 }
2304 return false;
2305 }
2306
2307 @override
2308 int get hashCode {
2309 return 218088493;
2310 }
2311 }
2312
2313 /**
2314 * analysis.updateContent params
2315 * 1941 *
2316 * { 1942 * {
2317 * "files": Map<FilePath, AddContentOverlay | ChangeContentOverlay | RemoveCon tentOverlay> 1943 * "sources": Map<String, List<String>>
2318 * } 1944 * }
2319 * 1945 *
2320 * Clients may not extend, implement or mix-in this class. 1946 * Clients may not extend, implement or mix-in this class.
2321 */ 1947 */
2322 class AnalysisUpdateContentParams implements HasToJson { 1948 class AnalysisGetReachableSourcesResult implements ResponseResult {
2323 Map<String, dynamic> _files; 1949 Map<String, List<String>> _sources;
2324 1950
2325 /** 1951 /**
2326 * A table mapping the files whose content has changed to a description of 1952 * A mapping from source URIs to directly reachable source URIs. For example,
2327 * the content change. 1953 * a file "foo.dart" that imports "bar.dart" would have the corresponding
1954 * mapping { "file:///foo.dart" : ["file:///bar.dart"] }. If "bar.dart" has
1955 * further imports (or exports) there will be a mapping from the URI
1956 * "file:///bar.dart" to them. To check if a specific URI is reachable from a
1957 * given file, clients can check for its presence in the resulting key set.
2328 */ 1958 */
2329 Map<String, dynamic> get files => _files; 1959 Map<String, List<String>> get sources => _sources;
2330 1960
2331 /** 1961 /**
2332 * A table mapping the files whose content has changed to a description of 1962 * A mapping from source URIs to directly reachable source URIs. For example,
2333 * the content change. 1963 * a file "foo.dart" that imports "bar.dart" would have the corresponding
1964 * mapping { "file:///foo.dart" : ["file:///bar.dart"] }. If "bar.dart" has
1965 * further imports (or exports) there will be a mapping from the URI
1966 * "file:///bar.dart" to them. To check if a specific URI is reachable from a
1967 * given file, clients can check for its presence in the resulting key set.
2334 */ 1968 */
2335 void set files(Map<String, dynamic> value) { 1969 void set sources(Map<String, List<String>> value) {
2336 assert(value != null); 1970 assert(value != null);
2337 this._files = value; 1971 this._sources = value;
2338 } 1972 }
2339 1973
2340 AnalysisUpdateContentParams(Map<String, dynamic> files) { 1974 AnalysisGetReachableSourcesResult(Map<String, List<String>> sources) {
2341 this.files = files; 1975 this.sources = sources;
2342 } 1976 }
2343 1977
2344 factory AnalysisUpdateContentParams.fromJson( 1978 factory AnalysisGetReachableSourcesResult.fromJson(
2345 JsonDecoder jsonDecoder, String jsonPath, Object json) { 1979 JsonDecoder jsonDecoder, String jsonPath, Object json) {
2346 if (json == null) { 1980 if (json == null) {
2347 json = {}; 1981 json = {};
2348 } 1982 }
2349 if (json is Map) { 1983 if (json is Map) {
2350 Map<String, dynamic> files; 1984 Map<String, List<String>> sources;
2351 if (json.containsKey("files")) { 1985 if (json.containsKey("sources")) {
2352 files = jsonDecoder.decodeMap(jsonPath + ".files", json["files"], 1986 sources = jsonDecoder.decodeMap(jsonPath + ".sources", json["sources"],
2353 valueDecoder: (String jsonPath, Object json) => 1987 valueDecoder: (String jsonPath, Object json) => jsonDecoder
2354 jsonDecoder.decodeUnion(jsonPath, json, "type", { 1988 .decodeList(jsonPath, json, jsonDecoder.decodeString));
2355 "add": (String jsonPath, Object json) =>
2356 new AddContentOverlay.fromJson(
2357 jsonDecoder, jsonPath, json),
2358 "change": (String jsonPath, Object json) =>
2359 new ChangeContentOverlay.fromJson(
2360 jsonDecoder, jsonPath, json),
2361 "remove": (String jsonPath, Object json) =>
2362 new RemoveContentOverlay.fromJson(
2363 jsonDecoder, jsonPath, json)
2364 }));
2365 } else { 1989 } else {
2366 throw jsonDecoder.missingKey(jsonPath, "files"); 1990 throw jsonDecoder.mismatch(jsonPath, "sources");
2367 } 1991 }
2368 return new AnalysisUpdateContentParams(files); 1992 return new AnalysisGetReachableSourcesResult(sources);
2369 } else { 1993 } else {
2370 throw jsonDecoder.mismatch( 1994 throw jsonDecoder.mismatch(
2371 jsonPath, "analysis.updateContent params", json); 1995 jsonPath, "analysis.getReachableSources result", json);
2372 } 1996 }
2373 } 1997 }
2374 1998
2375 factory AnalysisUpdateContentParams.fromRequest(Request request) { 1999 factory AnalysisGetReachableSourcesResult.fromResponse(Response response) {
2376 return new AnalysisUpdateContentParams.fromJson( 2000 return new AnalysisGetReachableSourcesResult.fromJson(
2377 new RequestDecoder(request), "params", request._params); 2001 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
2002 "result",
2003 response.result);
2378 } 2004 }
2379 2005
2006 @override
2380 Map<String, dynamic> toJson() { 2007 Map<String, dynamic> toJson() {
2381 Map<String, dynamic> result = {}; 2008 Map<String, dynamic> result = {};
2382 result["files"] = 2009 result["sources"] = sources;
2383 mapMap(files, valueCallback: (dynamic value) => value.toJson());
2384 return result; 2010 return result;
2385 } 2011 }
2386 2012
2387 Request toRequest(String id) {
2388 return new Request(id, "analysis.updateContent", toJson());
2389 }
2390
2391 @override 2013 @override
2392 String toString() => JSON.encode(toJson());
2393
2394 @override
2395 bool operator ==(other) {
2396 if (other is AnalysisUpdateContentParams) {
2397 return mapEqual(files, other.files, (dynamic a, dynamic b) => a == b);
2398 }
2399 return false;
2400 }
2401
2402 @override
2403 int get hashCode {
2404 int hash = 0;
2405 hash = JenkinsSmiHash.combine(hash, files.hashCode);
2406 return JenkinsSmiHash.finish(hash);
2407 }
2408 }
2409
2410 /**
2411 * analysis.updateContent result
2412 *
2413 * {
2414 * }
2415 *
2416 * Clients may not extend, implement or mix-in this class.
2417 */
2418 class AnalysisUpdateContentResult implements HasToJson {
2419 AnalysisUpdateContentResult();
2420
2421 factory AnalysisUpdateContentResult.fromJson(
2422 JsonDecoder jsonDecoder, String jsonPath, Object json) {
2423 if (json == null) {
2424 json = {};
2425 }
2426 if (json is Map) {
2427 return new AnalysisUpdateContentResult();
2428 } else {
2429 throw jsonDecoder.mismatch(
2430 jsonPath, "analysis.updateContent result", json);
2431 }
2432 }
2433
2434 factory AnalysisUpdateContentResult.fromResponse(Response response) {
2435 return new AnalysisUpdateContentResult.fromJson(
2436 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
2437 "result",
2438 response._result);
2439 }
2440
2441 Map<String, dynamic> toJson() {
2442 Map<String, dynamic> result = {};
2443 return result;
2444 }
2445
2446 Response toResponse(String id) { 2014 Response toResponse(String id) {
2447 return new Response(id, result: toJson()); 2015 return new Response(id, result: toJson());
2448 } 2016 }
2449 2017
2450 @override 2018 @override
2451 String toString() => JSON.encode(toJson()); 2019 String toString() => JSON.encode(toJson());
2452 2020
2453 @override 2021 @override
2454 bool operator ==(other) { 2022 bool operator ==(other) {
2455 if (other is AnalysisUpdateContentResult) { 2023 if (other is AnalysisGetReachableSourcesResult) {
2456 return true; 2024 return mapEqual(
2025 sources,
2026 other.sources,
2027 (List<String> a, List<String> b) =>
2028 listEqual(a, b, (String a, String b) => a == b));
2457 } 2029 }
2458 return false; 2030 return false;
2459 } 2031 }
2460 2032
2461 @override 2033 @override
2462 int get hashCode { 2034 int get hashCode {
2463 int hash = 0; 2035 int hash = 0;
2036 hash = JenkinsSmiHash.combine(hash, sources.hashCode);
2464 return JenkinsSmiHash.finish(hash); 2037 return JenkinsSmiHash.finish(hash);
2465 } 2038 }
2466 } 2039 }
2467 2040
2468 /** 2041 /**
2469 * analysis.updateOptions params 2042 * analysis.highlights params
2470 * 2043 *
2471 * { 2044 * {
2472 * "options": AnalysisOptions 2045 * "file": FilePath
2046 * "regions": List<HighlightRegion>
2473 * } 2047 * }
2474 * 2048 *
2475 * Clients may not extend, implement or mix-in this class. 2049 * Clients may not extend, implement or mix-in this class.
2476 */ 2050 */
2477 class AnalysisUpdateOptionsParams implements HasToJson { 2051 class AnalysisHighlightsParams implements HasToJson {
2478 AnalysisOptions _options; 2052 String _file;
2053
2054 List<HighlightRegion> _regions;
2479 2055
2480 /** 2056 /**
2481 * The options that are to be used to control analysis. 2057 * The file containing the highlight regions.
2482 */ 2058 */
2483 AnalysisOptions get options => _options; 2059 String get file => _file;
2484 2060
2485 /** 2061 /**
2486 * The options that are to be used to control analysis. 2062 * The file containing the highlight regions.
2487 */ 2063 */
2488 void set options(AnalysisOptions value) { 2064 void set file(String value) {
2489 assert(value != null); 2065 assert(value != null);
2490 this._options = value; 2066 this._file = value;
2491 } 2067 }
2492 2068
2493 AnalysisUpdateOptionsParams(AnalysisOptions options) { 2069 /**
2494 this.options = options; 2070 * The highlight regions contained in the file. Each highlight region
2071 * represents a particular syntactic or semantic meaning associated with some
2072 * range. Note that the highlight regions that are returned can overlap other
2073 * highlight regions if there is more than one meaning associated with a
2074 * particular region.
2075 */
2076 List<HighlightRegion> get regions => _regions;
2077
2078 /**
2079 * The highlight regions contained in the file. Each highlight region
2080 * represents a particular syntactic or semantic meaning associated with some
2081 * range. Note that the highlight regions that are returned can overlap other
2082 * highlight regions if there is more than one meaning associated with a
2083 * particular region.
2084 */
2085 void set regions(List<HighlightRegion> value) {
2086 assert(value != null);
2087 this._regions = value;
2495 } 2088 }
2496 2089
2497 factory AnalysisUpdateOptionsParams.fromJson( 2090 AnalysisHighlightsParams(String file, List<HighlightRegion> regions) {
2091 this.file = file;
2092 this.regions = regions;
2093 }
2094
2095 factory AnalysisHighlightsParams.fromJson(
2498 JsonDecoder jsonDecoder, String jsonPath, Object json) { 2096 JsonDecoder jsonDecoder, String jsonPath, Object json) {
2499 if (json == null) { 2097 if (json == null) {
2500 json = {}; 2098 json = {};
2501 } 2099 }
2502 if (json is Map) { 2100 if (json is Map) {
2503 AnalysisOptions options; 2101 String file;
2504 if (json.containsKey("options")) { 2102 if (json.containsKey("file")) {
2505 options = new AnalysisOptions.fromJson( 2103 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
2506 jsonDecoder, jsonPath + ".options", json["options"]);
2507 } else { 2104 } else {
2508 throw jsonDecoder.missingKey(jsonPath, "options"); 2105 throw jsonDecoder.mismatch(jsonPath, "file");
2509 } 2106 }
2510 return new AnalysisUpdateOptionsParams(options); 2107 List<HighlightRegion> regions;
2108 if (json.containsKey("regions")) {
2109 regions = jsonDecoder.decodeList(
2110 jsonPath + ".regions",
2111 json["regions"],
2112 (String jsonPath, Object json) =>
2113 new HighlightRegion.fromJson(jsonDecoder, jsonPath, json));
2114 } else {
2115 throw jsonDecoder.mismatch(jsonPath, "regions");
2116 }
2117 return new AnalysisHighlightsParams(file, regions);
2511 } else { 2118 } else {
2512 throw jsonDecoder.mismatch( 2119 throw jsonDecoder.mismatch(jsonPath, "analysis.highlights params", json);
2513 jsonPath, "analysis.updateOptions params", json);
2514 } 2120 }
2515 } 2121 }
2516 2122
2517 factory AnalysisUpdateOptionsParams.fromRequest(Request request) { 2123 factory AnalysisHighlightsParams.fromNotification(Notification notification) {
2518 return new AnalysisUpdateOptionsParams.fromJson( 2124 return new AnalysisHighlightsParams.fromJson(
2519 new RequestDecoder(request), "params", request._params); 2125 new ResponseDecoder(null), "params", notification.params);
2520 } 2126 }
2521 2127
2128 @override
2522 Map<String, dynamic> toJson() { 2129 Map<String, dynamic> toJson() {
2523 Map<String, dynamic> result = {}; 2130 Map<String, dynamic> result = {};
2524 result["options"] = options.toJson(); 2131 result["file"] = file;
2132 result["regions"] =
2133 regions.map((HighlightRegion value) => value.toJson()).toList();
2525 return result; 2134 return result;
2526 } 2135 }
2527 2136
2528 Request toRequest(String id) { 2137 Notification toNotification() {
2529 return new Request(id, "analysis.updateOptions", toJson()); 2138 return new Notification("analysis.highlights", toJson());
2530 } 2139 }
2531 2140
2532 @override 2141 @override
2533 String toString() => JSON.encode(toJson()); 2142 String toString() => JSON.encode(toJson());
2534 2143
2535 @override 2144 @override
2536 bool operator ==(other) { 2145 bool operator ==(other) {
2537 if (other is AnalysisUpdateOptionsParams) { 2146 if (other is AnalysisHighlightsParams) {
2538 return options == other.options; 2147 return file == other.file &&
2148 listEqual(regions, other.regions,
2149 (HighlightRegion a, HighlightRegion b) => a == b);
2539 } 2150 }
2540 return false; 2151 return false;
2541 } 2152 }
2542 2153
2543 @override 2154 @override
2544 int get hashCode { 2155 int get hashCode {
2545 int hash = 0; 2156 int hash = 0;
2546 hash = JenkinsSmiHash.combine(hash, options.hashCode); 2157 hash = JenkinsSmiHash.combine(hash, file.hashCode);
2158 hash = JenkinsSmiHash.combine(hash, regions.hashCode);
2547 return JenkinsSmiHash.finish(hash); 2159 return JenkinsSmiHash.finish(hash);
2548 } 2160 }
2549 } 2161 }
2550 2162
2551 /** 2163 /**
2552 * analysis.updateOptions result 2164 * analysis.implemented params
2553 *
2554 * Clients may not extend, implement or mix-in this class.
2555 */
2556 class AnalysisUpdateOptionsResult {
2557 Response toResponse(String id) {
2558 return new Response(id, result: null);
2559 }
2560
2561 @override
2562 bool operator ==(other) {
2563 if (other is AnalysisUpdateOptionsResult) {
2564 return true;
2565 }
2566 return false;
2567 }
2568
2569 @override
2570 int get hashCode {
2571 return 179689467;
2572 }
2573 }
2574
2575 /**
2576 * analysis.analyzedFiles params
2577 * 2165 *
2578 * { 2166 * {
2579 * "directories": List<FilePath> 2167 * "file": FilePath
2168 * "classes": List<ImplementedClass>
2169 * "members": List<ImplementedMember>
2580 * } 2170 * }
2581 * 2171 *
2582 * Clients may not extend, implement or mix-in this class. 2172 * Clients may not extend, implement or mix-in this class.
2583 */ 2173 */
2584 class AnalysisAnalyzedFilesParams implements HasToJson { 2174 class AnalysisImplementedParams implements HasToJson {
2585 List<String> _directories; 2175 String _file;
2176
2177 List<ImplementedClass> _classes;
2178
2179 List<ImplementedMember> _members;
2586 2180
2587 /** 2181 /**
2588 * A list of the paths of the files that are being analyzed. 2182 * The file with which the implementations are associated.
2589 */ 2183 */
2590 List<String> get directories => _directories; 2184 String get file => _file;
2591 2185
2592 /** 2186 /**
2593 * A list of the paths of the files that are being analyzed. 2187 * The file with which the implementations are associated.
2594 */ 2188 */
2595 void set directories(List<String> value) { 2189 void set file(String value) {
2596 assert(value != null); 2190 assert(value != null);
2597 this._directories = value; 2191 this._file = value;
2598 } 2192 }
2599 2193
2600 AnalysisAnalyzedFilesParams(List<String> directories) { 2194 /**
2601 this.directories = directories; 2195 * The classes defined in the file that are implemented or extended.
2196 */
2197 List<ImplementedClass> get classes => _classes;
2198
2199 /**
2200 * The classes defined in the file that are implemented or extended.
2201 */
2202 void set classes(List<ImplementedClass> value) {
2203 assert(value != null);
2204 this._classes = value;
2602 } 2205 }
2603 2206
2604 factory AnalysisAnalyzedFilesParams.fromJson( 2207 /**
2208 * The member defined in the file that are implemented or overridden.
2209 */
2210 List<ImplementedMember> get members => _members;
2211
2212 /**
2213 * The member defined in the file that are implemented or overridden.
2214 */
2215 void set members(List<ImplementedMember> value) {
2216 assert(value != null);
2217 this._members = value;
2218 }
2219
2220 AnalysisImplementedParams(String file, List<ImplementedClass> classes,
2221 List<ImplementedMember> members) {
2222 this.file = file;
2223 this.classes = classes;
2224 this.members = members;
2225 }
2226
2227 factory AnalysisImplementedParams.fromJson(
2605 JsonDecoder jsonDecoder, String jsonPath, Object json) { 2228 JsonDecoder jsonDecoder, String jsonPath, Object json) {
2606 if (json == null) { 2229 if (json == null) {
2607 json = {}; 2230 json = {};
2608 } 2231 }
2609 if (json is Map) { 2232 if (json is Map) {
2610 List<String> directories; 2233 String file;
2611 if (json.containsKey("directories")) { 2234 if (json.containsKey("file")) {
2612 directories = jsonDecoder.decodeList(jsonPath + ".directories", 2235 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
2613 json["directories"], jsonDecoder.decodeString);
2614 } else { 2236 } else {
2615 throw jsonDecoder.missingKey(jsonPath, "directories"); 2237 throw jsonDecoder.mismatch(jsonPath, "file");
2616 } 2238 }
2617 return new AnalysisAnalyzedFilesParams(directories); 2239 List<ImplementedClass> classes;
2240 if (json.containsKey("classes")) {
2241 classes = jsonDecoder.decodeList(
2242 jsonPath + ".classes",
2243 json["classes"],
2244 (String jsonPath, Object json) =>
2245 new ImplementedClass.fromJson(jsonDecoder, jsonPath, json));
2246 } else {
2247 throw jsonDecoder.mismatch(jsonPath, "classes");
2248 }
2249 List<ImplementedMember> members;
2250 if (json.containsKey("members")) {
2251 members = jsonDecoder.decodeList(
2252 jsonPath + ".members",
2253 json["members"],
2254 (String jsonPath, Object json) =>
2255 new ImplementedMember.fromJson(jsonDecoder, jsonPath, json));
2256 } else {
2257 throw jsonDecoder.mismatch(jsonPath, "members");
2258 }
2259 return new AnalysisImplementedParams(file, classes, members);
2618 } else { 2260 } else {
2619 throw jsonDecoder.mismatch( 2261 throw jsonDecoder.mismatch(jsonPath, "analysis.implemented params", json);
2620 jsonPath, "analysis.analyzedFiles params", json);
2621 } 2262 }
2622 } 2263 }
2623 2264
2624 factory AnalysisAnalyzedFilesParams.fromNotification( 2265 factory AnalysisImplementedParams.fromNotification(
2625 Notification notification) { 2266 Notification notification) {
2626 return new AnalysisAnalyzedFilesParams.fromJson( 2267 return new AnalysisImplementedParams.fromJson(
2627 new ResponseDecoder(null), "params", notification._params); 2268 new ResponseDecoder(null), "params", notification.params);
2628 } 2269 }
2629 2270
2271 @override
2630 Map<String, dynamic> toJson() { 2272 Map<String, dynamic> toJson() {
2631 Map<String, dynamic> result = {}; 2273 Map<String, dynamic> result = {};
2632 result["directories"] = directories; 2274 result["file"] = file;
2275 result["classes"] =
2276 classes.map((ImplementedClass value) => value.toJson()).toList();
2277 result["members"] =
2278 members.map((ImplementedMember value) => value.toJson()).toList();
2633 return result; 2279 return result;
2634 } 2280 }
2635 2281
2636 Notification toNotification() { 2282 Notification toNotification() {
2637 return new Notification("analysis.analyzedFiles", toJson()); 2283 return new Notification("analysis.implemented", toJson());
2638 } 2284 }
2639 2285
2640 @override 2286 @override
2641 String toString() => JSON.encode(toJson()); 2287 String toString() => JSON.encode(toJson());
2642 2288
2643 @override 2289 @override
2644 bool operator ==(other) { 2290 bool operator ==(other) {
2645 if (other is AnalysisAnalyzedFilesParams) { 2291 if (other is AnalysisImplementedParams) {
2646 return listEqual( 2292 return file == other.file &&
2647 directories, other.directories, (String a, String b) => a == b); 2293 listEqual(classes, other.classes,
2294 (ImplementedClass a, ImplementedClass b) => a == b) &&
2295 listEqual(members, other.members,
2296 (ImplementedMember a, ImplementedMember b) => a == b);
2648 } 2297 }
2649 return false; 2298 return false;
2650 } 2299 }
2651 2300
2652 @override 2301 @override
2653 int get hashCode { 2302 int get hashCode {
2654 int hash = 0; 2303 int hash = 0;
2655 hash = JenkinsSmiHash.combine(hash, directories.hashCode); 2304 hash = JenkinsSmiHash.combine(hash, file.hashCode);
2305 hash = JenkinsSmiHash.combine(hash, classes.hashCode);
2306 hash = JenkinsSmiHash.combine(hash, members.hashCode);
2656 return JenkinsSmiHash.finish(hash); 2307 return JenkinsSmiHash.finish(hash);
2657 } 2308 }
2658 } 2309 }
2659 2310
2660 /** 2311 /**
2661 * analysis.errors params 2312 * analysis.invalidate params
2662 * 2313 *
2663 * { 2314 * {
2664 * "file": FilePath 2315 * "file": FilePath
2665 * "errors": List<AnalysisError> 2316 * "offset": int
2317 * "length": int
2318 * "delta": int
2666 * } 2319 * }
2667 * 2320 *
2668 * Clients may not extend, implement or mix-in this class. 2321 * Clients may not extend, implement or mix-in this class.
2669 */ 2322 */
2670 class AnalysisErrorsParams implements HasToJson { 2323 class AnalysisInvalidateParams implements HasToJson {
2671 String _file; 2324 String _file;
2672 2325
2673 List<AnalysisError> _errors; 2326 int _offset;
2327
2328 int _length;
2329
2330 int _delta;
2674 2331
2675 /** 2332 /**
2676 * The file containing the errors. 2333 * The file whose information has been invalidated.
2677 */ 2334 */
2678 String get file => _file; 2335 String get file => _file;
2679 2336
2680 /** 2337 /**
2681 * The file containing the errors. 2338 * The file whose information has been invalidated.
2682 */ 2339 */
2683 void set file(String value) { 2340 void set file(String value) {
2684 assert(value != null); 2341 assert(value != null);
2685 this._file = value; 2342 this._file = value;
2686 } 2343 }
2687 2344
2688 /** 2345 /**
2689 * The errors contained in the file. 2346 * The offset of the invalidated region.
2690 */ 2347 */
2691 List<AnalysisError> get errors => _errors; 2348 int get offset => _offset;
2692 2349
2693 /** 2350 /**
2694 * The errors contained in the file. 2351 * The offset of the invalidated region.
2695 */ 2352 */
2696 void set errors(List<AnalysisError> value) { 2353 void set offset(int value) {
2697 assert(value != null); 2354 assert(value != null);
2698 this._errors = value; 2355 this._offset = value;
2699 } 2356 }
2700 2357
2701 AnalysisErrorsParams(String file, List<AnalysisError> errors) { 2358 /**
2702 this.file = file; 2359 * The length of the invalidated region.
2703 this.errors = errors; 2360 */
2361 int get length => _length;
2362
2363 /**
2364 * The length of the invalidated region.
2365 */
2366 void set length(int value) {
2367 assert(value != null);
2368 this._length = value;
2704 } 2369 }
2705 2370
2706 factory AnalysisErrorsParams.fromJson( 2371 /**
2372 * The delta to be applied to the offsets in information that follows the
2373 * invalidated region in order to update it so that it doesn't need to be
2374 * re-requested.
2375 */
2376 int get delta => _delta;
2377
2378 /**
2379 * The delta to be applied to the offsets in information that follows the
2380 * invalidated region in order to update it so that it doesn't need to be
2381 * re-requested.
2382 */
2383 void set delta(int value) {
2384 assert(value != null);
2385 this._delta = value;
2386 }
2387
2388 AnalysisInvalidateParams(String file, int offset, int length, int delta) {
2389 this.file = file;
2390 this.offset = offset;
2391 this.length = length;
2392 this.delta = delta;
2393 }
2394
2395 factory AnalysisInvalidateParams.fromJson(
2707 JsonDecoder jsonDecoder, String jsonPath, Object json) { 2396 JsonDecoder jsonDecoder, String jsonPath, Object json) {
2708 if (json == null) { 2397 if (json == null) {
2709 json = {}; 2398 json = {};
2710 } 2399 }
2711 if (json is Map) { 2400 if (json is Map) {
2712 String file; 2401 String file;
2713 if (json.containsKey("file")) { 2402 if (json.containsKey("file")) {
2714 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 2403 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
2715 } else { 2404 } else {
2716 throw jsonDecoder.missingKey(jsonPath, "file"); 2405 throw jsonDecoder.mismatch(jsonPath, "file");
2717 } 2406 }
2718 List<AnalysisError> errors; 2407 int offset;
2719 if (json.containsKey("errors")) { 2408 if (json.containsKey("offset")) {
2720 errors = jsonDecoder.decodeList( 2409 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
2721 jsonPath + ".errors",
2722 json["errors"],
2723 (String jsonPath, Object json) =>
2724 new AnalysisError.fromJson(jsonDecoder, jsonPath, json));
2725 } else { 2410 } else {
2726 throw jsonDecoder.missingKey(jsonPath, "errors"); 2411 throw jsonDecoder.mismatch(jsonPath, "offset");
2727 } 2412 }
2728 return new AnalysisErrorsParams(file, errors); 2413 int length;
2414 if (json.containsKey("length")) {
2415 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
2416 } else {
2417 throw jsonDecoder.mismatch(jsonPath, "length");
2418 }
2419 int delta;
2420 if (json.containsKey("delta")) {
2421 delta = jsonDecoder.decodeInt(jsonPath + ".delta", json["delta"]);
2422 } else {
2423 throw jsonDecoder.mismatch(jsonPath, "delta");
2424 }
2425 return new AnalysisInvalidateParams(file, offset, length, delta);
2729 } else { 2426 } else {
2730 throw jsonDecoder.mismatch(jsonPath, "analysis.errors params", json); 2427 throw jsonDecoder.mismatch(jsonPath, "analysis.invalidate params", json);
2731 } 2428 }
2732 } 2429 }
2733 2430
2734 factory AnalysisErrorsParams.fromNotification(Notification notification) { 2431 factory AnalysisInvalidateParams.fromNotification(Notification notification) {
2735 return new AnalysisErrorsParams.fromJson( 2432 return new AnalysisInvalidateParams.fromJson(
2736 new ResponseDecoder(null), "params", notification._params); 2433 new ResponseDecoder(null), "params", notification.params);
2737 } 2434 }
2738 2435
2436 @override
2739 Map<String, dynamic> toJson() { 2437 Map<String, dynamic> toJson() {
2740 Map<String, dynamic> result = {}; 2438 Map<String, dynamic> result = {};
2741 result["file"] = file; 2439 result["file"] = file;
2742 result["errors"] = 2440 result["offset"] = offset;
2743 errors.map((AnalysisError value) => value.toJson()).toList(); 2441 result["length"] = length;
2442 result["delta"] = delta;
2744 return result; 2443 return result;
2745 } 2444 }
2746 2445
2747 Notification toNotification() { 2446 Notification toNotification() {
2748 return new Notification("analysis.errors", toJson()); 2447 return new Notification("analysis.invalidate", toJson());
2749 } 2448 }
2750 2449
2751 @override 2450 @override
2752 String toString() => JSON.encode(toJson()); 2451 String toString() => JSON.encode(toJson());
2753 2452
2754 @override 2453 @override
2755 bool operator ==(other) { 2454 bool operator ==(other) {
2756 if (other is AnalysisErrorsParams) { 2455 if (other is AnalysisInvalidateParams) {
2757 return file == other.file && 2456 return file == other.file &&
2758 listEqual(errors, other.errors, 2457 offset == other.offset &&
2759 (AnalysisError a, AnalysisError b) => a == b); 2458 length == other.length &&
2459 delta == other.delta;
2760 } 2460 }
2761 return false; 2461 return false;
2762 } 2462 }
2763 2463
2764 @override 2464 @override
2765 int get hashCode { 2465 int get hashCode {
2766 int hash = 0; 2466 int hash = 0;
2767 hash = JenkinsSmiHash.combine(hash, file.hashCode); 2467 hash = JenkinsSmiHash.combine(hash, file.hashCode);
2768 hash = JenkinsSmiHash.combine(hash, errors.hashCode); 2468 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
2469 hash = JenkinsSmiHash.combine(hash, length.hashCode);
2470 hash = JenkinsSmiHash.combine(hash, delta.hashCode);
2769 return JenkinsSmiHash.finish(hash); 2471 return JenkinsSmiHash.finish(hash);
2770 } 2472 }
2771 } 2473 }
2772 2474
2773 /** 2475 /**
2774 * analysis.flushResults params 2476 * analysis.navigation params
2775 * 2477 *
2776 * { 2478 * {
2479 * "file": FilePath
2480 * "regions": List<NavigationRegion>
2481 * "targets": List<NavigationTarget>
2777 * "files": List<FilePath> 2482 * "files": List<FilePath>
2778 * } 2483 * }
2779 * 2484 *
2780 * Clients may not extend, implement or mix-in this class. 2485 * Clients may not extend, implement or mix-in this class.
2781 */ 2486 */
2782 class AnalysisFlushResultsParams implements HasToJson { 2487 class AnalysisNavigationParams implements HasToJson {
2488 String _file;
2489
2490 List<NavigationRegion> _regions;
2491
2492 List<NavigationTarget> _targets;
2493
2783 List<String> _files; 2494 List<String> _files;
2784 2495
2785 /** 2496 /**
2786 * The files that are no longer being analyzed. 2497 * The file containing the navigation regions.
2787 */
2788 List<String> get files => _files;
2789
2790 /**
2791 * The files that are no longer being analyzed.
2792 */
2793 void set files(List<String> value) {
2794 assert(value != null);
2795 this._files = value;
2796 }
2797
2798 AnalysisFlushResultsParams(List<String> files) {
2799 this.files = files;
2800 }
2801
2802 factory AnalysisFlushResultsParams.fromJson(
2803 JsonDecoder jsonDecoder, String jsonPath, Object json) {
2804 if (json == null) {
2805 json = {};
2806 }
2807 if (json is Map) {
2808 List<String> files;
2809 if (json.containsKey("files")) {
2810 files = jsonDecoder.decodeList(
2811 jsonPath + ".files", json["files"], jsonDecoder.decodeString);
2812 } else {
2813 throw jsonDecoder.missingKey(jsonPath, "files");
2814 }
2815 return new AnalysisFlushResultsParams(files);
2816 } else {
2817 throw jsonDecoder.mismatch(
2818 jsonPath, "analysis.flushResults params", json);
2819 }
2820 }
2821
2822 factory AnalysisFlushResultsParams.fromNotification(
2823 Notification notification) {
2824 return new AnalysisFlushResultsParams.fromJson(
2825 new ResponseDecoder(null), "params", notification._params);
2826 }
2827
2828 Map<String, dynamic> toJson() {
2829 Map<String, dynamic> result = {};
2830 result["files"] = files;
2831 return result;
2832 }
2833
2834 Notification toNotification() {
2835 return new Notification("analysis.flushResults", toJson());
2836 }
2837
2838 @override
2839 String toString() => JSON.encode(toJson());
2840
2841 @override
2842 bool operator ==(other) {
2843 if (other is AnalysisFlushResultsParams) {
2844 return listEqual(files, other.files, (String a, String b) => a == b);
2845 }
2846 return false;
2847 }
2848
2849 @override
2850 int get hashCode {
2851 int hash = 0;
2852 hash = JenkinsSmiHash.combine(hash, files.hashCode);
2853 return JenkinsSmiHash.finish(hash);
2854 }
2855 }
2856
2857 /**
2858 * analysis.folding params
2859 *
2860 * {
2861 * "file": FilePath
2862 * "regions": List<FoldingRegion>
2863 * }
2864 *
2865 * Clients may not extend, implement or mix-in this class.
2866 */
2867 class AnalysisFoldingParams implements HasToJson {
2868 String _file;
2869
2870 List<FoldingRegion> _regions;
2871
2872 /**
2873 * The file containing the folding regions.
2874 */ 2498 */
2875 String get file => _file; 2499 String get file => _file;
2876 2500
2877 /** 2501 /**
2878 * The file containing the folding regions. 2502 * The file containing the navigation regions.
2879 */ 2503 */
2880 void set file(String value) { 2504 void set file(String value) {
2881 assert(value != null); 2505 assert(value != null);
2882 this._file = value; 2506 this._file = value;
2883 } 2507 }
2884 2508
2885 /** 2509 /**
2886 * The folding regions contained in the file. 2510 * The navigation regions contained in the file. The regions are sorted by
2511 * their offsets. Each navigation region represents a list of targets
2512 * associated with some range. The lists will usually contain a single
2513 * target, but can contain more in the case of a part that is included in
2514 * multiple libraries or in Dart code that is compiled against multiple
2515 * versions of a package. Note that the navigation regions that are returned
2516 * do not overlap other navigation regions.
2887 */ 2517 */
2888 List<FoldingRegion> get regions => _regions; 2518 List<NavigationRegion> get regions => _regions;
2889 2519
2890 /** 2520 /**
2891 * The folding regions contained in the file. 2521 * The navigation regions contained in the file. The regions are sorted by
2522 * their offsets. Each navigation region represents a list of targets
2523 * associated with some range. The lists will usually contain a single
2524 * target, but can contain more in the case of a part that is included in
2525 * multiple libraries or in Dart code that is compiled against multiple
2526 * versions of a package. Note that the navigation regions that are returned
2527 * do not overlap other navigation regions.
2892 */ 2528 */
2893 void set regions(List<FoldingRegion> value) { 2529 void set regions(List<NavigationRegion> value) {
2894 assert(value != null); 2530 assert(value != null);
2895 this._regions = value; 2531 this._regions = value;
2896 } 2532 }
2897 2533
2898 AnalysisFoldingParams(String file, List<FoldingRegion> regions) { 2534 /**
2535 * The navigation targets referenced in the file. They are referenced by
2536 * NavigationRegions by their index in this array.
2537 */
2538 List<NavigationTarget> get targets => _targets;
2539
2540 /**
2541 * The navigation targets referenced in the file. They are referenced by
2542 * NavigationRegions by their index in this array.
2543 */
2544 void set targets(List<NavigationTarget> value) {
2545 assert(value != null);
2546 this._targets = value;
2547 }
2548
2549 /**
2550 * The files containing navigation targets referenced in the file. They are
2551 * referenced by NavigationTargets by their index in this array.
2552 */
2553 List<String> get files => _files;
2554
2555 /**
2556 * The files containing navigation targets referenced in the file. They are
2557 * referenced by NavigationTargets by their index in this array.
2558 */
2559 void set files(List<String> value) {
2560 assert(value != null);
2561 this._files = value;
2562 }
2563
2564 AnalysisNavigationParams(String file, List<NavigationRegion> regions,
2565 List<NavigationTarget> targets, List<String> files) {
2899 this.file = file; 2566 this.file = file;
2900 this.regions = regions; 2567 this.regions = regions;
2568 this.targets = targets;
2569 this.files = files;
2901 } 2570 }
2902 2571
2903 factory AnalysisFoldingParams.fromJson( 2572 factory AnalysisNavigationParams.fromJson(
2904 JsonDecoder jsonDecoder, String jsonPath, Object json) { 2573 JsonDecoder jsonDecoder, String jsonPath, Object json) {
2905 if (json == null) { 2574 if (json == null) {
2906 json = {}; 2575 json = {};
2907 } 2576 }
2908 if (json is Map) { 2577 if (json is Map) {
2909 String file; 2578 String file;
2910 if (json.containsKey("file")) { 2579 if (json.containsKey("file")) {
2911 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 2580 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
2912 } else { 2581 } else {
2913 throw jsonDecoder.missingKey(jsonPath, "file"); 2582 throw jsonDecoder.mismatch(jsonPath, "file");
2914 } 2583 }
2915 List<FoldingRegion> regions; 2584 List<NavigationRegion> regions;
2916 if (json.containsKey("regions")) { 2585 if (json.containsKey("regions")) {
2917 regions = jsonDecoder.decodeList( 2586 regions = jsonDecoder.decodeList(
2918 jsonPath + ".regions", 2587 jsonPath + ".regions",
2919 json["regions"], 2588 json["regions"],
2920 (String jsonPath, Object json) => 2589 (String jsonPath, Object json) =>
2921 new FoldingRegion.fromJson(jsonDecoder, jsonPath, json)); 2590 new NavigationRegion.fromJson(jsonDecoder, jsonPath, json));
2922 } else { 2591 } else {
2923 throw jsonDecoder.missingKey(jsonPath, "regions"); 2592 throw jsonDecoder.mismatch(jsonPath, "regions");
2924 } 2593 }
2925 return new AnalysisFoldingParams(file, regions); 2594 List<NavigationTarget> targets;
2595 if (json.containsKey("targets")) {
2596 targets = jsonDecoder.decodeList(
2597 jsonPath + ".targets",
2598 json["targets"],
2599 (String jsonPath, Object json) =>
2600 new NavigationTarget.fromJson(jsonDecoder, jsonPath, json));
2601 } else {
2602 throw jsonDecoder.mismatch(jsonPath, "targets");
2603 }
2604 List<String> files;
2605 if (json.containsKey("files")) {
2606 files = jsonDecoder.decodeList(
2607 jsonPath + ".files", json["files"], jsonDecoder.decodeString);
2608 } else {
2609 throw jsonDecoder.mismatch(jsonPath, "files");
2610 }
2611 return new AnalysisNavigationParams(file, regions, targets, files);
2926 } else { 2612 } else {
2927 throw jsonDecoder.mismatch(jsonPath, "analysis.folding params", json); 2613 throw jsonDecoder.mismatch(jsonPath, "analysis.navigation params", json);
2928 } 2614 }
2929 } 2615 }
2930 2616
2931 factory AnalysisFoldingParams.fromNotification(Notification notification) { 2617 factory AnalysisNavigationParams.fromNotification(Notification notification) {
2932 return new AnalysisFoldingParams.fromJson( 2618 return new AnalysisNavigationParams.fromJson(
2933 new ResponseDecoder(null), "params", notification._params); 2619 new ResponseDecoder(null), "params", notification.params);
2934 } 2620 }
2935 2621
2622 @override
2936 Map<String, dynamic> toJson() { 2623 Map<String, dynamic> toJson() {
2937 Map<String, dynamic> result = {}; 2624 Map<String, dynamic> result = {};
2938 result["file"] = file; 2625 result["file"] = file;
2939 result["regions"] = 2626 result["regions"] =
2940 regions.map((FoldingRegion value) => value.toJson()).toList(); 2627 regions.map((NavigationRegion value) => value.toJson()).toList();
2628 result["targets"] =
2629 targets.map((NavigationTarget value) => value.toJson()).toList();
2630 result["files"] = files;
2941 return result; 2631 return result;
2942 } 2632 }
2943 2633
2944 Notification toNotification() { 2634 Notification toNotification() {
2945 return new Notification("analysis.folding", toJson()); 2635 return new Notification("analysis.navigation", toJson());
2946 } 2636 }
2947 2637
2948 @override 2638 @override
2949 String toString() => JSON.encode(toJson()); 2639 String toString() => JSON.encode(toJson());
2950 2640
2951 @override 2641 @override
2952 bool operator ==(other) { 2642 bool operator ==(other) {
2953 if (other is AnalysisFoldingParams) { 2643 if (other is AnalysisNavigationParams) {
2954 return file == other.file && 2644 return file == other.file &&
2955 listEqual(regions, other.regions, 2645 listEqual(regions, other.regions,
2956 (FoldingRegion a, FoldingRegion b) => a == b); 2646 (NavigationRegion a, NavigationRegion b) => a == b) &&
2647 listEqual(targets, other.targets,
2648 (NavigationTarget a, NavigationTarget b) => a == b) &&
2649 listEqual(files, other.files, (String a, String b) => a == b);
2957 } 2650 }
2958 return false; 2651 return false;
2959 } 2652 }
2960 2653
2961 @override 2654 @override
2962 int get hashCode { 2655 int get hashCode {
2963 int hash = 0; 2656 int hash = 0;
2964 hash = JenkinsSmiHash.combine(hash, file.hashCode); 2657 hash = JenkinsSmiHash.combine(hash, file.hashCode);
2965 hash = JenkinsSmiHash.combine(hash, regions.hashCode); 2658 hash = JenkinsSmiHash.combine(hash, regions.hashCode);
2659 hash = JenkinsSmiHash.combine(hash, targets.hashCode);
2660 hash = JenkinsSmiHash.combine(hash, files.hashCode);
2966 return JenkinsSmiHash.finish(hash); 2661 return JenkinsSmiHash.finish(hash);
2967 } 2662 }
2968 } 2663 }
2969 2664
2970 /** 2665 /**
2971 * analysis.highlights params 2666 * analysis.occurrences params
2972 * 2667 *
2973 * { 2668 * {
2974 * "file": FilePath 2669 * "file": FilePath
2975 * "regions": List<HighlightRegion> 2670 * "occurrences": List<Occurrences>
2976 * } 2671 * }
2977 * 2672 *
2978 * Clients may not extend, implement or mix-in this class. 2673 * Clients may not extend, implement or mix-in this class.
2979 */ 2674 */
2980 class AnalysisHighlightsParams implements HasToJson { 2675 class AnalysisOccurrencesParams implements HasToJson {
2981 String _file; 2676 String _file;
2982 2677
2983 List<HighlightRegion> _regions; 2678 List<Occurrences> _occurrences;
2984 2679
2985 /** 2680 /**
2986 * The file containing the highlight regions. 2681 * The file in which the references occur.
2987 */ 2682 */
2988 String get file => _file; 2683 String get file => _file;
2989 2684
2990 /** 2685 /**
2991 * The file containing the highlight regions. 2686 * The file in which the references occur.
2992 */ 2687 */
2993 void set file(String value) { 2688 void set file(String value) {
2994 assert(value != null); 2689 assert(value != null);
2995 this._file = value; 2690 this._file = value;
2996 } 2691 }
2997 2692
2998 /** 2693 /**
2999 * The highlight regions contained in the file. Each highlight region 2694 * The occurrences of references to elements within the file.
3000 * represents a particular syntactic or semantic meaning associated with some
3001 * range. Note that the highlight regions that are returned can overlap other
3002 * highlight regions if there is more than one meaning associated with a
3003 * particular region.
3004 */ 2695 */
3005 List<HighlightRegion> get regions => _regions; 2696 List<Occurrences> get occurrences => _occurrences;
3006 2697
3007 /** 2698 /**
3008 * The highlight regions contained in the file. Each highlight region 2699 * The occurrences of references to elements within the file.
3009 * represents a particular syntactic or semantic meaning associated with some
3010 * range. Note that the highlight regions that are returned can overlap other
3011 * highlight regions if there is more than one meaning associated with a
3012 * particular region.
3013 */ 2700 */
3014 void set regions(List<HighlightRegion> value) { 2701 void set occurrences(List<Occurrences> value) {
3015 assert(value != null); 2702 assert(value != null);
3016 this._regions = value; 2703 this._occurrences = value;
3017 } 2704 }
3018 2705
3019 AnalysisHighlightsParams(String file, List<HighlightRegion> regions) { 2706 AnalysisOccurrencesParams(String file, List<Occurrences> occurrences) {
3020 this.file = file; 2707 this.file = file;
3021 this.regions = regions; 2708 this.occurrences = occurrences;
3022 } 2709 }
3023 2710
3024 factory AnalysisHighlightsParams.fromJson( 2711 factory AnalysisOccurrencesParams.fromJson(
3025 JsonDecoder jsonDecoder, String jsonPath, Object json) { 2712 JsonDecoder jsonDecoder, String jsonPath, Object json) {
3026 if (json == null) { 2713 if (json == null) {
3027 json = {}; 2714 json = {};
3028 } 2715 }
3029 if (json is Map) { 2716 if (json is Map) {
3030 String file; 2717 String file;
3031 if (json.containsKey("file")) { 2718 if (json.containsKey("file")) {
3032 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 2719 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
3033 } else { 2720 } else {
3034 throw jsonDecoder.missingKey(jsonPath, "file"); 2721 throw jsonDecoder.mismatch(jsonPath, "file");
3035 } 2722 }
3036 List<HighlightRegion> regions; 2723 List<Occurrences> occurrences;
3037 if (json.containsKey("regions")) { 2724 if (json.containsKey("occurrences")) {
3038 regions = jsonDecoder.decodeList( 2725 occurrences = jsonDecoder.decodeList(
3039 jsonPath + ".regions", 2726 jsonPath + ".occurrences",
3040 json["regions"], 2727 json["occurrences"],
3041 (String jsonPath, Object json) => 2728 (String jsonPath, Object json) =>
3042 new HighlightRegion.fromJson(jsonDecoder, jsonPath, json)); 2729 new Occurrences.fromJson(jsonDecoder, jsonPath, json));
3043 } else { 2730 } else {
3044 throw jsonDecoder.missingKey(jsonPath, "regions"); 2731 throw jsonDecoder.mismatch(jsonPath, "occurrences");
3045 } 2732 }
3046 return new AnalysisHighlightsParams(file, regions); 2733 return new AnalysisOccurrencesParams(file, occurrences);
3047 } else { 2734 } else {
3048 throw jsonDecoder.mismatch(jsonPath, "analysis.highlights params", json); 2735 throw jsonDecoder.mismatch(jsonPath, "analysis.occurrences params", json);
3049 } 2736 }
3050 } 2737 }
3051 2738
3052 factory AnalysisHighlightsParams.fromNotification(Notification notification) { 2739 factory AnalysisOccurrencesParams.fromNotification(
3053 return new AnalysisHighlightsParams.fromJson( 2740 Notification notification) {
3054 new ResponseDecoder(null), "params", notification._params); 2741 return new AnalysisOccurrencesParams.fromJson(
2742 new ResponseDecoder(null), "params", notification.params);
3055 } 2743 }
3056 2744
2745 @override
3057 Map<String, dynamic> toJson() { 2746 Map<String, dynamic> toJson() {
3058 Map<String, dynamic> result = {}; 2747 Map<String, dynamic> result = {};
3059 result["file"] = file; 2748 result["file"] = file;
3060 result["regions"] = 2749 result["occurrences"] =
3061 regions.map((HighlightRegion value) => value.toJson()).toList(); 2750 occurrences.map((Occurrences value) => value.toJson()).toList();
3062 return result; 2751 return result;
3063 } 2752 }
3064 2753
3065 Notification toNotification() { 2754 Notification toNotification() {
3066 return new Notification("analysis.highlights", toJson()); 2755 return new Notification("analysis.occurrences", toJson());
3067 } 2756 }
3068 2757
3069 @override 2758 @override
3070 String toString() => JSON.encode(toJson()); 2759 String toString() => JSON.encode(toJson());
3071 2760
3072 @override 2761 @override
3073 bool operator ==(other) { 2762 bool operator ==(other) {
3074 if (other is AnalysisHighlightsParams) { 2763 if (other is AnalysisOccurrencesParams) {
3075 return file == other.file && 2764 return file == other.file &&
3076 listEqual(regions, other.regions, 2765 listEqual(occurrences, other.occurrences,
3077 (HighlightRegion a, HighlightRegion b) => a == b); 2766 (Occurrences a, Occurrences b) => a == b);
3078 } 2767 }
3079 return false; 2768 return false;
3080 } 2769 }
3081 2770
3082 @override 2771 @override
3083 int get hashCode { 2772 int get hashCode {
3084 int hash = 0; 2773 int hash = 0;
3085 hash = JenkinsSmiHash.combine(hash, file.hashCode); 2774 hash = JenkinsSmiHash.combine(hash, file.hashCode);
3086 hash = JenkinsSmiHash.combine(hash, regions.hashCode); 2775 hash = JenkinsSmiHash.combine(hash, occurrences.hashCode);
3087 return JenkinsSmiHash.finish(hash); 2776 return JenkinsSmiHash.finish(hash);
3088 } 2777 }
3089 } 2778 }
3090 2779
3091 /** 2780 /**
3092 * analysis.implemented params 2781 * AnalysisOptions
3093 * 2782 *
3094 * { 2783 * {
3095 * "file": FilePath 2784 * "enableAsync": optional bool
3096 * "classes": List<ImplementedClass> 2785 * "enableDeferredLoading": optional bool
3097 * "members": List<ImplementedMember> 2786 * "enableEnums": optional bool
2787 * "enableNullAwareOperators": optional bool
2788 * "enableSuperMixins": optional bool
2789 * "generateDart2jsHints": optional bool
2790 * "generateHints": optional bool
2791 * "generateLints": optional bool
3098 * } 2792 * }
3099 * 2793 *
3100 * Clients may not extend, implement or mix-in this class. 2794 * Clients may not extend, implement or mix-in this class.
3101 */ 2795 */
3102 class AnalysisImplementedParams implements HasToJson { 2796 class AnalysisOptions implements HasToJson {
3103 String _file; 2797 bool _enableAsync;
3104 2798
3105 List<ImplementedClass> _classes; 2799 bool _enableDeferredLoading;
3106 2800
3107 List<ImplementedMember> _members; 2801 bool _enableEnums;
3108 2802
3109 /** 2803 bool _enableNullAwareOperators;
3110 * The file with which the implementations are associated. 2804
3111 */ 2805 bool _enableSuperMixins;
3112 String get file => _file; 2806
3113 2807 bool _generateDart2jsHints;
3114 /** 2808
3115 * The file with which the implementations are associated. 2809 bool _generateHints;
3116 */ 2810
3117 void set file(String value) { 2811 bool _generateLints;
3118 assert(value != null); 2812
3119 this._file = value; 2813 /**
3120 } 2814 * Deprecated: this feature is always enabled.
3121 2815 *
3122 /** 2816 * True if the client wants to enable support for the proposed async feature.
3123 * The classes defined in the file that are implemented or extended. 2817 */
3124 */ 2818 bool get enableAsync => _enableAsync;
3125 List<ImplementedClass> get classes => _classes; 2819
3126 2820 /**
3127 /** 2821 * Deprecated: this feature is always enabled.
3128 * The classes defined in the file that are implemented or extended. 2822 *
3129 */ 2823 * True if the client wants to enable support for the proposed async feature.
3130 void set classes(List<ImplementedClass> value) { 2824 */
3131 assert(value != null); 2825 void set enableAsync(bool value) {
3132 this._classes = value; 2826 this._enableAsync = value;
3133 } 2827 }
3134 2828
3135 /** 2829 /**
3136 * The member defined in the file that are implemented or overridden. 2830 * Deprecated: this feature is always enabled.
3137 */ 2831 *
3138 List<ImplementedMember> get members => _members; 2832 * True if the client wants to enable support for the proposed deferred
3139 2833 * loading feature.
3140 /** 2834 */
3141 * The member defined in the file that are implemented or overridden. 2835 bool get enableDeferredLoading => _enableDeferredLoading;
3142 */ 2836
3143 void set members(List<ImplementedMember> value) { 2837 /**
3144 assert(value != null); 2838 * Deprecated: this feature is always enabled.
3145 this._members = value; 2839 *
3146 } 2840 * True if the client wants to enable support for the proposed deferred
3147 2841 * loading feature.
3148 AnalysisImplementedParams(String file, List<ImplementedClass> classes, 2842 */
3149 List<ImplementedMember> members) { 2843 void set enableDeferredLoading(bool value) {
3150 this.file = file; 2844 this._enableDeferredLoading = value;
3151 this.classes = classes; 2845 }
3152 this.members = members; 2846
3153 } 2847 /**
3154 2848 * Deprecated: this feature is always enabled.
3155 factory AnalysisImplementedParams.fromJson( 2849 *
2850 * True if the client wants to enable support for the proposed enum feature.
2851 */
2852 bool get enableEnums => _enableEnums;
2853
2854 /**
2855 * Deprecated: this feature is always enabled.
2856 *
2857 * True if the client wants to enable support for the proposed enum feature.
2858 */
2859 void set enableEnums(bool value) {
2860 this._enableEnums = value;
2861 }
2862
2863 /**
2864 * Deprecated: this feature is always enabled.
2865 *
2866 * True if the client wants to enable support for the proposed "null aware
2867 * operators" feature.
2868 */
2869 bool get enableNullAwareOperators => _enableNullAwareOperators;
2870
2871 /**
2872 * Deprecated: this feature is always enabled.
2873 *
2874 * True if the client wants to enable support for the proposed "null aware
2875 * operators" feature.
2876 */
2877 void set enableNullAwareOperators(bool value) {
2878 this._enableNullAwareOperators = value;
2879 }
2880
2881 /**
2882 * True if the client wants to enable support for the proposed "less
2883 * restricted mixins" proposal (DEP 34).
2884 */
2885 bool get enableSuperMixins => _enableSuperMixins;
2886
2887 /**
2888 * True if the client wants to enable support for the proposed "less
2889 * restricted mixins" proposal (DEP 34).
2890 */
2891 void set enableSuperMixins(bool value) {
2892 this._enableSuperMixins = value;
2893 }
2894
2895 /**
2896 * True if hints that are specific to dart2js should be generated. This
2897 * option is ignored if generateHints is false.
2898 */
2899 bool get generateDart2jsHints => _generateDart2jsHints;
2900
2901 /**
2902 * True if hints that are specific to dart2js should be generated. This
2903 * option is ignored if generateHints is false.
2904 */
2905 void set generateDart2jsHints(bool value) {
2906 this._generateDart2jsHints = value;
2907 }
2908
2909 /**
2910 * True if hints should be generated as part of generating errors and
2911 * warnings.
2912 */
2913 bool get generateHints => _generateHints;
2914
2915 /**
2916 * True if hints should be generated as part of generating errors and
2917 * warnings.
2918 */
2919 void set generateHints(bool value) {
2920 this._generateHints = value;
2921 }
2922
2923 /**
2924 * True if lints should be generated as part of generating errors and
2925 * warnings.
2926 */
2927 bool get generateLints => _generateLints;
2928
2929 /**
2930 * True if lints should be generated as part of generating errors and
2931 * warnings.
2932 */
2933 void set generateLints(bool value) {
2934 this._generateLints = value;
2935 }
2936
2937 AnalysisOptions(
2938 {bool enableAsync,
2939 bool enableDeferredLoading,
2940 bool enableEnums,
2941 bool enableNullAwareOperators,
2942 bool enableSuperMixins,
2943 bool generateDart2jsHints,
2944 bool generateHints,
2945 bool generateLints}) {
2946 this.enableAsync = enableAsync;
2947 this.enableDeferredLoading = enableDeferredLoading;
2948 this.enableEnums = enableEnums;
2949 this.enableNullAwareOperators = enableNullAwareOperators;
2950 this.enableSuperMixins = enableSuperMixins;
2951 this.generateDart2jsHints = generateDart2jsHints;
2952 this.generateHints = generateHints;
2953 this.generateLints = generateLints;
2954 }
2955
2956 factory AnalysisOptions.fromJson(
3156 JsonDecoder jsonDecoder, String jsonPath, Object json) { 2957 JsonDecoder jsonDecoder, String jsonPath, Object json) {
3157 if (json == null) { 2958 if (json == null) {
3158 json = {}; 2959 json = {};
3159 } 2960 }
3160 if (json is Map) { 2961 if (json is Map) {
3161 String file; 2962 bool enableAsync;
3162 if (json.containsKey("file")) { 2963 if (json.containsKey("enableAsync")) {
3163 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 2964 enableAsync = jsonDecoder.decodeBool(
3164 } else { 2965 jsonPath + ".enableAsync", json["enableAsync"]);
3165 throw jsonDecoder.missingKey(jsonPath, "file"); 2966 }
3166 } 2967 bool enableDeferredLoading;
3167 List<ImplementedClass> classes; 2968 if (json.containsKey("enableDeferredLoading")) {
3168 if (json.containsKey("classes")) { 2969 enableDeferredLoading = jsonDecoder.decodeBool(
3169 classes = jsonDecoder.decodeList( 2970 jsonPath + ".enableDeferredLoading", json["enableDeferredLoading"]);
3170 jsonPath + ".classes", 2971 }
3171 json["classes"], 2972 bool enableEnums;
3172 (String jsonPath, Object json) => 2973 if (json.containsKey("enableEnums")) {
3173 new ImplementedClass.fromJson(jsonDecoder, jsonPath, json)); 2974 enableEnums = jsonDecoder.decodeBool(
3174 } else { 2975 jsonPath + ".enableEnums", json["enableEnums"]);
3175 throw jsonDecoder.missingKey(jsonPath, "classes"); 2976 }
3176 } 2977 bool enableNullAwareOperators;
3177 List<ImplementedMember> members; 2978 if (json.containsKey("enableNullAwareOperators")) {
3178 if (json.containsKey("members")) { 2979 enableNullAwareOperators = jsonDecoder.decodeBool(
3179 members = jsonDecoder.decodeList( 2980 jsonPath + ".enableNullAwareOperators",
3180 jsonPath + ".members", 2981 json["enableNullAwareOperators"]);
3181 json["members"], 2982 }
3182 (String jsonPath, Object json) => 2983 bool enableSuperMixins;
3183 new ImplementedMember.fromJson(jsonDecoder, jsonPath, json)); 2984 if (json.containsKey("enableSuperMixins")) {
3184 } else { 2985 enableSuperMixins = jsonDecoder.decodeBool(
3185 throw jsonDecoder.missingKey(jsonPath, "members"); 2986 jsonPath + ".enableSuperMixins", json["enableSuperMixins"]);
3186 } 2987 }
3187 return new AnalysisImplementedParams(file, classes, members); 2988 bool generateDart2jsHints;
2989 if (json.containsKey("generateDart2jsHints")) {
2990 generateDart2jsHints = jsonDecoder.decodeBool(
2991 jsonPath + ".generateDart2jsHints", json["generateDart2jsHints"]);
2992 }
2993 bool generateHints;
2994 if (json.containsKey("generateHints")) {
2995 generateHints = jsonDecoder.decodeBool(
2996 jsonPath + ".generateHints", json["generateHints"]);
2997 }
2998 bool generateLints;
2999 if (json.containsKey("generateLints")) {
3000 generateLints = jsonDecoder.decodeBool(
3001 jsonPath + ".generateLints", json["generateLints"]);
3002 }
3003 return new AnalysisOptions(
3004 enableAsync: enableAsync,
3005 enableDeferredLoading: enableDeferredLoading,
3006 enableEnums: enableEnums,
3007 enableNullAwareOperators: enableNullAwareOperators,
3008 enableSuperMixins: enableSuperMixins,
3009 generateDart2jsHints: generateDart2jsHints,
3010 generateHints: generateHints,
3011 generateLints: generateLints);
3188 } else { 3012 } else {
3189 throw jsonDecoder.mismatch(jsonPath, "analysis.implemented params", json); 3013 throw jsonDecoder.mismatch(jsonPath, "AnalysisOptions", json);
3190 } 3014 }
3191 } 3015 }
3192 3016
3193 factory AnalysisImplementedParams.fromNotification( 3017 @override
3194 Notification notification) {
3195 return new AnalysisImplementedParams.fromJson(
3196 new ResponseDecoder(null), "params", notification._params);
3197 }
3198
3199 Map<String, dynamic> toJson() { 3018 Map<String, dynamic> toJson() {
3200 Map<String, dynamic> result = {}; 3019 Map<String, dynamic> result = {};
3201 result["file"] = file; 3020 if (enableAsync != null) {
3202 result["classes"] = 3021 result["enableAsync"] = enableAsync;
3203 classes.map((ImplementedClass value) => value.toJson()).toList(); 3022 }
3204 result["members"] = 3023 if (enableDeferredLoading != null) {
3205 members.map((ImplementedMember value) => value.toJson()).toList(); 3024 result["enableDeferredLoading"] = enableDeferredLoading;
3025 }
3026 if (enableEnums != null) {
3027 result["enableEnums"] = enableEnums;
3028 }
3029 if (enableNullAwareOperators != null) {
3030 result["enableNullAwareOperators"] = enableNullAwareOperators;
3031 }
3032 if (enableSuperMixins != null) {
3033 result["enableSuperMixins"] = enableSuperMixins;
3034 }
3035 if (generateDart2jsHints != null) {
3036 result["generateDart2jsHints"] = generateDart2jsHints;
3037 }
3038 if (generateHints != null) {
3039 result["generateHints"] = generateHints;
3040 }
3041 if (generateLints != null) {
3042 result["generateLints"] = generateLints;
3043 }
3206 return result; 3044 return result;
3207 } 3045 }
3208 3046
3209 Notification toNotification() {
3210 return new Notification("analysis.implemented", toJson());
3211 }
3212
3213 @override 3047 @override
3214 String toString() => JSON.encode(toJson()); 3048 String toString() => JSON.encode(toJson());
3215 3049
3216 @override 3050 @override
3217 bool operator ==(other) { 3051 bool operator ==(other) {
3218 if (other is AnalysisImplementedParams) { 3052 if (other is AnalysisOptions) {
3219 return file == other.file && 3053 return enableAsync == other.enableAsync &&
3220 listEqual(classes, other.classes, 3054 enableDeferredLoading == other.enableDeferredLoading &&
3221 (ImplementedClass a, ImplementedClass b) => a == b) && 3055 enableEnums == other.enableEnums &&
3222 listEqual(members, other.members, 3056 enableNullAwareOperators == other.enableNullAwareOperators &&
3223 (ImplementedMember a, ImplementedMember b) => a == b); 3057 enableSuperMixins == other.enableSuperMixins &&
3058 generateDart2jsHints == other.generateDart2jsHints &&
3059 generateHints == other.generateHints &&
3060 generateLints == other.generateLints;
3224 } 3061 }
3225 return false; 3062 return false;
3226 } 3063 }
3227
3228 @override
3229 int get hashCode {
3230 int hash = 0;
3231 hash = JenkinsSmiHash.combine(hash, file.hashCode);
3232 hash = JenkinsSmiHash.combine(hash, classes.hashCode);
3233 hash = JenkinsSmiHash.combine(hash, members.hashCode);
3234 return JenkinsSmiHash.finish(hash);
3235 }
3236 }
3237
3238 /**
3239 * analysis.invalidate params
3240 *
3241 * {
3242 * "file": FilePath
3243 * "offset": int
3244 * "length": int
3245 * "delta": int
3246 * }
3247 *
3248 * Clients may not extend, implement or mix-in this class.
3249 */
3250 class AnalysisInvalidateParams implements HasToJson {
3251 String _file;
3252
3253 int _offset;
3254
3255 int _length;
3256
3257 int _delta;
3258
3259 /**
3260 * The file whose information has been invalidated.
3261 */
3262 String get file => _file;
3263
3264 /**
3265 * The file whose information has been invalidated.
3266 */
3267 void set file(String value) {
3268 assert(value != null);
3269 this._file = value;
3270 }
3271
3272 /**
3273 * The offset of the invalidated region.
3274 */
3275 int get offset => _offset;
3276
3277 /**
3278 * The offset of the invalidated region.
3279 */
3280 void set offset(int value) {
3281 assert(value != null);
3282 this._offset = value;
3283 }
3284
3285 /**
3286 * The length of the invalidated region.
3287 */
3288 int get length => _length;
3289
3290 /**
3291 * The length of the invalidated region.
3292 */
3293 void set length(int value) {
3294 assert(value != null);
3295 this._length = value;
3296 }
3297
3298 /**
3299 * The delta to be applied to the offsets in information that follows the
3300 * invalidated region in order to update it so that it doesn't need to be
3301 * re-requested.
3302 */
3303 int get delta => _delta;
3304
3305 /**
3306 * The delta to be applied to the offsets in information that follows the
3307 * invalidated region in order to update it so that it doesn't need to be
3308 * re-requested.
3309 */
3310 void set delta(int value) {
3311 assert(value != null);
3312 this._delta = value;
3313 }
3314
3315 AnalysisInvalidateParams(String file, int offset, int length, int delta) {
3316 this.file = file;
3317 this.offset = offset;
3318 this.length = length;
3319 this.delta = delta;
3320 }
3321
3322 factory AnalysisInvalidateParams.fromJson(
3323 JsonDecoder jsonDecoder, String jsonPath, Object json) {
3324 if (json == null) {
3325 json = {};
3326 }
3327 if (json is Map) {
3328 String file;
3329 if (json.containsKey("file")) {
3330 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
3331 } else {
3332 throw jsonDecoder.missingKey(jsonPath, "file");
3333 }
3334 int offset;
3335 if (json.containsKey("offset")) {
3336 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
3337 } else {
3338 throw jsonDecoder.missingKey(jsonPath, "offset");
3339 }
3340 int length;
3341 if (json.containsKey("length")) {
3342 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
3343 } else {
3344 throw jsonDecoder.missingKey(jsonPath, "length");
3345 }
3346 int delta;
3347 if (json.containsKey("delta")) {
3348 delta = jsonDecoder.decodeInt(jsonPath + ".delta", json["delta"]);
3349 } else {
3350 throw jsonDecoder.missingKey(jsonPath, "delta");
3351 }
3352 return new AnalysisInvalidateParams(file, offset, length, delta);
3353 } else {
3354 throw jsonDecoder.mismatch(jsonPath, "analysis.invalidate params", json);
3355 }
3356 }
3357
3358 factory AnalysisInvalidateParams.fromNotification(Notification notification) {
3359 return new AnalysisInvalidateParams.fromJson(
3360 new ResponseDecoder(null), "params", notification._params);
3361 }
3362
3363 Map<String, dynamic> toJson() {
3364 Map<String, dynamic> result = {};
3365 result["file"] = file;
3366 result["offset"] = offset;
3367 result["length"] = length;
3368 result["delta"] = delta;
3369 return result;
3370 }
3371
3372 Notification toNotification() {
3373 return new Notification("analysis.invalidate", toJson());
3374 }
3375
3376 @override
3377 String toString() => JSON.encode(toJson());
3378
3379 @override
3380 bool operator ==(other) {
3381 if (other is AnalysisInvalidateParams) {
3382 return file == other.file &&
3383 offset == other.offset &&
3384 length == other.length &&
3385 delta == other.delta;
3386 }
3387 return false;
3388 }
3389 3064
3390 @override 3065 @override
3391 int get hashCode { 3066 int get hashCode {
3392 int hash = 0; 3067 int hash = 0;
3393 hash = JenkinsSmiHash.combine(hash, file.hashCode); 3068 hash = JenkinsSmiHash.combine(hash, enableAsync.hashCode);
3394 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 3069 hash = JenkinsSmiHash.combine(hash, enableDeferredLoading.hashCode);
3395 hash = JenkinsSmiHash.combine(hash, length.hashCode); 3070 hash = JenkinsSmiHash.combine(hash, enableEnums.hashCode);
3396 hash = JenkinsSmiHash.combine(hash, delta.hashCode); 3071 hash = JenkinsSmiHash.combine(hash, enableNullAwareOperators.hashCode);
3072 hash = JenkinsSmiHash.combine(hash, enableSuperMixins.hashCode);
3073 hash = JenkinsSmiHash.combine(hash, generateDart2jsHints.hashCode);
3074 hash = JenkinsSmiHash.combine(hash, generateHints.hashCode);
3075 hash = JenkinsSmiHash.combine(hash, generateLints.hashCode);
3397 return JenkinsSmiHash.finish(hash); 3076 return JenkinsSmiHash.finish(hash);
3398 } 3077 }
3399 } 3078 }
3400 3079
3401 /** 3080 /**
3402 * analysis.navigation params 3081 * analysis.outline params
3403 * 3082 *
3404 * { 3083 * {
3405 * "file": FilePath 3084 * "file": FilePath
3406 * "regions": List<NavigationRegion> 3085 * "kind": FileKind
3407 * "targets": List<NavigationTarget> 3086 * "libraryName": optional String
3408 * "files": List<FilePath> 3087 * "outline": Outline
3409 * } 3088 * }
3410 * 3089 *
3411 * Clients may not extend, implement or mix-in this class. 3090 * Clients may not extend, implement or mix-in this class.
3412 */ 3091 */
3413 class AnalysisNavigationParams implements HasToJson { 3092 class AnalysisOutlineParams implements HasToJson {
3414 String _file; 3093 String _file;
3415 3094
3416 List<NavigationRegion> _regions; 3095 FileKind _kind;
3417 3096
3418 List<NavigationTarget> _targets; 3097 String _libraryName;
3419 3098
3420 List<String> _files; 3099 Outline _outline;
3421 3100
3422 /** 3101 /**
3423 * The file containing the navigation regions. 3102 * The file with which the outline is associated.
3424 */ 3103 */
3425 String get file => _file; 3104 String get file => _file;
3426 3105
3427 /** 3106 /**
3428 * The file containing the navigation regions. 3107 * The file with which the outline is associated.
3429 */ 3108 */
3430 void set file(String value) { 3109 void set file(String value) {
3431 assert(value != null); 3110 assert(value != null);
3432 this._file = value; 3111 this._file = value;
3433 } 3112 }
3434 3113
3435 /** 3114 /**
3436 * The navigation regions contained in the file. The regions are sorted by 3115 * The kind of the file.
3437 * their offsets. Each navigation region represents a list of targets
3438 * associated with some range. The lists will usually contain a single
3439 * target, but can contain more in the case of a part that is included in
3440 * multiple libraries or in Dart code that is compiled against multiple
3441 * versions of a package. Note that the navigation regions that are returned
3442 * do not overlap other navigation regions.
3443 */ 3116 */
3444 List<NavigationRegion> get regions => _regions; 3117 FileKind get kind => _kind;
3445 3118
3446 /** 3119 /**
3447 * The navigation regions contained in the file. The regions are sorted by 3120 * The kind of the file.
3448 * their offsets. Each navigation region represents a list of targets
3449 * associated with some range. The lists will usually contain a single
3450 * target, but can contain more in the case of a part that is included in
3451 * multiple libraries or in Dart code that is compiled against multiple
3452 * versions of a package. Note that the navigation regions that are returned
3453 * do not overlap other navigation regions.
3454 */ 3121 */
3455 void set regions(List<NavigationRegion> value) { 3122 void set kind(FileKind value) {
3456 assert(value != null); 3123 assert(value != null);
3457 this._regions = value; 3124 this._kind = value;
3458 } 3125 }
3459 3126
3460 /** 3127 /**
3461 * The navigation targets referenced in the file. They are referenced by 3128 * The name of the library defined by the file using a "library" directive,
3462 * NavigationRegions by their index in this array. 3129 * or referenced by a "part of" directive. If both "library" and "part of"
3130 * directives are present, then the "library" directive takes precedence.
3131 * This field will be omitted if the file has neither "library" nor "part of"
3132 * directives.
3463 */ 3133 */
3464 List<NavigationTarget> get targets => _targets; 3134 String get libraryName => _libraryName;
3465 3135
3466 /** 3136 /**
3467 * The navigation targets referenced in the file. They are referenced by 3137 * The name of the library defined by the file using a "library" directive,
3468 * NavigationRegions by their index in this array. 3138 * or referenced by a "part of" directive. If both "library" and "part of"
3139 * directives are present, then the "library" directive takes precedence.
3140 * This field will be omitted if the file has neither "library" nor "part of"
3141 * directives.
3469 */ 3142 */
3470 void set targets(List<NavigationTarget> value) { 3143 void set libraryName(String value) {
3471 assert(value != null); 3144 this._libraryName = value;
3472 this._targets = value;
3473 } 3145 }
3474 3146
3475 /** 3147 /**
3476 * The files containing navigation targets referenced in the file. They are 3148 * The outline associated with the file.
3477 * referenced by NavigationTargets by their index in this array.
3478 */ 3149 */
3479 List<String> get files => _files; 3150 Outline get outline => _outline;
3480 3151
3481 /** 3152 /**
3482 * The files containing navigation targets referenced in the file. They are 3153 * The outline associated with the file.
3483 * referenced by NavigationTargets by their index in this array.
3484 */ 3154 */
3485 void set files(List<String> value) { 3155 void set outline(Outline value) {
3486 assert(value != null); 3156 assert(value != null);
3487 this._files = value; 3157 this._outline = value;
3488 } 3158 }
3489 3159
3490 AnalysisNavigationParams(String file, List<NavigationRegion> regions, 3160 AnalysisOutlineParams(String file, FileKind kind, Outline outline,
3491 List<NavigationTarget> targets, List<String> files) { 3161 {String libraryName}) {
3492 this.file = file; 3162 this.file = file;
3493 this.regions = regions; 3163 this.kind = kind;
3494 this.targets = targets; 3164 this.libraryName = libraryName;
3495 this.files = files; 3165 this.outline = outline;
3496 } 3166 }
3497 3167
3498 factory AnalysisNavigationParams.fromJson( 3168 factory AnalysisOutlineParams.fromJson(
3499 JsonDecoder jsonDecoder, String jsonPath, Object json) { 3169 JsonDecoder jsonDecoder, String jsonPath, Object json) {
3500 if (json == null) { 3170 if (json == null) {
3501 json = {}; 3171 json = {};
3502 } 3172 }
3503 if (json is Map) { 3173 if (json is Map) {
3504 String file; 3174 String file;
3505 if (json.containsKey("file")) { 3175 if (json.containsKey("file")) {
3506 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 3176 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
3507 } else { 3177 } else {
3508 throw jsonDecoder.missingKey(jsonPath, "file"); 3178 throw jsonDecoder.mismatch(jsonPath, "file");
3509 } 3179 }
3510 List<NavigationRegion> regions; 3180 FileKind kind;
3511 if (json.containsKey("regions")) { 3181 if (json.containsKey("kind")) {
3512 regions = jsonDecoder.decodeList( 3182 kind = new FileKind.fromJson(
3513 jsonPath + ".regions", 3183 jsonDecoder, jsonPath + ".kind", json["kind"]);
3514 json["regions"],
3515 (String jsonPath, Object json) =>
3516 new NavigationRegion.fromJson(jsonDecoder, jsonPath, json));
3517 } else { 3184 } else {
3518 throw jsonDecoder.missingKey(jsonPath, "regions"); 3185 throw jsonDecoder.mismatch(jsonPath, "kind");
3519 } 3186 }
3520 List<NavigationTarget> targets; 3187 String libraryName;
3521 if (json.containsKey("targets")) { 3188 if (json.containsKey("libraryName")) {
3522 targets = jsonDecoder.decodeList( 3189 libraryName = jsonDecoder.decodeString(
3523 jsonPath + ".targets", 3190 jsonPath + ".libraryName", json["libraryName"]);
3524 json["targets"], 3191 }
3525 (String jsonPath, Object json) => 3192 Outline outline;
3526 new NavigationTarget.fromJson(jsonDecoder, jsonPath, json)); 3193 if (json.containsKey("outline")) {
3194 outline = new Outline.fromJson(
3195 jsonDecoder, jsonPath + ".outline", json["outline"]);
3527 } else { 3196 } else {
3528 throw jsonDecoder.missingKey(jsonPath, "targets"); 3197 throw jsonDecoder.mismatch(jsonPath, "outline");
3529 } 3198 }
3530 List<String> files; 3199 return new AnalysisOutlineParams(file, kind, outline,
3531 if (json.containsKey("files")) { 3200 libraryName: libraryName);
3532 files = jsonDecoder.decodeList(
3533 jsonPath + ".files", json["files"], jsonDecoder.decodeString);
3534 } else {
3535 throw jsonDecoder.missingKey(jsonPath, "files");
3536 }
3537 return new AnalysisNavigationParams(file, regions, targets, files);
3538 } else { 3201 } else {
3539 throw jsonDecoder.mismatch(jsonPath, "analysis.navigation params", json); 3202 throw jsonDecoder.mismatch(jsonPath, "analysis.outline params", json);
3540 } 3203 }
3541 } 3204 }
3542 3205
3543 factory AnalysisNavigationParams.fromNotification(Notification notification) { 3206 factory AnalysisOutlineParams.fromNotification(Notification notification) {
3544 return new AnalysisNavigationParams.fromJson( 3207 return new AnalysisOutlineParams.fromJson(
3545 new ResponseDecoder(null), "params", notification._params); 3208 new ResponseDecoder(null), "params", notification.params);
3546 } 3209 }
3547 3210
3211 @override
3548 Map<String, dynamic> toJson() { 3212 Map<String, dynamic> toJson() {
3549 Map<String, dynamic> result = {}; 3213 Map<String, dynamic> result = {};
3550 result["file"] = file; 3214 result["file"] = file;
3551 result["regions"] = 3215 result["kind"] = kind.toJson();
3552 regions.map((NavigationRegion value) => value.toJson()).toList(); 3216 if (libraryName != null) {
3553 result["targets"] = 3217 result["libraryName"] = libraryName;
3554 targets.map((NavigationTarget value) => value.toJson()).toList(); 3218 }
3555 result["files"] = files; 3219 result["outline"] = outline.toJson();
3556 return result; 3220 return result;
3557 } 3221 }
3558 3222
3559 Notification toNotification() { 3223 Notification toNotification() {
3560 return new Notification("analysis.navigation", toJson()); 3224 return new Notification("analysis.outline", toJson());
3561 } 3225 }
3562 3226
3563 @override 3227 @override
3564 String toString() => JSON.encode(toJson()); 3228 String toString() => JSON.encode(toJson());
3565 3229
3566 @override 3230 @override
3567 bool operator ==(other) { 3231 bool operator ==(other) {
3568 if (other is AnalysisNavigationParams) { 3232 if (other is AnalysisOutlineParams) {
3569 return file == other.file && 3233 return file == other.file &&
3570 listEqual(regions, other.regions, 3234 kind == other.kind &&
3571 (NavigationRegion a, NavigationRegion b) => a == b) && 3235 libraryName == other.libraryName &&
3572 listEqual(targets, other.targets, 3236 outline == other.outline;
3573 (NavigationTarget a, NavigationTarget b) => a == b) &&
3574 listEqual(files, other.files, (String a, String b) => a == b);
3575 } 3237 }
3576 return false; 3238 return false;
3577 } 3239 }
3578 3240
3579 @override 3241 @override
3580 int get hashCode { 3242 int get hashCode {
3581 int hash = 0; 3243 int hash = 0;
3582 hash = JenkinsSmiHash.combine(hash, file.hashCode); 3244 hash = JenkinsSmiHash.combine(hash, file.hashCode);
3583 hash = JenkinsSmiHash.combine(hash, regions.hashCode); 3245 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
3584 hash = JenkinsSmiHash.combine(hash, targets.hashCode); 3246 hash = JenkinsSmiHash.combine(hash, libraryName.hashCode);
3585 hash = JenkinsSmiHash.combine(hash, files.hashCode); 3247 hash = JenkinsSmiHash.combine(hash, outline.hashCode);
3586 return JenkinsSmiHash.finish(hash); 3248 return JenkinsSmiHash.finish(hash);
3587 } 3249 }
3588 } 3250 }
3589 3251
3590 /** 3252 /**
3591 * analysis.occurrences params 3253 * analysis.overrides params
3592 * 3254 *
3593 * { 3255 * {
3594 * "file": FilePath 3256 * "file": FilePath
3595 * "occurrences": List<Occurrences> 3257 * "overrides": List<Override>
3596 * } 3258 * }
3597 * 3259 *
3598 * Clients may not extend, implement or mix-in this class. 3260 * Clients may not extend, implement or mix-in this class.
3599 */ 3261 */
3600 class AnalysisOccurrencesParams implements HasToJson { 3262 class AnalysisOverridesParams implements HasToJson {
3601 String _file; 3263 String _file;
3602 3264
3603 List<Occurrences> _occurrences; 3265 List<Override> _overrides;
3604 3266
3605 /** 3267 /**
3606 * The file in which the references occur. 3268 * The file with which the overrides are associated.
3607 */ 3269 */
3608 String get file => _file; 3270 String get file => _file;
3609 3271
3610 /** 3272 /**
3611 * The file in which the references occur. 3273 * The file with which the overrides are associated.
3612 */ 3274 */
3613 void set file(String value) { 3275 void set file(String value) {
3614 assert(value != null); 3276 assert(value != null);
3615 this._file = value; 3277 this._file = value;
3616 } 3278 }
3617 3279
3618 /** 3280 /**
3619 * The occurrences of references to elements within the file. 3281 * The overrides associated with the file.
3620 */ 3282 */
3621 List<Occurrences> get occurrences => _occurrences; 3283 List<Override> get overrides => _overrides;
3622 3284
3623 /** 3285 /**
3624 * The occurrences of references to elements within the file. 3286 * The overrides associated with the file.
3625 */ 3287 */
3626 void set occurrences(List<Occurrences> value) { 3288 void set overrides(List<Override> value) {
3627 assert(value != null); 3289 assert(value != null);
3628 this._occurrences = value; 3290 this._overrides = value;
3629 } 3291 }
3630 3292
3631 AnalysisOccurrencesParams(String file, List<Occurrences> occurrences) { 3293 AnalysisOverridesParams(String file, List<Override> overrides) {
3632 this.file = file; 3294 this.file = file;
3633 this.occurrences = occurrences; 3295 this.overrides = overrides;
3634 } 3296 }
3635 3297
3636 factory AnalysisOccurrencesParams.fromJson( 3298 factory AnalysisOverridesParams.fromJson(
3637 JsonDecoder jsonDecoder, String jsonPath, Object json) { 3299 JsonDecoder jsonDecoder, String jsonPath, Object json) {
3638 if (json == null) { 3300 if (json == null) {
3639 json = {}; 3301 json = {};
3640 } 3302 }
3641 if (json is Map) { 3303 if (json is Map) {
3642 String file; 3304 String file;
3643 if (json.containsKey("file")) { 3305 if (json.containsKey("file")) {
3644 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 3306 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
3645 } else { 3307 } else {
3646 throw jsonDecoder.missingKey(jsonPath, "file"); 3308 throw jsonDecoder.mismatch(jsonPath, "file");
3647 } 3309 }
3648 List<Occurrences> occurrences; 3310 List<Override> overrides;
3649 if (json.containsKey("occurrences")) { 3311 if (json.containsKey("overrides")) {
3650 occurrences = jsonDecoder.decodeList( 3312 overrides = jsonDecoder.decodeList(
3651 jsonPath + ".occurrences", 3313 jsonPath + ".overrides",
3652 json["occurrences"], 3314 json["overrides"],
3653 (String jsonPath, Object json) => 3315 (String jsonPath, Object json) =>
3654 new Occurrences.fromJson(jsonDecoder, jsonPath, json)); 3316 new Override.fromJson(jsonDecoder, jsonPath, json));
3655 } else { 3317 } else {
3656 throw jsonDecoder.missingKey(jsonPath, "occurrences"); 3318 throw jsonDecoder.mismatch(jsonPath, "overrides");
3657 } 3319 }
3658 return new AnalysisOccurrencesParams(file, occurrences); 3320 return new AnalysisOverridesParams(file, overrides);
3659 } else { 3321 } else {
3660 throw jsonDecoder.mismatch(jsonPath, "analysis.occurrences params", json); 3322 throw jsonDecoder.mismatch(jsonPath, "analysis.overrides params", json);
3661 } 3323 }
3662 } 3324 }
3663 3325
3664 factory AnalysisOccurrencesParams.fromNotification( 3326 factory AnalysisOverridesParams.fromNotification(Notification notification) {
3665 Notification notification) { 3327 return new AnalysisOverridesParams.fromJson(
3666 return new AnalysisOccurrencesParams.fromJson( 3328 new ResponseDecoder(null), "params", notification.params);
3667 new ResponseDecoder(null), "params", notification._params);
3668 } 3329 }
3669 3330
3331 @override
3670 Map<String, dynamic> toJson() { 3332 Map<String, dynamic> toJson() {
3671 Map<String, dynamic> result = {}; 3333 Map<String, dynamic> result = {};
3672 result["file"] = file; 3334 result["file"] = file;
3673 result["occurrences"] = 3335 result["overrides"] =
3674 occurrences.map((Occurrences value) => value.toJson()).toList(); 3336 overrides.map((Override value) => value.toJson()).toList();
3675 return result; 3337 return result;
3676 } 3338 }
3677 3339
3678 Notification toNotification() { 3340 Notification toNotification() {
3679 return new Notification("analysis.occurrences", toJson()); 3341 return new Notification("analysis.overrides", toJson());
3680 } 3342 }
3681 3343
3682 @override 3344 @override
3683 String toString() => JSON.encode(toJson()); 3345 String toString() => JSON.encode(toJson());
3684 3346
3685 @override 3347 @override
3686 bool operator ==(other) { 3348 bool operator ==(other) {
3687 if (other is AnalysisOccurrencesParams) { 3349 if (other is AnalysisOverridesParams) {
3688 return file == other.file && 3350 return file == other.file &&
3689 listEqual(occurrences, other.occurrences, 3351 listEqual(
3690 (Occurrences a, Occurrences b) => a == b); 3352 overrides, other.overrides, (Override a, Override b) => a == b);
3691 } 3353 }
3692 return false; 3354 return false;
3693 } 3355 }
3694 3356
3695 @override 3357 @override
3696 int get hashCode { 3358 int get hashCode {
3697 int hash = 0; 3359 int hash = 0;
3698 hash = JenkinsSmiHash.combine(hash, file.hashCode); 3360 hash = JenkinsSmiHash.combine(hash, file.hashCode);
3699 hash = JenkinsSmiHash.combine(hash, occurrences.hashCode); 3361 hash = JenkinsSmiHash.combine(hash, overrides.hashCode);
3700 return JenkinsSmiHash.finish(hash); 3362 return JenkinsSmiHash.finish(hash);
3701 } 3363 }
3702 } 3364 }
3703 3365
3704 /** 3366 /**
3705 * analysis.outline params 3367 * analysis.reanalyze params
3706 * 3368 *
3707 * { 3369 * {
3708 * "file": FilePath 3370 * "roots": optional List<FilePath>
3709 * "kind": FileKind
3710 * "libraryName": optional String
3711 * "outline": Outline
3712 * } 3371 * }
3713 * 3372 *
3714 * Clients may not extend, implement or mix-in this class. 3373 * Clients may not extend, implement or mix-in this class.
3715 */ 3374 */
3716 class AnalysisOutlineParams implements HasToJson { 3375 class AnalysisReanalyzeParams implements RequestParams {
3717 String _file; 3376 List<String> _roots;
3718
3719 FileKind _kind;
3720
3721 String _libraryName;
3722
3723 Outline _outline;
3724 3377
3725 /** 3378 /**
3726 * The file with which the outline is associated. 3379 * A list of the analysis roots that are to be re-analyzed.
3727 */ 3380 */
3728 String get file => _file; 3381 List<String> get roots => _roots;
3729 3382
3730 /** 3383 /**
3731 * The file with which the outline is associated. 3384 * A list of the analysis roots that are to be re-analyzed.
3732 */ 3385 */
3733 void set file(String value) { 3386 void set roots(List<String> value) {
3734 assert(value != null); 3387 this._roots = value;
3735 this._file = value;
3736 } 3388 }
3737 3389
3738 /** 3390 AnalysisReanalyzeParams({List<String> roots}) {
3739 * The kind of the file. 3391 this.roots = roots;
3740 */
3741 FileKind get kind => _kind;
3742
3743 /**
3744 * The kind of the file.
3745 */
3746 void set kind(FileKind value) {
3747 assert(value != null);
3748 this._kind = value;
3749 } 3392 }
3750 3393
3751 /** 3394 factory AnalysisReanalyzeParams.fromJson(
3752 * The name of the library defined by the file using a "library" directive,
3753 * or referenced by a "part of" directive. If both "library" and "part of"
3754 * directives are present, then the "library" directive takes precedence.
3755 * This field will be omitted if the file has neither "library" nor "part of"
3756 * directives.
3757 */
3758 String get libraryName => _libraryName;
3759
3760 /**
3761 * The name of the library defined by the file using a "library" directive,
3762 * or referenced by a "part of" directive. If both "library" and "part of"
3763 * directives are present, then the "library" directive takes precedence.
3764 * This field will be omitted if the file has neither "library" nor "part of"
3765 * directives.
3766 */
3767 void set libraryName(String value) {
3768 this._libraryName = value;
3769 }
3770
3771 /**
3772 * The outline associated with the file.
3773 */
3774 Outline get outline => _outline;
3775
3776 /**
3777 * The outline associated with the file.
3778 */
3779 void set outline(Outline value) {
3780 assert(value != null);
3781 this._outline = value;
3782 }
3783
3784 AnalysisOutlineParams(String file, FileKind kind, Outline outline,
3785 {String libraryName}) {
3786 this.file = file;
3787 this.kind = kind;
3788 this.libraryName = libraryName;
3789 this.outline = outline;
3790 }
3791
3792 factory AnalysisOutlineParams.fromJson(
3793 JsonDecoder jsonDecoder, String jsonPath, Object json) { 3395 JsonDecoder jsonDecoder, String jsonPath, Object json) {
3794 if (json == null) { 3396 if (json == null) {
3795 json = {}; 3397 json = {};
3796 } 3398 }
3797 if (json is Map) { 3399 if (json is Map) {
3798 String file; 3400 List<String> roots;
3799 if (json.containsKey("file")) { 3401 if (json.containsKey("roots")) {
3800 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 3402 roots = jsonDecoder.decodeList(
3801 } else { 3403 jsonPath + ".roots", json["roots"], jsonDecoder.decodeString);
3802 throw jsonDecoder.missingKey(jsonPath, "file");
3803 } 3404 }
3804 FileKind kind; 3405 return new AnalysisReanalyzeParams(roots: roots);
3805 if (json.containsKey("kind")) {
3806 kind = new FileKind.fromJson(
3807 jsonDecoder, jsonPath + ".kind", json["kind"]);
3808 } else {
3809 throw jsonDecoder.missingKey(jsonPath, "kind");
3810 }
3811 String libraryName;
3812 if (json.containsKey("libraryName")) {
3813 libraryName = jsonDecoder.decodeString(
3814 jsonPath + ".libraryName", json["libraryName"]);
3815 }
3816 Outline outline;
3817 if (json.containsKey("outline")) {
3818 outline = new Outline.fromJson(
3819 jsonDecoder, jsonPath + ".outline", json["outline"]);
3820 } else {
3821 throw jsonDecoder.missingKey(jsonPath, "outline");
3822 }
3823 return new AnalysisOutlineParams(file, kind, outline,
3824 libraryName: libraryName);
3825 } else { 3406 } else {
3826 throw jsonDecoder.mismatch(jsonPath, "analysis.outline params", json); 3407 throw jsonDecoder.mismatch(jsonPath, "analysis.reanalyze params", json);
3827 } 3408 }
3828 } 3409 }
3829 3410
3830 factory AnalysisOutlineParams.fromNotification(Notification notification) { 3411 factory AnalysisReanalyzeParams.fromRequest(Request request) {
3831 return new AnalysisOutlineParams.fromJson( 3412 return new AnalysisReanalyzeParams.fromJson(
3832 new ResponseDecoder(null), "params", notification._params); 3413 new RequestDecoder(request), "params", request.params);
3833 } 3414 }
3834 3415
3416 @override
3835 Map<String, dynamic> toJson() { 3417 Map<String, dynamic> toJson() {
3836 Map<String, dynamic> result = {}; 3418 Map<String, dynamic> result = {};
3837 result["file"] = file; 3419 if (roots != null) {
3838 result["kind"] = kind.toJson(); 3420 result["roots"] = roots;
3839 if (libraryName != null) {
3840 result["libraryName"] = libraryName;
3841 } 3421 }
3842 result["outline"] = outline.toJson();
3843 return result; 3422 return result;
3844 } 3423 }
3845 3424
3846 Notification toNotification() { 3425 @override
3847 return new Notification("analysis.outline", toJson()); 3426 Request toRequest(String id) {
3427 return new Request(id, "analysis.reanalyze", toJson());
3848 } 3428 }
3849 3429
3850 @override 3430 @override
3851 String toString() => JSON.encode(toJson()); 3431 String toString() => JSON.encode(toJson());
3852 3432
3853 @override 3433 @override
3854 bool operator ==(other) { 3434 bool operator ==(other) {
3855 if (other is AnalysisOutlineParams) { 3435 if (other is AnalysisReanalyzeParams) {
3856 return file == other.file && 3436 return listEqual(roots, other.roots, (String a, String b) => a == b);
3857 kind == other.kind &&
3858 libraryName == other.libraryName &&
3859 outline == other.outline;
3860 } 3437 }
3861 return false; 3438 return false;
3862 } 3439 }
3863 3440
3864 @override 3441 @override
3865 int get hashCode { 3442 int get hashCode {
3866 int hash = 0; 3443 int hash = 0;
3867 hash = JenkinsSmiHash.combine(hash, file.hashCode); 3444 hash = JenkinsSmiHash.combine(hash, roots.hashCode);
3868 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
3869 hash = JenkinsSmiHash.combine(hash, libraryName.hashCode);
3870 hash = JenkinsSmiHash.combine(hash, outline.hashCode);
3871 return JenkinsSmiHash.finish(hash); 3445 return JenkinsSmiHash.finish(hash);
3872 } 3446 }
3873 } 3447 }
3874 3448
3875 /** 3449 /**
3876 * analysis.overrides params 3450 * analysis.reanalyze result
3877 *
3878 * {
3879 * "file": FilePath
3880 * "overrides": List<Override>
3881 * }
3882 * 3451 *
3883 * Clients may not extend, implement or mix-in this class. 3452 * Clients may not extend, implement or mix-in this class.
3884 */ 3453 */
3885 class AnalysisOverridesParams implements HasToJson { 3454 class AnalysisReanalyzeResult implements ResponseResult {
3886 String _file; 3455 @override
3887 3456 Map<String, dynamic> toJson() => <String, dynamic>{};
3888 List<Override> _overrides; 3457
3889 3458 @override
3890 /** 3459 Response toResponse(String id) {
3891 * The file with which the overrides are associated. 3460 return new Response(id, result: null);
3892 */ 3461 }
3893 String get file => _file; 3462
3894 3463 @override
3895 /** 3464 bool operator ==(other) {
3896 * The file with which the overrides are associated. 3465 if (other is AnalysisReanalyzeResult) {
3897 */ 3466 return true;
3898 void set file(String value) { 3467 }
3468 return false;
3469 }
3470
3471 @override
3472 int get hashCode {
3473 return 846803925;
3474 }
3475 }
3476
3477 /**
3478 * AnalysisService
3479 *
3480 * enum {
3481 * FOLDING
3482 * HIGHLIGHTS
3483 * IMPLEMENTED
3484 * INVALIDATE
3485 * NAVIGATION
3486 * OCCURRENCES
3487 * OUTLINE
3488 * OVERRIDES
3489 * }
3490 *
3491 * Clients may not extend, implement or mix-in this class.
3492 */
3493 class AnalysisService implements Enum {
3494 static const AnalysisService FOLDING = const AnalysisService._("FOLDING");
3495
3496 static const AnalysisService HIGHLIGHTS =
3497 const AnalysisService._("HIGHLIGHTS");
3498
3499 static const AnalysisService IMPLEMENTED =
3500 const AnalysisService._("IMPLEMENTED");
3501
3502 /**
3503 * This service is not currently implemented and will become a
3504 * GeneralAnalysisService in a future release.
3505 */
3506 static const AnalysisService INVALIDATE =
3507 const AnalysisService._("INVALIDATE");
3508
3509 static const AnalysisService NAVIGATION =
3510 const AnalysisService._("NAVIGATION");
3511
3512 static const AnalysisService OCCURRENCES =
3513 const AnalysisService._("OCCURRENCES");
3514
3515 static const AnalysisService OUTLINE = const AnalysisService._("OUTLINE");
3516
3517 static const AnalysisService OVERRIDES = const AnalysisService._("OVERRIDES");
3518
3519 /**
3520 * A list containing all of the enum values that are defined.
3521 */
3522 static const List<AnalysisService> VALUES = const <AnalysisService>[
3523 FOLDING,
3524 HIGHLIGHTS,
3525 IMPLEMENTED,
3526 INVALIDATE,
3527 NAVIGATION,
3528 OCCURRENCES,
3529 OUTLINE,
3530 OVERRIDES
3531 ];
3532
3533 @override
3534 final String name;
3535
3536 const AnalysisService._(this.name);
3537
3538 factory AnalysisService(String name) {
3539 switch (name) {
3540 case "FOLDING":
3541 return FOLDING;
3542 case "HIGHLIGHTS":
3543 return HIGHLIGHTS;
3544 case "IMPLEMENTED":
3545 return IMPLEMENTED;
3546 case "INVALIDATE":
3547 return INVALIDATE;
3548 case "NAVIGATION":
3549 return NAVIGATION;
3550 case "OCCURRENCES":
3551 return OCCURRENCES;
3552 case "OUTLINE":
3553 return OUTLINE;
3554 case "OVERRIDES":
3555 return OVERRIDES;
3556 }
3557 throw new Exception('Illegal enum value: $name');
3558 }
3559
3560 factory AnalysisService.fromJson(
3561 JsonDecoder jsonDecoder, String jsonPath, Object json) {
3562 if (json is String) {
3563 try {
3564 return new AnalysisService(json);
3565 } catch (_) {
3566 // Fall through
3567 }
3568 }
3569 throw jsonDecoder.mismatch(jsonPath, "AnalysisService", json);
3570 }
3571
3572 @override
3573 String toString() => "AnalysisService.$name";
3574
3575 String toJson() => name;
3576 }
3577
3578 /**
3579 * analysis.setAnalysisRoots params
3580 *
3581 * {
3582 * "included": List<FilePath>
3583 * "excluded": List<FilePath>
3584 * "packageRoots": optional Map<FilePath, FilePath>
3585 * }
3586 *
3587 * Clients may not extend, implement or mix-in this class.
3588 */
3589 class AnalysisSetAnalysisRootsParams implements RequestParams {
3590 List<String> _included;
3591
3592 List<String> _excluded;
3593
3594 Map<String, String> _packageRoots;
3595
3596 /**
3597 * A list of the files and directories that should be analyzed.
3598 */
3599 List<String> get included => _included;
3600
3601 /**
3602 * A list of the files and directories that should be analyzed.
3603 */
3604 void set included(List<String> value) {
3899 assert(value != null); 3605 assert(value != null);
3900 this._file = value; 3606 this._included = value;
3901 } 3607 }
3902 3608
3903 /** 3609 /**
3904 * The overrides associated with the file. 3610 * A list of the files and directories within the included directories that
3905 */ 3611 * should not be analyzed.
3906 List<Override> get overrides => _overrides; 3612 */
3907 3613 List<String> get excluded => _excluded;
3908 /** 3614
3909 * The overrides associated with the file. 3615 /**
3910 */ 3616 * A list of the files and directories within the included directories that
3911 void set overrides(List<Override> value) { 3617 * should not be analyzed.
3618 */
3619 void set excluded(List<String> value) {
3912 assert(value != null); 3620 assert(value != null);
3913 this._overrides = value; 3621 this._excluded = value;
3914 } 3622 }
3915 3623
3916 AnalysisOverridesParams(String file, List<Override> overrides) { 3624 /**
3917 this.file = file; 3625 * A mapping from source directories to package roots that should override
3918 this.overrides = overrides; 3626 * the normal package: URI resolution mechanism.
3919 } 3627 *
3920 3628 * If a package root is a directory, then the analyzer will behave as though
3921 factory AnalysisOverridesParams.fromJson( 3629 * the associated source directory in the map contains a special pubspec.yaml
3630 * file which resolves any package: URI to the corresponding path within that
3631 * package root directory. The effect is the same as specifying the package
3632 * root directory as a "--package_root" parameter to the Dart VM when
3633 * executing any Dart file inside the source directory.
3634 *
3635 * If a package root is a file, then the analyzer will behave as though that
3636 * file is a ".packages" file in the source directory. The effect is the same
3637 * as specifying the file as a "--packages" parameter to the Dart VM when
3638 * executing any Dart file inside the source directory.
3639 *
3640 * Files in any directories that are not overridden by this mapping have
3641 * their package: URI's resolved using the normal pubspec.yaml mechanism. If
3642 * this field is absent, or the empty map is specified, that indicates that
3643 * the normal pubspec.yaml mechanism should always be used.
3644 */
3645 Map<String, String> get packageRoots => _packageRoots;
3646
3647 /**
3648 * A mapping from source directories to package roots that should override
3649 * the normal package: URI resolution mechanism.
3650 *
3651 * If a package root is a directory, then the analyzer will behave as though
3652 * the associated source directory in the map contains a special pubspec.yaml
3653 * file which resolves any package: URI to the corresponding path within that
3654 * package root directory. The effect is the same as specifying the package
3655 * root directory as a "--package_root" parameter to the Dart VM when
3656 * executing any Dart file inside the source directory.
3657 *
3658 * If a package root is a file, then the analyzer will behave as though that
3659 * file is a ".packages" file in the source directory. The effect is the same
3660 * as specifying the file as a "--packages" parameter to the Dart VM when
3661 * executing any Dart file inside the source directory.
3662 *
3663 * Files in any directories that are not overridden by this mapping have
3664 * their package: URI's resolved using the normal pubspec.yaml mechanism. If
3665 * this field is absent, or the empty map is specified, that indicates that
3666 * the normal pubspec.yaml mechanism should always be used.
3667 */
3668 void set packageRoots(Map<String, String> value) {
3669 this._packageRoots = value;
3670 }
3671
3672 AnalysisSetAnalysisRootsParams(List<String> included, List<String> excluded,
3673 {Map<String, String> packageRoots}) {
3674 this.included = included;
3675 this.excluded = excluded;
3676 this.packageRoots = packageRoots;
3677 }
3678
3679 factory AnalysisSetAnalysisRootsParams.fromJson(
3922 JsonDecoder jsonDecoder, String jsonPath, Object json) { 3680 JsonDecoder jsonDecoder, String jsonPath, Object json) {
3923 if (json == null) { 3681 if (json == null) {
3924 json = {}; 3682 json = {};
3925 } 3683 }
3926 if (json is Map) { 3684 if (json is Map) {
3927 String file; 3685 List<String> included;
3928 if (json.containsKey("file")) { 3686 if (json.containsKey("included")) {
3929 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 3687 included = jsonDecoder.decodeList(
3688 jsonPath + ".included", json["included"], jsonDecoder.decodeString);
3930 } else { 3689 } else {
3931 throw jsonDecoder.missingKey(jsonPath, "file"); 3690 throw jsonDecoder.mismatch(jsonPath, "included");
3932 } 3691 }
3933 List<Override> overrides; 3692 List<String> excluded;
3934 if (json.containsKey("overrides")) { 3693 if (json.containsKey("excluded")) {
3935 overrides = jsonDecoder.decodeList( 3694 excluded = jsonDecoder.decodeList(
3936 jsonPath + ".overrides", 3695 jsonPath + ".excluded", json["excluded"], jsonDecoder.decodeString);
3937 json["overrides"],
3938 (String jsonPath, Object json) =>
3939 new Override.fromJson(jsonDecoder, jsonPath, json));
3940 } else { 3696 } else {
3941 throw jsonDecoder.missingKey(jsonPath, "overrides"); 3697 throw jsonDecoder.mismatch(jsonPath, "excluded");
3942 } 3698 }
3943 return new AnalysisOverridesParams(file, overrides); 3699 Map<String, String> packageRoots;
3700 if (json.containsKey("packageRoots")) {
3701 packageRoots = jsonDecoder.decodeMap(
3702 jsonPath + ".packageRoots", json["packageRoots"],
3703 valueDecoder: jsonDecoder.decodeString);
3704 }
3705 return new AnalysisSetAnalysisRootsParams(included, excluded,
3706 packageRoots: packageRoots);
3944 } else { 3707 } else {
3945 throw jsonDecoder.mismatch(jsonPath, "analysis.overrides params", json); 3708 throw jsonDecoder.mismatch(
3946 } 3709 jsonPath, "analysis.setAnalysisRoots params", json);
3947 } 3710 }
3948 3711 }
3949 factory AnalysisOverridesParams.fromNotification(Notification notification) { 3712
3950 return new AnalysisOverridesParams.fromJson( 3713 factory AnalysisSetAnalysisRootsParams.fromRequest(Request request) {
3951 new ResponseDecoder(null), "params", notification._params); 3714 return new AnalysisSetAnalysisRootsParams.fromJson(
3952 } 3715 new RequestDecoder(request), "params", request.params);
3953 3716 }
3717
3718 @override
3954 Map<String, dynamic> toJson() { 3719 Map<String, dynamic> toJson() {
3955 Map<String, dynamic> result = {}; 3720 Map<String, dynamic> result = {};
3956 result["file"] = file; 3721 result["included"] = included;
3957 result["overrides"] = 3722 result["excluded"] = excluded;
3958 overrides.map((Override value) => value.toJson()).toList(); 3723 if (packageRoots != null) {
3724 result["packageRoots"] = packageRoots;
3725 }
3959 return result; 3726 return result;
3960 } 3727 }
3961 3728
3962 Notification toNotification() { 3729 @override
3963 return new Notification("analysis.overrides", toJson());
3964 }
3965
3966 @override
3967 String toString() => JSON.encode(toJson());
3968
3969 @override
3970 bool operator ==(other) {
3971 if (other is AnalysisOverridesParams) {
3972 return file == other.file &&
3973 listEqual(
3974 overrides, other.overrides, (Override a, Override b) => a == b);
3975 }
3976 return false;
3977 }
3978
3979 @override
3980 int get hashCode {
3981 int hash = 0;
3982 hash = JenkinsSmiHash.combine(hash, file.hashCode);
3983 hash = JenkinsSmiHash.combine(hash, overrides.hashCode);
3984 return JenkinsSmiHash.finish(hash);
3985 }
3986 }
3987
3988 /**
3989 * completion.getSuggestions params
3990 *
3991 * {
3992 * "file": FilePath
3993 * "offset": int
3994 * }
3995 *
3996 * Clients may not extend, implement or mix-in this class.
3997 */
3998 class CompletionGetSuggestionsParams implements HasToJson {
3999 String _file;
4000
4001 int _offset;
4002
4003 /**
4004 * The file containing the point at which suggestions are to be made.
4005 */
4006 String get file => _file;
4007
4008 /**
4009 * The file containing the point at which suggestions are to be made.
4010 */
4011 void set file(String value) {
4012 assert(value != null);
4013 this._file = value;
4014 }
4015
4016 /**
4017 * The offset within the file at which suggestions are to be made.
4018 */
4019 int get offset => _offset;
4020
4021 /**
4022 * The offset within the file at which suggestions are to be made.
4023 */
4024 void set offset(int value) {
4025 assert(value != null);
4026 this._offset = value;
4027 }
4028
4029 CompletionGetSuggestionsParams(String file, int offset) {
4030 this.file = file;
4031 this.offset = offset;
4032 }
4033
4034 factory CompletionGetSuggestionsParams.fromJson(
4035 JsonDecoder jsonDecoder, String jsonPath, Object json) {
4036 if (json == null) {
4037 json = {};
4038 }
4039 if (json is Map) {
4040 String file;
4041 if (json.containsKey("file")) {
4042 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
4043 } else {
4044 throw jsonDecoder.missingKey(jsonPath, "file");
4045 }
4046 int offset;
4047 if (json.containsKey("offset")) {
4048 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
4049 } else {
4050 throw jsonDecoder.missingKey(jsonPath, "offset");
4051 }
4052 return new CompletionGetSuggestionsParams(file, offset);
4053 } else {
4054 throw jsonDecoder.mismatch(
4055 jsonPath, "completion.getSuggestions params", json);
4056 }
4057 }
4058
4059 factory CompletionGetSuggestionsParams.fromRequest(Request request) {
4060 return new CompletionGetSuggestionsParams.fromJson(
4061 new RequestDecoder(request), "params", request._params);
4062 }
4063
4064 Map<String, dynamic> toJson() {
4065 Map<String, dynamic> result = {};
4066 result["file"] = file;
4067 result["offset"] = offset;
4068 return result;
4069 }
4070
4071 Request toRequest(String id) { 3730 Request toRequest(String id) {
4072 return new Request(id, "completion.getSuggestions", toJson()); 3731 return new Request(id, "analysis.setAnalysisRoots", toJson());
4073 } 3732 }
4074 3733
4075 @override 3734 @override
4076 String toString() => JSON.encode(toJson()); 3735 String toString() => JSON.encode(toJson());
4077 3736
4078 @override 3737 @override
4079 bool operator ==(other) { 3738 bool operator ==(other) {
4080 if (other is CompletionGetSuggestionsParams) { 3739 if (other is AnalysisSetAnalysisRootsParams) {
4081 return file == other.file && offset == other.offset; 3740 return listEqual(
3741 included, other.included, (String a, String b) => a == b) &&
3742 listEqual(excluded, other.excluded, (String a, String b) => a == b) &&
3743 mapEqual(
3744 packageRoots, other.packageRoots, (String a, String b) => a == b);
4082 } 3745 }
4083 return false; 3746 return false;
4084 } 3747 }
4085 3748
4086 @override 3749 @override
4087 int get hashCode { 3750 int get hashCode {
4088 int hash = 0; 3751 int hash = 0;
4089 hash = JenkinsSmiHash.combine(hash, file.hashCode); 3752 hash = JenkinsSmiHash.combine(hash, included.hashCode);
4090 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 3753 hash = JenkinsSmiHash.combine(hash, excluded.hashCode);
3754 hash = JenkinsSmiHash.combine(hash, packageRoots.hashCode);
4091 return JenkinsSmiHash.finish(hash); 3755 return JenkinsSmiHash.finish(hash);
4092 } 3756 }
4093 } 3757 }
4094 3758
4095 /** 3759 /**
4096 * completion.getSuggestions result 3760 * analysis.setAnalysisRoots result
3761 *
3762 * Clients may not extend, implement or mix-in this class.
3763 */
3764 class AnalysisSetAnalysisRootsResult implements ResponseResult {
3765 @override
3766 Map<String, dynamic> toJson() => <String, dynamic>{};
3767
3768 @override
3769 Response toResponse(String id) {
3770 return new Response(id, result: null);
3771 }
3772
3773 @override
3774 bool operator ==(other) {
3775 if (other is AnalysisSetAnalysisRootsResult) {
3776 return true;
3777 }
3778 return false;
3779 }
3780
3781 @override
3782 int get hashCode {
3783 return 866004753;
3784 }
3785 }
3786
3787 /**
3788 * analysis.setGeneralSubscriptions params
4097 * 3789 *
4098 * { 3790 * {
4099 * "id": CompletionId 3791 * "subscriptions": List<GeneralAnalysisService>
4100 * } 3792 * }
4101 * 3793 *
4102 * Clients may not extend, implement or mix-in this class. 3794 * Clients may not extend, implement or mix-in this class.
4103 */ 3795 */
4104 class CompletionGetSuggestionsResult implements HasToJson { 3796 class AnalysisSetGeneralSubscriptionsParams implements RequestParams {
4105 String _id; 3797 List<GeneralAnalysisService> _subscriptions;
4106 3798
4107 /** 3799 /**
4108 * The identifier used to associate results with this completion request. 3800 * A list of the services being subscribed to.
4109 */ 3801 */
4110 String get id => _id; 3802 List<GeneralAnalysisService> get subscriptions => _subscriptions;
4111 3803
4112 /** 3804 /**
4113 * The identifier used to associate results with this completion request. 3805 * A list of the services being subscribed to.
4114 */ 3806 */
4115 void set id(String value) { 3807 void set subscriptions(List<GeneralAnalysisService> value) {
4116 assert(value != null); 3808 assert(value != null);
4117 this._id = value; 3809 this._subscriptions = value;
4118 } 3810 }
4119 3811
4120 CompletionGetSuggestionsResult(String id) { 3812 AnalysisSetGeneralSubscriptionsParams(
4121 this.id = id; 3813 List<GeneralAnalysisService> subscriptions) {
3814 this.subscriptions = subscriptions;
4122 } 3815 }
4123 3816
4124 factory CompletionGetSuggestionsResult.fromJson( 3817 factory AnalysisSetGeneralSubscriptionsParams.fromJson(
4125 JsonDecoder jsonDecoder, String jsonPath, Object json) { 3818 JsonDecoder jsonDecoder, String jsonPath, Object json) {
4126 if (json == null) { 3819 if (json == null) {
4127 json = {}; 3820 json = {};
4128 } 3821 }
4129 if (json is Map) { 3822 if (json is Map) {
4130 String id; 3823 List<GeneralAnalysisService> subscriptions;
4131 if (json.containsKey("id")) { 3824 if (json.containsKey("subscriptions")) {
4132 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]); 3825 subscriptions = jsonDecoder.decodeList(
3826 jsonPath + ".subscriptions",
3827 json["subscriptions"],
3828 (String jsonPath, Object json) =>
3829 new GeneralAnalysisService.fromJson(
3830 jsonDecoder, jsonPath, json));
4133 } else { 3831 } else {
4134 throw jsonDecoder.missingKey(jsonPath, "id"); 3832 throw jsonDecoder.mismatch(jsonPath, "subscriptions");
4135 } 3833 }
4136 return new CompletionGetSuggestionsResult(id); 3834 return new AnalysisSetGeneralSubscriptionsParams(subscriptions);
4137 } else { 3835 } else {
4138 throw jsonDecoder.mismatch( 3836 throw jsonDecoder.mismatch(
4139 jsonPath, "completion.getSuggestions result", json); 3837 jsonPath, "analysis.setGeneralSubscriptions params", json);
4140 } 3838 }
4141 } 3839 }
4142 3840
4143 factory CompletionGetSuggestionsResult.fromResponse(Response response) { 3841 factory AnalysisSetGeneralSubscriptionsParams.fromRequest(Request request) {
4144 return new CompletionGetSuggestionsResult.fromJson( 3842 return new AnalysisSetGeneralSubscriptionsParams.fromJson(
4145 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), 3843 new RequestDecoder(request), "params", request.params);
4146 "result",
4147 response._result);
4148 } 3844 }
4149 3845
3846 @override
4150 Map<String, dynamic> toJson() { 3847 Map<String, dynamic> toJson() {
4151 Map<String, dynamic> result = {}; 3848 Map<String, dynamic> result = {};
4152 result["id"] = id; 3849 result["subscriptions"] = subscriptions
3850 .map((GeneralAnalysisService value) => value.toJson())
3851 .toList();
4153 return result; 3852 return result;
4154 } 3853 }
4155 3854
4156 Response toResponse(String id) { 3855 @override
4157 return new Response(id, result: toJson()); 3856 Request toRequest(String id) {
3857 return new Request(id, "analysis.setGeneralSubscriptions", toJson());
4158 } 3858 }
4159 3859
4160 @override 3860 @override
4161 String toString() => JSON.encode(toJson()); 3861 String toString() => JSON.encode(toJson());
4162 3862
4163 @override 3863 @override
4164 bool operator ==(other) { 3864 bool operator ==(other) {
4165 if (other is CompletionGetSuggestionsResult) { 3865 if (other is AnalysisSetGeneralSubscriptionsParams) {
4166 return id == other.id; 3866 return listEqual(subscriptions, other.subscriptions,
3867 (GeneralAnalysisService a, GeneralAnalysisService b) => a == b);
4167 } 3868 }
4168 return false; 3869 return false;
4169 } 3870 }
4170 3871
4171 @override 3872 @override
4172 int get hashCode { 3873 int get hashCode {
4173 int hash = 0; 3874 int hash = 0;
4174 hash = JenkinsSmiHash.combine(hash, id.hashCode); 3875 hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
4175 return JenkinsSmiHash.finish(hash); 3876 return JenkinsSmiHash.finish(hash);
4176 } 3877 }
4177 } 3878 }
4178 3879
4179 /** 3880 /**
4180 * completion.results params 3881 * analysis.setGeneralSubscriptions result
3882 *
3883 * Clients may not extend, implement or mix-in this class.
3884 */
3885 class AnalysisSetGeneralSubscriptionsResult implements ResponseResult {
3886 @override
3887 Map<String, dynamic> toJson() => <String, dynamic>{};
3888
3889 @override
3890 Response toResponse(String id) {
3891 return new Response(id, result: null);
3892 }
3893
3894 @override
3895 bool operator ==(other) {
3896 if (other is AnalysisSetGeneralSubscriptionsResult) {
3897 return true;
3898 }
3899 return false;
3900 }
3901
3902 @override
3903 int get hashCode {
3904 return 386759562;
3905 }
3906 }
3907
3908 /**
3909 * analysis.setPriorityFiles params
4181 * 3910 *
4182 * { 3911 * {
4183 * "id": CompletionId 3912 * "files": List<FilePath>
4184 * "replacementOffset": int
4185 * "replacementLength": int
4186 * "results": List<CompletionSuggestion>
4187 * "isLast": bool
4188 * } 3913 * }
4189 * 3914 *
4190 * Clients may not extend, implement or mix-in this class. 3915 * Clients may not extend, implement or mix-in this class.
4191 */ 3916 */
4192 class CompletionResultsParams implements HasToJson { 3917 class AnalysisSetPriorityFilesParams implements RequestParams {
4193 String _id; 3918 List<String> _files;
4194
4195 int _replacementOffset;
4196
4197 int _replacementLength;
4198
4199 List<CompletionSuggestion> _results;
4200
4201 bool _isLast;
4202 3919
4203 /** 3920 /**
4204 * The id associated with the completion. 3921 * The files that are to be a priority for analysis.
4205 */ 3922 */
4206 String get id => _id; 3923 List<String> get files => _files;
4207 3924
4208 /** 3925 /**
4209 * The id associated with the completion. 3926 * The files that are to be a priority for analysis.
4210 */ 3927 */
4211 void set id(String value) { 3928 void set files(List<String> value) {
4212 assert(value != null); 3929 assert(value != null);
4213 this._id = value; 3930 this._files = value;
4214 } 3931 }
4215 3932
4216 /** 3933 AnalysisSetPriorityFilesParams(List<String> files) {
4217 * The offset of the start of the text to be replaced. This will be different 3934 this.files = files;
4218 * than the offset used to request the completion suggestions if there was a
4219 * portion of an identifier before the original offset. In particular, the
4220 * replacementOffset will be the offset of the beginning of said identifier.
4221 */
4222 int get replacementOffset => _replacementOffset;
4223
4224 /**
4225 * The offset of the start of the text to be replaced. This will be different
4226 * than the offset used to request the completion suggestions if there was a
4227 * portion of an identifier before the original offset. In particular, the
4228 * replacementOffset will be the offset of the beginning of said identifier.
4229 */
4230 void set replacementOffset(int value) {
4231 assert(value != null);
4232 this._replacementOffset = value;
4233 } 3935 }
4234 3936
4235 /** 3937 factory AnalysisSetPriorityFilesParams.fromJson(
4236 * The length of the text to be replaced if the remainder of the identifier
4237 * containing the cursor is to be replaced when the suggestion is applied
4238 * (that is, the number of characters in the existing identifier).
4239 */
4240 int get replacementLength => _replacementLength;
4241
4242 /**
4243 * The length of the text to be replaced if the remainder of the identifier
4244 * containing the cursor is to be replaced when the suggestion is applied
4245 * (that is, the number of characters in the existing identifier).
4246 */
4247 void set replacementLength(int value) {
4248 assert(value != null);
4249 this._replacementLength = value;
4250 }
4251
4252 /**
4253 * The completion suggestions being reported. The notification contains all
4254 * possible completions at the requested cursor position, even those that do
4255 * not match the characters the user has already typed. This allows the
4256 * client to respond to further keystrokes from the user without having to
4257 * make additional requests.
4258 */
4259 List<CompletionSuggestion> get results => _results;
4260
4261 /**
4262 * The completion suggestions being reported. The notification contains all
4263 * possible completions at the requested cursor position, even those that do
4264 * not match the characters the user has already typed. This allows the
4265 * client to respond to further keystrokes from the user without having to
4266 * make additional requests.
4267 */
4268 void set results(List<CompletionSuggestion> value) {
4269 assert(value != null);
4270 this._results = value;
4271 }
4272
4273 /**
4274 * True if this is that last set of results that will be returned for the
4275 * indicated completion.
4276 */
4277 bool get isLast => _isLast;
4278
4279 /**
4280 * True if this is that last set of results that will be returned for the
4281 * indicated completion.
4282 */
4283 void set isLast(bool value) {
4284 assert(value != null);
4285 this._isLast = value;
4286 }
4287
4288 CompletionResultsParams(String id, int replacementOffset,
4289 int replacementLength, List<CompletionSuggestion> results, bool isLast) {
4290 this.id = id;
4291 this.replacementOffset = replacementOffset;
4292 this.replacementLength = replacementLength;
4293 this.results = results;
4294 this.isLast = isLast;
4295 }
4296
4297 factory CompletionResultsParams.fromJson(
4298 JsonDecoder jsonDecoder, String jsonPath, Object json) { 3938 JsonDecoder jsonDecoder, String jsonPath, Object json) {
4299 if (json == null) { 3939 if (json == null) {
4300 json = {}; 3940 json = {};
4301 } 3941 }
4302 if (json is Map) { 3942 if (json is Map) {
4303 String id; 3943 List<String> files;
4304 if (json.containsKey("id")) { 3944 if (json.containsKey("files")) {
4305 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]); 3945 files = jsonDecoder.decodeList(
3946 jsonPath + ".files", json["files"], jsonDecoder.decodeString);
4306 } else { 3947 } else {
4307 throw jsonDecoder.missingKey(jsonPath, "id"); 3948 throw jsonDecoder.mismatch(jsonPath, "files");
4308 } 3949 }
4309 int replacementOffset; 3950 return new AnalysisSetPriorityFilesParams(files);
4310 if (json.containsKey("replacementOffset")) {
4311 replacementOffset = jsonDecoder.decodeInt(
4312 jsonPath + ".replacementOffset", json["replacementOffset"]);
4313 } else {
4314 throw jsonDecoder.missingKey(jsonPath, "replacementOffset");
4315 }
4316 int replacementLength;
4317 if (json.containsKey("replacementLength")) {
4318 replacementLength = jsonDecoder.decodeInt(
4319 jsonPath + ".replacementLength", json["replacementLength"]);
4320 } else {
4321 throw jsonDecoder.missingKey(jsonPath, "replacementLength");
4322 }
4323 List<CompletionSuggestion> results;
4324 if (json.containsKey("results")) {
4325 results = jsonDecoder.decodeList(
4326 jsonPath + ".results",
4327 json["results"],
4328 (String jsonPath, Object json) =>
4329 new CompletionSuggestion.fromJson(jsonDecoder, jsonPath, json));
4330 } else {
4331 throw jsonDecoder.missingKey(jsonPath, "results");
4332 }
4333 bool isLast;
4334 if (json.containsKey("isLast")) {
4335 isLast = jsonDecoder.decodeBool(jsonPath + ".isLast", json["isLast"]);
4336 } else {
4337 throw jsonDecoder.missingKey(jsonPath, "isLast");
4338 }
4339 return new CompletionResultsParams(
4340 id, replacementOffset, replacementLength, results, isLast);
4341 } else { 3951 } else {
4342 throw jsonDecoder.mismatch(jsonPath, "completion.results params", json); 3952 throw jsonDecoder.mismatch(
3953 jsonPath, "analysis.setPriorityFiles params", json);
4343 } 3954 }
4344 } 3955 }
4345 3956
4346 factory CompletionResultsParams.fromNotification(Notification notification) { 3957 factory AnalysisSetPriorityFilesParams.fromRequest(Request request) {
4347 return new CompletionResultsParams.fromJson( 3958 return new AnalysisSetPriorityFilesParams.fromJson(
4348 new ResponseDecoder(null), "params", notification._params); 3959 new RequestDecoder(request), "params", request.params);
4349 } 3960 }
4350 3961
3962 @override
4351 Map<String, dynamic> toJson() { 3963 Map<String, dynamic> toJson() {
4352 Map<String, dynamic> result = {}; 3964 Map<String, dynamic> result = {};
4353 result["id"] = id; 3965 result["files"] = files;
4354 result["replacementOffset"] = replacementOffset;
4355 result["replacementLength"] = replacementLength;
4356 result["results"] =
4357 results.map((CompletionSuggestion value) => value.toJson()).toList();
4358 result["isLast"] = isLast;
4359 return result; 3966 return result;
4360 } 3967 }
4361 3968
4362 Notification toNotification() { 3969 @override
4363 return new Notification("completion.results", toJson()); 3970 Request toRequest(String id) {
3971 return new Request(id, "analysis.setPriorityFiles", toJson());
4364 } 3972 }
4365 3973
4366 @override 3974 @override
4367 String toString() => JSON.encode(toJson()); 3975 String toString() => JSON.encode(toJson());
4368 3976
4369 @override 3977 @override
4370 bool operator ==(other) { 3978 bool operator ==(other) {
4371 if (other is CompletionResultsParams) { 3979 if (other is AnalysisSetPriorityFilesParams) {
4372 return id == other.id && 3980 return listEqual(files, other.files, (String a, String b) => a == b);
4373 replacementOffset == other.replacementOffset &&
4374 replacementLength == other.replacementLength &&
4375 listEqual(results, other.results,
4376 (CompletionSuggestion a, CompletionSuggestion b) => a == b) &&
4377 isLast == other.isLast;
4378 } 3981 }
4379 return false; 3982 return false;
4380 } 3983 }
4381 3984
4382 @override 3985 @override
4383 int get hashCode { 3986 int get hashCode {
4384 int hash = 0; 3987 int hash = 0;
4385 hash = JenkinsSmiHash.combine(hash, id.hashCode); 3988 hash = JenkinsSmiHash.combine(hash, files.hashCode);
4386 hash = JenkinsSmiHash.combine(hash, replacementOffset.hashCode);
4387 hash = JenkinsSmiHash.combine(hash, replacementLength.hashCode);
4388 hash = JenkinsSmiHash.combine(hash, results.hashCode);
4389 hash = JenkinsSmiHash.combine(hash, isLast.hashCode);
4390 return JenkinsSmiHash.finish(hash); 3989 return JenkinsSmiHash.finish(hash);
4391 } 3990 }
4392 } 3991 }
4393 3992
4394 /** 3993 /**
4395 * search.findElementReferences params 3994 * analysis.setPriorityFiles result
3995 *
3996 * Clients may not extend, implement or mix-in this class.
3997 */
3998 class AnalysisSetPriorityFilesResult implements ResponseResult {
3999 @override
4000 Map<String, dynamic> toJson() => <String, dynamic>{};
4001
4002 @override
4003 Response toResponse(String id) {
4004 return new Response(id, result: null);
4005 }
4006
4007 @override
4008 bool operator ==(other) {
4009 if (other is AnalysisSetPriorityFilesResult) {
4010 return true;
4011 }
4012 return false;
4013 }
4014
4015 @override
4016 int get hashCode {
4017 return 330050055;
4018 }
4019 }
4020
4021 /**
4022 * analysis.setSubscriptions params
4396 * 4023 *
4397 * { 4024 * {
4398 * "file": FilePath 4025 * "subscriptions": Map<AnalysisService, List<FilePath>>
4399 * "offset": int
4400 * "includePotential": bool
4401 * } 4026 * }
4402 * 4027 *
4403 * Clients may not extend, implement or mix-in this class. 4028 * Clients may not extend, implement or mix-in this class.
4404 */ 4029 */
4405 class SearchFindElementReferencesParams implements HasToJson { 4030 class AnalysisSetSubscriptionsParams implements RequestParams {
4406 String _file; 4031 Map<AnalysisService, List<String>> _subscriptions;
4407
4408 int _offset;
4409
4410 bool _includePotential;
4411 4032
4412 /** 4033 /**
4413 * The file containing the declaration of or reference to the element used to 4034 * A table mapping services to a list of the files being subscribed to the
4414 * define the search. 4035 * service.
4415 */ 4036 */
4416 String get file => _file; 4037 Map<AnalysisService, List<String>> get subscriptions => _subscriptions;
4417 4038
4418 /** 4039 /**
4419 * The file containing the declaration of or reference to the element used to 4040 * A table mapping services to a list of the files being subscribed to the
4420 * define the search. 4041 * service.
4421 */ 4042 */
4422 void set file(String value) { 4043 void set subscriptions(Map<AnalysisService, List<String>> value) {
4423 assert(value != null); 4044 assert(value != null);
4424 this._file = value; 4045 this._subscriptions = value;
4425 } 4046 }
4426 4047
4427 /** 4048 AnalysisSetSubscriptionsParams(
4428 * The offset within the file of the declaration of or reference to the 4049 Map<AnalysisService, List<String>> subscriptions) {
4429 * element. 4050 this.subscriptions = subscriptions;
4430 */
4431 int get offset => _offset;
4432
4433 /**
4434 * The offset within the file of the declaration of or reference to the
4435 * element.
4436 */
4437 void set offset(int value) {
4438 assert(value != null);
4439 this._offset = value;
4440 } 4051 }
4441 4052
4442 /** 4053 factory AnalysisSetSubscriptionsParams.fromJson(
4443 * True if potential matches are to be included in the results.
4444 */
4445 bool get includePotential => _includePotential;
4446
4447 /**
4448 * True if potential matches are to be included in the results.
4449 */
4450 void set includePotential(bool value) {
4451 assert(value != null);
4452 this._includePotential = value;
4453 }
4454
4455 SearchFindElementReferencesParams(
4456 String file, int offset, bool includePotential) {
4457 this.file = file;
4458 this.offset = offset;
4459 this.includePotential = includePotential;
4460 }
4461
4462 factory SearchFindElementReferencesParams.fromJson(
4463 JsonDecoder jsonDecoder, String jsonPath, Object json) { 4054 JsonDecoder jsonDecoder, String jsonPath, Object json) {
4464 if (json == null) { 4055 if (json == null) {
4465 json = {}; 4056 json = {};
4466 } 4057 }
4467 if (json is Map) { 4058 if (json is Map) {
4468 String file; 4059 Map<AnalysisService, List<String>> subscriptions;
4469 if (json.containsKey("file")) { 4060 if (json.containsKey("subscriptions")) {
4470 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 4061 subscriptions = jsonDecoder.decodeMap(
4062 jsonPath + ".subscriptions", json["subscriptions"],
4063 keyDecoder: (String jsonPath, Object json) =>
4064 new AnalysisService.fromJson(jsonDecoder, jsonPath, json),
4065 valueDecoder: (String jsonPath, Object json) => jsonDecoder
4066 .decodeList(jsonPath, json, jsonDecoder.decodeString));
4471 } else { 4067 } else {
4472 throw jsonDecoder.missingKey(jsonPath, "file"); 4068 throw jsonDecoder.mismatch(jsonPath, "subscriptions");
4473 } 4069 }
4474 int offset; 4070 return new AnalysisSetSubscriptionsParams(subscriptions);
4475 if (json.containsKey("offset")) {
4476 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
4477 } else {
4478 throw jsonDecoder.missingKey(jsonPath, "offset");
4479 }
4480 bool includePotential;
4481 if (json.containsKey("includePotential")) {
4482 includePotential = jsonDecoder.decodeBool(
4483 jsonPath + ".includePotential", json["includePotential"]);
4484 } else {
4485 throw jsonDecoder.missingKey(jsonPath, "includePotential");
4486 }
4487 return new SearchFindElementReferencesParams(
4488 file, offset, includePotential);
4489 } else { 4071 } else {
4490 throw jsonDecoder.mismatch( 4072 throw jsonDecoder.mismatch(
4491 jsonPath, "search.findElementReferences params", json); 4073 jsonPath, "analysis.setSubscriptions params", json);
4492 } 4074 }
4493 } 4075 }
4494 4076
4495 factory SearchFindElementReferencesParams.fromRequest(Request request) { 4077 factory AnalysisSetSubscriptionsParams.fromRequest(Request request) {
4496 return new SearchFindElementReferencesParams.fromJson( 4078 return new AnalysisSetSubscriptionsParams.fromJson(
4497 new RequestDecoder(request), "params", request._params); 4079 new RequestDecoder(request), "params", request.params);
4498 } 4080 }
4499 4081
4082 @override
4500 Map<String, dynamic> toJson() { 4083 Map<String, dynamic> toJson() {
4501 Map<String, dynamic> result = {}; 4084 Map<String, dynamic> result = {};
4502 result["file"] = file; 4085 result["subscriptions"] = mapMap(subscriptions,
4503 result["offset"] = offset; 4086 keyCallback: (AnalysisService value) => value.toJson());
4504 result["includePotential"] = includePotential;
4505 return result; 4087 return result;
4506 } 4088 }
4507 4089
4090 @override
4508 Request toRequest(String id) { 4091 Request toRequest(String id) {
4509 return new Request(id, "search.findElementReferences", toJson()); 4092 return new Request(id, "analysis.setSubscriptions", toJson());
4510 } 4093 }
4511 4094
4512 @override 4095 @override
4513 String toString() => JSON.encode(toJson()); 4096 String toString() => JSON.encode(toJson());
4514 4097
4515 @override 4098 @override
4516 bool operator ==(other) { 4099 bool operator ==(other) {
4517 if (other is SearchFindElementReferencesParams) { 4100 if (other is AnalysisSetSubscriptionsParams) {
4518 return file == other.file && 4101 return mapEqual(
4519 offset == other.offset && 4102 subscriptions,
4520 includePotential == other.includePotential; 4103 other.subscriptions,
4104 (List<String> a, List<String> b) =>
4105 listEqual(a, b, (String a, String b) => a == b));
4521 } 4106 }
4522 return false; 4107 return false;
4523 } 4108 }
4524 4109
4525 @override 4110 @override
4526 int get hashCode { 4111 int get hashCode {
4527 int hash = 0; 4112 int hash = 0;
4528 hash = JenkinsSmiHash.combine(hash, file.hashCode); 4113 hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
4529 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
4530 hash = JenkinsSmiHash.combine(hash, includePotential.hashCode);
4531 return JenkinsSmiHash.finish(hash); 4114 return JenkinsSmiHash.finish(hash);
4532 } 4115 }
4533 } 4116 }
4534 4117
4535 /** 4118 /**
4536 * search.findElementReferences result 4119 * analysis.setSubscriptions result
4120 *
4121 * Clients may not extend, implement or mix-in this class.
4122 */
4123 class AnalysisSetSubscriptionsResult implements ResponseResult {
4124 @override
4125 Map<String, dynamic> toJson() => <String, dynamic>{};
4126
4127 @override
4128 Response toResponse(String id) {
4129 return new Response(id, result: null);
4130 }
4131
4132 @override
4133 bool operator ==(other) {
4134 if (other is AnalysisSetSubscriptionsResult) {
4135 return true;
4136 }
4137 return false;
4138 }
4139
4140 @override
4141 int get hashCode {
4142 return 218088493;
4143 }
4144 }
4145
4146 /**
4147 * AnalysisStatus
4537 * 4148 *
4538 * { 4149 * {
4539 * "id": optional SearchId 4150 * "isAnalyzing": bool
4540 * "element": optional Element 4151 * "analysisTarget": optional String
4541 * } 4152 * }
4542 * 4153 *
4543 * Clients may not extend, implement or mix-in this class. 4154 * Clients may not extend, implement or mix-in this class.
4544 */ 4155 */
4545 class SearchFindElementReferencesResult implements HasToJson { 4156 class AnalysisStatus implements HasToJson {
4546 String _id; 4157 bool _isAnalyzing;
4547 4158
4548 Element _element; 4159 String _analysisTarget;
4549 4160
4550 /** 4161 /**
4551 * The identifier used to associate results with this search request. 4162 * True if analysis is currently being performed.
4552 *
4553 * If no element was found at the given location, this field will be absent,
4554 * and no results will be reported via the search.results notification.
4555 */ 4163 */
4556 String get id => _id; 4164 bool get isAnalyzing => _isAnalyzing;
4557 4165
4558 /** 4166 /**
4559 * The identifier used to associate results with this search request. 4167 * True if analysis is currently being performed.
4560 *
4561 * If no element was found at the given location, this field will be absent,
4562 * and no results will be reported via the search.results notification.
4563 */ 4168 */
4564 void set id(String value) { 4169 void set isAnalyzing(bool value) {
4565 this._id = value; 4170 assert(value != null);
4171 this._isAnalyzing = value;
4566 } 4172 }
4567 4173
4568 /** 4174 /**
4569 * The element referenced or defined at the given offset and whose references 4175 * The name of the current target of analysis. This field is omitted if
4570 * will be returned in the search results. 4176 * analyzing is false.
4571 *
4572 * If no element was found at the given location, this field will be absent.
4573 */ 4177 */
4574 Element get element => _element; 4178 String get analysisTarget => _analysisTarget;
4575 4179
4576 /** 4180 /**
4577 * The element referenced or defined at the given offset and whose references 4181 * The name of the current target of analysis. This field is omitted if
4578 * will be returned in the search results. 4182 * analyzing is false.
4579 *
4580 * If no element was found at the given location, this field will be absent.
4581 */ 4183 */
4582 void set element(Element value) { 4184 void set analysisTarget(String value) {
4583 this._element = value; 4185 this._analysisTarget = value;
4584 } 4186 }
4585 4187
4586 SearchFindElementReferencesResult({String id, Element element}) { 4188 AnalysisStatus(bool isAnalyzing, {String analysisTarget}) {
4587 this.id = id; 4189 this.isAnalyzing = isAnalyzing;
4588 this.element = element; 4190 this.analysisTarget = analysisTarget;
4589 } 4191 }
4590 4192
4591 factory SearchFindElementReferencesResult.fromJson( 4193 factory AnalysisStatus.fromJson(
4592 JsonDecoder jsonDecoder, String jsonPath, Object json) { 4194 JsonDecoder jsonDecoder, String jsonPath, Object json) {
4593 if (json == null) { 4195 if (json == null) {
4594 json = {}; 4196 json = {};
4595 } 4197 }
4596 if (json is Map) { 4198 if (json is Map) {
4597 String id; 4199 bool isAnalyzing;
4598 if (json.containsKey("id")) { 4200 if (json.containsKey("isAnalyzing")) {
4599 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]); 4201 isAnalyzing = jsonDecoder.decodeBool(
4202 jsonPath + ".isAnalyzing", json["isAnalyzing"]);
4203 } else {
4204 throw jsonDecoder.mismatch(jsonPath, "isAnalyzing");
4600 } 4205 }
4601 Element element; 4206 String analysisTarget;
4602 if (json.containsKey("element")) { 4207 if (json.containsKey("analysisTarget")) {
4603 element = new Element.fromJson( 4208 analysisTarget = jsonDecoder.decodeString(
4604 jsonDecoder, jsonPath + ".element", json["element"]); 4209 jsonPath + ".analysisTarget", json["analysisTarget"]);
4605 } 4210 }
4606 return new SearchFindElementReferencesResult(id: id, element: element); 4211 return new AnalysisStatus(isAnalyzing, analysisTarget: analysisTarget);
4607 } else { 4212 } else {
4608 throw jsonDecoder.mismatch( 4213 throw jsonDecoder.mismatch(jsonPath, "AnalysisStatus", json);
4609 jsonPath, "search.findElementReferences result", json);
4610 } 4214 }
4611 } 4215 }
4612 4216
4613 factory SearchFindElementReferencesResult.fromResponse(Response response) { 4217 @override
4614 return new SearchFindElementReferencesResult.fromJson(
4615 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
4616 "result",
4617 response._result);
4618 }
4619
4620 Map<String, dynamic> toJson() { 4218 Map<String, dynamic> toJson() {
4621 Map<String, dynamic> result = {}; 4219 Map<String, dynamic> result = {};
4622 if (id != null) { 4220 result["isAnalyzing"] = isAnalyzing;
4623 result["id"] = id; 4221 if (analysisTarget != null) {
4624 } 4222 result["analysisTarget"] = analysisTarget;
4625 if (element != null) {
4626 result["element"] = element.toJson();
4627 } 4223 }
4628 return result; 4224 return result;
4629 } 4225 }
4630 4226
4631 Response toResponse(String id) {
4632 return new Response(id, result: toJson());
4633 }
4634
4635 @override 4227 @override
4636 String toString() => JSON.encode(toJson()); 4228 String toString() => JSON.encode(toJson());
4637 4229
4638 @override 4230 @override
4639 bool operator ==(other) { 4231 bool operator ==(other) {
4640 if (other is SearchFindElementReferencesResult) { 4232 if (other is AnalysisStatus) {
4641 return id == other.id && element == other.element; 4233 return isAnalyzing == other.isAnalyzing &&
4234 analysisTarget == other.analysisTarget;
4642 } 4235 }
4643 return false; 4236 return false;
4644 } 4237 }
4645 4238
4646 @override 4239 @override
4647 int get hashCode { 4240 int get hashCode {
4648 int hash = 0; 4241 int hash = 0;
4649 hash = JenkinsSmiHash.combine(hash, id.hashCode); 4242 hash = JenkinsSmiHash.combine(hash, isAnalyzing.hashCode);
4650 hash = JenkinsSmiHash.combine(hash, element.hashCode); 4243 hash = JenkinsSmiHash.combine(hash, analysisTarget.hashCode);
4651 return JenkinsSmiHash.finish(hash); 4244 return JenkinsSmiHash.finish(hash);
4652 } 4245 }
4653 } 4246 }
4654 4247
4655 /** 4248 /**
4656 * search.findMemberDeclarations params 4249 * analysis.updateContent params
4657 * 4250 *
4658 * { 4251 * {
4659 * "name": String 4252 * "files": Map<FilePath, AddContentOverlay | ChangeContentOverlay | RemoveCon tentOverlay>
4660 * } 4253 * }
4661 * 4254 *
4662 * Clients may not extend, implement or mix-in this class. 4255 * Clients may not extend, implement or mix-in this class.
4663 */ 4256 */
4664 class SearchFindMemberDeclarationsParams implements HasToJson { 4257 class AnalysisUpdateContentParams implements RequestParams {
4665 String _name; 4258 Map<String, dynamic> _files;
4666 4259
4667 /** 4260 /**
4668 * The name of the declarations to be found. 4261 * A table mapping the files whose content has changed to a description of
4262 * the content change.
4669 */ 4263 */
4670 String get name => _name; 4264 Map<String, dynamic> get files => _files;
4671 4265
4672 /** 4266 /**
4673 * The name of the declarations to be found. 4267 * A table mapping the files whose content has changed to a description of
4268 * the content change.
4674 */ 4269 */
4675 void set name(String value) { 4270 void set files(Map<String, dynamic> value) {
4676 assert(value != null); 4271 assert(value != null);
4677 this._name = value; 4272 this._files = value;
4678 } 4273 }
4679 4274
4680 SearchFindMemberDeclarationsParams(String name) { 4275 AnalysisUpdateContentParams(Map<String, dynamic> files) {
4681 this.name = name; 4276 this.files = files;
4682 } 4277 }
4683 4278
4684 factory SearchFindMemberDeclarationsParams.fromJson( 4279 factory AnalysisUpdateContentParams.fromJson(
4685 JsonDecoder jsonDecoder, String jsonPath, Object json) { 4280 JsonDecoder jsonDecoder, String jsonPath, Object json) {
4686 if (json == null) { 4281 if (json == null) {
4687 json = {}; 4282 json = {};
4688 } 4283 }
4689 if (json is Map) { 4284 if (json is Map) {
4690 String name; 4285 Map<String, dynamic> files;
4691 if (json.containsKey("name")) { 4286 if (json.containsKey("files")) {
4692 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]); 4287 files = jsonDecoder.decodeMap(jsonPath + ".files", json["files"],
4288 valueDecoder: (String jsonPath, Object json) =>
4289 jsonDecoder.decodeUnion(jsonPath, json, "type", {
4290 "add": (String jsonPath, Object json) =>
4291 new AddContentOverlay.fromJson(
4292 jsonDecoder, jsonPath, json),
4293 "change": (String jsonPath, Object json) =>
4294 new ChangeContentOverlay.fromJson(
4295 jsonDecoder, jsonPath, json),
4296 "remove": (String jsonPath, Object json) =>
4297 new RemoveContentOverlay.fromJson(
4298 jsonDecoder, jsonPath, json)
4299 }));
4693 } else { 4300 } else {
4694 throw jsonDecoder.missingKey(jsonPath, "name"); 4301 throw jsonDecoder.mismatch(jsonPath, "files");
4695 } 4302 }
4696 return new SearchFindMemberDeclarationsParams(name); 4303 return new AnalysisUpdateContentParams(files);
4697 } else { 4304 } else {
4698 throw jsonDecoder.mismatch( 4305 throw jsonDecoder.mismatch(
4699 jsonPath, "search.findMemberDeclarations params", json); 4306 jsonPath, "analysis.updateContent params", json);
4700 } 4307 }
4701 } 4308 }
4702 4309
4703 factory SearchFindMemberDeclarationsParams.fromRequest(Request request) { 4310 factory AnalysisUpdateContentParams.fromRequest(Request request) {
4704 return new SearchFindMemberDeclarationsParams.fromJson( 4311 return new AnalysisUpdateContentParams.fromJson(
4705 new RequestDecoder(request), "params", request._params); 4312 new RequestDecoder(request), "params", request.params);
4706 } 4313 }
4707 4314
4315 @override
4708 Map<String, dynamic> toJson() { 4316 Map<String, dynamic> toJson() {
4709 Map<String, dynamic> result = {}; 4317 Map<String, dynamic> result = {};
4710 result["name"] = name; 4318 result["files"] =
4319 mapMap(files, valueCallback: (dynamic value) => value.toJson());
4711 return result; 4320 return result;
4712 } 4321 }
4713 4322
4323 @override
4714 Request toRequest(String id) { 4324 Request toRequest(String id) {
4715 return new Request(id, "search.findMemberDeclarations", toJson()); 4325 return new Request(id, "analysis.updateContent", toJson());
4716 } 4326 }
4717 4327
4718 @override 4328 @override
4719 String toString() => JSON.encode(toJson()); 4329 String toString() => JSON.encode(toJson());
4720 4330
4721 @override 4331 @override
4722 bool operator ==(other) { 4332 bool operator ==(other) {
4723 if (other is SearchFindMemberDeclarationsParams) { 4333 if (other is AnalysisUpdateContentParams) {
4724 return name == other.name; 4334 return mapEqual(files, other.files, (dynamic a, dynamic b) => a == b);
4725 } 4335 }
4726 return false; 4336 return false;
4727 } 4337 }
4728 4338
4729 @override 4339 @override
4730 int get hashCode { 4340 int get hashCode {
4731 int hash = 0; 4341 int hash = 0;
4732 hash = JenkinsSmiHash.combine(hash, name.hashCode); 4342 hash = JenkinsSmiHash.combine(hash, files.hashCode);
4733 return JenkinsSmiHash.finish(hash); 4343 return JenkinsSmiHash.finish(hash);
4734 } 4344 }
4735 } 4345 }
4736 4346
4737 /** 4347 /**
4738 * search.findMemberDeclarations result 4348 * analysis.updateContent result
4739 * 4349 *
4740 * { 4350 * {
4741 * "id": SearchId
4742 * } 4351 * }
4743 * 4352 *
4744 * Clients may not extend, implement or mix-in this class. 4353 * Clients may not extend, implement or mix-in this class.
4745 */ 4354 */
4746 class SearchFindMemberDeclarationsResult implements HasToJson { 4355 class AnalysisUpdateContentResult implements ResponseResult {
4747 String _id; 4356 AnalysisUpdateContentResult();
4748 4357
4749 /** 4358 factory AnalysisUpdateContentResult.fromJson(
4750 * The identifier used to associate results with this search request.
4751 */
4752 String get id => _id;
4753
4754 /**
4755 * The identifier used to associate results with this search request.
4756 */
4757 void set id(String value) {
4758 assert(value != null);
4759 this._id = value;
4760 }
4761
4762 SearchFindMemberDeclarationsResult(String id) {
4763 this.id = id;
4764 }
4765
4766 factory SearchFindMemberDeclarationsResult.fromJson(
4767 JsonDecoder jsonDecoder, String jsonPath, Object json) { 4359 JsonDecoder jsonDecoder, String jsonPath, Object json) {
4768 if (json == null) { 4360 if (json == null) {
4769 json = {}; 4361 json = {};
4770 } 4362 }
4771 if (json is Map) { 4363 if (json is Map) {
4772 String id; 4364 return new AnalysisUpdateContentResult();
4773 if (json.containsKey("id")) {
4774 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
4775 } else {
4776 throw jsonDecoder.missingKey(jsonPath, "id");
4777 }
4778 return new SearchFindMemberDeclarationsResult(id);
4779 } else { 4365 } else {
4780 throw jsonDecoder.mismatch( 4366 throw jsonDecoder.mismatch(
4781 jsonPath, "search.findMemberDeclarations result", json); 4367 jsonPath, "analysis.updateContent result", json);
4782 } 4368 }
4783 } 4369 }
4784 4370
4785 factory SearchFindMemberDeclarationsResult.fromResponse(Response response) { 4371 factory AnalysisUpdateContentResult.fromResponse(Response response) {
4786 return new SearchFindMemberDeclarationsResult.fromJson( 4372 return new AnalysisUpdateContentResult.fromJson(
4787 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), 4373 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
4788 "result", 4374 "result",
4789 response._result); 4375 response.result);
4790 } 4376 }
4791 4377
4378 @override
4792 Map<String, dynamic> toJson() { 4379 Map<String, dynamic> toJson() {
4793 Map<String, dynamic> result = {}; 4380 Map<String, dynamic> result = {};
4794 result["id"] = id;
4795 return result; 4381 return result;
4796 } 4382 }
4797 4383
4384 @override
4798 Response toResponse(String id) { 4385 Response toResponse(String id) {
4799 return new Response(id, result: toJson()); 4386 return new Response(id, result: toJson());
4800 } 4387 }
4801 4388
4802 @override 4389 @override
4803 String toString() => JSON.encode(toJson()); 4390 String toString() => JSON.encode(toJson());
4804 4391
4805 @override 4392 @override
4806 bool operator ==(other) { 4393 bool operator ==(other) {
4807 if (other is SearchFindMemberDeclarationsResult) { 4394 if (other is AnalysisUpdateContentResult) {
4808 return id == other.id; 4395 return true;
4809 } 4396 }
4810 return false; 4397 return false;
4811 } 4398 }
4812 4399
4813 @override 4400 @override
4814 int get hashCode { 4401 int get hashCode {
4815 int hash = 0; 4402 int hash = 0;
4816 hash = JenkinsSmiHash.combine(hash, id.hashCode);
4817 return JenkinsSmiHash.finish(hash); 4403 return JenkinsSmiHash.finish(hash);
4818 } 4404 }
4819 } 4405 }
4820 4406
4821 /** 4407 /**
4822 * search.findMemberReferences params 4408 * analysis.updateOptions params
4823 * 4409 *
4824 * { 4410 * {
4825 * "name": String 4411 * "options": AnalysisOptions
4826 * } 4412 * }
4827 * 4413 *
4828 * Clients may not extend, implement or mix-in this class. 4414 * Clients may not extend, implement or mix-in this class.
4829 */ 4415 */
4830 class SearchFindMemberReferencesParams implements HasToJson { 4416 class AnalysisUpdateOptionsParams implements RequestParams {
4831 String _name; 4417 AnalysisOptions _options;
4832 4418
4833 /** 4419 /**
4834 * The name of the references to be found. 4420 * The options that are to be used to control analysis.
4835 */ 4421 */
4836 String get name => _name; 4422 AnalysisOptions get options => _options;
4837 4423
4838 /** 4424 /**
4839 * The name of the references to be found. 4425 * The options that are to be used to control analysis.
4840 */ 4426 */
4841 void set name(String value) { 4427 void set options(AnalysisOptions value) {
4842 assert(value != null); 4428 assert(value != null);
4843 this._name = value; 4429 this._options = value;
4844 } 4430 }
4845 4431
4846 SearchFindMemberReferencesParams(String name) { 4432 AnalysisUpdateOptionsParams(AnalysisOptions options) {
4847 this.name = name; 4433 this.options = options;
4848 } 4434 }
4849 4435
4850 factory SearchFindMemberReferencesParams.fromJson( 4436 factory AnalysisUpdateOptionsParams.fromJson(
4851 JsonDecoder jsonDecoder, String jsonPath, Object json) { 4437 JsonDecoder jsonDecoder, String jsonPath, Object json) {
4852 if (json == null) { 4438 if (json == null) {
4853 json = {}; 4439 json = {};
4854 } 4440 }
4855 if (json is Map) { 4441 if (json is Map) {
4856 String name; 4442 AnalysisOptions options;
4857 if (json.containsKey("name")) { 4443 if (json.containsKey("options")) {
4858 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]); 4444 options = new AnalysisOptions.fromJson(
4445 jsonDecoder, jsonPath + ".options", json["options"]);
4859 } else { 4446 } else {
4860 throw jsonDecoder.missingKey(jsonPath, "name"); 4447 throw jsonDecoder.mismatch(jsonPath, "options");
4861 } 4448 }
4862 return new SearchFindMemberReferencesParams(name); 4449 return new AnalysisUpdateOptionsParams(options);
4863 } else { 4450 } else {
4864 throw jsonDecoder.mismatch( 4451 throw jsonDecoder.mismatch(
4865 jsonPath, "search.findMemberReferences params", json); 4452 jsonPath, "analysis.updateOptions params", json);
4866 } 4453 }
4867 } 4454 }
4868 4455
4869 factory SearchFindMemberReferencesParams.fromRequest(Request request) { 4456 factory AnalysisUpdateOptionsParams.fromRequest(Request request) {
4870 return new SearchFindMemberReferencesParams.fromJson( 4457 return new AnalysisUpdateOptionsParams.fromJson(
4871 new RequestDecoder(request), "params", request._params); 4458 new RequestDecoder(request), "params", request.params);
4872 } 4459 }
4873 4460
4461 @override
4874 Map<String, dynamic> toJson() { 4462 Map<String, dynamic> toJson() {
4875 Map<String, dynamic> result = {}; 4463 Map<String, dynamic> result = {};
4876 result["name"] = name; 4464 result["options"] = options.toJson();
4877 return result; 4465 return result;
4878 } 4466 }
4879 4467
4468 @override
4880 Request toRequest(String id) { 4469 Request toRequest(String id) {
4881 return new Request(id, "search.findMemberReferences", toJson()); 4470 return new Request(id, "analysis.updateOptions", toJson());
4882 } 4471 }
4883 4472
4884 @override 4473 @override
4885 String toString() => JSON.encode(toJson()); 4474 String toString() => JSON.encode(toJson());
4886 4475
4887 @override 4476 @override
4888 bool operator ==(other) { 4477 bool operator ==(other) {
4889 if (other is SearchFindMemberReferencesParams) { 4478 if (other is AnalysisUpdateOptionsParams) {
4890 return name == other.name; 4479 return options == other.options;
4891 } 4480 }
4892 return false; 4481 return false;
4893 } 4482 }
4894 4483
4895 @override 4484 @override
4896 int get hashCode { 4485 int get hashCode {
4897 int hash = 0; 4486 int hash = 0;
4898 hash = JenkinsSmiHash.combine(hash, name.hashCode); 4487 hash = JenkinsSmiHash.combine(hash, options.hashCode);
4899 return JenkinsSmiHash.finish(hash); 4488 return JenkinsSmiHash.finish(hash);
4900 } 4489 }
4901 } 4490 }
4902 4491
4903 /** 4492 /**
4904 * search.findMemberReferences result 4493 * analysis.updateOptions result
4494 *
4495 * Clients may not extend, implement or mix-in this class.
4496 */
4497 class AnalysisUpdateOptionsResult implements ResponseResult {
4498 @override
4499 Map<String, dynamic> toJson() => <String, dynamic>{};
4500
4501 @override
4502 Response toResponse(String id) {
4503 return new Response(id, result: null);
4504 }
4505
4506 @override
4507 bool operator ==(other) {
4508 if (other is AnalysisUpdateOptionsResult) {
4509 return true;
4510 }
4511 return false;
4512 }
4513
4514 @override
4515 int get hashCode {
4516 return 179689467;
4517 }
4518 }
4519
4520 /**
4521 * ChangeContentOverlay
4905 * 4522 *
4906 * { 4523 * {
4907 * "id": SearchId 4524 * "type": "change"
4525 * "edits": List<SourceEdit>
4908 * } 4526 * }
4909 * 4527 *
4910 * Clients may not extend, implement or mix-in this class. 4528 * Clients may not extend, implement or mix-in this class.
4911 */ 4529 */
4912 class SearchFindMemberReferencesResult implements HasToJson { 4530 class ChangeContentOverlay implements HasToJson {
4913 String _id; 4531 List<SourceEdit> _edits;
4914 4532
4915 /** 4533 /**
4916 * The identifier used to associate results with this search request. 4534 * The edits to be applied to the file.
4917 */ 4535 */
4918 String get id => _id; 4536 List<SourceEdit> get edits => _edits;
4919 4537
4920 /** 4538 /**
4921 * The identifier used to associate results with this search request. 4539 * The edits to be applied to the file.
4922 */ 4540 */
4923 void set id(String value) { 4541 void set edits(List<SourceEdit> value) {
4924 assert(value != null); 4542 assert(value != null);
4925 this._id = value; 4543 this._edits = value;
4926 } 4544 }
4927 4545
4928 SearchFindMemberReferencesResult(String id) { 4546 ChangeContentOverlay(List<SourceEdit> edits) {
4929 this.id = id; 4547 this.edits = edits;
4930 } 4548 }
4931 4549
4932 factory SearchFindMemberReferencesResult.fromJson( 4550 factory ChangeContentOverlay.fromJson(
4933 JsonDecoder jsonDecoder, String jsonPath, Object json) { 4551 JsonDecoder jsonDecoder, String jsonPath, Object json) {
4934 if (json == null) { 4552 if (json == null) {
4935 json = {}; 4553 json = {};
4936 } 4554 }
4937 if (json is Map) { 4555 if (json is Map) {
4938 String id; 4556 if (json["type"] != "change") {
4939 if (json.containsKey("id")) { 4557 throw jsonDecoder.mismatch(jsonPath, "equal " + "change", json);
4940 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]); 4558 }
4559 List<SourceEdit> edits;
4560 if (json.containsKey("edits")) {
4561 edits = jsonDecoder.decodeList(
4562 jsonPath + ".edits",
4563 json["edits"],
4564 (String jsonPath, Object json) =>
4565 new SourceEdit.fromJson(jsonDecoder, jsonPath, json));
4941 } else { 4566 } else {
4942 throw jsonDecoder.missingKey(jsonPath, "id"); 4567 throw jsonDecoder.mismatch(jsonPath, "edits");
4943 } 4568 }
4944 return new SearchFindMemberReferencesResult(id); 4569 return new ChangeContentOverlay(edits);
4945 } else { 4570 } else {
4946 throw jsonDecoder.mismatch( 4571 throw jsonDecoder.mismatch(jsonPath, "ChangeContentOverlay", json);
4947 jsonPath, "search.findMemberReferences result", json);
4948 } 4572 }
4949 } 4573 }
4950 4574
4951 factory SearchFindMemberReferencesResult.fromResponse(Response response) { 4575 @override
4952 return new SearchFindMemberReferencesResult.fromJson(
4953 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
4954 "result",
4955 response._result);
4956 }
4957
4958 Map<String, dynamic> toJson() { 4576 Map<String, dynamic> toJson() {
4959 Map<String, dynamic> result = {}; 4577 Map<String, dynamic> result = {};
4960 result["id"] = id; 4578 result["type"] = "change";
4579 result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList();
4961 return result; 4580 return result;
4962 } 4581 }
4963 4582
4964 Response toResponse(String id) {
4965 return new Response(id, result: toJson());
4966 }
4967
4968 @override 4583 @override
4969 String toString() => JSON.encode(toJson()); 4584 String toString() => JSON.encode(toJson());
4970 4585
4971 @override 4586 @override
4972 bool operator ==(other) { 4587 bool operator ==(other) {
4973 if (other is SearchFindMemberReferencesResult) { 4588 if (other is ChangeContentOverlay) {
4974 return id == other.id; 4589 return listEqual(
4590 edits, other.edits, (SourceEdit a, SourceEdit b) => a == b);
4975 } 4591 }
4976 return false; 4592 return false;
4977 } 4593 }
4978 4594
4979 @override 4595 @override
4980 int get hashCode { 4596 int get hashCode {
4981 int hash = 0; 4597 int hash = 0;
4982 hash = JenkinsSmiHash.combine(hash, id.hashCode); 4598 hash = JenkinsSmiHash.combine(hash, 873118866);
4599 hash = JenkinsSmiHash.combine(hash, edits.hashCode);
4983 return JenkinsSmiHash.finish(hash); 4600 return JenkinsSmiHash.finish(hash);
4984 } 4601 }
4985 } 4602 }
4986 4603
4987 /** 4604 /**
4988 * search.findTopLevelDeclarations params 4605 * completion.getSuggestions params
4989 * 4606 *
4990 * { 4607 * {
4991 * "pattern": String 4608 * "file": FilePath
4609 * "offset": int
4992 * } 4610 * }
4993 * 4611 *
4994 * Clients may not extend, implement or mix-in this class. 4612 * Clients may not extend, implement or mix-in this class.
4995 */ 4613 */
4996 class SearchFindTopLevelDeclarationsParams implements HasToJson { 4614 class CompletionGetSuggestionsParams implements RequestParams {
4997 String _pattern; 4615 String _file;
4616
4617 int _offset;
4998 4618
4999 /** 4619 /**
5000 * The regular expression used to match the names of the declarations to be 4620 * The file containing the point at which suggestions are to be made.
5001 * found.
5002 */ 4621 */
5003 String get pattern => _pattern; 4622 String get file => _file;
5004 4623
5005 /** 4624 /**
5006 * The regular expression used to match the names of the declarations to be 4625 * The file containing the point at which suggestions are to be made.
5007 * found.
5008 */ 4626 */
5009 void set pattern(String value) { 4627 void set file(String value) {
5010 assert(value != null); 4628 assert(value != null);
5011 this._pattern = value; 4629 this._file = value;
5012 } 4630 }
5013 4631
5014 SearchFindTopLevelDeclarationsParams(String pattern) { 4632 /**
5015 this.pattern = pattern; 4633 * The offset within the file at which suggestions are to be made.
4634 */
4635 int get offset => _offset;
4636
4637 /**
4638 * The offset within the file at which suggestions are to be made.
4639 */
4640 void set offset(int value) {
4641 assert(value != null);
4642 this._offset = value;
5016 } 4643 }
5017 4644
5018 factory SearchFindTopLevelDeclarationsParams.fromJson( 4645 CompletionGetSuggestionsParams(String file, int offset) {
4646 this.file = file;
4647 this.offset = offset;
4648 }
4649
4650 factory CompletionGetSuggestionsParams.fromJson(
5019 JsonDecoder jsonDecoder, String jsonPath, Object json) { 4651 JsonDecoder jsonDecoder, String jsonPath, Object json) {
5020 if (json == null) { 4652 if (json == null) {
5021 json = {}; 4653 json = {};
5022 } 4654 }
5023 if (json is Map) { 4655 if (json is Map) {
5024 String pattern; 4656 String file;
5025 if (json.containsKey("pattern")) { 4657 if (json.containsKey("file")) {
5026 pattern = 4658 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
5027 jsonDecoder.decodeString(jsonPath + ".pattern", json["pattern"]);
5028 } else { 4659 } else {
5029 throw jsonDecoder.missingKey(jsonPath, "pattern"); 4660 throw jsonDecoder.mismatch(jsonPath, "file");
5030 } 4661 }
5031 return new SearchFindTopLevelDeclarationsParams(pattern); 4662 int offset;
4663 if (json.containsKey("offset")) {
4664 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
4665 } else {
4666 throw jsonDecoder.mismatch(jsonPath, "offset");
4667 }
4668 return new CompletionGetSuggestionsParams(file, offset);
5032 } else { 4669 } else {
5033 throw jsonDecoder.mismatch( 4670 throw jsonDecoder.mismatch(
5034 jsonPath, "search.findTopLevelDeclarations params", json); 4671 jsonPath, "completion.getSuggestions params", json);
5035 } 4672 }
5036 } 4673 }
5037 4674
5038 factory SearchFindTopLevelDeclarationsParams.fromRequest(Request request) { 4675 factory CompletionGetSuggestionsParams.fromRequest(Request request) {
5039 return new SearchFindTopLevelDeclarationsParams.fromJson( 4676 return new CompletionGetSuggestionsParams.fromJson(
5040 new RequestDecoder(request), "params", request._params); 4677 new RequestDecoder(request), "params", request.params);
5041 } 4678 }
5042 4679
4680 @override
5043 Map<String, dynamic> toJson() { 4681 Map<String, dynamic> toJson() {
5044 Map<String, dynamic> result = {}; 4682 Map<String, dynamic> result = {};
5045 result["pattern"] = pattern; 4683 result["file"] = file;
4684 result["offset"] = offset;
5046 return result; 4685 return result;
5047 } 4686 }
5048 4687
4688 @override
5049 Request toRequest(String id) { 4689 Request toRequest(String id) {
5050 return new Request(id, "search.findTopLevelDeclarations", toJson()); 4690 return new Request(id, "completion.getSuggestions", toJson());
5051 } 4691 }
5052 4692
5053 @override 4693 @override
5054 String toString() => JSON.encode(toJson()); 4694 String toString() => JSON.encode(toJson());
5055 4695
5056 @override 4696 @override
5057 bool operator ==(other) { 4697 bool operator ==(other) {
5058 if (other is SearchFindTopLevelDeclarationsParams) { 4698 if (other is CompletionGetSuggestionsParams) {
5059 return pattern == other.pattern; 4699 return file == other.file && offset == other.offset;
5060 } 4700 }
5061 return false; 4701 return false;
5062 } 4702 }
5063 4703
5064 @override 4704 @override
5065 int get hashCode { 4705 int get hashCode {
5066 int hash = 0; 4706 int hash = 0;
5067 hash = JenkinsSmiHash.combine(hash, pattern.hashCode); 4707 hash = JenkinsSmiHash.combine(hash, file.hashCode);
4708 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
5068 return JenkinsSmiHash.finish(hash); 4709 return JenkinsSmiHash.finish(hash);
5069 } 4710 }
5070 } 4711 }
5071 4712
5072 /** 4713 /**
5073 * search.findTopLevelDeclarations result 4714 * completion.getSuggestions result
5074 * 4715 *
5075 * { 4716 * {
5076 * "id": SearchId 4717 * "id": CompletionId
5077 * } 4718 * }
5078 * 4719 *
5079 * Clients may not extend, implement or mix-in this class. 4720 * Clients may not extend, implement or mix-in this class.
5080 */ 4721 */
5081 class SearchFindTopLevelDeclarationsResult implements HasToJson { 4722 class CompletionGetSuggestionsResult implements ResponseResult {
5082 String _id; 4723 String _id;
5083 4724
5084 /** 4725 /**
5085 * The identifier used to associate results with this search request. 4726 * The identifier used to associate results with this completion request.
5086 */ 4727 */
5087 String get id => _id; 4728 String get id => _id;
5088 4729
5089 /** 4730 /**
5090 * The identifier used to associate results with this search request. 4731 * The identifier used to associate results with this completion request.
5091 */ 4732 */
5092 void set id(String value) { 4733 void set id(String value) {
5093 assert(value != null); 4734 assert(value != null);
5094 this._id = value; 4735 this._id = value;
5095 } 4736 }
5096 4737
5097 SearchFindTopLevelDeclarationsResult(String id) { 4738 CompletionGetSuggestionsResult(String id) {
5098 this.id = id; 4739 this.id = id;
5099 } 4740 }
5100 4741
5101 factory SearchFindTopLevelDeclarationsResult.fromJson( 4742 factory CompletionGetSuggestionsResult.fromJson(
5102 JsonDecoder jsonDecoder, String jsonPath, Object json) { 4743 JsonDecoder jsonDecoder, String jsonPath, Object json) {
5103 if (json == null) { 4744 if (json == null) {
5104 json = {}; 4745 json = {};
5105 } 4746 }
5106 if (json is Map) { 4747 if (json is Map) {
5107 String id; 4748 String id;
5108 if (json.containsKey("id")) { 4749 if (json.containsKey("id")) {
5109 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]); 4750 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
5110 } else { 4751 } else {
5111 throw jsonDecoder.missingKey(jsonPath, "id"); 4752 throw jsonDecoder.mismatch(jsonPath, "id");
5112 } 4753 }
5113 return new SearchFindTopLevelDeclarationsResult(id); 4754 return new CompletionGetSuggestionsResult(id);
5114 } else { 4755 } else {
5115 throw jsonDecoder.mismatch( 4756 throw jsonDecoder.mismatch(
5116 jsonPath, "search.findTopLevelDeclarations result", json); 4757 jsonPath, "completion.getSuggestions result", json);
5117 } 4758 }
5118 } 4759 }
5119 4760
5120 factory SearchFindTopLevelDeclarationsResult.fromResponse(Response response) { 4761 factory CompletionGetSuggestionsResult.fromResponse(Response response) {
5121 return new SearchFindTopLevelDeclarationsResult.fromJson( 4762 return new CompletionGetSuggestionsResult.fromJson(
5122 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), 4763 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
5123 "result", 4764 "result",
5124 response._result); 4765 response.result);
5125 } 4766 }
5126 4767
4768 @override
5127 Map<String, dynamic> toJson() { 4769 Map<String, dynamic> toJson() {
5128 Map<String, dynamic> result = {}; 4770 Map<String, dynamic> result = {};
5129 result["id"] = id; 4771 result["id"] = id;
5130 return result; 4772 return result;
5131 } 4773 }
5132 4774
4775 @override
5133 Response toResponse(String id) { 4776 Response toResponse(String id) {
5134 return new Response(id, result: toJson()); 4777 return new Response(id, result: toJson());
5135 } 4778 }
5136 4779
5137 @override 4780 @override
5138 String toString() => JSON.encode(toJson()); 4781 String toString() => JSON.encode(toJson());
5139 4782
5140 @override 4783 @override
5141 bool operator ==(other) { 4784 bool operator ==(other) {
5142 if (other is SearchFindTopLevelDeclarationsResult) { 4785 if (other is CompletionGetSuggestionsResult) {
5143 return id == other.id; 4786 return id == other.id;
5144 } 4787 }
5145 return false; 4788 return false;
5146 } 4789 }
5147 4790
5148 @override 4791 @override
5149 int get hashCode { 4792 int get hashCode {
5150 int hash = 0; 4793 int hash = 0;
5151 hash = JenkinsSmiHash.combine(hash, id.hashCode); 4794 hash = JenkinsSmiHash.combine(hash, id.hashCode);
5152 return JenkinsSmiHash.finish(hash); 4795 return JenkinsSmiHash.finish(hash);
5153 } 4796 }
5154 } 4797 }
5155 4798
5156 /** 4799 /**
5157 * search.getTypeHierarchy params 4800 * completion.results params
5158 * 4801 *
5159 * { 4802 * {
5160 * "file": FilePath 4803 * "id": CompletionId
5161 * "offset": int 4804 * "replacementOffset": int
5162 * "superOnly": optional bool 4805 * "replacementLength": int
4806 * "results": List<CompletionSuggestion>
4807 * "isLast": bool
5163 * } 4808 * }
5164 * 4809 *
5165 * Clients may not extend, implement or mix-in this class. 4810 * Clients may not extend, implement or mix-in this class.
5166 */ 4811 */
5167 class SearchGetTypeHierarchyParams implements HasToJson { 4812 class CompletionResultsParams implements HasToJson {
5168 String _file; 4813 String _id;
5169 4814
5170 int _offset; 4815 int _replacementOffset;
5171 4816
5172 bool _superOnly; 4817 int _replacementLength;
4818
4819 List<CompletionSuggestion> _results;
4820
4821 bool _isLast;
5173 4822
5174 /** 4823 /**
5175 * The file containing the declaration or reference to the type for which a 4824 * The id associated with the completion.
5176 * hierarchy is being requested.
5177 */ 4825 */
5178 String get file => _file; 4826 String get id => _id;
5179 4827
5180 /** 4828 /**
5181 * The file containing the declaration or reference to the type for which a 4829 * The id associated with the completion.
5182 * hierarchy is being requested.
5183 */ 4830 */
5184 void set file(String value) { 4831 void set id(String value) {
5185 assert(value != null); 4832 assert(value != null);
5186 this._file = value; 4833 this._id = value;
5187 } 4834 }
5188 4835
5189 /** 4836 /**
5190 * The offset of the name of the type within the file. 4837 * The offset of the start of the text to be replaced. This will be different
4838 * than the offset used to request the completion suggestions if there was a
4839 * portion of an identifier before the original offset. In particular, the
4840 * replacementOffset will be the offset of the beginning of said identifier.
5191 */ 4841 */
5192 int get offset => _offset; 4842 int get replacementOffset => _replacementOffset;
5193 4843
5194 /** 4844 /**
5195 * The offset of the name of the type within the file. 4845 * The offset of the start of the text to be replaced. This will be different
4846 * than the offset used to request the completion suggestions if there was a
4847 * portion of an identifier before the original offset. In particular, the
4848 * replacementOffset will be the offset of the beginning of said identifier.
5196 */ 4849 */
5197 void set offset(int value) { 4850 void set replacementOffset(int value) {
5198 assert(value != null); 4851 assert(value != null);
5199 this._offset = value; 4852 this._replacementOffset = value;
5200 } 4853 }
5201 4854
5202 /** 4855 /**
5203 * True if the client is only requesting superclasses and interfaces 4856 * The length of the text to be replaced if the remainder of the identifier
5204 * hierarchy. 4857 * containing the cursor is to be replaced when the suggestion is applied
4858 * (that is, the number of characters in the existing identifier).
5205 */ 4859 */
5206 bool get superOnly => _superOnly; 4860 int get replacementLength => _replacementLength;
5207 4861
5208 /** 4862 /**
5209 * True if the client is only requesting superclasses and interfaces 4863 * The length of the text to be replaced if the remainder of the identifier
5210 * hierarchy. 4864 * containing the cursor is to be replaced when the suggestion is applied
4865 * (that is, the number of characters in the existing identifier).
5211 */ 4866 */
5212 void set superOnly(bool value) { 4867 void set replacementLength(int value) {
5213 this._superOnly = value; 4868 assert(value != null);
4869 this._replacementLength = value;
5214 } 4870 }
5215 4871
5216 SearchGetTypeHierarchyParams(String file, int offset, {bool superOnly}) { 4872 /**
5217 this.file = file; 4873 * The completion suggestions being reported. The notification contains all
5218 this.offset = offset; 4874 * possible completions at the requested cursor position, even those that do
5219 this.superOnly = superOnly; 4875 * not match the characters the user has already typed. This allows the
4876 * client to respond to further keystrokes from the user without having to
4877 * make additional requests.
4878 */
4879 List<CompletionSuggestion> get results => _results;
4880
4881 /**
4882 * The completion suggestions being reported. The notification contains all
4883 * possible completions at the requested cursor position, even those that do
4884 * not match the characters the user has already typed. This allows the
4885 * client to respond to further keystrokes from the user without having to
4886 * make additional requests.
4887 */
4888 void set results(List<CompletionSuggestion> value) {
4889 assert(value != null);
4890 this._results = value;
5220 } 4891 }
5221 4892
5222 factory SearchGetTypeHierarchyParams.fromJson( 4893 /**
4894 * True if this is that last set of results that will be returned for the
4895 * indicated completion.
4896 */
4897 bool get isLast => _isLast;
4898
4899 /**
4900 * True if this is that last set of results that will be returned for the
4901 * indicated completion.
4902 */
4903 void set isLast(bool value) {
4904 assert(value != null);
4905 this._isLast = value;
4906 }
4907
4908 CompletionResultsParams(String id, int replacementOffset,
4909 int replacementLength, List<CompletionSuggestion> results, bool isLast) {
4910 this.id = id;
4911 this.replacementOffset = replacementOffset;
4912 this.replacementLength = replacementLength;
4913 this.results = results;
4914 this.isLast = isLast;
4915 }
4916
4917 factory CompletionResultsParams.fromJson(
5223 JsonDecoder jsonDecoder, String jsonPath, Object json) { 4918 JsonDecoder jsonDecoder, String jsonPath, Object json) {
5224 if (json == null) { 4919 if (json == null) {
5225 json = {}; 4920 json = {};
5226 } 4921 }
5227 if (json is Map) { 4922 if (json is Map) {
5228 String file; 4923 String id;
5229 if (json.containsKey("file")) { 4924 if (json.containsKey("id")) {
5230 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 4925 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
5231 } else { 4926 } else {
5232 throw jsonDecoder.missingKey(jsonPath, "file"); 4927 throw jsonDecoder.mismatch(jsonPath, "id");
5233 } 4928 }
5234 int offset; 4929 int replacementOffset;
5235 if (json.containsKey("offset")) { 4930 if (json.containsKey("replacementOffset")) {
5236 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 4931 replacementOffset = jsonDecoder.decodeInt(
4932 jsonPath + ".replacementOffset", json["replacementOffset"]);
5237 } else { 4933 } else {
5238 throw jsonDecoder.missingKey(jsonPath, "offset"); 4934 throw jsonDecoder.mismatch(jsonPath, "replacementOffset");
5239 } 4935 }
5240 bool superOnly; 4936 int replacementLength;
5241 if (json.containsKey("superOnly")) { 4937 if (json.containsKey("replacementLength")) {
5242 superOnly = 4938 replacementLength = jsonDecoder.decodeInt(
5243 jsonDecoder.decodeBool(jsonPath + ".superOnly", json["superOnly"]); 4939 jsonPath + ".replacementLength", json["replacementLength"]);
4940 } else {
4941 throw jsonDecoder.mismatch(jsonPath, "replacementLength");
5244 } 4942 }
5245 return new SearchGetTypeHierarchyParams(file, offset, 4943 List<CompletionSuggestion> results;
5246 superOnly: superOnly); 4944 if (json.containsKey("results")) {
4945 results = jsonDecoder.decodeList(
4946 jsonPath + ".results",
4947 json["results"],
4948 (String jsonPath, Object json) =>
4949 new CompletionSuggestion.fromJson(jsonDecoder, jsonPath, json));
4950 } else {
4951 throw jsonDecoder.mismatch(jsonPath, "results");
4952 }
4953 bool isLast;
4954 if (json.containsKey("isLast")) {
4955 isLast = jsonDecoder.decodeBool(jsonPath + ".isLast", json["isLast"]);
4956 } else {
4957 throw jsonDecoder.mismatch(jsonPath, "isLast");
4958 }
4959 return new CompletionResultsParams(
4960 id, replacementOffset, replacementLength, results, isLast);
5247 } else { 4961 } else {
5248 throw jsonDecoder.mismatch( 4962 throw jsonDecoder.mismatch(jsonPath, "completion.results params", json);
5249 jsonPath, "search.getTypeHierarchy params", json);
5250 } 4963 }
5251 } 4964 }
5252 4965
5253 factory SearchGetTypeHierarchyParams.fromRequest(Request request) { 4966 factory CompletionResultsParams.fromNotification(Notification notification) {
5254 return new SearchGetTypeHierarchyParams.fromJson( 4967 return new CompletionResultsParams.fromJson(
5255 new RequestDecoder(request), "params", request._params); 4968 new ResponseDecoder(null), "params", notification.params);
5256 } 4969 }
5257 4970
4971 @override
5258 Map<String, dynamic> toJson() { 4972 Map<String, dynamic> toJson() {
5259 Map<String, dynamic> result = {}; 4973 Map<String, dynamic> result = {};
5260 result["file"] = file; 4974 result["id"] = id;
5261 result["offset"] = offset; 4975 result["replacementOffset"] = replacementOffset;
5262 if (superOnly != null) { 4976 result["replacementLength"] = replacementLength;
5263 result["superOnly"] = superOnly; 4977 result["results"] =
5264 } 4978 results.map((CompletionSuggestion value) => value.toJson()).toList();
4979 result["isLast"] = isLast;
5265 return result; 4980 return result;
5266 } 4981 }
5267 4982
5268 Request toRequest(String id) { 4983 Notification toNotification() {
5269 return new Request(id, "search.getTypeHierarchy", toJson()); 4984 return new Notification("completion.results", toJson());
5270 } 4985 }
5271 4986
5272 @override 4987 @override
5273 String toString() => JSON.encode(toJson()); 4988 String toString() => JSON.encode(toJson());
5274 4989
5275 @override 4990 @override
5276 bool operator ==(other) { 4991 bool operator ==(other) {
5277 if (other is SearchGetTypeHierarchyParams) { 4992 if (other is CompletionResultsParams) {
5278 return file == other.file && 4993 return id == other.id &&
5279 offset == other.offset && 4994 replacementOffset == other.replacementOffset &&
5280 superOnly == other.superOnly; 4995 replacementLength == other.replacementLength &&
4996 listEqual(results, other.results,
4997 (CompletionSuggestion a, CompletionSuggestion b) => a == b) &&
4998 isLast == other.isLast;
5281 } 4999 }
5282 return false; 5000 return false;
5283 } 5001 }
5284 5002
5285 @override 5003 @override
5286 int get hashCode { 5004 int get hashCode {
5287 int hash = 0; 5005 int hash = 0;
5288 hash = JenkinsSmiHash.combine(hash, file.hashCode); 5006 hash = JenkinsSmiHash.combine(hash, id.hashCode);
5289 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 5007 hash = JenkinsSmiHash.combine(hash, replacementOffset.hashCode);
5290 hash = JenkinsSmiHash.combine(hash, superOnly.hashCode); 5008 hash = JenkinsSmiHash.combine(hash, replacementLength.hashCode);
5009 hash = JenkinsSmiHash.combine(hash, results.hashCode);
5010 hash = JenkinsSmiHash.combine(hash, isLast.hashCode);
5291 return JenkinsSmiHash.finish(hash); 5011 return JenkinsSmiHash.finish(hash);
5292 } 5012 }
5293 } 5013 }
5294 5014
5295 /** 5015 /**
5296 * search.getTypeHierarchy result 5016 * CompletionSuggestion
5297 * 5017 *
5298 * { 5018 * {
5299 * "hierarchyItems": optional List<TypeHierarchyItem> 5019 * "kind": CompletionSuggestionKind
5020 * "relevance": int
5021 * "completion": String
5022 * "selectionOffset": int
5023 * "selectionLength": int
5024 * "isDeprecated": bool
5025 * "isPotential": bool
5026 * "docSummary": optional String
5027 * "docComplete": optional String
5028 * "declaringType": optional String
5029 * "defaultArgumentListString": optional String
5030 * "defaultArgumentListTextRanges": optional List<int>
5031 * "element": optional Element
5032 * "returnType": optional String
5033 * "parameterNames": optional List<String>
5034 * "parameterTypes": optional List<String>
5035 * "requiredParameterCount": optional int
5036 * "hasNamedParameters": optional bool
5037 * "parameterName": optional String
5038 * "parameterType": optional String
5039 * "importUri": optional String
5300 * } 5040 * }
5301 * 5041 *
5302 * Clients may not extend, implement or mix-in this class. 5042 * Clients may not extend, implement or mix-in this class.
5303 */ 5043 */
5304 class SearchGetTypeHierarchyResult implements HasToJson { 5044 class CompletionSuggestion implements HasToJson {
5305 List<TypeHierarchyItem> _hierarchyItems; 5045 CompletionSuggestionKind _kind;
5306 5046
5307 /** 5047 int _relevance;
5308 * A list of the types in the requested hierarchy. The first element of the 5048
5309 * list is the item representing the type for which the hierarchy was 5049 String _completion;
5310 * requested. The index of other elements of the list is unspecified, but 5050
5311 * correspond to the integers used to reference supertype and subtype items 5051 int _selectionOffset;
5312 * within the items. 5052
5313 * 5053 int _selectionLength;
5314 * This field will be absent if the code at the given file and offset does 5054
5315 * not represent a type, or if the file has not been sufficiently analyzed to 5055 bool _isDeprecated;
5316 * allow a type hierarchy to be produced. 5056
5317 */ 5057 bool _isPotential;
5318 List<TypeHierarchyItem> get hierarchyItems => _hierarchyItems; 5058
5319 5059 String _docSummary;
5320 /** 5060
5321 * A list of the types in the requested hierarchy. The first element of the 5061 String _docComplete;
5322 * list is the item representing the type for which the hierarchy was 5062
5323 * requested. The index of other elements of the list is unspecified, but 5063 String _declaringType;
5324 * correspond to the integers used to reference supertype and subtype items 5064
5325 * within the items. 5065 String _defaultArgumentListString;
5326 * 5066
5327 * This field will be absent if the code at the given file and offset does 5067 List<int> _defaultArgumentListTextRanges;
5328 * not represent a type, or if the file has not been sufficiently analyzed to 5068
5329 * allow a type hierarchy to be produced. 5069 Element _element;
5330 */ 5070
5331 void set hierarchyItems(List<TypeHierarchyItem> value) { 5071 String _returnType;
5332 this._hierarchyItems = value; 5072
5333 } 5073 List<String> _parameterNames;
5334 5074
5335 SearchGetTypeHierarchyResult({List<TypeHierarchyItem> hierarchyItems}) { 5075 List<String> _parameterTypes;
5336 this.hierarchyItems = hierarchyItems; 5076
5337 } 5077 int _requiredParameterCount;
5338 5078
5339 factory SearchGetTypeHierarchyResult.fromJson( 5079 bool _hasNamedParameters;
5080
5081 String _parameterName;
5082
5083 String _parameterType;
5084
5085 String _importUri;
5086
5087 /**
5088 * The kind of element being suggested.
5089 */
5090 CompletionSuggestionKind get kind => _kind;
5091
5092 /**
5093 * The kind of element being suggested.
5094 */
5095 void set kind(CompletionSuggestionKind value) {
5096 assert(value != null);
5097 this._kind = value;
5098 }
5099
5100 /**
5101 * The relevance of this completion suggestion where a higher number
5102 * indicates a higher relevance.
5103 */
5104 int get relevance => _relevance;
5105
5106 /**
5107 * The relevance of this completion suggestion where a higher number
5108 * indicates a higher relevance.
5109 */
5110 void set relevance(int value) {
5111 assert(value != null);
5112 this._relevance = value;
5113 }
5114
5115 /**
5116 * The identifier to be inserted if the suggestion is selected. If the
5117 * suggestion is for a method or function, the client might want to
5118 * additionally insert a template for the parameters. The information
5119 * required in order to do so is contained in other fields.
5120 */
5121 String get completion => _completion;
5122
5123 /**
5124 * The identifier to be inserted if the suggestion is selected. If the
5125 * suggestion is for a method or function, the client might want to
5126 * additionally insert a template for the parameters. The information
5127 * required in order to do so is contained in other fields.
5128 */
5129 void set completion(String value) {
5130 assert(value != null);
5131 this._completion = value;
5132 }
5133
5134 /**
5135 * The offset, relative to the beginning of the completion, of where the
5136 * selection should be placed after insertion.
5137 */
5138 int get selectionOffset => _selectionOffset;
5139
5140 /**
5141 * The offset, relative to the beginning of the completion, of where the
5142 * selection should be placed after insertion.
5143 */
5144 void set selectionOffset(int value) {
5145 assert(value != null);
5146 this._selectionOffset = value;
5147 }
5148
5149 /**
5150 * The number of characters that should be selected after insertion.
5151 */
5152 int get selectionLength => _selectionLength;
5153
5154 /**
5155 * The number of characters that should be selected after insertion.
5156 */
5157 void set selectionLength(int value) {
5158 assert(value != null);
5159 this._selectionLength = value;
5160 }
5161
5162 /**
5163 * True if the suggested element is deprecated.
5164 */
5165 bool get isDeprecated => _isDeprecated;
5166
5167 /**
5168 * True if the suggested element is deprecated.
5169 */
5170 void set isDeprecated(bool value) {
5171 assert(value != null);
5172 this._isDeprecated = value;
5173 }
5174
5175 /**
5176 * True if the element is not known to be valid for the target. This happens
5177 * if the type of the target is dynamic.
5178 */
5179 bool get isPotential => _isPotential;
5180
5181 /**
5182 * True if the element is not known to be valid for the target. This happens
5183 * if the type of the target is dynamic.
5184 */
5185 void set isPotential(bool value) {
5186 assert(value != null);
5187 this._isPotential = value;
5188 }
5189
5190 /**
5191 * An abbreviated version of the Dartdoc associated with the element being
5192 * suggested, This field is omitted if there is no Dartdoc associated with
5193 * the element.
5194 */
5195 String get docSummary => _docSummary;
5196
5197 /**
5198 * An abbreviated version of the Dartdoc associated with the element being
5199 * suggested, This field is omitted if there is no Dartdoc associated with
5200 * the element.
5201 */
5202 void set docSummary(String value) {
5203 this._docSummary = value;
5204 }
5205
5206 /**
5207 * The Dartdoc associated with the element being suggested, This field is
5208 * omitted if there is no Dartdoc associated with the element.
5209 */
5210 String get docComplete => _docComplete;
5211
5212 /**
5213 * The Dartdoc associated with the element being suggested, This field is
5214 * omitted if there is no Dartdoc associated with the element.
5215 */
5216 void set docComplete(String value) {
5217 this._docComplete = value;
5218 }
5219
5220 /**
5221 * The class that declares the element being suggested. This field is omitted
5222 * if the suggested element is not a member of a class.
5223 */
5224 String get declaringType => _declaringType;
5225
5226 /**
5227 * The class that declares the element being suggested. This field is omitted
5228 * if the suggested element is not a member of a class.
5229 */
5230 void set declaringType(String value) {
5231 this._declaringType = value;
5232 }
5233
5234 /**
5235 * A default String for use in generating argument list source contents on
5236 * the client side.
5237 */
5238 String get defaultArgumentListString => _defaultArgumentListString;
5239
5240 /**
5241 * A default String for use in generating argument list source contents on
5242 * the client side.
5243 */
5244 void set defaultArgumentListString(String value) {
5245 this._defaultArgumentListString = value;
5246 }
5247
5248 /**
5249 * Pairs of offsets and lengths describing 'defaultArgumentListString' text
5250 * ranges suitable for use by clients to set up linked edits of default
5251 * argument source contents. For example, given an argument list string 'x,
5252 * y', the corresponding text range [0, 1, 3, 1], indicates two text ranges
5253 * of length 1, starting at offsets 0 and 3. Clients can use these ranges to
5254 * treat the 'x' and 'y' values specially for linked edits.
5255 */
5256 List<int> get defaultArgumentListTextRanges => _defaultArgumentListTextRanges;
5257
5258 /**
5259 * Pairs of offsets and lengths describing 'defaultArgumentListString' text
5260 * ranges suitable for use by clients to set up linked edits of default
5261 * argument source contents. For example, given an argument list string 'x,
5262 * y', the corresponding text range [0, 1, 3, 1], indicates two text ranges
5263 * of length 1, starting at offsets 0 and 3. Clients can use these ranges to
5264 * treat the 'x' and 'y' values specially for linked edits.
5265 */
5266 void set defaultArgumentListTextRanges(List<int> value) {
5267 this._defaultArgumentListTextRanges = value;
5268 }
5269
5270 /**
5271 * Information about the element reference being suggested.
5272 */
5273 Element get element => _element;
5274
5275 /**
5276 * Information about the element reference being suggested.
5277 */
5278 void set element(Element value) {
5279 this._element = value;
5280 }
5281
5282 /**
5283 * The return type of the getter, function or method or the type of the field
5284 * being suggested. This field is omitted if the suggested element is not a
5285 * getter, function or method.
5286 */
5287 String get returnType => _returnType;
5288
5289 /**
5290 * The return type of the getter, function or method or the type of the field
5291 * being suggested. This field is omitted if the suggested element is not a
5292 * getter, function or method.
5293 */
5294 void set returnType(String value) {
5295 this._returnType = value;
5296 }
5297
5298 /**
5299 * The names of the parameters of the function or method being suggested.
5300 * This field is omitted if the suggested element is not a setter, function
5301 * or method.
5302 */
5303 List<String> get parameterNames => _parameterNames;
5304
5305 /**
5306 * The names of the parameters of the function or method being suggested.
5307 * This field is omitted if the suggested element is not a setter, function
5308 * or method.
5309 */
5310 void set parameterNames(List<String> value) {
5311 this._parameterNames = value;
5312 }
5313
5314 /**
5315 * The types of the parameters of the function or method being suggested.
5316 * This field is omitted if the parameterNames field is omitted.
5317 */
5318 List<String> get parameterTypes => _parameterTypes;
5319
5320 /**
5321 * The types of the parameters of the function or method being suggested.
5322 * This field is omitted if the parameterNames field is omitted.
5323 */
5324 void set parameterTypes(List<String> value) {
5325 this._parameterTypes = value;
5326 }
5327
5328 /**
5329 * The number of required parameters for the function or method being
5330 * suggested. This field is omitted if the parameterNames field is omitted.
5331 */
5332 int get requiredParameterCount => _requiredParameterCount;
5333
5334 /**
5335 * The number of required parameters for the function or method being
5336 * suggested. This field is omitted if the parameterNames field is omitted.
5337 */
5338 void set requiredParameterCount(int value) {
5339 this._requiredParameterCount = value;
5340 }
5341
5342 /**
5343 * True if the function or method being suggested has at least one named
5344 * parameter. This field is omitted if the parameterNames field is omitted.
5345 */
5346 bool get hasNamedParameters => _hasNamedParameters;
5347
5348 /**
5349 * True if the function or method being suggested has at least one named
5350 * parameter. This field is omitted if the parameterNames field is omitted.
5351 */
5352 void set hasNamedParameters(bool value) {
5353 this._hasNamedParameters = value;
5354 }
5355
5356 /**
5357 * The name of the optional parameter being suggested. This field is omitted
5358 * if the suggestion is not the addition of an optional argument within an
5359 * argument list.
5360 */
5361 String get parameterName => _parameterName;
5362
5363 /**
5364 * The name of the optional parameter being suggested. This field is omitted
5365 * if the suggestion is not the addition of an optional argument within an
5366 * argument list.
5367 */
5368 void set parameterName(String value) {
5369 this._parameterName = value;
5370 }
5371
5372 /**
5373 * The type of the options parameter being suggested. This field is omitted
5374 * if the parameterName field is omitted.
5375 */
5376 String get parameterType => _parameterType;
5377
5378 /**
5379 * The type of the options parameter being suggested. This field is omitted
5380 * if the parameterName field is omitted.
5381 */
5382 void set parameterType(String value) {
5383 this._parameterType = value;
5384 }
5385
5386 /**
5387 * The import to be added if the suggestion is out of scope and needs an
5388 * import to be added to be in scope.
5389 */
5390 String get importUri => _importUri;
5391
5392 /**
5393 * The import to be added if the suggestion is out of scope and needs an
5394 * import to be added to be in scope.
5395 */
5396 void set importUri(String value) {
5397 this._importUri = value;
5398 }
5399
5400 CompletionSuggestion(
5401 CompletionSuggestionKind kind,
5402 int relevance,
5403 String completion,
5404 int selectionOffset,
5405 int selectionLength,
5406 bool isDeprecated,
5407 bool isPotential,
5408 {String docSummary,
5409 String docComplete,
5410 String declaringType,
5411 String defaultArgumentListString,
5412 List<int> defaultArgumentListTextRanges,
5413 Element element,
5414 String returnType,
5415 List<String> parameterNames,
5416 List<String> parameterTypes,
5417 int requiredParameterCount,
5418 bool hasNamedParameters,
5419 String parameterName,
5420 String parameterType,
5421 String importUri}) {
5422 this.kind = kind;
5423 this.relevance = relevance;
5424 this.completion = completion;
5425 this.selectionOffset = selectionOffset;
5426 this.selectionLength = selectionLength;
5427 this.isDeprecated = isDeprecated;
5428 this.isPotential = isPotential;
5429 this.docSummary = docSummary;
5430 this.docComplete = docComplete;
5431 this.declaringType = declaringType;
5432 this.defaultArgumentListString = defaultArgumentListString;
5433 this.defaultArgumentListTextRanges = defaultArgumentListTextRanges;
5434 this.element = element;
5435 this.returnType = returnType;
5436 this.parameterNames = parameterNames;
5437 this.parameterTypes = parameterTypes;
5438 this.requiredParameterCount = requiredParameterCount;
5439 this.hasNamedParameters = hasNamedParameters;
5440 this.parameterName = parameterName;
5441 this.parameterType = parameterType;
5442 this.importUri = importUri;
5443 }
5444
5445 factory CompletionSuggestion.fromJson(
5340 JsonDecoder jsonDecoder, String jsonPath, Object json) { 5446 JsonDecoder jsonDecoder, String jsonPath, Object json) {
5341 if (json == null) { 5447 if (json == null) {
5342 json = {}; 5448 json = {};
5343 } 5449 }
5344 if (json is Map) { 5450 if (json is Map) {
5345 List<TypeHierarchyItem> hierarchyItems; 5451 CompletionSuggestionKind kind;
5346 if (json.containsKey("hierarchyItems")) { 5452 if (json.containsKey("kind")) {
5347 hierarchyItems = jsonDecoder.decodeList( 5453 kind = new CompletionSuggestionKind.fromJson(
5348 jsonPath + ".hierarchyItems", 5454 jsonDecoder, jsonPath + ".kind", json["kind"]);
5349 json["hierarchyItems"],
5350 (String jsonPath, Object json) =>
5351 new TypeHierarchyItem.fromJson(jsonDecoder, jsonPath, json));
5352 }
5353 return new SearchGetTypeHierarchyResult(hierarchyItems: hierarchyItems);
5354 } else {
5355 throw jsonDecoder.mismatch(
5356 jsonPath, "search.getTypeHierarchy result", json);
5357 }
5358 }
5359
5360 factory SearchGetTypeHierarchyResult.fromResponse(Response response) {
5361 return new SearchGetTypeHierarchyResult.fromJson(
5362 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
5363 "result",
5364 response._result);
5365 }
5366
5367 Map<String, dynamic> toJson() {
5368 Map<String, dynamic> result = {};
5369 if (hierarchyItems != null) {
5370 result["hierarchyItems"] = hierarchyItems
5371 .map((TypeHierarchyItem value) => value.toJson())
5372 .toList();
5373 }
5374 return result;
5375 }
5376
5377 Response toResponse(String id) {
5378 return new Response(id, result: toJson());
5379 }
5380
5381 @override
5382 String toString() => JSON.encode(toJson());
5383
5384 @override
5385 bool operator ==(other) {
5386 if (other is SearchGetTypeHierarchyResult) {
5387 return listEqual(hierarchyItems, other.hierarchyItems,
5388 (TypeHierarchyItem a, TypeHierarchyItem b) => a == b);
5389 }
5390 return false;
5391 }
5392
5393 @override
5394 int get hashCode {
5395 int hash = 0;
5396 hash = JenkinsSmiHash.combine(hash, hierarchyItems.hashCode);
5397 return JenkinsSmiHash.finish(hash);
5398 }
5399 }
5400
5401 /**
5402 * search.results params
5403 *
5404 * {
5405 * "id": SearchId
5406 * "results": List<SearchResult>
5407 * "isLast": bool
5408 * }
5409 *
5410 * Clients may not extend, implement or mix-in this class.
5411 */
5412 class SearchResultsParams implements HasToJson {
5413 String _id;
5414
5415 List<SearchResult> _results;
5416
5417 bool _isLast;
5418
5419 /**
5420 * The id associated with the search.
5421 */
5422 String get id => _id;
5423
5424 /**
5425 * The id associated with the search.
5426 */
5427 void set id(String value) {
5428 assert(value != null);
5429 this._id = value;
5430 }
5431
5432 /**
5433 * The search results being reported.
5434 */
5435 List<SearchResult> get results => _results;
5436
5437 /**
5438 * The search results being reported.
5439 */
5440 void set results(List<SearchResult> value) {
5441 assert(value != null);
5442 this._results = value;
5443 }
5444
5445 /**
5446 * True if this is that last set of results that will be returned for the
5447 * indicated search.
5448 */
5449 bool get isLast => _isLast;
5450
5451 /**
5452 * True if this is that last set of results that will be returned for the
5453 * indicated search.
5454 */
5455 void set isLast(bool value) {
5456 assert(value != null);
5457 this._isLast = value;
5458 }
5459
5460 SearchResultsParams(String id, List<SearchResult> results, bool isLast) {
5461 this.id = id;
5462 this.results = results;
5463 this.isLast = isLast;
5464 }
5465
5466 factory SearchResultsParams.fromJson(
5467 JsonDecoder jsonDecoder, String jsonPath, Object json) {
5468 if (json == null) {
5469 json = {};
5470 }
5471 if (json is Map) {
5472 String id;
5473 if (json.containsKey("id")) {
5474 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
5475 } else { 5455 } else {
5476 throw jsonDecoder.missingKey(jsonPath, "id"); 5456 throw jsonDecoder.mismatch(jsonPath, "kind");
5477 } 5457 }
5478 List<SearchResult> results; 5458 int relevance;
5479 if (json.containsKey("results")) { 5459 if (json.containsKey("relevance")) {
5480 results = jsonDecoder.decodeList( 5460 relevance =
5481 jsonPath + ".results", 5461 jsonDecoder.decodeInt(jsonPath + ".relevance", json["relevance"]);
5482 json["results"],
5483 (String jsonPath, Object json) =>
5484 new SearchResult.fromJson(jsonDecoder, jsonPath, json));
5485 } else { 5462 } else {
5486 throw jsonDecoder.missingKey(jsonPath, "results"); 5463 throw jsonDecoder.mismatch(jsonPath, "relevance");
5487 } 5464 }
5488 bool isLast; 5465 String completion;
5489 if (json.containsKey("isLast")) { 5466 if (json.containsKey("completion")) {
5490 isLast = jsonDecoder.decodeBool(jsonPath + ".isLast", json["isLast"]); 5467 completion = jsonDecoder.decodeString(
5468 jsonPath + ".completion", json["completion"]);
5491 } else { 5469 } else {
5492 throw jsonDecoder.missingKey(jsonPath, "isLast"); 5470 throw jsonDecoder.mismatch(jsonPath, "completion");
5493 }
5494 return new SearchResultsParams(id, results, isLast);
5495 } else {
5496 throw jsonDecoder.mismatch(jsonPath, "search.results params", json);
5497 }
5498 }
5499
5500 factory SearchResultsParams.fromNotification(Notification notification) {
5501 return new SearchResultsParams.fromJson(
5502 new ResponseDecoder(null), "params", notification._params);
5503 }
5504
5505 Map<String, dynamic> toJson() {
5506 Map<String, dynamic> result = {};
5507 result["id"] = id;
5508 result["results"] =
5509 results.map((SearchResult value) => value.toJson()).toList();
5510 result["isLast"] = isLast;
5511 return result;
5512 }
5513
5514 Notification toNotification() {
5515 return new Notification("search.results", toJson());
5516 }
5517
5518 @override
5519 String toString() => JSON.encode(toJson());
5520
5521 @override
5522 bool operator ==(other) {
5523 if (other is SearchResultsParams) {
5524 return id == other.id &&
5525 listEqual(results, other.results,
5526 (SearchResult a, SearchResult b) => a == b) &&
5527 isLast == other.isLast;
5528 }
5529 return false;
5530 }
5531
5532 @override
5533 int get hashCode {
5534 int hash = 0;
5535 hash = JenkinsSmiHash.combine(hash, id.hashCode);
5536 hash = JenkinsSmiHash.combine(hash, results.hashCode);
5537 hash = JenkinsSmiHash.combine(hash, isLast.hashCode);
5538 return JenkinsSmiHash.finish(hash);
5539 }
5540 }
5541
5542 /**
5543 * edit.format params
5544 *
5545 * {
5546 * "file": FilePath
5547 * "selectionOffset": int
5548 * "selectionLength": int
5549 * "lineLength": optional int
5550 * }
5551 *
5552 * Clients may not extend, implement or mix-in this class.
5553 */
5554 class EditFormatParams implements HasToJson {
5555 String _file;
5556
5557 int _selectionOffset;
5558
5559 int _selectionLength;
5560
5561 int _lineLength;
5562
5563 /**
5564 * The file containing the code to be formatted.
5565 */
5566 String get file => _file;
5567
5568 /**
5569 * The file containing the code to be formatted.
5570 */
5571 void set file(String value) {
5572 assert(value != null);
5573 this._file = value;
5574 }
5575
5576 /**
5577 * The offset of the current selection in the file.
5578 */
5579 int get selectionOffset => _selectionOffset;
5580
5581 /**
5582 * The offset of the current selection in the file.
5583 */
5584 void set selectionOffset(int value) {
5585 assert(value != null);
5586 this._selectionOffset = value;
5587 }
5588
5589 /**
5590 * The length of the current selection in the file.
5591 */
5592 int get selectionLength => _selectionLength;
5593
5594 /**
5595 * The length of the current selection in the file.
5596 */
5597 void set selectionLength(int value) {
5598 assert(value != null);
5599 this._selectionLength = value;
5600 }
5601
5602 /**
5603 * The line length to be used by the formatter.
5604 */
5605 int get lineLength => _lineLength;
5606
5607 /**
5608 * The line length to be used by the formatter.
5609 */
5610 void set lineLength(int value) {
5611 this._lineLength = value;
5612 }
5613
5614 EditFormatParams(String file, int selectionOffset, int selectionLength,
5615 {int lineLength}) {
5616 this.file = file;
5617 this.selectionOffset = selectionOffset;
5618 this.selectionLength = selectionLength;
5619 this.lineLength = lineLength;
5620 }
5621
5622 factory EditFormatParams.fromJson(
5623 JsonDecoder jsonDecoder, String jsonPath, Object json) {
5624 if (json == null) {
5625 json = {};
5626 }
5627 if (json is Map) {
5628 String file;
5629 if (json.containsKey("file")) {
5630 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
5631 } else {
5632 throw jsonDecoder.missingKey(jsonPath, "file");
5633 } 5471 }
5634 int selectionOffset; 5472 int selectionOffset;
5635 if (json.containsKey("selectionOffset")) { 5473 if (json.containsKey("selectionOffset")) {
5636 selectionOffset = jsonDecoder.decodeInt( 5474 selectionOffset = jsonDecoder.decodeInt(
5637 jsonPath + ".selectionOffset", json["selectionOffset"]); 5475 jsonPath + ".selectionOffset", json["selectionOffset"]);
5638 } else { 5476 } else {
5639 throw jsonDecoder.missingKey(jsonPath, "selectionOffset"); 5477 throw jsonDecoder.mismatch(jsonPath, "selectionOffset");
5640 } 5478 }
5641 int selectionLength; 5479 int selectionLength;
5642 if (json.containsKey("selectionLength")) { 5480 if (json.containsKey("selectionLength")) {
5643 selectionLength = jsonDecoder.decodeInt( 5481 selectionLength = jsonDecoder.decodeInt(
5644 jsonPath + ".selectionLength", json["selectionLength"]); 5482 jsonPath + ".selectionLength", json["selectionLength"]);
5645 } else { 5483 } else {
5646 throw jsonDecoder.missingKey(jsonPath, "selectionLength"); 5484 throw jsonDecoder.mismatch(jsonPath, "selectionLength");
5647 } 5485 }
5648 int lineLength; 5486 bool isDeprecated;
5649 if (json.containsKey("lineLength")) { 5487 if (json.containsKey("isDeprecated")) {
5650 lineLength = 5488 isDeprecated = jsonDecoder.decodeBool(
5651 jsonDecoder.decodeInt(jsonPath + ".lineLength", json["lineLength"]); 5489 jsonPath + ".isDeprecated", json["isDeprecated"]);
5652 } 5490 } else {
5653 return new EditFormatParams(file, selectionOffset, selectionLength, 5491 throw jsonDecoder.mismatch(jsonPath, "isDeprecated");
5654 lineLength: lineLength); 5492 }
5493 bool isPotential;
5494 if (json.containsKey("isPotential")) {
5495 isPotential = jsonDecoder.decodeBool(
5496 jsonPath + ".isPotential", json["isPotential"]);
5497 } else {
5498 throw jsonDecoder.mismatch(jsonPath, "isPotential");
5499 }
5500 String docSummary;
5501 if (json.containsKey("docSummary")) {
5502 docSummary = jsonDecoder.decodeString(
5503 jsonPath + ".docSummary", json["docSummary"]);
5504 }
5505 String docComplete;
5506 if (json.containsKey("docComplete")) {
5507 docComplete = jsonDecoder.decodeString(
5508 jsonPath + ".docComplete", json["docComplete"]);
5509 }
5510 String declaringType;
5511 if (json.containsKey("declaringType")) {
5512 declaringType = jsonDecoder.decodeString(
5513 jsonPath + ".declaringType", json["declaringType"]);
5514 }
5515 String defaultArgumentListString;
5516 if (json.containsKey("defaultArgumentListString")) {
5517 defaultArgumentListString = jsonDecoder.decodeString(
5518 jsonPath + ".defaultArgumentListString",
5519 json["defaultArgumentListString"]);
5520 }
5521 List<int> defaultArgumentListTextRanges;
5522 if (json.containsKey("defaultArgumentListTextRanges")) {
5523 defaultArgumentListTextRanges = jsonDecoder.decodeList(
5524 jsonPath + ".defaultArgumentListTextRanges",
5525 json["defaultArgumentListTextRanges"],
5526 jsonDecoder.decodeInt);
5527 }
5528 Element element;
5529 if (json.containsKey("element")) {
5530 element = new Element.fromJson(
5531 jsonDecoder, jsonPath + ".element", json["element"]);
5532 }
5533 String returnType;
5534 if (json.containsKey("returnType")) {
5535 returnType = jsonDecoder.decodeString(
5536 jsonPath + ".returnType", json["returnType"]);
5537 }
5538 List<String> parameterNames;
5539 if (json.containsKey("parameterNames")) {
5540 parameterNames = jsonDecoder.decodeList(jsonPath + ".parameterNames",
5541 json["parameterNames"], jsonDecoder.decodeString);
5542 }
5543 List<String> parameterTypes;
5544 if (json.containsKey("parameterTypes")) {
5545 parameterTypes = jsonDecoder.decodeList(jsonPath + ".parameterTypes",
5546 json["parameterTypes"], jsonDecoder.decodeString);
5547 }
5548 int requiredParameterCount;
5549 if (json.containsKey("requiredParameterCount")) {
5550 requiredParameterCount = jsonDecoder.decodeInt(
5551 jsonPath + ".requiredParameterCount",
5552 json["requiredParameterCount"]);
5553 }
5554 bool hasNamedParameters;
5555 if (json.containsKey("hasNamedParameters")) {
5556 hasNamedParameters = jsonDecoder.decodeBool(
5557 jsonPath + ".hasNamedParameters", json["hasNamedParameters"]);
5558 }
5559 String parameterName;
5560 if (json.containsKey("parameterName")) {
5561 parameterName = jsonDecoder.decodeString(
5562 jsonPath + ".parameterName", json["parameterName"]);
5563 }
5564 String parameterType;
5565 if (json.containsKey("parameterType")) {
5566 parameterType = jsonDecoder.decodeString(
5567 jsonPath + ".parameterType", json["parameterType"]);
5568 }
5569 String importUri;
5570 if (json.containsKey("importUri")) {
5571 importUri = jsonDecoder.decodeString(
5572 jsonPath + ".importUri", json["importUri"]);
5573 }
5574 return new CompletionSuggestion(kind, relevance, completion,
5575 selectionOffset, selectionLength, isDeprecated, isPotential,
5576 docSummary: docSummary,
5577 docComplete: docComplete,
5578 declaringType: declaringType,
5579 defaultArgumentListString: defaultArgumentListString,
5580 defaultArgumentListTextRanges: defaultArgumentListTextRanges,
5581 element: element,
5582 returnType: returnType,
5583 parameterNames: parameterNames,
5584 parameterTypes: parameterTypes,
5585 requiredParameterCount: requiredParameterCount,
5586 hasNamedParameters: hasNamedParameters,
5587 parameterName: parameterName,
5588 parameterType: parameterType,
5589 importUri: importUri);
5655 } else { 5590 } else {
5656 throw jsonDecoder.mismatch(jsonPath, "edit.format params", json); 5591 throw jsonDecoder.mismatch(jsonPath, "CompletionSuggestion", json);
5657 } 5592 }
5658 } 5593 }
5659 5594
5660 factory EditFormatParams.fromRequest(Request request) { 5595 @override
5661 return new EditFormatParams.fromJson(
5662 new RequestDecoder(request), "params", request._params);
5663 }
5664
5665 Map<String, dynamic> toJson() { 5596 Map<String, dynamic> toJson() {
5666 Map<String, dynamic> result = {}; 5597 Map<String, dynamic> result = {};
5667 result["file"] = file; 5598 result["kind"] = kind.toJson();
5599 result["relevance"] = relevance;
5600 result["completion"] = completion;
5668 result["selectionOffset"] = selectionOffset; 5601 result["selectionOffset"] = selectionOffset;
5669 result["selectionLength"] = selectionLength; 5602 result["selectionLength"] = selectionLength;
5670 if (lineLength != null) { 5603 result["isDeprecated"] = isDeprecated;
5671 result["lineLength"] = lineLength; 5604 result["isPotential"] = isPotential;
5605 if (docSummary != null) {
5606 result["docSummary"] = docSummary;
5607 }
5608 if (docComplete != null) {
5609 result["docComplete"] = docComplete;
5610 }
5611 if (declaringType != null) {
5612 result["declaringType"] = declaringType;
5613 }
5614 if (defaultArgumentListString != null) {
5615 result["defaultArgumentListString"] = defaultArgumentListString;
5616 }
5617 if (defaultArgumentListTextRanges != null) {
5618 result["defaultArgumentListTextRanges"] = defaultArgumentListTextRanges;
5619 }
5620 if (element != null) {
5621 result["element"] = element.toJson();
5622 }
5623 if (returnType != null) {
5624 result["returnType"] = returnType;
5625 }
5626 if (parameterNames != null) {
5627 result["parameterNames"] = parameterNames;
5628 }
5629 if (parameterTypes != null) {
5630 result["parameterTypes"] = parameterTypes;
5631 }
5632 if (requiredParameterCount != null) {
5633 result["requiredParameterCount"] = requiredParameterCount;
5634 }
5635 if (hasNamedParameters != null) {
5636 result["hasNamedParameters"] = hasNamedParameters;
5637 }
5638 if (parameterName != null) {
5639 result["parameterName"] = parameterName;
5640 }
5641 if (parameterType != null) {
5642 result["parameterType"] = parameterType;
5643 }
5644 if (importUri != null) {
5645 result["importUri"] = importUri;
5672 } 5646 }
5673 return result; 5647 return result;
5674 } 5648 }
5675 5649
5676 Request toRequest(String id) {
5677 return new Request(id, "edit.format", toJson());
5678 }
5679
5680 @override 5650 @override
5681 String toString() => JSON.encode(toJson());
5682
5683 @override
5684 bool operator ==(other) {
5685 if (other is EditFormatParams) {
5686 return file == other.file &&
5687 selectionOffset == other.selectionOffset &&
5688 selectionLength == other.selectionLength &&
5689 lineLength == other.lineLength;
5690 }
5691 return false;
5692 }
5693
5694 @override
5695 int get hashCode {
5696 int hash = 0;
5697 hash = JenkinsSmiHash.combine(hash, file.hashCode);
5698 hash = JenkinsSmiHash.combine(hash, selectionOffset.hashCode);
5699 hash = JenkinsSmiHash.combine(hash, selectionLength.hashCode);
5700 hash = JenkinsSmiHash.combine(hash, lineLength.hashCode);
5701 return JenkinsSmiHash.finish(hash);
5702 }
5703 }
5704
5705 /**
5706 * edit.format result
5707 *
5708 * {
5709 * "edits": List<SourceEdit>
5710 * "selectionOffset": int
5711 * "selectionLength": int
5712 * }
5713 *
5714 * Clients may not extend, implement or mix-in this class.
5715 */
5716 class EditFormatResult implements HasToJson {
5717 List<SourceEdit> _edits;
5718
5719 int _selectionOffset;
5720
5721 int _selectionLength;
5722
5723 /**
5724 * The edit(s) to be applied in order to format the code. The list will be
5725 * empty if the code was already formatted (there are no changes).
5726 */
5727 List<SourceEdit> get edits => _edits;
5728
5729 /**
5730 * The edit(s) to be applied in order to format the code. The list will be
5731 * empty if the code was already formatted (there are no changes).
5732 */
5733 void set edits(List<SourceEdit> value) {
5734 assert(value != null);
5735 this._edits = value;
5736 }
5737
5738 /**
5739 * The offset of the selection after formatting the code.
5740 */
5741 int get selectionOffset => _selectionOffset;
5742
5743 /**
5744 * The offset of the selection after formatting the code.
5745 */
5746 void set selectionOffset(int value) {
5747 assert(value != null);
5748 this._selectionOffset = value;
5749 }
5750
5751 /**
5752 * The length of the selection after formatting the code.
5753 */
5754 int get selectionLength => _selectionLength;
5755
5756 /**
5757 * The length of the selection after formatting the code.
5758 */
5759 void set selectionLength(int value) {
5760 assert(value != null);
5761 this._selectionLength = value;
5762 }
5763
5764 EditFormatResult(
5765 List<SourceEdit> edits, int selectionOffset, int selectionLength) {
5766 this.edits = edits;
5767 this.selectionOffset = selectionOffset;
5768 this.selectionLength = selectionLength;
5769 }
5770
5771 factory EditFormatResult.fromJson(
5772 JsonDecoder jsonDecoder, String jsonPath, Object json) {
5773 if (json == null) {
5774 json = {};
5775 }
5776 if (json is Map) {
5777 List<SourceEdit> edits;
5778 if (json.containsKey("edits")) {
5779 edits = jsonDecoder.decodeList(
5780 jsonPath + ".edits",
5781 json["edits"],
5782 (String jsonPath, Object json) =>
5783 new SourceEdit.fromJson(jsonDecoder, jsonPath, json));
5784 } else {
5785 throw jsonDecoder.missingKey(jsonPath, "edits");
5786 }
5787 int selectionOffset;
5788 if (json.containsKey("selectionOffset")) {
5789 selectionOffset = jsonDecoder.decodeInt(
5790 jsonPath + ".selectionOffset", json["selectionOffset"]);
5791 } else {
5792 throw jsonDecoder.missingKey(jsonPath, "selectionOffset");
5793 }
5794 int selectionLength;
5795 if (json.containsKey("selectionLength")) {
5796 selectionLength = jsonDecoder.decodeInt(
5797 jsonPath + ".selectionLength", json["selectionLength"]);
5798 } else {
5799 throw jsonDecoder.missingKey(jsonPath, "selectionLength");
5800 }
5801 return new EditFormatResult(edits, selectionOffset, selectionLength);
5802 } else {
5803 throw jsonDecoder.mismatch(jsonPath, "edit.format result", json);
5804 }
5805 }
5806
5807 factory EditFormatResult.fromResponse(Response response) {
5808 return new EditFormatResult.fromJson(
5809 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
5810 "result",
5811 response._result);
5812 }
5813
5814 Map<String, dynamic> toJson() {
5815 Map<String, dynamic> result = {};
5816 result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList();
5817 result["selectionOffset"] = selectionOffset;
5818 result["selectionLength"] = selectionLength;
5819 return result;
5820 }
5821
5822 Response toResponse(String id) {
5823 return new Response(id, result: toJson());
5824 }
5825
5826 @override
5827 String toString() => JSON.encode(toJson());
5828
5829 @override
5830 bool operator ==(other) {
5831 if (other is EditFormatResult) {
5832 return listEqual(
5833 edits, other.edits, (SourceEdit a, SourceEdit b) => a == b) &&
5834 selectionOffset == other.selectionOffset &&
5835 selectionLength == other.selectionLength;
5836 }
5837 return false;
5838 }
5839
5840 @override
5841 int get hashCode {
5842 int hash = 0;
5843 hash = JenkinsSmiHash.combine(hash, edits.hashCode);
5844 hash = JenkinsSmiHash.combine(hash, selectionOffset.hashCode);
5845 hash = JenkinsSmiHash.combine(hash, selectionLength.hashCode);
5846 return JenkinsSmiHash.finish(hash);
5847 }
5848 }
5849
5850 /**
5851 * edit.getAssists params
5852 *
5853 * {
5854 * "file": FilePath
5855 * "offset": int
5856 * "length": int
5857 * }
5858 *
5859 * Clients may not extend, implement or mix-in this class.
5860 */
5861 class EditGetAssistsParams implements HasToJson {
5862 String _file;
5863
5864 int _offset;
5865
5866 int _length;
5867
5868 /**
5869 * The file containing the code for which assists are being requested.
5870 */
5871 String get file => _file;
5872
5873 /**
5874 * The file containing the code for which assists are being requested.
5875 */
5876 void set file(String value) {
5877 assert(value != null);
5878 this._file = value;
5879 }
5880
5881 /**
5882 * The offset of the code for which assists are being requested.
5883 */
5884 int get offset => _offset;
5885
5886 /**
5887 * The offset of the code for which assists are being requested.
5888 */
5889 void set offset(int value) {
5890 assert(value != null);
5891 this._offset = value;
5892 }
5893
5894 /**
5895 * The length of the code for which assists are being requested.
5896 */
5897 int get length => _length;
5898
5899 /**
5900 * The length of the code for which assists are being requested.
5901 */
5902 void set length(int value) {
5903 assert(value != null);
5904 this._length = value;
5905 }
5906
5907 EditGetAssistsParams(String file, int offset, int length) {
5908 this.file = file;
5909 this.offset = offset;
5910 this.length = length;
5911 }
5912
5913 factory EditGetAssistsParams.fromJson(
5914 JsonDecoder jsonDecoder, String jsonPath, Object json) {
5915 if (json == null) {
5916 json = {};
5917 }
5918 if (json is Map) {
5919 String file;
5920 if (json.containsKey("file")) {
5921 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
5922 } else {
5923 throw jsonDecoder.missingKey(jsonPath, "file");
5924 }
5925 int offset;
5926 if (json.containsKey("offset")) {
5927 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
5928 } else {
5929 throw jsonDecoder.missingKey(jsonPath, "offset");
5930 }
5931 int length;
5932 if (json.containsKey("length")) {
5933 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
5934 } else {
5935 throw jsonDecoder.missingKey(jsonPath, "length");
5936 }
5937 return new EditGetAssistsParams(file, offset, length);
5938 } else {
5939 throw jsonDecoder.mismatch(jsonPath, "edit.getAssists params", json);
5940 }
5941 }
5942
5943 factory EditGetAssistsParams.fromRequest(Request request) {
5944 return new EditGetAssistsParams.fromJson(
5945 new RequestDecoder(request), "params", request._params);
5946 }
5947
5948 Map<String, dynamic> toJson() {
5949 Map<String, dynamic> result = {};
5950 result["file"] = file;
5951 result["offset"] = offset;
5952 result["length"] = length;
5953 return result;
5954 }
5955
5956 Request toRequest(String id) {
5957 return new Request(id, "edit.getAssists", toJson());
5958 }
5959
5960 @override
5961 String toString() => JSON.encode(toJson());
5962
5963 @override
5964 bool operator ==(other) {
5965 if (other is EditGetAssistsParams) {
5966 return file == other.file &&
5967 offset == other.offset &&
5968 length == other.length;
5969 }
5970 return false;
5971 }
5972
5973 @override
5974 int get hashCode {
5975 int hash = 0;
5976 hash = JenkinsSmiHash.combine(hash, file.hashCode);
5977 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
5978 hash = JenkinsSmiHash.combine(hash, length.hashCode);
5979 return JenkinsSmiHash.finish(hash);
5980 }
5981 }
5982
5983 /**
5984 * edit.getAssists result
5985 *
5986 * {
5987 * "assists": List<SourceChange>
5988 * }
5989 *
5990 * Clients may not extend, implement or mix-in this class.
5991 */
5992 class EditGetAssistsResult implements HasToJson {
5993 List<SourceChange> _assists;
5994
5995 /**
5996 * The assists that are available at the given location.
5997 */
5998 List<SourceChange> get assists => _assists;
5999
6000 /**
6001 * The assists that are available at the given location.
6002 */
6003 void set assists(List<SourceChange> value) {
6004 assert(value != null);
6005 this._assists = value;
6006 }
6007
6008 EditGetAssistsResult(List<SourceChange> assists) {
6009 this.assists = assists;
6010 }
6011
6012 factory EditGetAssistsResult.fromJson(
6013 JsonDecoder jsonDecoder, String jsonPath, Object json) {
6014 if (json == null) {
6015 json = {};
6016 }
6017 if (json is Map) {
6018 List<SourceChange> assists;
6019 if (json.containsKey("assists")) {
6020 assists = jsonDecoder.decodeList(
6021 jsonPath + ".assists",
6022 json["assists"],
6023 (String jsonPath, Object json) =>
6024 new SourceChange.fromJson(jsonDecoder, jsonPath, json));
6025 } else {
6026 throw jsonDecoder.missingKey(jsonPath, "assists");
6027 }
6028 return new EditGetAssistsResult(assists);
6029 } else {
6030 throw jsonDecoder.mismatch(jsonPath, "edit.getAssists result", json);
6031 }
6032 }
6033
6034 factory EditGetAssistsResult.fromResponse(Response response) {
6035 return new EditGetAssistsResult.fromJson(
6036 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
6037 "result",
6038 response._result);
6039 }
6040
6041 Map<String, dynamic> toJson() {
6042 Map<String, dynamic> result = {};
6043 result["assists"] =
6044 assists.map((SourceChange value) => value.toJson()).toList();
6045 return result;
6046 }
6047
6048 Response toResponse(String id) {
6049 return new Response(id, result: toJson());
6050 }
6051
6052 @override
6053 String toString() => JSON.encode(toJson()); 5651 String toString() => JSON.encode(toJson());
6054 5652
6055 @override 5653 @override
6056 bool operator ==(other) { 5654 bool operator ==(other) {
6057 if (other is EditGetAssistsResult) { 5655 if (other is CompletionSuggestion) {
6058 return listEqual( 5656 return kind == other.kind &&
6059 assists, other.assists, (SourceChange a, SourceChange b) => a == b); 5657 relevance == other.relevance &&
5658 completion == other.completion &&
5659 selectionOffset == other.selectionOffset &&
5660 selectionLength == other.selectionLength &&
5661 isDeprecated == other.isDeprecated &&
5662 isPotential == other.isPotential &&
5663 docSummary == other.docSummary &&
5664 docComplete == other.docComplete &&
5665 declaringType == other.declaringType &&
5666 defaultArgumentListString == other.defaultArgumentListString &&
5667 listEqual(defaultArgumentListTextRanges,
5668 other.defaultArgumentListTextRanges, (int a, int b) => a == b) &&
5669 element == other.element &&
5670 returnType == other.returnType &&
5671 listEqual(parameterNames, other.parameterNames,
5672 (String a, String b) => a == b) &&
5673 listEqual(parameterTypes, other.parameterTypes,
5674 (String a, String b) => a == b) &&
5675 requiredParameterCount == other.requiredParameterCount &&
5676 hasNamedParameters == other.hasNamedParameters &&
5677 parameterName == other.parameterName &&
5678 parameterType == other.parameterType &&
5679 importUri == other.importUri;
6060 } 5680 }
6061 return false; 5681 return false;
6062 } 5682 }
6063 5683
6064 @override 5684 @override
6065 int get hashCode { 5685 int get hashCode {
6066 int hash = 0; 5686 int hash = 0;
6067 hash = JenkinsSmiHash.combine(hash, assists.hashCode); 5687 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
5688 hash = JenkinsSmiHash.combine(hash, relevance.hashCode);
5689 hash = JenkinsSmiHash.combine(hash, completion.hashCode);
5690 hash = JenkinsSmiHash.combine(hash, selectionOffset.hashCode);
5691 hash = JenkinsSmiHash.combine(hash, selectionLength.hashCode);
5692 hash = JenkinsSmiHash.combine(hash, isDeprecated.hashCode);
5693 hash = JenkinsSmiHash.combine(hash, isPotential.hashCode);
5694 hash = JenkinsSmiHash.combine(hash, docSummary.hashCode);
5695 hash = JenkinsSmiHash.combine(hash, docComplete.hashCode);
5696 hash = JenkinsSmiHash.combine(hash, declaringType.hashCode);
5697 hash = JenkinsSmiHash.combine(hash, defaultArgumentListString.hashCode);
5698 hash = JenkinsSmiHash.combine(hash, defaultArgumentListTextRanges.hashCode);
5699 hash = JenkinsSmiHash.combine(hash, element.hashCode);
5700 hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
5701 hash = JenkinsSmiHash.combine(hash, parameterNames.hashCode);
5702 hash = JenkinsSmiHash.combine(hash, parameterTypes.hashCode);
5703 hash = JenkinsSmiHash.combine(hash, requiredParameterCount.hashCode);
5704 hash = JenkinsSmiHash.combine(hash, hasNamedParameters.hashCode);
5705 hash = JenkinsSmiHash.combine(hash, parameterName.hashCode);
5706 hash = JenkinsSmiHash.combine(hash, parameterType.hashCode);
5707 hash = JenkinsSmiHash.combine(hash, importUri.hashCode);
6068 return JenkinsSmiHash.finish(hash); 5708 return JenkinsSmiHash.finish(hash);
6069 } 5709 }
6070 } 5710 }
6071 5711
6072 /** 5712 /**
6073 * edit.getAvailableRefactorings params 5713 * CompletionSuggestionKind
6074 * 5714 *
6075 * { 5715 * enum {
6076 * "file": FilePath 5716 * ARGUMENT_LIST
6077 * "offset": int 5717 * IMPORT
6078 * "length": int 5718 * IDENTIFIER
5719 * INVOCATION
5720 * KEYWORD
5721 * NAMED_ARGUMENT
5722 * OPTIONAL_ARGUMENT
5723 * PARAMETER
6079 * } 5724 * }
6080 * 5725 *
6081 * Clients may not extend, implement or mix-in this class. 5726 * Clients may not extend, implement or mix-in this class.
6082 */ 5727 */
6083 class EditGetAvailableRefactoringsParams implements HasToJson { 5728 class CompletionSuggestionKind implements Enum {
6084 String _file; 5729 /**
6085 5730 * A list of arguments for the method or function that is being invoked. For
6086 int _offset; 5731 * this suggestion kind, the completion field is a textual representation of
6087 5732 * the invocation and the parameterNames, parameterTypes, and
6088 int _length; 5733 * requiredParameterCount attributes are defined.
6089 5734 */
6090 /** 5735 static const CompletionSuggestionKind ARGUMENT_LIST =
6091 * The file containing the code on which the refactoring would be based. 5736 const CompletionSuggestionKind._("ARGUMENT_LIST");
6092 */ 5737
6093 String get file => _file; 5738 static const CompletionSuggestionKind IMPORT =
6094 5739 const CompletionSuggestionKind._("IMPORT");
6095 /** 5740
6096 * The file containing the code on which the refactoring would be based. 5741 /**
6097 */ 5742 * The element identifier should be inserted at the completion location. For
6098 void set file(String value) { 5743 * example "someMethod" in import 'myLib.dart' show someMethod; . For
6099 assert(value != null); 5744 * suggestions of this kind, the element attribute is defined and the
6100 this._file = value; 5745 * completion field is the element's identifier.
6101 } 5746 */
6102 5747 static const CompletionSuggestionKind IDENTIFIER =
6103 /** 5748 const CompletionSuggestionKind._("IDENTIFIER");
6104 * The offset of the code on which the refactoring would be based. 5749
6105 */ 5750 /**
6106 int get offset => _offset; 5751 * The element is being invoked at the completion location. For example,
6107 5752 * "someMethod" in x.someMethod(); . For suggestions of this kind, the
6108 /** 5753 * element attribute is defined and the completion field is the element's
6109 * The offset of the code on which the refactoring would be based. 5754 * identifier.
6110 */ 5755 */
6111 void set offset(int value) { 5756 static const CompletionSuggestionKind INVOCATION =
6112 assert(value != null); 5757 const CompletionSuggestionKind._("INVOCATION");
6113 this._offset = value; 5758
6114 } 5759 /**
6115 5760 * A keyword is being suggested. For suggestions of this kind, the completion
6116 /** 5761 * is the keyword.
6117 * The length of the code on which the refactoring would be based. 5762 */
6118 */ 5763 static const CompletionSuggestionKind KEYWORD =
6119 int get length => _length; 5764 const CompletionSuggestionKind._("KEYWORD");
6120 5765
6121 /** 5766 /**
6122 * The length of the code on which the refactoring would be based. 5767 * A named argument for the current callsite is being suggested. For
6123 */ 5768 * suggestions of this kind, the completion is the named argument identifier
6124 void set length(int value) { 5769 * including a trailing ':' and space.
6125 assert(value != null); 5770 */
6126 this._length = value; 5771 static const CompletionSuggestionKind NAMED_ARGUMENT =
6127 } 5772 const CompletionSuggestionKind._("NAMED_ARGUMENT");
6128 5773
6129 EditGetAvailableRefactoringsParams(String file, int offset, int length) { 5774 static const CompletionSuggestionKind OPTIONAL_ARGUMENT =
6130 this.file = file; 5775 const CompletionSuggestionKind._("OPTIONAL_ARGUMENT");
6131 this.offset = offset; 5776
6132 this.length = length; 5777 static const CompletionSuggestionKind PARAMETER =
6133 } 5778 const CompletionSuggestionKind._("PARAMETER");
6134 5779
6135 factory EditGetAvailableRefactoringsParams.fromJson( 5780 /**
5781 * A list containing all of the enum values that are defined.
5782 */
5783 static const List<CompletionSuggestionKind> VALUES =
5784 const <CompletionSuggestionKind>[
5785 ARGUMENT_LIST,
5786 IMPORT,
5787 IDENTIFIER,
5788 INVOCATION,
5789 KEYWORD,
5790 NAMED_ARGUMENT,
5791 OPTIONAL_ARGUMENT,
5792 PARAMETER
5793 ];
5794
5795 @override
5796 final String name;
5797
5798 const CompletionSuggestionKind._(this.name);
5799
5800 factory CompletionSuggestionKind(String name) {
5801 switch (name) {
5802 case "ARGUMENT_LIST":
5803 return ARGUMENT_LIST;
5804 case "IMPORT":
5805 return IMPORT;
5806 case "IDENTIFIER":
5807 return IDENTIFIER;
5808 case "INVOCATION":
5809 return INVOCATION;
5810 case "KEYWORD":
5811 return KEYWORD;
5812 case "NAMED_ARGUMENT":
5813 return NAMED_ARGUMENT;
5814 case "OPTIONAL_ARGUMENT":
5815 return OPTIONAL_ARGUMENT;
5816 case "PARAMETER":
5817 return PARAMETER;
5818 }
5819 throw new Exception('Illegal enum value: $name');
5820 }
5821
5822 factory CompletionSuggestionKind.fromJson(
5823 JsonDecoder jsonDecoder, String jsonPath, Object json) {
5824 if (json is String) {
5825 try {
5826 return new CompletionSuggestionKind(json);
5827 } catch (_) {
5828 // Fall through
5829 }
5830 }
5831 throw jsonDecoder.mismatch(jsonPath, "CompletionSuggestionKind", json);
5832 }
5833
5834 @override
5835 String toString() => "CompletionSuggestionKind.$name";
5836
5837 String toJson() => name;
5838 }
5839
5840 /**
5841 * ContextData
5842 *
5843 * {
5844 * "name": String
5845 * "explicitFileCount": int
5846 * "implicitFileCount": int
5847 * "workItemQueueLength": int
5848 * "cacheEntryExceptions": List<String>
5849 * }
5850 *
5851 * Clients may not extend, implement or mix-in this class.
5852 */
5853 class ContextData implements HasToJson {
5854 String _name;
5855
5856 int _explicitFileCount;
5857
5858 int _implicitFileCount;
5859
5860 int _workItemQueueLength;
5861
5862 List<String> _cacheEntryExceptions;
5863
5864 /**
5865 * The name of the context.
5866 */
5867 String get name => _name;
5868
5869 /**
5870 * The name of the context.
5871 */
5872 void set name(String value) {
5873 assert(value != null);
5874 this._name = value;
5875 }
5876
5877 /**
5878 * Explicitly analyzed files.
5879 */
5880 int get explicitFileCount => _explicitFileCount;
5881
5882 /**
5883 * Explicitly analyzed files.
5884 */
5885 void set explicitFileCount(int value) {
5886 assert(value != null);
5887 this._explicitFileCount = value;
5888 }
5889
5890 /**
5891 * Implicitly analyzed files.
5892 */
5893 int get implicitFileCount => _implicitFileCount;
5894
5895 /**
5896 * Implicitly analyzed files.
5897 */
5898 void set implicitFileCount(int value) {
5899 assert(value != null);
5900 this._implicitFileCount = value;
5901 }
5902
5903 /**
5904 * The number of work items in the queue.
5905 */
5906 int get workItemQueueLength => _workItemQueueLength;
5907
5908 /**
5909 * The number of work items in the queue.
5910 */
5911 void set workItemQueueLength(int value) {
5912 assert(value != null);
5913 this._workItemQueueLength = value;
5914 }
5915
5916 /**
5917 * Exceptions associated with cache entries.
5918 */
5919 List<String> get cacheEntryExceptions => _cacheEntryExceptions;
5920
5921 /**
5922 * Exceptions associated with cache entries.
5923 */
5924 void set cacheEntryExceptions(List<String> value) {
5925 assert(value != null);
5926 this._cacheEntryExceptions = value;
5927 }
5928
5929 ContextData(String name, int explicitFileCount, int implicitFileCount,
5930 int workItemQueueLength, List<String> cacheEntryExceptions) {
5931 this.name = name;
5932 this.explicitFileCount = explicitFileCount;
5933 this.implicitFileCount = implicitFileCount;
5934 this.workItemQueueLength = workItemQueueLength;
5935 this.cacheEntryExceptions = cacheEntryExceptions;
5936 }
5937
5938 factory ContextData.fromJson(
6136 JsonDecoder jsonDecoder, String jsonPath, Object json) { 5939 JsonDecoder jsonDecoder, String jsonPath, Object json) {
6137 if (json == null) { 5940 if (json == null) {
6138 json = {}; 5941 json = {};
6139 } 5942 }
6140 if (json is Map) { 5943 if (json is Map) {
6141 String file; 5944 String name;
6142 if (json.containsKey("file")) { 5945 if (json.containsKey("name")) {
6143 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 5946 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]);
6144 } else { 5947 } else {
6145 throw jsonDecoder.missingKey(jsonPath, "file"); 5948 throw jsonDecoder.mismatch(jsonPath, "name");
6146 } 5949 }
6147 int offset; 5950 int explicitFileCount;
6148 if (json.containsKey("offset")) { 5951 if (json.containsKey("explicitFileCount")) {
6149 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 5952 explicitFileCount = jsonDecoder.decodeInt(
6150 } else { 5953 jsonPath + ".explicitFileCount", json["explicitFileCount"]);
6151 throw jsonDecoder.missingKey(jsonPath, "offset"); 5954 } else {
6152 } 5955 throw jsonDecoder.mismatch(jsonPath, "explicitFileCount");
6153 int length; 5956 }
6154 if (json.containsKey("length")) { 5957 int implicitFileCount;
6155 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); 5958 if (json.containsKey("implicitFileCount")) {
6156 } else { 5959 implicitFileCount = jsonDecoder.decodeInt(
6157 throw jsonDecoder.missingKey(jsonPath, "length"); 5960 jsonPath + ".implicitFileCount", json["implicitFileCount"]);
6158 } 5961 } else {
6159 return new EditGetAvailableRefactoringsParams(file, offset, length); 5962 throw jsonDecoder.mismatch(jsonPath, "implicitFileCount");
5963 }
5964 int workItemQueueLength;
5965 if (json.containsKey("workItemQueueLength")) {
5966 workItemQueueLength = jsonDecoder.decodeInt(
5967 jsonPath + ".workItemQueueLength", json["workItemQueueLength"]);
5968 } else {
5969 throw jsonDecoder.mismatch(jsonPath, "workItemQueueLength");
5970 }
5971 List<String> cacheEntryExceptions;
5972 if (json.containsKey("cacheEntryExceptions")) {
5973 cacheEntryExceptions = jsonDecoder.decodeList(
5974 jsonPath + ".cacheEntryExceptions",
5975 json["cacheEntryExceptions"],
5976 jsonDecoder.decodeString);
5977 } else {
5978 throw jsonDecoder.mismatch(jsonPath, "cacheEntryExceptions");
5979 }
5980 return new ContextData(name, explicitFileCount, implicitFileCount,
5981 workItemQueueLength, cacheEntryExceptions);
6160 } else { 5982 } else {
6161 throw jsonDecoder.mismatch( 5983 throw jsonDecoder.mismatch(jsonPath, "ContextData", json);
6162 jsonPath, "edit.getAvailableRefactorings params", json); 5984 }
6163 } 5985 }
6164 } 5986
6165 5987 @override
6166 factory EditGetAvailableRefactoringsParams.fromRequest(Request request) {
6167 return new EditGetAvailableRefactoringsParams.fromJson(
6168 new RequestDecoder(request), "params", request._params);
6169 }
6170
6171 Map<String, dynamic> toJson() { 5988 Map<String, dynamic> toJson() {
6172 Map<String, dynamic> result = {}; 5989 Map<String, dynamic> result = {};
6173 result["file"] = file; 5990 result["name"] = name;
6174 result["offset"] = offset; 5991 result["explicitFileCount"] = explicitFileCount;
6175 result["length"] = length; 5992 result["implicitFileCount"] = implicitFileCount;
5993 result["workItemQueueLength"] = workItemQueueLength;
5994 result["cacheEntryExceptions"] = cacheEntryExceptions;
6176 return result; 5995 return result;
6177 } 5996 }
6178 5997
6179 Request toRequest(String id) {
6180 return new Request(id, "edit.getAvailableRefactorings", toJson());
6181 }
6182
6183 @override 5998 @override
6184 String toString() => JSON.encode(toJson()); 5999 String toString() => JSON.encode(toJson());
6185 6000
6186 @override 6001 @override
6187 bool operator ==(other) { 6002 bool operator ==(other) {
6188 if (other is EditGetAvailableRefactoringsParams) { 6003 if (other is ContextData) {
6189 return file == other.file && 6004 return name == other.name &&
6190 offset == other.offset && 6005 explicitFileCount == other.explicitFileCount &&
6191 length == other.length; 6006 implicitFileCount == other.implicitFileCount &&
6007 workItemQueueLength == other.workItemQueueLength &&
6008 listEqual(cacheEntryExceptions, other.cacheEntryExceptions,
6009 (String a, String b) => a == b);
6192 } 6010 }
6193 return false; 6011 return false;
6194 } 6012 }
6195 6013
6196 @override 6014 @override
6197 int get hashCode { 6015 int get hashCode {
6198 int hash = 0; 6016 int hash = 0;
6199 hash = JenkinsSmiHash.combine(hash, file.hashCode); 6017 hash = JenkinsSmiHash.combine(hash, name.hashCode);
6200 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 6018 hash = JenkinsSmiHash.combine(hash, explicitFileCount.hashCode);
6201 hash = JenkinsSmiHash.combine(hash, length.hashCode); 6019 hash = JenkinsSmiHash.combine(hash, implicitFileCount.hashCode);
6020 hash = JenkinsSmiHash.combine(hash, workItemQueueLength.hashCode);
6021 hash = JenkinsSmiHash.combine(hash, cacheEntryExceptions.hashCode);
6202 return JenkinsSmiHash.finish(hash); 6022 return JenkinsSmiHash.finish(hash);
6203 } 6023 }
6204 } 6024 }
6205 6025
6206 /** 6026 /**
6207 * edit.getAvailableRefactorings result 6027 * convertGetterToMethod feedback
6028 *
6029 * Clients may not extend, implement or mix-in this class.
6030 */
6031 class ConvertGetterToMethodFeedback extends RefactoringFeedback
6032 implements HasToJson {
6033 @override
6034 bool operator ==(other) {
6035 if (other is ConvertGetterToMethodFeedback) {
6036 return true;
6037 }
6038 return false;
6039 }
6040
6041 @override
6042 int get hashCode {
6043 return 616032599;
6044 }
6045 }
6046
6047 /**
6048 * convertGetterToMethod options
6049 *
6050 * Clients may not extend, implement or mix-in this class.
6051 */
6052 class ConvertGetterToMethodOptions extends RefactoringOptions
6053 implements HasToJson {
6054 @override
6055 bool operator ==(other) {
6056 if (other is ConvertGetterToMethodOptions) {
6057 return true;
6058 }
6059 return false;
6060 }
6061
6062 @override
6063 int get hashCode {
6064 return 488848400;
6065 }
6066 }
6067
6068 /**
6069 * convertMethodToGetter feedback
6070 *
6071 * Clients may not extend, implement or mix-in this class.
6072 */
6073 class ConvertMethodToGetterFeedback extends RefactoringFeedback
6074 implements HasToJson {
6075 @override
6076 bool operator ==(other) {
6077 if (other is ConvertMethodToGetterFeedback) {
6078 return true;
6079 }
6080 return false;
6081 }
6082
6083 @override
6084 int get hashCode {
6085 return 165291526;
6086 }
6087 }
6088
6089 /**
6090 * convertMethodToGetter options
6091 *
6092 * Clients may not extend, implement or mix-in this class.
6093 */
6094 class ConvertMethodToGetterOptions extends RefactoringOptions
6095 implements HasToJson {
6096 @override
6097 bool operator ==(other) {
6098 if (other is ConvertMethodToGetterOptions) {
6099 return true;
6100 }
6101 return false;
6102 }
6103
6104 @override
6105 int get hashCode {
6106 return 27952290;
6107 }
6108 }
6109
6110 /**
6111 * diagnostic.getDiagnostics params
6112 *
6113 * Clients may not extend, implement or mix-in this class.
6114 */
6115 class DiagnosticGetDiagnosticsParams implements RequestParams {
6116 @override
6117 Map<String, dynamic> toJson() => <String, dynamic>{};
6118
6119 @override
6120 Request toRequest(String id) {
6121 return new Request(id, "diagnostic.getDiagnostics", null);
6122 }
6123
6124 @override
6125 bool operator ==(other) {
6126 if (other is DiagnosticGetDiagnosticsParams) {
6127 return true;
6128 }
6129 return false;
6130 }
6131
6132 @override
6133 int get hashCode {
6134 return 587526202;
6135 }
6136 }
6137
6138 /**
6139 * diagnostic.getDiagnostics result
6208 * 6140 *
6209 * { 6141 * {
6210 * "kinds": List<RefactoringKind> 6142 * "contexts": List<ContextData>
6211 * } 6143 * }
6212 * 6144 *
6213 * Clients may not extend, implement or mix-in this class. 6145 * Clients may not extend, implement or mix-in this class.
6214 */ 6146 */
6215 class EditGetAvailableRefactoringsResult implements HasToJson { 6147 class DiagnosticGetDiagnosticsResult implements ResponseResult {
6216 List<RefactoringKind> _kinds; 6148 List<ContextData> _contexts;
6217 6149
6218 /** 6150 /**
6219 * The kinds of refactorings that are valid for the given selection. 6151 * The list of analysis contexts.
6220 */ 6152 */
6221 List<RefactoringKind> get kinds => _kinds; 6153 List<ContextData> get contexts => _contexts;
6222 6154
6223 /** 6155 /**
6224 * The kinds of refactorings that are valid for the given selection. 6156 * The list of analysis contexts.
6225 */ 6157 */
6226 void set kinds(List<RefactoringKind> value) { 6158 void set contexts(List<ContextData> value) {
6227 assert(value != null); 6159 assert(value != null);
6228 this._kinds = value; 6160 this._contexts = value;
6229 } 6161 }
6230 6162
6231 EditGetAvailableRefactoringsResult(List<RefactoringKind> kinds) { 6163 DiagnosticGetDiagnosticsResult(List<ContextData> contexts) {
6232 this.kinds = kinds; 6164 this.contexts = contexts;
6233 } 6165 }
6234 6166
6235 factory EditGetAvailableRefactoringsResult.fromJson( 6167 factory DiagnosticGetDiagnosticsResult.fromJson(
6236 JsonDecoder jsonDecoder, String jsonPath, Object json) { 6168 JsonDecoder jsonDecoder, String jsonPath, Object json) {
6237 if (json == null) { 6169 if (json == null) {
6238 json = {}; 6170 json = {};
6239 } 6171 }
6240 if (json is Map) { 6172 if (json is Map) {
6241 List<RefactoringKind> kinds; 6173 List<ContextData> contexts;
6242 if (json.containsKey("kinds")) { 6174 if (json.containsKey("contexts")) {
6243 kinds = jsonDecoder.decodeList( 6175 contexts = jsonDecoder.decodeList(
6244 jsonPath + ".kinds", 6176 jsonPath + ".contexts",
6245 json["kinds"], 6177 json["contexts"],
6246 (String jsonPath, Object json) => 6178 (String jsonPath, Object json) =>
6247 new RefactoringKind.fromJson(jsonDecoder, jsonPath, json)); 6179 new ContextData.fromJson(jsonDecoder, jsonPath, json));
6248 } else { 6180 } else {
6249 throw jsonDecoder.missingKey(jsonPath, "kinds"); 6181 throw jsonDecoder.mismatch(jsonPath, "contexts");
6250 } 6182 }
6251 return new EditGetAvailableRefactoringsResult(kinds); 6183 return new DiagnosticGetDiagnosticsResult(contexts);
6252 } else { 6184 } else {
6253 throw jsonDecoder.mismatch( 6185 throw jsonDecoder.mismatch(
6254 jsonPath, "edit.getAvailableRefactorings result", json); 6186 jsonPath, "diagnostic.getDiagnostics result", json);
6255 } 6187 }
6256 } 6188 }
6257 6189
6258 factory EditGetAvailableRefactoringsResult.fromResponse(Response response) { 6190 factory DiagnosticGetDiagnosticsResult.fromResponse(Response response) {
6259 return new EditGetAvailableRefactoringsResult.fromJson( 6191 return new DiagnosticGetDiagnosticsResult.fromJson(
6260 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), 6192 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
6261 "result", 6193 "result",
6262 response._result); 6194 response.result);
6263 } 6195 }
6264 6196
6197 @override
6265 Map<String, dynamic> toJson() { 6198 Map<String, dynamic> toJson() {
6266 Map<String, dynamic> result = {}; 6199 Map<String, dynamic> result = {};
6267 result["kinds"] = 6200 result["contexts"] =
6268 kinds.map((RefactoringKind value) => value.toJson()).toList(); 6201 contexts.map((ContextData value) => value.toJson()).toList();
6269 return result; 6202 return result;
6270 } 6203 }
6271 6204
6205 @override
6272 Response toResponse(String id) { 6206 Response toResponse(String id) {
6273 return new Response(id, result: toJson()); 6207 return new Response(id, result: toJson());
6274 } 6208 }
6275 6209
6276 @override 6210 @override
6277 String toString() => JSON.encode(toJson()); 6211 String toString() => JSON.encode(toJson());
6278 6212
6279 @override 6213 @override
6280 bool operator ==(other) { 6214 bool operator ==(other) {
6281 if (other is EditGetAvailableRefactoringsResult) { 6215 if (other is DiagnosticGetDiagnosticsResult) {
6282 return listEqual( 6216 return listEqual(
6283 kinds, other.kinds, (RefactoringKind a, RefactoringKind b) => a == b); 6217 contexts, other.contexts, (ContextData a, ContextData b) => a == b);
6284 } 6218 }
6285 return false; 6219 return false;
6286 } 6220 }
6287 6221
6288 @override 6222 @override
6289 int get hashCode { 6223 int get hashCode {
6290 int hash = 0; 6224 int hash = 0;
6291 hash = JenkinsSmiHash.combine(hash, kinds.hashCode); 6225 hash = JenkinsSmiHash.combine(hash, contexts.hashCode);
6292 return JenkinsSmiHash.finish(hash); 6226 return JenkinsSmiHash.finish(hash);
6293 } 6227 }
6294 } 6228 }
6295 6229
6296 /** 6230 /**
6297 * edit.getFixes params 6231 * diagnostic.getServerPort params
6232 *
6233 * Clients may not extend, implement or mix-in this class.
6234 */
6235 class DiagnosticGetServerPortParams implements RequestParams {
6236 @override
6237 Map<String, dynamic> toJson() => <String, dynamic>{};
6238
6239 @override
6240 Request toRequest(String id) {
6241 return new Request(id, "diagnostic.getServerPort", null);
6242 }
6243
6244 @override
6245 bool operator ==(other) {
6246 if (other is DiagnosticGetServerPortParams) {
6247 return true;
6248 }
6249 return false;
6250 }
6251
6252 @override
6253 int get hashCode {
6254 return 367508704;
6255 }
6256 }
6257
6258 /**
6259 * diagnostic.getServerPort result
6298 * 6260 *
6299 * { 6261 * {
6300 * "file": FilePath 6262 * "port": int
6301 * "offset": int
6302 * } 6263 * }
6303 * 6264 *
6304 * Clients may not extend, implement or mix-in this class. 6265 * Clients may not extend, implement or mix-in this class.
6305 */ 6266 */
6306 class EditGetFixesParams implements HasToJson { 6267 class DiagnosticGetServerPortResult implements ResponseResult {
6307 String _file; 6268 int _port;
6308
6309 int _offset;
6310 6269
6311 /** 6270 /**
6312 * The file containing the errors for which fixes are being requested. 6271 * The diagnostic server port.
6313 */ 6272 */
6314 String get file => _file; 6273 int get port => _port;
6315 6274
6316 /** 6275 /**
6317 * The file containing the errors for which fixes are being requested. 6276 * The diagnostic server port.
6318 */ 6277 */
6319 void set file(String value) { 6278 void set port(int value) {
6320 assert(value != null); 6279 assert(value != null);
6321 this._file = value; 6280 this._port = value;
6322 } 6281 }
6323 6282
6324 /** 6283 DiagnosticGetServerPortResult(int port) {
6325 * The offset used to select the errors for which fixes will be returned. 6284 this.port = port;
6326 */
6327 int get offset => _offset;
6328
6329 /**
6330 * The offset used to select the errors for which fixes will be returned.
6331 */
6332 void set offset(int value) {
6333 assert(value != null);
6334 this._offset = value;
6335 } 6285 }
6336 6286
6337 EditGetFixesParams(String file, int offset) { 6287 factory DiagnosticGetServerPortResult.fromJson(
6338 this.file = file;
6339 this.offset = offset;
6340 }
6341
6342 factory EditGetFixesParams.fromJson(
6343 JsonDecoder jsonDecoder, String jsonPath, Object json) { 6288 JsonDecoder jsonDecoder, String jsonPath, Object json) {
6344 if (json == null) { 6289 if (json == null) {
6345 json = {}; 6290 json = {};
6346 } 6291 }
6347 if (json is Map) { 6292 if (json is Map) {
6348 String file; 6293 int port;
6349 if (json.containsKey("file")) { 6294 if (json.containsKey("port")) {
6350 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 6295 port = jsonDecoder.decodeInt(jsonPath + ".port", json["port"]);
6351 } else { 6296 } else {
6352 throw jsonDecoder.missingKey(jsonPath, "file"); 6297 throw jsonDecoder.mismatch(jsonPath, "port");
6353 } 6298 }
6354 int offset; 6299 return new DiagnosticGetServerPortResult(port);
6355 if (json.containsKey("offset")) {
6356 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
6357 } else {
6358 throw jsonDecoder.missingKey(jsonPath, "offset");
6359 }
6360 return new EditGetFixesParams(file, offset);
6361 } else { 6300 } else {
6362 throw jsonDecoder.mismatch(jsonPath, "edit.getFixes params", json); 6301 throw jsonDecoder.mismatch(
6302 jsonPath, "diagnostic.getServerPort result", json);
6363 } 6303 }
6364 } 6304 }
6365 6305
6366 factory EditGetFixesParams.fromRequest(Request request) { 6306 factory DiagnosticGetServerPortResult.fromResponse(Response response) {
6367 return new EditGetFixesParams.fromJson( 6307 return new DiagnosticGetServerPortResult.fromJson(
6368 new RequestDecoder(request), "params", request._params); 6308 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
6309 "result",
6310 response.result);
6369 } 6311 }
6370 6312
6313 @override
6371 Map<String, dynamic> toJson() { 6314 Map<String, dynamic> toJson() {
6372 Map<String, dynamic> result = {}; 6315 Map<String, dynamic> result = {};
6373 result["file"] = file; 6316 result["port"] = port;
6374 result["offset"] = offset;
6375 return result; 6317 return result;
6376 } 6318 }
6377 6319
6378 Request toRequest(String id) { 6320 @override
6379 return new Request(id, "edit.getFixes", toJson()); 6321 Response toResponse(String id) {
6322 return new Response(id, result: toJson());
6380 } 6323 }
6381 6324
6382 @override 6325 @override
6383 String toString() => JSON.encode(toJson()); 6326 String toString() => JSON.encode(toJson());
6384 6327
6385 @override 6328 @override
6386 bool operator ==(other) { 6329 bool operator ==(other) {
6387 if (other is EditGetFixesParams) { 6330 if (other is DiagnosticGetServerPortResult) {
6388 return file == other.file && offset == other.offset; 6331 return port == other.port;
6389 } 6332 }
6390 return false; 6333 return false;
6391 } 6334 }
6392 6335
6393 @override 6336 @override
6394 int get hashCode { 6337 int get hashCode {
6395 int hash = 0; 6338 int hash = 0;
6396 hash = JenkinsSmiHash.combine(hash, file.hashCode); 6339 hash = JenkinsSmiHash.combine(hash, port.hashCode);
6397 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
6398 return JenkinsSmiHash.finish(hash); 6340 return JenkinsSmiHash.finish(hash);
6399 } 6341 }
6400 } 6342 }
6401 6343
6402 /** 6344 /**
6403 * edit.getFixes result 6345 * edit.format params
6404 * 6346 *
6405 * { 6347 * {
6406 * "fixes": List<AnalysisErrorFixes> 6348 * "file": FilePath
6349 * "selectionOffset": int
6350 * "selectionLength": int
6351 * "lineLength": optional int
6407 * } 6352 * }
6408 * 6353 *
6409 * Clients may not extend, implement or mix-in this class. 6354 * Clients may not extend, implement or mix-in this class.
6410 */ 6355 */
6411 class EditGetFixesResult implements HasToJson { 6356 class EditFormatParams implements RequestParams {
6412 List<AnalysisErrorFixes> _fixes; 6357 String _file;
6358
6359 int _selectionOffset;
6360
6361 int _selectionLength;
6362
6363 int _lineLength;
6413 6364
6414 /** 6365 /**
6415 * The fixes that are available for the errors at the given offset. 6366 * The file containing the code to be formatted.
6416 */ 6367 */
6417 List<AnalysisErrorFixes> get fixes => _fixes; 6368 String get file => _file;
6418 6369
6419 /** 6370 /**
6420 * The fixes that are available for the errors at the given offset. 6371 * The file containing the code to be formatted.
6421 */ 6372 */
6422 void set fixes(List<AnalysisErrorFixes> value) { 6373 void set file(String value) {
6423 assert(value != null); 6374 assert(value != null);
6424 this._fixes = value; 6375 this._file = value;
6425 } 6376 }
6426 6377
6427 EditGetFixesResult(List<AnalysisErrorFixes> fixes) { 6378 /**
6428 this.fixes = fixes; 6379 * The offset of the current selection in the file.
6380 */
6381 int get selectionOffset => _selectionOffset;
6382
6383 /**
6384 * The offset of the current selection in the file.
6385 */
6386 void set selectionOffset(int value) {
6387 assert(value != null);
6388 this._selectionOffset = value;
6429 } 6389 }
6430 6390
6431 factory EditGetFixesResult.fromJson( 6391 /**
6392 * The length of the current selection in the file.
6393 */
6394 int get selectionLength => _selectionLength;
6395
6396 /**
6397 * The length of the current selection in the file.
6398 */
6399 void set selectionLength(int value) {
6400 assert(value != null);
6401 this._selectionLength = value;
6402 }
6403
6404 /**
6405 * The line length to be used by the formatter.
6406 */
6407 int get lineLength => _lineLength;
6408
6409 /**
6410 * The line length to be used by the formatter.
6411 */
6412 void set lineLength(int value) {
6413 this._lineLength = value;
6414 }
6415
6416 EditFormatParams(String file, int selectionOffset, int selectionLength,
6417 {int lineLength}) {
6418 this.file = file;
6419 this.selectionOffset = selectionOffset;
6420 this.selectionLength = selectionLength;
6421 this.lineLength = lineLength;
6422 }
6423
6424 factory EditFormatParams.fromJson(
6432 JsonDecoder jsonDecoder, String jsonPath, Object json) { 6425 JsonDecoder jsonDecoder, String jsonPath, Object json) {
6433 if (json == null) { 6426 if (json == null) {
6434 json = {}; 6427 json = {};
6435 } 6428 }
6436 if (json is Map) { 6429 if (json is Map) {
6437 List<AnalysisErrorFixes> fixes; 6430 String file;
6438 if (json.containsKey("fixes")) { 6431 if (json.containsKey("file")) {
6439 fixes = jsonDecoder.decodeList( 6432 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
6440 jsonPath + ".fixes",
6441 json["fixes"],
6442 (String jsonPath, Object json) =>
6443 new AnalysisErrorFixes.fromJson(jsonDecoder, jsonPath, json));
6444 } else { 6433 } else {
6445 throw jsonDecoder.missingKey(jsonPath, "fixes"); 6434 throw jsonDecoder.mismatch(jsonPath, "file");
6446 } 6435 }
6447 return new EditGetFixesResult(fixes); 6436 int selectionOffset;
6437 if (json.containsKey("selectionOffset")) {
6438 selectionOffset = jsonDecoder.decodeInt(
6439 jsonPath + ".selectionOffset", json["selectionOffset"]);
6440 } else {
6441 throw jsonDecoder.mismatch(jsonPath, "selectionOffset");
6442 }
6443 int selectionLength;
6444 if (json.containsKey("selectionLength")) {
6445 selectionLength = jsonDecoder.decodeInt(
6446 jsonPath + ".selectionLength", json["selectionLength"]);
6447 } else {
6448 throw jsonDecoder.mismatch(jsonPath, "selectionLength");
6449 }
6450 int lineLength;
6451 if (json.containsKey("lineLength")) {
6452 lineLength =
6453 jsonDecoder.decodeInt(jsonPath + ".lineLength", json["lineLength"]);
6454 }
6455 return new EditFormatParams(file, selectionOffset, selectionLength,
6456 lineLength: lineLength);
6448 } else { 6457 } else {
6449 throw jsonDecoder.mismatch(jsonPath, "edit.getFixes result", json); 6458 throw jsonDecoder.mismatch(jsonPath, "edit.format params", json);
6450 } 6459 }
6451 } 6460 }
6452 6461
6453 factory EditGetFixesResult.fromResponse(Response response) { 6462 factory EditFormatParams.fromRequest(Request request) {
6454 return new EditGetFixesResult.fromJson( 6463 return new EditFormatParams.fromJson(
6455 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), 6464 new RequestDecoder(request), "params", request.params);
6456 "result",
6457 response._result);
6458 } 6465 }
6459 6466
6467 @override
6460 Map<String, dynamic> toJson() { 6468 Map<String, dynamic> toJson() {
6461 Map<String, dynamic> result = {}; 6469 Map<String, dynamic> result = {};
6462 result["fixes"] = 6470 result["file"] = file;
6463 fixes.map((AnalysisErrorFixes value) => value.toJson()).toList(); 6471 result["selectionOffset"] = selectionOffset;
6472 result["selectionLength"] = selectionLength;
6473 if (lineLength != null) {
6474 result["lineLength"] = lineLength;
6475 }
6464 return result; 6476 return result;
6465 } 6477 }
6466 6478
6467 Response toResponse(String id) { 6479 @override
6468 return new Response(id, result: toJson()); 6480 Request toRequest(String id) {
6481 return new Request(id, "edit.format", toJson());
6469 } 6482 }
6470 6483
6471 @override 6484 @override
6472 String toString() => JSON.encode(toJson()); 6485 String toString() => JSON.encode(toJson());
6473 6486
6474 @override 6487 @override
6475 bool operator ==(other) { 6488 bool operator ==(other) {
6476 if (other is EditGetFixesResult) { 6489 if (other is EditFormatParams) {
6477 return listEqual(fixes, other.fixes, 6490 return file == other.file &&
6478 (AnalysisErrorFixes a, AnalysisErrorFixes b) => a == b); 6491 selectionOffset == other.selectionOffset &&
6492 selectionLength == other.selectionLength &&
6493 lineLength == other.lineLength;
6479 } 6494 }
6480 return false; 6495 return false;
6481 } 6496 }
6482 6497
6483 @override 6498 @override
6484 int get hashCode { 6499 int get hashCode {
6485 int hash = 0; 6500 int hash = 0;
6486 hash = JenkinsSmiHash.combine(hash, fixes.hashCode); 6501 hash = JenkinsSmiHash.combine(hash, file.hashCode);
6502 hash = JenkinsSmiHash.combine(hash, selectionOffset.hashCode);
6503 hash = JenkinsSmiHash.combine(hash, selectionLength.hashCode);
6504 hash = JenkinsSmiHash.combine(hash, lineLength.hashCode);
6487 return JenkinsSmiHash.finish(hash); 6505 return JenkinsSmiHash.finish(hash);
6488 } 6506 }
6489 } 6507 }
6490 6508
6491 /** 6509 /**
6492 * edit.getRefactoring params 6510 * edit.format result
6493 * 6511 *
6494 * { 6512 * {
6495 * "kind": RefactoringKind 6513 * "edits": List<SourceEdit>
6514 * "selectionOffset": int
6515 * "selectionLength": int
6516 * }
6517 *
6518 * Clients may not extend, implement or mix-in this class.
6519 */
6520 class EditFormatResult implements ResponseResult {
6521 List<SourceEdit> _edits;
6522
6523 int _selectionOffset;
6524
6525 int _selectionLength;
6526
6527 /**
6528 * The edit(s) to be applied in order to format the code. The list will be
6529 * empty if the code was already formatted (there are no changes).
6530 */
6531 List<SourceEdit> get edits => _edits;
6532
6533 /**
6534 * The edit(s) to be applied in order to format the code. The list will be
6535 * empty if the code was already formatted (there are no changes).
6536 */
6537 void set edits(List<SourceEdit> value) {
6538 assert(value != null);
6539 this._edits = value;
6540 }
6541
6542 /**
6543 * The offset of the selection after formatting the code.
6544 */
6545 int get selectionOffset => _selectionOffset;
6546
6547 /**
6548 * The offset of the selection after formatting the code.
6549 */
6550 void set selectionOffset(int value) {
6551 assert(value != null);
6552 this._selectionOffset = value;
6553 }
6554
6555 /**
6556 * The length of the selection after formatting the code.
6557 */
6558 int get selectionLength => _selectionLength;
6559
6560 /**
6561 * The length of the selection after formatting the code.
6562 */
6563 void set selectionLength(int value) {
6564 assert(value != null);
6565 this._selectionLength = value;
6566 }
6567
6568 EditFormatResult(
6569 List<SourceEdit> edits, int selectionOffset, int selectionLength) {
6570 this.edits = edits;
6571 this.selectionOffset = selectionOffset;
6572 this.selectionLength = selectionLength;
6573 }
6574
6575 factory EditFormatResult.fromJson(
6576 JsonDecoder jsonDecoder, String jsonPath, Object json) {
6577 if (json == null) {
6578 json = {};
6579 }
6580 if (json is Map) {
6581 List<SourceEdit> edits;
6582 if (json.containsKey("edits")) {
6583 edits = jsonDecoder.decodeList(
6584 jsonPath + ".edits",
6585 json["edits"],
6586 (String jsonPath, Object json) =>
6587 new SourceEdit.fromJson(jsonDecoder, jsonPath, json));
6588 } else {
6589 throw jsonDecoder.mismatch(jsonPath, "edits");
6590 }
6591 int selectionOffset;
6592 if (json.containsKey("selectionOffset")) {
6593 selectionOffset = jsonDecoder.decodeInt(
6594 jsonPath + ".selectionOffset", json["selectionOffset"]);
6595 } else {
6596 throw jsonDecoder.mismatch(jsonPath, "selectionOffset");
6597 }
6598 int selectionLength;
6599 if (json.containsKey("selectionLength")) {
6600 selectionLength = jsonDecoder.decodeInt(
6601 jsonPath + ".selectionLength", json["selectionLength"]);
6602 } else {
6603 throw jsonDecoder.mismatch(jsonPath, "selectionLength");
6604 }
6605 return new EditFormatResult(edits, selectionOffset, selectionLength);
6606 } else {
6607 throw jsonDecoder.mismatch(jsonPath, "edit.format result", json);
6608 }
6609 }
6610
6611 factory EditFormatResult.fromResponse(Response response) {
6612 return new EditFormatResult.fromJson(
6613 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
6614 "result",
6615 response.result);
6616 }
6617
6618 @override
6619 Map<String, dynamic> toJson() {
6620 Map<String, dynamic> result = {};
6621 result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList();
6622 result["selectionOffset"] = selectionOffset;
6623 result["selectionLength"] = selectionLength;
6624 return result;
6625 }
6626
6627 @override
6628 Response toResponse(String id) {
6629 return new Response(id, result: toJson());
6630 }
6631
6632 @override
6633 String toString() => JSON.encode(toJson());
6634
6635 @override
6636 bool operator ==(other) {
6637 if (other is EditFormatResult) {
6638 return listEqual(
6639 edits, other.edits, (SourceEdit a, SourceEdit b) => a == b) &&
6640 selectionOffset == other.selectionOffset &&
6641 selectionLength == other.selectionLength;
6642 }
6643 return false;
6644 }
6645
6646 @override
6647 int get hashCode {
6648 int hash = 0;
6649 hash = JenkinsSmiHash.combine(hash, edits.hashCode);
6650 hash = JenkinsSmiHash.combine(hash, selectionOffset.hashCode);
6651 hash = JenkinsSmiHash.combine(hash, selectionLength.hashCode);
6652 return JenkinsSmiHash.finish(hash);
6653 }
6654 }
6655
6656 /**
6657 * edit.getAssists params
6658 *
6659 * {
6496 * "file": FilePath 6660 * "file": FilePath
6497 * "offset": int 6661 * "offset": int
6498 * "length": int 6662 * "length": int
6499 * "validateOnly": bool
6500 * "options": optional RefactoringOptions
6501 * } 6663 * }
6502 * 6664 *
6503 * Clients may not extend, implement or mix-in this class. 6665 * Clients may not extend, implement or mix-in this class.
6504 */ 6666 */
6505 class EditGetRefactoringParams implements HasToJson { 6667 class EditGetAssistsParams implements RequestParams {
6506 RefactoringKind _kind;
6507
6508 String _file; 6668 String _file;
6509 6669
6510 int _offset; 6670 int _offset;
6511 6671
6512 int _length; 6672 int _length;
6513 6673
6514 bool _validateOnly; 6674 /**
6515 6675 * The file containing the code for which assists are being requested.
6516 RefactoringOptions _options;
6517
6518 /**
6519 * The kind of refactoring to be performed.
6520 */
6521 RefactoringKind get kind => _kind;
6522
6523 /**
6524 * The kind of refactoring to be performed.
6525 */
6526 void set kind(RefactoringKind value) {
6527 assert(value != null);
6528 this._kind = value;
6529 }
6530
6531 /**
6532 * The file containing the code involved in the refactoring.
6533 */ 6676 */
6534 String get file => _file; 6677 String get file => _file;
6535 6678
6536 /** 6679 /**
6537 * The file containing the code involved in the refactoring. 6680 * The file containing the code for which assists are being requested.
6538 */ 6681 */
6539 void set file(String value) { 6682 void set file(String value) {
6540 assert(value != null); 6683 assert(value != null);
6541 this._file = value; 6684 this._file = value;
6542 } 6685 }
6543 6686
6544 /** 6687 /**
6545 * The offset of the region involved in the refactoring. 6688 * The offset of the code for which assists are being requested.
6546 */ 6689 */
6547 int get offset => _offset; 6690 int get offset => _offset;
6548 6691
6549 /** 6692 /**
6550 * The offset of the region involved in the refactoring. 6693 * The offset of the code for which assists are being requested.
6551 */ 6694 */
6552 void set offset(int value) { 6695 void set offset(int value) {
6553 assert(value != null); 6696 assert(value != null);
6554 this._offset = value; 6697 this._offset = value;
6555 } 6698 }
6556 6699
6557 /** 6700 /**
6558 * The length of the region involved in the refactoring. 6701 * The length of the code for which assists are being requested.
6559 */ 6702 */
6560 int get length => _length; 6703 int get length => _length;
6561 6704
6562 /** 6705 /**
6563 * The length of the region involved in the refactoring. 6706 * The length of the code for which assists are being requested.
6564 */ 6707 */
6565 void set length(int value) { 6708 void set length(int value) {
6566 assert(value != null); 6709 assert(value != null);
6567 this._length = value; 6710 this._length = value;
6568 } 6711 }
6569 6712
6570 /** 6713 EditGetAssistsParams(String file, int offset, int length) {
6571 * True if the client is only requesting that the values of the options be
6572 * validated and no change be generated.
6573 */
6574 bool get validateOnly => _validateOnly;
6575
6576 /**
6577 * True if the client is only requesting that the values of the options be
6578 * validated and no change be generated.
6579 */
6580 void set validateOnly(bool value) {
6581 assert(value != null);
6582 this._validateOnly = value;
6583 }
6584
6585 /**
6586 * Data used to provide values provided by the user. The structure of the
6587 * data is dependent on the kind of refactoring being performed. The data
6588 * that is expected is documented in the section titled Refactorings, labeled
6589 * as "Options". This field can be omitted if the refactoring does not
6590 * require any options or if the values of those options are not known.
6591 */
6592 RefactoringOptions get options => _options;
6593
6594 /**
6595 * Data used to provide values provided by the user. The structure of the
6596 * data is dependent on the kind of refactoring being performed. The data
6597 * that is expected is documented in the section titled Refactorings, labeled
6598 * as "Options". This field can be omitted if the refactoring does not
6599 * require any options or if the values of those options are not known.
6600 */
6601 void set options(RefactoringOptions value) {
6602 this._options = value;
6603 }
6604
6605 EditGetRefactoringParams(RefactoringKind kind, String file, int offset,
6606 int length, bool validateOnly,
6607 {RefactoringOptions options}) {
6608 this.kind = kind;
6609 this.file = file; 6714 this.file = file;
6610 this.offset = offset; 6715 this.offset = offset;
6611 this.length = length; 6716 this.length = length;
6612 this.validateOnly = validateOnly; 6717 }
6613 this.options = options; 6718
6614 } 6719 factory EditGetAssistsParams.fromJson(
6615
6616 factory EditGetRefactoringParams.fromJson(
6617 JsonDecoder jsonDecoder, String jsonPath, Object json) { 6720 JsonDecoder jsonDecoder, String jsonPath, Object json) {
6618 if (json == null) { 6721 if (json == null) {
6619 json = {}; 6722 json = {};
6620 } 6723 }
6621 if (json is Map) { 6724 if (json is Map) {
6622 RefactoringKind kind;
6623 if (json.containsKey("kind")) {
6624 kind = new RefactoringKind.fromJson(
6625 jsonDecoder, jsonPath + ".kind", json["kind"]);
6626 } else {
6627 throw jsonDecoder.missingKey(jsonPath, "kind");
6628 }
6629 String file; 6725 String file;
6630 if (json.containsKey("file")) { 6726 if (json.containsKey("file")) {
6631 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 6727 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
6632 } else { 6728 } else {
6633 throw jsonDecoder.missingKey(jsonPath, "file"); 6729 throw jsonDecoder.mismatch(jsonPath, "file");
6634 } 6730 }
6635 int offset; 6731 int offset;
6636 if (json.containsKey("offset")) { 6732 if (json.containsKey("offset")) {
6637 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 6733 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
6638 } else { 6734 } else {
6639 throw jsonDecoder.missingKey(jsonPath, "offset"); 6735 throw jsonDecoder.mismatch(jsonPath, "offset");
6640 } 6736 }
6641 int length; 6737 int length;
6642 if (json.containsKey("length")) { 6738 if (json.containsKey("length")) {
6643 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); 6739 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
6644 } else { 6740 } else {
6645 throw jsonDecoder.missingKey(jsonPath, "length"); 6741 throw jsonDecoder.mismatch(jsonPath, "length");
6646 } 6742 }
6647 bool validateOnly; 6743 return new EditGetAssistsParams(file, offset, length);
6648 if (json.containsKey("validateOnly")) {
6649 validateOnly = jsonDecoder.decodeBool(
6650 jsonPath + ".validateOnly", json["validateOnly"]);
6651 } else {
6652 throw jsonDecoder.missingKey(jsonPath, "validateOnly");
6653 }
6654 RefactoringOptions options;
6655 if (json.containsKey("options")) {
6656 options = new RefactoringOptions.fromJson(
6657 jsonDecoder, jsonPath + ".options", json["options"], kind);
6658 }
6659 return new EditGetRefactoringParams(
6660 kind, file, offset, length, validateOnly,
6661 options: options);
6662 } else { 6744 } else {
6663 throw jsonDecoder.mismatch(jsonPath, "edit.getRefactoring params", json); 6745 throw jsonDecoder.mismatch(jsonPath, "edit.getAssists params", json);
6664 } 6746 }
6665 } 6747 }
6666 6748
6667 factory EditGetRefactoringParams.fromRequest(Request request) { 6749 factory EditGetAssistsParams.fromRequest(Request request) {
6668 var params = new EditGetRefactoringParams.fromJson( 6750 return new EditGetAssistsParams.fromJson(
6669 new RequestDecoder(request), "params", request._params); 6751 new RequestDecoder(request), "params", request.params);
6670 REQUEST_ID_REFACTORING_KINDS[request.id] = params.kind; 6752 }
6671 return params; 6753
6672 } 6754 @override
6673
6674 Map<String, dynamic> toJson() { 6755 Map<String, dynamic> toJson() {
6675 Map<String, dynamic> result = {}; 6756 Map<String, dynamic> result = {};
6676 result["kind"] = kind.toJson();
6677 result["file"] = file; 6757 result["file"] = file;
6678 result["offset"] = offset; 6758 result["offset"] = offset;
6679 result["length"] = length; 6759 result["length"] = length;
6680 result["validateOnly"] = validateOnly;
6681 if (options != null) {
6682 result["options"] = options.toJson();
6683 }
6684 return result; 6760 return result;
6685 } 6761 }
6686 6762
6763 @override
6687 Request toRequest(String id) { 6764 Request toRequest(String id) {
6688 return new Request(id, "edit.getRefactoring", toJson()); 6765 return new Request(id, "edit.getAssists", toJson());
6689 } 6766 }
6690 6767
6691 @override 6768 @override
6692 String toString() => JSON.encode(toJson()); 6769 String toString() => JSON.encode(toJson());
6693 6770
6694 @override 6771 @override
6695 bool operator ==(other) { 6772 bool operator ==(other) {
6696 if (other is EditGetRefactoringParams) { 6773 if (other is EditGetAssistsParams) {
6697 return kind == other.kind && 6774 return file == other.file &&
6698 file == other.file &&
6699 offset == other.offset && 6775 offset == other.offset &&
6700 length == other.length && 6776 length == other.length;
6701 validateOnly == other.validateOnly &&
6702 options == other.options;
6703 } 6777 }
6704 return false; 6778 return false;
6705 } 6779 }
6706 6780
6707 @override 6781 @override
6708 int get hashCode { 6782 int get hashCode {
6709 int hash = 0; 6783 int hash = 0;
6710 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
6711 hash = JenkinsSmiHash.combine(hash, file.hashCode); 6784 hash = JenkinsSmiHash.combine(hash, file.hashCode);
6712 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 6785 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
6713 hash = JenkinsSmiHash.combine(hash, length.hashCode); 6786 hash = JenkinsSmiHash.combine(hash, length.hashCode);
6714 hash = JenkinsSmiHash.combine(hash, validateOnly.hashCode);
6715 hash = JenkinsSmiHash.combine(hash, options.hashCode);
6716 return JenkinsSmiHash.finish(hash); 6787 return JenkinsSmiHash.finish(hash);
6717 } 6788 }
6718 } 6789 }
6719 6790
6720 /** 6791 /**
6721 * edit.getRefactoring result 6792 * edit.getAssists result
6722 * 6793 *
6723 * { 6794 * {
6724 * "initialProblems": List<RefactoringProblem> 6795 * "assists": List<SourceChange>
6725 * "optionsProblems": List<RefactoringProblem>
6726 * "finalProblems": List<RefactoringProblem>
6727 * "feedback": optional RefactoringFeedback
6728 * "change": optional SourceChange
6729 * "potentialEdits": optional List<String>
6730 * } 6796 * }
6731 * 6797 *
6732 * Clients may not extend, implement or mix-in this class. 6798 * Clients may not extend, implement or mix-in this class.
6733 */ 6799 */
6734 class EditGetRefactoringResult implements HasToJson { 6800 class EditGetAssistsResult implements ResponseResult {
6735 List<RefactoringProblem> _initialProblems; 6801 List<SourceChange> _assists;
6736
6737 List<RefactoringProblem> _optionsProblems;
6738
6739 List<RefactoringProblem> _finalProblems;
6740
6741 RefactoringFeedback _feedback;
6742
6743 SourceChange _change;
6744
6745 List<String> _potentialEdits;
6746 6802
6747 /** 6803 /**
6748 * The initial status of the refactoring, i.e. problems related to the 6804 * The assists that are available at the given location.
6749 * context in which the refactoring is requested. The array will be empty if
6750 * there are no known problems.
6751 */ 6805 */
6752 List<RefactoringProblem> get initialProblems => _initialProblems; 6806 List<SourceChange> get assists => _assists;
6753 6807
6754 /** 6808 /**
6755 * The initial status of the refactoring, i.e. problems related to the 6809 * The assists that are available at the given location.
6756 * context in which the refactoring is requested. The array will be empty if
6757 * there are no known problems.
6758 */ 6810 */
6759 void set initialProblems(List<RefactoringProblem> value) { 6811 void set assists(List<SourceChange> value) {
6760 assert(value != null); 6812 assert(value != null);
6761 this._initialProblems = value; 6813 this._assists = value;
6762 } 6814 }
6763 6815
6764 /** 6816 EditGetAssistsResult(List<SourceChange> assists) {
6765 * The options validation status, i.e. problems in the given options, such as 6817 this.assists = assists;
6766 * light-weight validation of a new name, flags compatibility, etc. The array
6767 * will be empty if there are no known problems.
6768 */
6769 List<RefactoringProblem> get optionsProblems => _optionsProblems;
6770
6771 /**
6772 * The options validation status, i.e. problems in the given options, such as
6773 * light-weight validation of a new name, flags compatibility, etc. The array
6774 * will be empty if there are no known problems.
6775 */
6776 void set optionsProblems(List<RefactoringProblem> value) {
6777 assert(value != null);
6778 this._optionsProblems = value;
6779 } 6818 }
6780 6819
6781 /** 6820 factory EditGetAssistsResult.fromJson(
6782 * The final status of the refactoring, i.e. problems identified in the
6783 * result of a full, potentially expensive validation and / or change
6784 * creation. The array will be empty if there are no known problems.
6785 */
6786 List<RefactoringProblem> get finalProblems => _finalProblems;
6787
6788 /**
6789 * The final status of the refactoring, i.e. problems identified in the
6790 * result of a full, potentially expensive validation and / or change
6791 * creation. The array will be empty if there are no known problems.
6792 */
6793 void set finalProblems(List<RefactoringProblem> value) {
6794 assert(value != null);
6795 this._finalProblems = value;
6796 }
6797
6798 /**
6799 * Data used to provide feedback to the user. The structure of the data is
6800 * dependent on the kind of refactoring being created. The data that is
6801 * returned is documented in the section titled Refactorings, labeled as
6802 * "Feedback".
6803 */
6804 RefactoringFeedback get feedback => _feedback;
6805
6806 /**
6807 * Data used to provide feedback to the user. The structure of the data is
6808 * dependent on the kind of refactoring being created. The data that is
6809 * returned is documented in the section titled Refactorings, labeled as
6810 * "Feedback".
6811 */
6812 void set feedback(RefactoringFeedback value) {
6813 this._feedback = value;
6814 }
6815
6816 /**
6817 * The changes that are to be applied to affect the refactoring. This field
6818 * will be omitted if there are problems that prevent a set of changes from
6819 * being computed, such as having no options specified for a refactoring that
6820 * requires them, or if only validation was requested.
6821 */
6822 SourceChange get change => _change;
6823
6824 /**
6825 * The changes that are to be applied to affect the refactoring. This field
6826 * will be omitted if there are problems that prevent a set of changes from
6827 * being computed, such as having no options specified for a refactoring that
6828 * requires them, or if only validation was requested.
6829 */
6830 void set change(SourceChange value) {
6831 this._change = value;
6832 }
6833
6834 /**
6835 * The ids of source edits that are not known to be valid. An edit is not
6836 * known to be valid if there was insufficient type information for the
6837 * server to be able to determine whether or not the code needs to be
6838 * modified, such as when a member is being renamed and there is a reference
6839 * to a member from an unknown type. This field will be omitted if the change
6840 * field is omitted or if there are no potential edits for the refactoring.
6841 */
6842 List<String> get potentialEdits => _potentialEdits;
6843
6844 /**
6845 * The ids of source edits that are not known to be valid. An edit is not
6846 * known to be valid if there was insufficient type information for the
6847 * server to be able to determine whether or not the code needs to be
6848 * modified, such as when a member is being renamed and there is a reference
6849 * to a member from an unknown type. This field will be omitted if the change
6850 * field is omitted or if there are no potential edits for the refactoring.
6851 */
6852 void set potentialEdits(List<String> value) {
6853 this._potentialEdits = value;
6854 }
6855
6856 EditGetRefactoringResult(
6857 List<RefactoringProblem> initialProblems,
6858 List<RefactoringProblem> optionsProblems,
6859 List<RefactoringProblem> finalProblems,
6860 {RefactoringFeedback feedback,
6861 SourceChange change,
6862 List<String> potentialEdits}) {
6863 this.initialProblems = initialProblems;
6864 this.optionsProblems = optionsProblems;
6865 this.finalProblems = finalProblems;
6866 this.feedback = feedback;
6867 this.change = change;
6868 this.potentialEdits = potentialEdits;
6869 }
6870
6871 factory EditGetRefactoringResult.fromJson(
6872 JsonDecoder jsonDecoder, String jsonPath, Object json) { 6821 JsonDecoder jsonDecoder, String jsonPath, Object json) {
6873 if (json == null) { 6822 if (json == null) {
6874 json = {}; 6823 json = {};
6875 } 6824 }
6876 if (json is Map) { 6825 if (json is Map) {
6877 List<RefactoringProblem> initialProblems; 6826 List<SourceChange> assists;
6878 if (json.containsKey("initialProblems")) { 6827 if (json.containsKey("assists")) {
6879 initialProblems = jsonDecoder.decodeList( 6828 assists = jsonDecoder.decodeList(
6880 jsonPath + ".initialProblems", 6829 jsonPath + ".assists",
6881 json["initialProblems"], 6830 json["assists"],
6882 (String jsonPath, Object json) => 6831 (String jsonPath, Object json) =>
6883 new RefactoringProblem.fromJson(jsonDecoder, jsonPath, json)); 6832 new SourceChange.fromJson(jsonDecoder, jsonPath, json));
6884 } else { 6833 } else {
6885 throw jsonDecoder.missingKey(jsonPath, "initialProblems"); 6834 throw jsonDecoder.mismatch(jsonPath, "assists");
6886 } 6835 }
6887 List<RefactoringProblem> optionsProblems; 6836 return new EditGetAssistsResult(assists);
6888 if (json.containsKey("optionsProblems")) {
6889 optionsProblems = jsonDecoder.decodeList(
6890 jsonPath + ".optionsProblems",
6891 json["optionsProblems"],
6892 (String jsonPath, Object json) =>
6893 new RefactoringProblem.fromJson(jsonDecoder, jsonPath, json));
6894 } else {
6895 throw jsonDecoder.missingKey(jsonPath, "optionsProblems");
6896 }
6897 List<RefactoringProblem> finalProblems;
6898 if (json.containsKey("finalProblems")) {
6899 finalProblems = jsonDecoder.decodeList(
6900 jsonPath + ".finalProblems",
6901 json["finalProblems"],
6902 (String jsonPath, Object json) =>
6903 new RefactoringProblem.fromJson(jsonDecoder, jsonPath, json));
6904 } else {
6905 throw jsonDecoder.missingKey(jsonPath, "finalProblems");
6906 }
6907 RefactoringFeedback feedback;
6908 if (json.containsKey("feedback")) {
6909 feedback = new RefactoringFeedback.fromJson(
6910 jsonDecoder, jsonPath + ".feedback", json["feedback"], json);
6911 }
6912 SourceChange change;
6913 if (json.containsKey("change")) {
6914 change = new SourceChange.fromJson(
6915 jsonDecoder, jsonPath + ".change", json["change"]);
6916 }
6917 List<String> potentialEdits;
6918 if (json.containsKey("potentialEdits")) {
6919 potentialEdits = jsonDecoder.decodeList(jsonPath + ".potentialEdits",
6920 json["potentialEdits"], jsonDecoder.decodeString);
6921 }
6922 return new EditGetRefactoringResult(
6923 initialProblems, optionsProblems, finalProblems,
6924 feedback: feedback, change: change, potentialEdits: potentialEdits);
6925 } else { 6837 } else {
6926 throw jsonDecoder.mismatch(jsonPath, "edit.getRefactoring result", json); 6838 throw jsonDecoder.mismatch(jsonPath, "edit.getAssists result", json);
6927 } 6839 }
6928 } 6840 }
6929 6841
6930 factory EditGetRefactoringResult.fromResponse(Response response) { 6842 factory EditGetAssistsResult.fromResponse(Response response) {
6931 return new EditGetRefactoringResult.fromJson( 6843 return new EditGetAssistsResult.fromJson(
6932 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), 6844 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
6933 "result", 6845 "result",
6934 response._result); 6846 response.result);
6935 } 6847 }
6936 6848
6849 @override
6937 Map<String, dynamic> toJson() { 6850 Map<String, dynamic> toJson() {
6938 Map<String, dynamic> result = {}; 6851 Map<String, dynamic> result = {};
6939 result["initialProblems"] = initialProblems 6852 result["assists"] =
6940 .map((RefactoringProblem value) => value.toJson()) 6853 assists.map((SourceChange value) => value.toJson()).toList();
6941 .toList();
6942 result["optionsProblems"] = optionsProblems
6943 .map((RefactoringProblem value) => value.toJson())
6944 .toList();
6945 result["finalProblems"] = finalProblems
6946 .map((RefactoringProblem value) => value.toJson())
6947 .toList();
6948 if (feedback != null) {
6949 result["feedback"] = feedback.toJson();
6950 }
6951 if (change != null) {
6952 result["change"] = change.toJson();
6953 }
6954 if (potentialEdits != null) {
6955 result["potentialEdits"] = potentialEdits;
6956 }
6957 return result; 6854 return result;
6958 } 6855 }
6959 6856
6857 @override
6960 Response toResponse(String id) { 6858 Response toResponse(String id) {
6961 return new Response(id, result: toJson()); 6859 return new Response(id, result: toJson());
6962 } 6860 }
6963 6861
6964 @override 6862 @override
6965 String toString() => JSON.encode(toJson()); 6863 String toString() => JSON.encode(toJson());
6966 6864
6967 @override 6865 @override
6968 bool operator ==(other) { 6866 bool operator ==(other) {
6969 if (other is EditGetRefactoringResult) { 6867 if (other is EditGetAssistsResult) {
6970 return listEqual(initialProblems, other.initialProblems, 6868 return listEqual(
6971 (RefactoringProblem a, RefactoringProblem b) => a == b) && 6869 assists, other.assists, (SourceChange a, SourceChange b) => a == b);
6972 listEqual(optionsProblems, other.optionsProblems,
6973 (RefactoringProblem a, RefactoringProblem b) => a == b) &&
6974 listEqual(finalProblems, other.finalProblems,
6975 (RefactoringProblem a, RefactoringProblem b) => a == b) &&
6976 feedback == other.feedback &&
6977 change == other.change &&
6978 listEqual(potentialEdits, other.potentialEdits,
6979 (String a, String b) => a == b);
6980 } 6870 }
6981 return false; 6871 return false;
6982 } 6872 }
6983 6873
6984 @override 6874 @override
6985 int get hashCode { 6875 int get hashCode {
6986 int hash = 0; 6876 int hash = 0;
6987 hash = JenkinsSmiHash.combine(hash, initialProblems.hashCode); 6877 hash = JenkinsSmiHash.combine(hash, assists.hashCode);
6988 hash = JenkinsSmiHash.combine(hash, optionsProblems.hashCode);
6989 hash = JenkinsSmiHash.combine(hash, finalProblems.hashCode);
6990 hash = JenkinsSmiHash.combine(hash, feedback.hashCode);
6991 hash = JenkinsSmiHash.combine(hash, change.hashCode);
6992 hash = JenkinsSmiHash.combine(hash, potentialEdits.hashCode);
6993 return JenkinsSmiHash.finish(hash); 6878 return JenkinsSmiHash.finish(hash);
6994 } 6879 }
6995 } 6880 }
6996 6881
6997 /** 6882 /**
6998 * edit.getStatementCompletion params 6883 * edit.getAvailableRefactorings params
6999 * 6884 *
7000 * { 6885 * {
7001 * "file": FilePath 6886 * "file": FilePath
7002 * "offset": int 6887 * "offset": int
6888 * "length": int
7003 * } 6889 * }
7004 * 6890 *
7005 * Clients may not extend, implement or mix-in this class. 6891 * Clients may not extend, implement or mix-in this class.
7006 */ 6892 */
7007 class EditGetStatementCompletionParams implements HasToJson { 6893 class EditGetAvailableRefactoringsParams implements RequestParams {
7008 String _file; 6894 String _file;
7009 6895
7010 int _offset; 6896 int _offset;
7011 6897
6898 int _length;
6899
7012 /** 6900 /**
7013 * The file containing the statement to be completed. 6901 * The file containing the code on which the refactoring would be based.
7014 */ 6902 */
7015 String get file => _file; 6903 String get file => _file;
7016 6904
7017 /** 6905 /**
7018 * The file containing the statement to be completed. 6906 * The file containing the code on which the refactoring would be based.
7019 */ 6907 */
7020 void set file(String value) { 6908 void set file(String value) {
7021 assert(value != null); 6909 assert(value != null);
7022 this._file = value; 6910 this._file = value;
7023 } 6911 }
7024 6912
7025 /** 6913 /**
7026 * The offset used to identify the statement to be completed. 6914 * The offset of the code on which the refactoring would be based.
7027 */ 6915 */
7028 int get offset => _offset; 6916 int get offset => _offset;
7029 6917
7030 /** 6918 /**
7031 * The offset used to identify the statement to be completed. 6919 * The offset of the code on which the refactoring would be based.
7032 */ 6920 */
7033 void set offset(int value) { 6921 void set offset(int value) {
7034 assert(value != null); 6922 assert(value != null);
7035 this._offset = value; 6923 this._offset = value;
7036 } 6924 }
7037 6925
7038 EditGetStatementCompletionParams(String file, int offset) { 6926 /**
6927 * The length of the code on which the refactoring would be based.
6928 */
6929 int get length => _length;
6930
6931 /**
6932 * The length of the code on which the refactoring would be based.
6933 */
6934 void set length(int value) {
6935 assert(value != null);
6936 this._length = value;
6937 }
6938
6939 EditGetAvailableRefactoringsParams(String file, int offset, int length) {
7039 this.file = file; 6940 this.file = file;
7040 this.offset = offset; 6941 this.offset = offset;
6942 this.length = length;
7041 } 6943 }
7042 6944
7043 factory EditGetStatementCompletionParams.fromJson( 6945 factory EditGetAvailableRefactoringsParams.fromJson(
7044 JsonDecoder jsonDecoder, String jsonPath, Object json) { 6946 JsonDecoder jsonDecoder, String jsonPath, Object json) {
7045 if (json == null) { 6947 if (json == null) {
7046 json = {}; 6948 json = {};
7047 } 6949 }
7048 if (json is Map) { 6950 if (json is Map) {
7049 String file; 6951 String file;
7050 if (json.containsKey("file")) { 6952 if (json.containsKey("file")) {
7051 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 6953 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
7052 } else { 6954 } else {
7053 throw jsonDecoder.missingKey(jsonPath, "file"); 6955 throw jsonDecoder.mismatch(jsonPath, "file");
7054 } 6956 }
7055 int offset; 6957 int offset;
7056 if (json.containsKey("offset")) { 6958 if (json.containsKey("offset")) {
7057 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 6959 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
7058 } else { 6960 } else {
7059 throw jsonDecoder.missingKey(jsonPath, "offset"); 6961 throw jsonDecoder.mismatch(jsonPath, "offset");
7060 } 6962 }
7061 return new EditGetStatementCompletionParams(file, offset); 6963 int length;
6964 if (json.containsKey("length")) {
6965 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
6966 } else {
6967 throw jsonDecoder.mismatch(jsonPath, "length");
6968 }
6969 return new EditGetAvailableRefactoringsParams(file, offset, length);
7062 } else { 6970 } else {
7063 throw jsonDecoder.mismatch( 6971 throw jsonDecoder.mismatch(
7064 jsonPath, "edit.getStatementCompletion params", json); 6972 jsonPath, "edit.getAvailableRefactorings params", json);
7065 } 6973 }
7066 } 6974 }
7067 6975
7068 factory EditGetStatementCompletionParams.fromRequest(Request request) { 6976 factory EditGetAvailableRefactoringsParams.fromRequest(Request request) {
7069 return new EditGetStatementCompletionParams.fromJson( 6977 return new EditGetAvailableRefactoringsParams.fromJson(
7070 new RequestDecoder(request), "params", request._params); 6978 new RequestDecoder(request), "params", request.params);
7071 } 6979 }
7072 6980
6981 @override
7073 Map<String, dynamic> toJson() { 6982 Map<String, dynamic> toJson() {
7074 Map<String, dynamic> result = {}; 6983 Map<String, dynamic> result = {};
7075 result["file"] = file; 6984 result["file"] = file;
7076 result["offset"] = offset; 6985 result["offset"] = offset;
6986 result["length"] = length;
7077 return result; 6987 return result;
7078 } 6988 }
7079 6989
6990 @override
7080 Request toRequest(String id) { 6991 Request toRequest(String id) {
7081 return new Request(id, "edit.getStatementCompletion", toJson()); 6992 return new Request(id, "edit.getAvailableRefactorings", toJson());
7082 } 6993 }
7083 6994
7084 @override 6995 @override
7085 String toString() => JSON.encode(toJson()); 6996 String toString() => JSON.encode(toJson());
7086 6997
7087 @override 6998 @override
7088 bool operator ==(other) { 6999 bool operator ==(other) {
7089 if (other is EditGetStatementCompletionParams) { 7000 if (other is EditGetAvailableRefactoringsParams) {
7090 return file == other.file && offset == other.offset; 7001 return file == other.file &&
7002 offset == other.offset &&
7003 length == other.length;
7091 } 7004 }
7092 return false; 7005 return false;
7093 } 7006 }
7094 7007
7095 @override 7008 @override
7096 int get hashCode { 7009 int get hashCode {
7097 int hash = 0; 7010 int hash = 0;
7098 hash = JenkinsSmiHash.combine(hash, file.hashCode); 7011 hash = JenkinsSmiHash.combine(hash, file.hashCode);
7099 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 7012 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
7013 hash = JenkinsSmiHash.combine(hash, length.hashCode);
7100 return JenkinsSmiHash.finish(hash); 7014 return JenkinsSmiHash.finish(hash);
7101 } 7015 }
7102 } 7016 }
7103 7017
7104 /** 7018 /**
7105 * edit.getStatementCompletion result 7019 * edit.getAvailableRefactorings result
7106 * 7020 *
7107 * { 7021 * {
7108 * "change": SourceChange 7022 * "kinds": List<RefactoringKind>
7109 * "whitespaceOnly": bool
7110 * } 7023 * }
7111 * 7024 *
7112 * Clients may not extend, implement or mix-in this class. 7025 * Clients may not extend, implement or mix-in this class.
7113 */ 7026 */
7114 class EditGetStatementCompletionResult implements HasToJson { 7027 class EditGetAvailableRefactoringsResult implements ResponseResult {
7115 SourceChange _change; 7028 List<RefactoringKind> _kinds;
7116
7117 bool _whitespaceOnly;
7118 7029
7119 /** 7030 /**
7120 * The change to be applied in order to complete the statement. 7031 * The kinds of refactorings that are valid for the given selection.
7121 */ 7032 */
7122 SourceChange get change => _change; 7033 List<RefactoringKind> get kinds => _kinds;
7123 7034
7124 /** 7035 /**
7125 * The change to be applied in order to complete the statement. 7036 * The kinds of refactorings that are valid for the given selection.
7126 */ 7037 */
7127 void set change(SourceChange value) { 7038 void set kinds(List<RefactoringKind> value) {
7128 assert(value != null); 7039 assert(value != null);
7129 this._change = value; 7040 this._kinds = value;
7130 } 7041 }
7131 7042
7132 /** 7043 EditGetAvailableRefactoringsResult(List<RefactoringKind> kinds) {
7133 * Will be true if the change contains nothing but whitespace characters, or 7044 this.kinds = kinds;
7134 * is empty.
7135 */
7136 bool get whitespaceOnly => _whitespaceOnly;
7137
7138 /**
7139 * Will be true if the change contains nothing but whitespace characters, or
7140 * is empty.
7141 */
7142 void set whitespaceOnly(bool value) {
7143 assert(value != null);
7144 this._whitespaceOnly = value;
7145 } 7045 }
7146 7046
7147 EditGetStatementCompletionResult(SourceChange change, bool whitespaceOnly) { 7047 factory EditGetAvailableRefactoringsResult.fromJson(
7148 this.change = change;
7149 this.whitespaceOnly = whitespaceOnly;
7150 }
7151
7152 factory EditGetStatementCompletionResult.fromJson(
7153 JsonDecoder jsonDecoder, String jsonPath, Object json) { 7048 JsonDecoder jsonDecoder, String jsonPath, Object json) {
7154 if (json == null) { 7049 if (json == null) {
7155 json = {}; 7050 json = {};
7156 } 7051 }
7157 if (json is Map) { 7052 if (json is Map) {
7158 SourceChange change; 7053 List<RefactoringKind> kinds;
7159 if (json.containsKey("change")) { 7054 if (json.containsKey("kinds")) {
7160 change = new SourceChange.fromJson( 7055 kinds = jsonDecoder.decodeList(
7161 jsonDecoder, jsonPath + ".change", json["change"]); 7056 jsonPath + ".kinds",
7057 json["kinds"],
7058 (String jsonPath, Object json) =>
7059 new RefactoringKind.fromJson(jsonDecoder, jsonPath, json));
7162 } else { 7060 } else {
7163 throw jsonDecoder.missingKey(jsonPath, "change"); 7061 throw jsonDecoder.mismatch(jsonPath, "kinds");
7164 } 7062 }
7165 bool whitespaceOnly; 7063 return new EditGetAvailableRefactoringsResult(kinds);
7166 if (json.containsKey("whitespaceOnly")) {
7167 whitespaceOnly = jsonDecoder.decodeBool(
7168 jsonPath + ".whitespaceOnly", json["whitespaceOnly"]);
7169 } else {
7170 throw jsonDecoder.missingKey(jsonPath, "whitespaceOnly");
7171 }
7172 return new EditGetStatementCompletionResult(change, whitespaceOnly);
7173 } else { 7064 } else {
7174 throw jsonDecoder.mismatch( 7065 throw jsonDecoder.mismatch(
7175 jsonPath, "edit.getStatementCompletion result", json); 7066 jsonPath, "edit.getAvailableRefactorings result", json);
7176 } 7067 }
7177 } 7068 }
7178 7069
7179 factory EditGetStatementCompletionResult.fromResponse(Response response) { 7070 factory EditGetAvailableRefactoringsResult.fromResponse(Response response) {
7180 return new EditGetStatementCompletionResult.fromJson( 7071 return new EditGetAvailableRefactoringsResult.fromJson(
7181 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), 7072 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
7182 "result", 7073 "result",
7183 response._result); 7074 response.result);
7184 } 7075 }
7185 7076
7077 @override
7186 Map<String, dynamic> toJson() { 7078 Map<String, dynamic> toJson() {
7187 Map<String, dynamic> result = {}; 7079 Map<String, dynamic> result = {};
7188 result["change"] = change.toJson(); 7080 result["kinds"] =
7189 result["whitespaceOnly"] = whitespaceOnly; 7081 kinds.map((RefactoringKind value) => value.toJson()).toList();
7190 return result; 7082 return result;
7191 } 7083 }
7192 7084
7085 @override
7193 Response toResponse(String id) { 7086 Response toResponse(String id) {
7194 return new Response(id, result: toJson()); 7087 return new Response(id, result: toJson());
7195 } 7088 }
7196 7089
7197 @override 7090 @override
7198 String toString() => JSON.encode(toJson()); 7091 String toString() => JSON.encode(toJson());
7199 7092
7200 @override 7093 @override
7201 bool operator ==(other) { 7094 bool operator ==(other) {
7202 if (other is EditGetStatementCompletionResult) { 7095 if (other is EditGetAvailableRefactoringsResult) {
7203 return change == other.change && whitespaceOnly == other.whitespaceOnly; 7096 return listEqual(
7097 kinds, other.kinds, (RefactoringKind a, RefactoringKind b) => a == b);
7204 } 7098 }
7205 return false; 7099 return false;
7206 } 7100 }
7207 7101
7208 @override 7102 @override
7209 int get hashCode { 7103 int get hashCode {
7210 int hash = 0; 7104 int hash = 0;
7211 hash = JenkinsSmiHash.combine(hash, change.hashCode); 7105 hash = JenkinsSmiHash.combine(hash, kinds.hashCode);
7212 hash = JenkinsSmiHash.combine(hash, whitespaceOnly.hashCode);
7213 return JenkinsSmiHash.finish(hash); 7106 return JenkinsSmiHash.finish(hash);
7214 } 7107 }
7215 } 7108 }
7216 7109
7217 /** 7110 /**
7218 * edit.sortMembers params 7111 * edit.getFixes params
7219 * 7112 *
7220 * { 7113 * {
7221 * "file": FilePath 7114 * "file": FilePath
7115 * "offset": int
7222 * } 7116 * }
7223 * 7117 *
7224 * Clients may not extend, implement or mix-in this class. 7118 * Clients may not extend, implement or mix-in this class.
7225 */ 7119 */
7226 class EditSortMembersParams implements HasToJson { 7120 class EditGetFixesParams implements RequestParams {
7227 String _file; 7121 String _file;
7228 7122
7123 int _offset;
7124
7229 /** 7125 /**
7230 * The Dart file to sort. 7126 * The file containing the errors for which fixes are being requested.
7231 */ 7127 */
7232 String get file => _file; 7128 String get file => _file;
7233 7129
7234 /** 7130 /**
7235 * The Dart file to sort. 7131 * The file containing the errors for which fixes are being requested.
7236 */ 7132 */
7237 void set file(String value) { 7133 void set file(String value) {
7238 assert(value != null); 7134 assert(value != null);
7239 this._file = value; 7135 this._file = value;
7240 } 7136 }
7241 7137
7242 EditSortMembersParams(String file) { 7138 /**
7243 this.file = file; 7139 * The offset used to select the errors for which fixes will be returned.
7140 */
7141 int get offset => _offset;
7142
7143 /**
7144 * The offset used to select the errors for which fixes will be returned.
7145 */
7146 void set offset(int value) {
7147 assert(value != null);
7148 this._offset = value;
7244 } 7149 }
7245 7150
7246 factory EditSortMembersParams.fromJson( 7151 EditGetFixesParams(String file, int offset) {
7152 this.file = file;
7153 this.offset = offset;
7154 }
7155
7156 factory EditGetFixesParams.fromJson(
7247 JsonDecoder jsonDecoder, String jsonPath, Object json) { 7157 JsonDecoder jsonDecoder, String jsonPath, Object json) {
7248 if (json == null) { 7158 if (json == null) {
7249 json = {}; 7159 json = {};
7250 } 7160 }
7251 if (json is Map) { 7161 if (json is Map) {
7252 String file; 7162 String file;
7253 if (json.containsKey("file")) { 7163 if (json.containsKey("file")) {
7254 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 7164 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
7255 } else { 7165 } else {
7256 throw jsonDecoder.missingKey(jsonPath, "file"); 7166 throw jsonDecoder.mismatch(jsonPath, "file");
7257 } 7167 }
7258 return new EditSortMembersParams(file); 7168 int offset;
7169 if (json.containsKey("offset")) {
7170 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
7171 } else {
7172 throw jsonDecoder.mismatch(jsonPath, "offset");
7173 }
7174 return new EditGetFixesParams(file, offset);
7259 } else { 7175 } else {
7260 throw jsonDecoder.mismatch(jsonPath, "edit.sortMembers params", json); 7176 throw jsonDecoder.mismatch(jsonPath, "edit.getFixes params", json);
7261 } 7177 }
7262 } 7178 }
7263 7179
7264 factory EditSortMembersParams.fromRequest(Request request) { 7180 factory EditGetFixesParams.fromRequest(Request request) {
7265 return new EditSortMembersParams.fromJson( 7181 return new EditGetFixesParams.fromJson(
7266 new RequestDecoder(request), "params", request._params); 7182 new RequestDecoder(request), "params", request.params);
7267 } 7183 }
7268 7184
7185 @override
7269 Map<String, dynamic> toJson() { 7186 Map<String, dynamic> toJson() {
7270 Map<String, dynamic> result = {}; 7187 Map<String, dynamic> result = {};
7271 result["file"] = file; 7188 result["file"] = file;
7189 result["offset"] = offset;
7272 return result; 7190 return result;
7273 } 7191 }
7274 7192
7193 @override
7275 Request toRequest(String id) { 7194 Request toRequest(String id) {
7276 return new Request(id, "edit.sortMembers", toJson()); 7195 return new Request(id, "edit.getFixes", toJson());
7277 } 7196 }
7278 7197
7279 @override 7198 @override
7280 String toString() => JSON.encode(toJson()); 7199 String toString() => JSON.encode(toJson());
7281 7200
7282 @override 7201 @override
7283 bool operator ==(other) { 7202 bool operator ==(other) {
7284 if (other is EditSortMembersParams) { 7203 if (other is EditGetFixesParams) {
7285 return file == other.file; 7204 return file == other.file && offset == other.offset;
7286 } 7205 }
7287 return false; 7206 return false;
7288 } 7207 }
7289 7208
7290 @override 7209 @override
7291 int get hashCode { 7210 int get hashCode {
7292 int hash = 0; 7211 int hash = 0;
7293 hash = JenkinsSmiHash.combine(hash, file.hashCode); 7212 hash = JenkinsSmiHash.combine(hash, file.hashCode);
7213 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
7294 return JenkinsSmiHash.finish(hash); 7214 return JenkinsSmiHash.finish(hash);
7295 } 7215 }
7296 } 7216 }
7297 7217
7298 /** 7218 /**
7299 * edit.sortMembers result 7219 * edit.getFixes result
7300 * 7220 *
7301 * { 7221 * {
7302 * "edit": SourceFileEdit 7222 * "fixes": List<AnalysisErrorFixes>
7303 * } 7223 * }
7304 * 7224 *
7305 * Clients may not extend, implement or mix-in this class. 7225 * Clients may not extend, implement or mix-in this class.
7306 */ 7226 */
7307 class EditSortMembersResult implements HasToJson { 7227 class EditGetFixesResult implements ResponseResult {
7308 SourceFileEdit _edit; 7228 List<AnalysisErrorFixes> _fixes;
7309 7229
7310 /** 7230 /**
7311 * The file edit that is to be applied to the given file to effect the 7231 * The fixes that are available for the errors at the given offset.
7312 * sorting.
7313 */ 7232 */
7314 SourceFileEdit get edit => _edit; 7233 List<AnalysisErrorFixes> get fixes => _fixes;
7315 7234
7316 /** 7235 /**
7317 * The file edit that is to be applied to the given file to effect the 7236 * The fixes that are available for the errors at the given offset.
7318 * sorting.
7319 */ 7237 */
7320 void set edit(SourceFileEdit value) { 7238 void set fixes(List<AnalysisErrorFixes> value) {
7321 assert(value != null); 7239 assert(value != null);
7322 this._edit = value; 7240 this._fixes = value;
7323 } 7241 }
7324 7242
7325 EditSortMembersResult(SourceFileEdit edit) { 7243 EditGetFixesResult(List<AnalysisErrorFixes> fixes) {
7326 this.edit = edit; 7244 this.fixes = fixes;
7327 } 7245 }
7328 7246
7329 factory EditSortMembersResult.fromJson( 7247 factory EditGetFixesResult.fromJson(
7330 JsonDecoder jsonDecoder, String jsonPath, Object json) { 7248 JsonDecoder jsonDecoder, String jsonPath, Object json) {
7331 if (json == null) { 7249 if (json == null) {
7332 json = {}; 7250 json = {};
7333 } 7251 }
7334 if (json is Map) { 7252 if (json is Map) {
7335 SourceFileEdit edit; 7253 List<AnalysisErrorFixes> fixes;
7336 if (json.containsKey("edit")) { 7254 if (json.containsKey("fixes")) {
7337 edit = new SourceFileEdit.fromJson( 7255 fixes = jsonDecoder.decodeList(
7338 jsonDecoder, jsonPath + ".edit", json["edit"]); 7256 jsonPath + ".fixes",
7257 json["fixes"],
7258 (String jsonPath, Object json) =>
7259 new AnalysisErrorFixes.fromJson(jsonDecoder, jsonPath, json));
7339 } else { 7260 } else {
7340 throw jsonDecoder.missingKey(jsonPath, "edit"); 7261 throw jsonDecoder.mismatch(jsonPath, "fixes");
7341 } 7262 }
7342 return new EditSortMembersResult(edit); 7263 return new EditGetFixesResult(fixes);
7343 } else { 7264 } else {
7344 throw jsonDecoder.mismatch(jsonPath, "edit.sortMembers result", json); 7265 throw jsonDecoder.mismatch(jsonPath, "edit.getFixes result", json);
7345 } 7266 }
7346 } 7267 }
7347 7268
7348 factory EditSortMembersResult.fromResponse(Response response) { 7269 factory EditGetFixesResult.fromResponse(Response response) {
7349 return new EditSortMembersResult.fromJson( 7270 return new EditGetFixesResult.fromJson(
7350 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), 7271 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
7351 "result", 7272 "result",
7352 response._result); 7273 response.result);
7353 } 7274 }
7354 7275
7276 @override
7355 Map<String, dynamic> toJson() { 7277 Map<String, dynamic> toJson() {
7356 Map<String, dynamic> result = {}; 7278 Map<String, dynamic> result = {};
7357 result["edit"] = edit.toJson(); 7279 result["fixes"] =
7280 fixes.map((AnalysisErrorFixes value) => value.toJson()).toList();
7358 return result; 7281 return result;
7359 } 7282 }
7360 7283
7284 @override
7361 Response toResponse(String id) { 7285 Response toResponse(String id) {
7362 return new Response(id, result: toJson()); 7286 return new Response(id, result: toJson());
7363 } 7287 }
7364 7288
7365 @override 7289 @override
7366 String toString() => JSON.encode(toJson()); 7290 String toString() => JSON.encode(toJson());
7367 7291
7368 @override 7292 @override
7369 bool operator ==(other) { 7293 bool operator ==(other) {
7370 if (other is EditSortMembersResult) { 7294 if (other is EditGetFixesResult) {
7371 return edit == other.edit; 7295 return listEqual(fixes, other.fixes,
7296 (AnalysisErrorFixes a, AnalysisErrorFixes b) => a == b);
7372 } 7297 }
7373 return false; 7298 return false;
7374 } 7299 }
7375 7300
7376 @override 7301 @override
7377 int get hashCode { 7302 int get hashCode {
7378 int hash = 0; 7303 int hash = 0;
7379 hash = JenkinsSmiHash.combine(hash, edit.hashCode); 7304 hash = JenkinsSmiHash.combine(hash, fixes.hashCode);
7380 return JenkinsSmiHash.finish(hash); 7305 return JenkinsSmiHash.finish(hash);
7381 } 7306 }
7382 } 7307 }
7383 7308
7384 /** 7309 /**
7385 * edit.organizeDirectives params 7310 * edit.getRefactoring params
7386 * 7311 *
7387 * { 7312 * {
7313 * "kind": RefactoringKind
7388 * "file": FilePath 7314 * "file": FilePath
7315 * "offset": int
7316 * "length": int
7317 * "validateOnly": bool
7318 * "options": optional RefactoringOptions
7389 * } 7319 * }
7390 * 7320 *
7391 * Clients may not extend, implement or mix-in this class. 7321 * Clients may not extend, implement or mix-in this class.
7392 */ 7322 */
7393 class EditOrganizeDirectivesParams implements HasToJson { 7323 class EditGetRefactoringParams implements RequestParams {
7324 RefactoringKind _kind;
7325
7394 String _file; 7326 String _file;
7395 7327
7396 /** 7328 int _offset;
7397 * The Dart file to organize directives in. 7329
7330 int _length;
7331
7332 bool _validateOnly;
7333
7334 RefactoringOptions _options;
7335
7336 /**
7337 * The kind of refactoring to be performed.
7338 */
7339 RefactoringKind get kind => _kind;
7340
7341 /**
7342 * The kind of refactoring to be performed.
7343 */
7344 void set kind(RefactoringKind value) {
7345 assert(value != null);
7346 this._kind = value;
7347 }
7348
7349 /**
7350 * The file containing the code involved in the refactoring.
7398 */ 7351 */
7399 String get file => _file; 7352 String get file => _file;
7400 7353
7401 /** 7354 /**
7402 * The Dart file to organize directives in. 7355 * The file containing the code involved in the refactoring.
7403 */ 7356 */
7404 void set file(String value) { 7357 void set file(String value) {
7405 assert(value != null); 7358 assert(value != null);
7406 this._file = value; 7359 this._file = value;
7407 } 7360 }
7408 7361
7409 EditOrganizeDirectivesParams(String file) { 7362 /**
7363 * The offset of the region involved in the refactoring.
7364 */
7365 int get offset => _offset;
7366
7367 /**
7368 * The offset of the region involved in the refactoring.
7369 */
7370 void set offset(int value) {
7371 assert(value != null);
7372 this._offset = value;
7373 }
7374
7375 /**
7376 * The length of the region involved in the refactoring.
7377 */
7378 int get length => _length;
7379
7380 /**
7381 * The length of the region involved in the refactoring.
7382 */
7383 void set length(int value) {
7384 assert(value != null);
7385 this._length = value;
7386 }
7387
7388 /**
7389 * True if the client is only requesting that the values of the options be
7390 * validated and no change be generated.
7391 */
7392 bool get validateOnly => _validateOnly;
7393
7394 /**
7395 * True if the client is only requesting that the values of the options be
7396 * validated and no change be generated.
7397 */
7398 void set validateOnly(bool value) {
7399 assert(value != null);
7400 this._validateOnly = value;
7401 }
7402
7403 /**
7404 * Data used to provide values provided by the user. The structure of the
7405 * data is dependent on the kind of refactoring being performed. The data
7406 * that is expected is documented in the section titled Refactorings, labeled
7407 * as "Options". This field can be omitted if the refactoring does not
7408 * require any options or if the values of those options are not known.
7409 */
7410 RefactoringOptions get options => _options;
7411
7412 /**
7413 * Data used to provide values provided by the user. The structure of the
7414 * data is dependent on the kind of refactoring being performed. The data
7415 * that is expected is documented in the section titled Refactorings, labeled
7416 * as "Options". This field can be omitted if the refactoring does not
7417 * require any options or if the values of those options are not known.
7418 */
7419 void set options(RefactoringOptions value) {
7420 this._options = value;
7421 }
7422
7423 EditGetRefactoringParams(RefactoringKind kind, String file, int offset,
7424 int length, bool validateOnly,
7425 {RefactoringOptions options}) {
7426 this.kind = kind;
7410 this.file = file; 7427 this.file = file;
7411 } 7428 this.offset = offset;
7412 7429 this.length = length;
7413 factory EditOrganizeDirectivesParams.fromJson( 7430 this.validateOnly = validateOnly;
7431 this.options = options;
7432 }
7433
7434 factory EditGetRefactoringParams.fromJson(
7414 JsonDecoder jsonDecoder, String jsonPath, Object json) { 7435 JsonDecoder jsonDecoder, String jsonPath, Object json) {
7415 if (json == null) { 7436 if (json == null) {
7416 json = {}; 7437 json = {};
7417 } 7438 }
7418 if (json is Map) { 7439 if (json is Map) {
7440 RefactoringKind kind;
7441 if (json.containsKey("kind")) {
7442 kind = new RefactoringKind.fromJson(
7443 jsonDecoder, jsonPath + ".kind", json["kind"]);
7444 } else {
7445 throw jsonDecoder.mismatch(jsonPath, "kind");
7446 }
7419 String file; 7447 String file;
7420 if (json.containsKey("file")) { 7448 if (json.containsKey("file")) {
7421 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 7449 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
7422 } else { 7450 } else {
7423 throw jsonDecoder.missingKey(jsonPath, "file"); 7451 throw jsonDecoder.mismatch(jsonPath, "file");
7424 } 7452 }
7425 return new EditOrganizeDirectivesParams(file); 7453 int offset;
7454 if (json.containsKey("offset")) {
7455 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
7456 } else {
7457 throw jsonDecoder.mismatch(jsonPath, "offset");
7458 }
7459 int length;
7460 if (json.containsKey("length")) {
7461 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
7462 } else {
7463 throw jsonDecoder.mismatch(jsonPath, "length");
7464 }
7465 bool validateOnly;
7466 if (json.containsKey("validateOnly")) {
7467 validateOnly = jsonDecoder.decodeBool(
7468 jsonPath + ".validateOnly", json["validateOnly"]);
7469 } else {
7470 throw jsonDecoder.mismatch(jsonPath, "validateOnly");
7471 }
7472 RefactoringOptions options;
7473 if (json.containsKey("options")) {
7474 options = new RefactoringOptions.fromJson(
7475 jsonDecoder, jsonPath + ".options", json["options"], kind);
7476 }
7477 return new EditGetRefactoringParams(
7478 kind, file, offset, length, validateOnly,
7479 options: options);
7426 } else { 7480 } else {
7427 throw jsonDecoder.mismatch( 7481 throw jsonDecoder.mismatch(jsonPath, "edit.getRefactoring params", json);
7428 jsonPath, "edit.organizeDirectives params", json);
7429 } 7482 }
7430 } 7483 }
7431 7484
7432 factory EditOrganizeDirectivesParams.fromRequest(Request request) { 7485 factory EditGetRefactoringParams.fromRequest(Request request) {
7433 return new EditOrganizeDirectivesParams.fromJson( 7486 var params = new EditGetRefactoringParams.fromJson(
7434 new RequestDecoder(request), "params", request._params); 7487 new RequestDecoder(request), "params", request.params);
7435 } 7488 REQUEST_ID_REFACTORING_KINDS[request.id] = params.kind;
7436 7489 return params;
7490 }
7491
7492 @override
7437 Map<String, dynamic> toJson() { 7493 Map<String, dynamic> toJson() {
7438 Map<String, dynamic> result = {}; 7494 Map<String, dynamic> result = {};
7495 result["kind"] = kind.toJson();
7439 result["file"] = file; 7496 result["file"] = file;
7497 result["offset"] = offset;
7498 result["length"] = length;
7499 result["validateOnly"] = validateOnly;
7500 if (options != null) {
7501 result["options"] = options.toJson();
7502 }
7440 return result; 7503 return result;
7441 } 7504 }
7442 7505
7506 @override
7443 Request toRequest(String id) { 7507 Request toRequest(String id) {
7444 return new Request(id, "edit.organizeDirectives", toJson()); 7508 return new Request(id, "edit.getRefactoring", toJson());
7445 } 7509 }
7446 7510
7447 @override 7511 @override
7448 String toString() => JSON.encode(toJson());
7449
7450 @override
7451 bool operator ==(other) {
7452 if (other is EditOrganizeDirectivesParams) {
7453 return file == other.file;
7454 }
7455 return false;
7456 }
7457
7458 @override
7459 int get hashCode {
7460 int hash = 0;
7461 hash = JenkinsSmiHash.combine(hash, file.hashCode);
7462 return JenkinsSmiHash.finish(hash);
7463 }
7464 }
7465
7466 /**
7467 * edit.organizeDirectives result
7468 *
7469 * {
7470 * "edit": SourceFileEdit
7471 * }
7472 *
7473 * Clients may not extend, implement or mix-in this class.
7474 */
7475 class EditOrganizeDirectivesResult implements HasToJson {
7476 SourceFileEdit _edit;
7477
7478 /**
7479 * The file edit that is to be applied to the given file to effect the
7480 * organizing.
7481 */
7482 SourceFileEdit get edit => _edit;
7483
7484 /**
7485 * The file edit that is to be applied to the given file to effect the
7486 * organizing.
7487 */
7488 void set edit(SourceFileEdit value) {
7489 assert(value != null);
7490 this._edit = value;
7491 }
7492
7493 EditOrganizeDirectivesResult(SourceFileEdit edit) {
7494 this.edit = edit;
7495 }
7496
7497 factory EditOrganizeDirectivesResult.fromJson(
7498 JsonDecoder jsonDecoder, String jsonPath, Object json) {
7499 if (json == null) {
7500 json = {};
7501 }
7502 if (json is Map) {
7503 SourceFileEdit edit;
7504 if (json.containsKey("edit")) {
7505 edit = new SourceFileEdit.fromJson(
7506 jsonDecoder, jsonPath + ".edit", json["edit"]);
7507 } else {
7508 throw jsonDecoder.missingKey(jsonPath, "edit");
7509 }
7510 return new EditOrganizeDirectivesResult(edit);
7511 } else {
7512 throw jsonDecoder.mismatch(
7513 jsonPath, "edit.organizeDirectives result", json);
7514 }
7515 }
7516
7517 factory EditOrganizeDirectivesResult.fromResponse(Response response) {
7518 return new EditOrganizeDirectivesResult.fromJson(
7519 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
7520 "result",
7521 response._result);
7522 }
7523
7524 Map<String, dynamic> toJson() {
7525 Map<String, dynamic> result = {};
7526 result["edit"] = edit.toJson();
7527 return result;
7528 }
7529
7530 Response toResponse(String id) {
7531 return new Response(id, result: toJson());
7532 }
7533
7534 @override
7535 String toString() => JSON.encode(toJson()); 7512 String toString() => JSON.encode(toJson());
7536 7513
7537 @override 7514 @override
7538 bool operator ==(other) { 7515 bool operator ==(other) {
7539 if (other is EditOrganizeDirectivesResult) { 7516 if (other is EditGetRefactoringParams) {
7540 return edit == other.edit; 7517 return kind == other.kind &&
7518 file == other.file &&
7519 offset == other.offset &&
7520 length == other.length &&
7521 validateOnly == other.validateOnly &&
7522 options == other.options;
7541 } 7523 }
7542 return false; 7524 return false;
7543 } 7525 }
7544 7526
7545 @override 7527 @override
7546 int get hashCode { 7528 int get hashCode {
7547 int hash = 0; 7529 int hash = 0;
7548 hash = JenkinsSmiHash.combine(hash, edit.hashCode); 7530 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
7531 hash = JenkinsSmiHash.combine(hash, file.hashCode);
7532 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
7533 hash = JenkinsSmiHash.combine(hash, length.hashCode);
7534 hash = JenkinsSmiHash.combine(hash, validateOnly.hashCode);
7535 hash = JenkinsSmiHash.combine(hash, options.hashCode);
7549 return JenkinsSmiHash.finish(hash); 7536 return JenkinsSmiHash.finish(hash);
7550 } 7537 }
7551 } 7538 }
7552 7539
7553 /** 7540 /**
7554 * execution.createContext params 7541 * edit.getRefactoring result
7555 * 7542 *
7556 * { 7543 * {
7557 * "contextRoot": FilePath 7544 * "initialProblems": List<RefactoringProblem>
7545 * "optionsProblems": List<RefactoringProblem>
7546 * "finalProblems": List<RefactoringProblem>
7547 * "feedback": optional RefactoringFeedback
7548 * "change": optional SourceChange
7549 * "potentialEdits": optional List<String>
7558 * } 7550 * }
7559 * 7551 *
7560 * Clients may not extend, implement or mix-in this class. 7552 * Clients may not extend, implement or mix-in this class.
7561 */ 7553 */
7562 class ExecutionCreateContextParams implements HasToJson { 7554 class EditGetRefactoringResult implements ResponseResult {
7563 String _contextRoot; 7555 List<RefactoringProblem> _initialProblems;
7564 7556
7565 /** 7557 List<RefactoringProblem> _optionsProblems;
7566 * The path of the Dart or HTML file that will be launched, or the path of 7558
7567 * the directory containing the file. 7559 List<RefactoringProblem> _finalProblems;
7568 */ 7560
7569 String get contextRoot => _contextRoot; 7561 RefactoringFeedback _feedback;
7570 7562
7571 /** 7563 SourceChange _change;
7572 * The path of the Dart or HTML file that will be launched, or the path of 7564
7573 * the directory containing the file. 7565 List<String> _potentialEdits;
7574 */ 7566
7575 void set contextRoot(String value) { 7567 /**
7568 * The initial status of the refactoring, i.e. problems related to the
7569 * context in which the refactoring is requested. The array will be empty if
7570 * there are no known problems.
7571 */
7572 List<RefactoringProblem> get initialProblems => _initialProblems;
7573
7574 /**
7575 * The initial status of the refactoring, i.e. problems related to the
7576 * context in which the refactoring is requested. The array will be empty if
7577 * there are no known problems.
7578 */
7579 void set initialProblems(List<RefactoringProblem> value) {
7576 assert(value != null); 7580 assert(value != null);
7577 this._contextRoot = value; 7581 this._initialProblems = value;
7578 } 7582 }
7579 7583
7580 ExecutionCreateContextParams(String contextRoot) { 7584 /**
7581 this.contextRoot = contextRoot; 7585 * The options validation status, i.e. problems in the given options, such as
7582 } 7586 * light-weight validation of a new name, flags compatibility, etc. The array
7583 7587 * will be empty if there are no known problems.
7584 factory ExecutionCreateContextParams.fromJson( 7588 */
7589 List<RefactoringProblem> get optionsProblems => _optionsProblems;
7590
7591 /**
7592 * The options validation status, i.e. problems in the given options, such as
7593 * light-weight validation of a new name, flags compatibility, etc. The array
7594 * will be empty if there are no known problems.
7595 */
7596 void set optionsProblems(List<RefactoringProblem> value) {
7597 assert(value != null);
7598 this._optionsProblems = value;
7599 }
7600
7601 /**
7602 * The final status of the refactoring, i.e. problems identified in the
7603 * result of a full, potentially expensive validation and / or change
7604 * creation. The array will be empty if there are no known problems.
7605 */
7606 List<RefactoringProblem> get finalProblems => _finalProblems;
7607
7608 /**
7609 * The final status of the refactoring, i.e. problems identified in the
7610 * result of a full, potentially expensive validation and / or change
7611 * creation. The array will be empty if there are no known problems.
7612 */
7613 void set finalProblems(List<RefactoringProblem> value) {
7614 assert(value != null);
7615 this._finalProblems = value;
7616 }
7617
7618 /**
7619 * Data used to provide feedback to the user. The structure of the data is
7620 * dependent on the kind of refactoring being created. The data that is
7621 * returned is documented in the section titled Refactorings, labeled as
7622 * "Feedback".
7623 */
7624 RefactoringFeedback get feedback => _feedback;
7625
7626 /**
7627 * Data used to provide feedback to the user. The structure of the data is
7628 * dependent on the kind of refactoring being created. The data that is
7629 * returned is documented in the section titled Refactorings, labeled as
7630 * "Feedback".
7631 */
7632 void set feedback(RefactoringFeedback value) {
7633 this._feedback = value;
7634 }
7635
7636 /**
7637 * The changes that are to be applied to affect the refactoring. This field
7638 * will be omitted if there are problems that prevent a set of changes from
7639 * being computed, such as having no options specified for a refactoring that
7640 * requires them, or if only validation was requested.
7641 */
7642 SourceChange get change => _change;
7643
7644 /**
7645 * The changes that are to be applied to affect the refactoring. This field
7646 * will be omitted if there are problems that prevent a set of changes from
7647 * being computed, such as having no options specified for a refactoring that
7648 * requires them, or if only validation was requested.
7649 */
7650 void set change(SourceChange value) {
7651 this._change = value;
7652 }
7653
7654 /**
7655 * The ids of source edits that are not known to be valid. An edit is not
7656 * known to be valid if there was insufficient type information for the
7657 * server to be able to determine whether or not the code needs to be
7658 * modified, such as when a member is being renamed and there is a reference
7659 * to a member from an unknown type. This field will be omitted if the change
7660 * field is omitted or if there are no potential edits for the refactoring.
7661 */
7662 List<String> get potentialEdits => _potentialEdits;
7663
7664 /**
7665 * The ids of source edits that are not known to be valid. An edit is not
7666 * known to be valid if there was insufficient type information for the
7667 * server to be able to determine whether or not the code needs to be
7668 * modified, such as when a member is being renamed and there is a reference
7669 * to a member from an unknown type. This field will be omitted if the change
7670 * field is omitted or if there are no potential edits for the refactoring.
7671 */
7672 void set potentialEdits(List<String> value) {
7673 this._potentialEdits = value;
7674 }
7675
7676 EditGetRefactoringResult(
7677 List<RefactoringProblem> initialProblems,
7678 List<RefactoringProblem> optionsProblems,
7679 List<RefactoringProblem> finalProblems,
7680 {RefactoringFeedback feedback,
7681 SourceChange change,
7682 List<String> potentialEdits}) {
7683 this.initialProblems = initialProblems;
7684 this.optionsProblems = optionsProblems;
7685 this.finalProblems = finalProblems;
7686 this.feedback = feedback;
7687 this.change = change;
7688 this.potentialEdits = potentialEdits;
7689 }
7690
7691 factory EditGetRefactoringResult.fromJson(
7585 JsonDecoder jsonDecoder, String jsonPath, Object json) { 7692 JsonDecoder jsonDecoder, String jsonPath, Object json) {
7586 if (json == null) { 7693 if (json == null) {
7587 json = {}; 7694 json = {};
7588 } 7695 }
7589 if (json is Map) { 7696 if (json is Map) {
7590 String contextRoot; 7697 List<RefactoringProblem> initialProblems;
7591 if (json.containsKey("contextRoot")) { 7698 if (json.containsKey("initialProblems")) {
7592 contextRoot = jsonDecoder.decodeString( 7699 initialProblems = jsonDecoder.decodeList(
7593 jsonPath + ".contextRoot", json["contextRoot"]); 7700 jsonPath + ".initialProblems",
7701 json["initialProblems"],
7702 (String jsonPath, Object json) =>
7703 new RefactoringProblem.fromJson(jsonDecoder, jsonPath, json));
7594 } else { 7704 } else {
7595 throw jsonDecoder.missingKey(jsonPath, "contextRoot"); 7705 throw jsonDecoder.mismatch(jsonPath, "initialProblems");
7596 } 7706 }
7597 return new ExecutionCreateContextParams(contextRoot); 7707 List<RefactoringProblem> optionsProblems;
7708 if (json.containsKey("optionsProblems")) {
7709 optionsProblems = jsonDecoder.decodeList(
7710 jsonPath + ".optionsProblems",
7711 json["optionsProblems"],
7712 (String jsonPath, Object json) =>
7713 new RefactoringProblem.fromJson(jsonDecoder, jsonPath, json));
7714 } else {
7715 throw jsonDecoder.mismatch(jsonPath, "optionsProblems");
7716 }
7717 List<RefactoringProblem> finalProblems;
7718 if (json.containsKey("finalProblems")) {
7719 finalProblems = jsonDecoder.decodeList(
7720 jsonPath + ".finalProblems",
7721 json["finalProblems"],
7722 (String jsonPath, Object json) =>
7723 new RefactoringProblem.fromJson(jsonDecoder, jsonPath, json));
7724 } else {
7725 throw jsonDecoder.mismatch(jsonPath, "finalProblems");
7726 }
7727 RefactoringFeedback feedback;
7728 if (json.containsKey("feedback")) {
7729 feedback = new RefactoringFeedback.fromJson(
7730 jsonDecoder, jsonPath + ".feedback", json["feedback"], json);
7731 }
7732 SourceChange change;
7733 if (json.containsKey("change")) {
7734 change = new SourceChange.fromJson(
7735 jsonDecoder, jsonPath + ".change", json["change"]);
7736 }
7737 List<String> potentialEdits;
7738 if (json.containsKey("potentialEdits")) {
7739 potentialEdits = jsonDecoder.decodeList(jsonPath + ".potentialEdits",
7740 json["potentialEdits"], jsonDecoder.decodeString);
7741 }
7742 return new EditGetRefactoringResult(
7743 initialProblems, optionsProblems, finalProblems,
7744 feedback: feedback, change: change, potentialEdits: potentialEdits);
7598 } else { 7745 } else {
7599 throw jsonDecoder.mismatch( 7746 throw jsonDecoder.mismatch(jsonPath, "edit.getRefactoring result", json);
7600 jsonPath, "execution.createContext params", json); 7747 }
7601 } 7748 }
7602 } 7749
7603 7750 factory EditGetRefactoringResult.fromResponse(Response response) {
7604 factory ExecutionCreateContextParams.fromRequest(Request request) { 7751 return new EditGetRefactoringResult.fromJson(
7605 return new ExecutionCreateContextParams.fromJson( 7752 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
7606 new RequestDecoder(request), "params", request._params); 7753 "result",
7607 } 7754 response.result);
7608 7755 }
7756
7757 @override
7609 Map<String, dynamic> toJson() { 7758 Map<String, dynamic> toJson() {
7610 Map<String, dynamic> result = {}; 7759 Map<String, dynamic> result = {};
7611 result["contextRoot"] = contextRoot; 7760 result["initialProblems"] = initialProblems
7761 .map((RefactoringProblem value) => value.toJson())
7762 .toList();
7763 result["optionsProblems"] = optionsProblems
7764 .map((RefactoringProblem value) => value.toJson())
7765 .toList();
7766 result["finalProblems"] = finalProblems
7767 .map((RefactoringProblem value) => value.toJson())
7768 .toList();
7769 if (feedback != null) {
7770 result["feedback"] = feedback.toJson();
7771 }
7772 if (change != null) {
7773 result["change"] = change.toJson();
7774 }
7775 if (potentialEdits != null) {
7776 result["potentialEdits"] = potentialEdits;
7777 }
7612 return result; 7778 return result;
7613 } 7779 }
7614 7780
7615 Request toRequest(String id) {
7616 return new Request(id, "execution.createContext", toJson());
7617 }
7618
7619 @override 7781 @override
7620 String toString() => JSON.encode(toJson());
7621
7622 @override
7623 bool operator ==(other) {
7624 if (other is ExecutionCreateContextParams) {
7625 return contextRoot == other.contextRoot;
7626 }
7627 return false;
7628 }
7629
7630 @override
7631 int get hashCode {
7632 int hash = 0;
7633 hash = JenkinsSmiHash.combine(hash, contextRoot.hashCode);
7634 return JenkinsSmiHash.finish(hash);
7635 }
7636 }
7637
7638 /**
7639 * execution.createContext result
7640 *
7641 * {
7642 * "id": ExecutionContextId
7643 * }
7644 *
7645 * Clients may not extend, implement or mix-in this class.
7646 */
7647 class ExecutionCreateContextResult implements HasToJson {
7648 String _id;
7649
7650 /**
7651 * The identifier used to refer to the execution context that was created.
7652 */
7653 String get id => _id;
7654
7655 /**
7656 * The identifier used to refer to the execution context that was created.
7657 */
7658 void set id(String value) {
7659 assert(value != null);
7660 this._id = value;
7661 }
7662
7663 ExecutionCreateContextResult(String id) {
7664 this.id = id;
7665 }
7666
7667 factory ExecutionCreateContextResult.fromJson(
7668 JsonDecoder jsonDecoder, String jsonPath, Object json) {
7669 if (json == null) {
7670 json = {};
7671 }
7672 if (json is Map) {
7673 String id;
7674 if (json.containsKey("id")) {
7675 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
7676 } else {
7677 throw jsonDecoder.missingKey(jsonPath, "id");
7678 }
7679 return new ExecutionCreateContextResult(id);
7680 } else {
7681 throw jsonDecoder.mismatch(
7682 jsonPath, "execution.createContext result", json);
7683 }
7684 }
7685
7686 factory ExecutionCreateContextResult.fromResponse(Response response) {
7687 return new ExecutionCreateContextResult.fromJson(
7688 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
7689 "result",
7690 response._result);
7691 }
7692
7693 Map<String, dynamic> toJson() {
7694 Map<String, dynamic> result = {};
7695 result["id"] = id;
7696 return result;
7697 }
7698
7699 Response toResponse(String id) { 7782 Response toResponse(String id) {
7700 return new Response(id, result: toJson()); 7783 return new Response(id, result: toJson());
7701 } 7784 }
7702 7785
7703 @override 7786 @override
7704 String toString() => JSON.encode(toJson()); 7787 String toString() => JSON.encode(toJson());
7705 7788
7706 @override 7789 @override
7707 bool operator ==(other) { 7790 bool operator ==(other) {
7708 if (other is ExecutionCreateContextResult) { 7791 if (other is EditGetRefactoringResult) {
7709 return id == other.id; 7792 return listEqual(initialProblems, other.initialProblems,
7793 (RefactoringProblem a, RefactoringProblem b) => a == b) &&
7794 listEqual(optionsProblems, other.optionsProblems,
7795 (RefactoringProblem a, RefactoringProblem b) => a == b) &&
7796 listEqual(finalProblems, other.finalProblems,
7797 (RefactoringProblem a, RefactoringProblem b) => a == b) &&
7798 feedback == other.feedback &&
7799 change == other.change &&
7800 listEqual(potentialEdits, other.potentialEdits,
7801 (String a, String b) => a == b);
7710 } 7802 }
7711 return false; 7803 return false;
7712 } 7804 }
7713 7805
7714 @override 7806 @override
7715 int get hashCode { 7807 int get hashCode {
7716 int hash = 0; 7808 int hash = 0;
7717 hash = JenkinsSmiHash.combine(hash, id.hashCode); 7809 hash = JenkinsSmiHash.combine(hash, initialProblems.hashCode);
7810 hash = JenkinsSmiHash.combine(hash, optionsProblems.hashCode);
7811 hash = JenkinsSmiHash.combine(hash, finalProblems.hashCode);
7812 hash = JenkinsSmiHash.combine(hash, feedback.hashCode);
7813 hash = JenkinsSmiHash.combine(hash, change.hashCode);
7814 hash = JenkinsSmiHash.combine(hash, potentialEdits.hashCode);
7718 return JenkinsSmiHash.finish(hash); 7815 return JenkinsSmiHash.finish(hash);
7719 } 7816 }
7720 } 7817 }
7721 7818
7722 /** 7819 /**
7723 * execution.deleteContext params 7820 * edit.getStatementCompletion params
7724 * 7821 *
7725 * { 7822 * {
7726 * "id": ExecutionContextId 7823 * "file": FilePath
7824 * "offset": int
7727 * } 7825 * }
7728 * 7826 *
7729 * Clients may not extend, implement or mix-in this class. 7827 * Clients may not extend, implement or mix-in this class.
7730 */ 7828 */
7731 class ExecutionDeleteContextParams implements HasToJson { 7829 class EditGetStatementCompletionParams implements RequestParams {
7732 String _id; 7830 String _file;
7831
7832 int _offset;
7733 7833
7734 /** 7834 /**
7735 * The identifier of the execution context that is to be deleted. 7835 * The file containing the statement to be completed.
7736 */ 7836 */
7737 String get id => _id; 7837 String get file => _file;
7738 7838
7739 /** 7839 /**
7740 * The identifier of the execution context that is to be deleted. 7840 * The file containing the statement to be completed.
7741 */ 7841 */
7742 void set id(String value) { 7842 void set file(String value) {
7743 assert(value != null); 7843 assert(value != null);
7744 this._id = value; 7844 this._file = value;
7745 } 7845 }
7746 7846
7747 ExecutionDeleteContextParams(String id) { 7847 /**
7748 this.id = id; 7848 * The offset used to identify the statement to be completed.
7849 */
7850 int get offset => _offset;
7851
7852 /**
7853 * The offset used to identify the statement to be completed.
7854 */
7855 void set offset(int value) {
7856 assert(value != null);
7857 this._offset = value;
7749 } 7858 }
7750 7859
7751 factory ExecutionDeleteContextParams.fromJson( 7860 EditGetStatementCompletionParams(String file, int offset) {
7861 this.file = file;
7862 this.offset = offset;
7863 }
7864
7865 factory EditGetStatementCompletionParams.fromJson(
7752 JsonDecoder jsonDecoder, String jsonPath, Object json) { 7866 JsonDecoder jsonDecoder, String jsonPath, Object json) {
7753 if (json == null) { 7867 if (json == null) {
7754 json = {}; 7868 json = {};
7755 } 7869 }
7756 if (json is Map) { 7870 if (json is Map) {
7757 String id; 7871 String file;
7758 if (json.containsKey("id")) { 7872 if (json.containsKey("file")) {
7759 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]); 7873 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
7760 } else { 7874 } else {
7761 throw jsonDecoder.missingKey(jsonPath, "id"); 7875 throw jsonDecoder.mismatch(jsonPath, "file");
7762 } 7876 }
7763 return new ExecutionDeleteContextParams(id); 7877 int offset;
7878 if (json.containsKey("offset")) {
7879 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
7880 } else {
7881 throw jsonDecoder.mismatch(jsonPath, "offset");
7882 }
7883 return new EditGetStatementCompletionParams(file, offset);
7764 } else { 7884 } else {
7765 throw jsonDecoder.mismatch( 7885 throw jsonDecoder.mismatch(
7766 jsonPath, "execution.deleteContext params", json); 7886 jsonPath, "edit.getStatementCompletion params", json);
7767 } 7887 }
7768 } 7888 }
7769 7889
7770 factory ExecutionDeleteContextParams.fromRequest(Request request) { 7890 factory EditGetStatementCompletionParams.fromRequest(Request request) {
7771 return new ExecutionDeleteContextParams.fromJson( 7891 return new EditGetStatementCompletionParams.fromJson(
7772 new RequestDecoder(request), "params", request._params); 7892 new RequestDecoder(request), "params", request.params);
7773 } 7893 }
7774 7894
7895 @override
7775 Map<String, dynamic> toJson() { 7896 Map<String, dynamic> toJson() {
7776 Map<String, dynamic> result = {}; 7897 Map<String, dynamic> result = {};
7777 result["id"] = id; 7898 result["file"] = file;
7899 result["offset"] = offset;
7778 return result; 7900 return result;
7779 } 7901 }
7780 7902
7903 @override
7781 Request toRequest(String id) { 7904 Request toRequest(String id) {
7782 return new Request(id, "execution.deleteContext", toJson()); 7905 return new Request(id, "edit.getStatementCompletion", toJson());
7783 } 7906 }
7784 7907
7785 @override 7908 @override
7786 String toString() => JSON.encode(toJson()); 7909 String toString() => JSON.encode(toJson());
7787 7910
7788 @override 7911 @override
7789 bool operator ==(other) { 7912 bool operator ==(other) {
7790 if (other is ExecutionDeleteContextParams) { 7913 if (other is EditGetStatementCompletionParams) {
7791 return id == other.id; 7914 return file == other.file && offset == other.offset;
7792 } 7915 }
7793 return false; 7916 return false;
7794 } 7917 }
7795 7918
7796 @override 7919 @override
7797 int get hashCode { 7920 int get hashCode {
7798 int hash = 0; 7921 int hash = 0;
7799 hash = JenkinsSmiHash.combine(hash, id.hashCode); 7922 hash = JenkinsSmiHash.combine(hash, file.hashCode);
7923 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
7800 return JenkinsSmiHash.finish(hash); 7924 return JenkinsSmiHash.finish(hash);
7801 } 7925 }
7802 } 7926 }
7803 7927
7804 /** 7928 /**
7805 * execution.deleteContext result 7929 * edit.getStatementCompletion result
7806 *
7807 * Clients may not extend, implement or mix-in this class.
7808 */
7809 class ExecutionDeleteContextResult {
7810 Response toResponse(String id) {
7811 return new Response(id, result: null);
7812 }
7813
7814 @override
7815 bool operator ==(other) {
7816 if (other is ExecutionDeleteContextResult) {
7817 return true;
7818 }
7819 return false;
7820 }
7821
7822 @override
7823 int get hashCode {
7824 return 479954425;
7825 }
7826 }
7827
7828 /**
7829 * execution.mapUri params
7830 * 7930 *
7831 * { 7931 * {
7832 * "id": ExecutionContextId 7932 * "change": SourceChange
7833 * "file": optional FilePath 7933 * "whitespaceOnly": bool
7834 * "uri": optional String
7835 * } 7934 * }
7836 * 7935 *
7837 * Clients may not extend, implement or mix-in this class. 7936 * Clients may not extend, implement or mix-in this class.
7838 */ 7937 */
7839 class ExecutionMapUriParams implements HasToJson { 7938 class EditGetStatementCompletionResult implements ResponseResult {
7840 String _id; 7939 SourceChange _change;
7841 7940
7842 String _file; 7941 bool _whitespaceOnly;
7843
7844 String _uri;
7845 7942
7846 /** 7943 /**
7847 * The identifier of the execution context in which the URI is to be mapped. 7944 * The change to be applied in order to complete the statement.
7848 */ 7945 */
7849 String get id => _id; 7946 SourceChange get change => _change;
7850 7947
7851 /** 7948 /**
7852 * The identifier of the execution context in which the URI is to be mapped. 7949 * The change to be applied in order to complete the statement.
7853 */ 7950 */
7854 void set id(String value) { 7951 void set change(SourceChange value) {
7855 assert(value != null); 7952 assert(value != null);
7856 this._id = value; 7953 this._change = value;
7857 } 7954 }
7858 7955
7859 /** 7956 /**
7860 * The path of the file to be mapped into a URI. 7957 * Will be true if the change contains nothing but whitespace characters, or
7958 * is empty.
7861 */ 7959 */
7862 String get file => _file; 7960 bool get whitespaceOnly => _whitespaceOnly;
7863 7961
7864 /** 7962 /**
7865 * The path of the file to be mapped into a URI. 7963 * Will be true if the change contains nothing but whitespace characters, or
7964 * is empty.
7866 */ 7965 */
7867 void set file(String value) { 7966 void set whitespaceOnly(bool value) {
7868 this._file = value; 7967 assert(value != null);
7968 this._whitespaceOnly = value;
7869 } 7969 }
7870 7970
7871 /** 7971 EditGetStatementCompletionResult(SourceChange change, bool whitespaceOnly) {
7872 * The URI to be mapped into a file path. 7972 this.change = change;
7873 */ 7973 this.whitespaceOnly = whitespaceOnly;
7874 String get uri => _uri;
7875
7876 /**
7877 * The URI to be mapped into a file path.
7878 */
7879 void set uri(String value) {
7880 this._uri = value;
7881 } 7974 }
7882 7975
7883 ExecutionMapUriParams(String id, {String file, String uri}) { 7976 factory EditGetStatementCompletionResult.fromJson(
7884 this.id = id;
7885 this.file = file;
7886 this.uri = uri;
7887 }
7888
7889 factory ExecutionMapUriParams.fromJson(
7890 JsonDecoder jsonDecoder, String jsonPath, Object json) { 7977 JsonDecoder jsonDecoder, String jsonPath, Object json) {
7891 if (json == null) { 7978 if (json == null) {
7892 json = {}; 7979 json = {};
7893 } 7980 }
7894 if (json is Map) { 7981 if (json is Map) {
7895 String id; 7982 SourceChange change;
7896 if (json.containsKey("id")) { 7983 if (json.containsKey("change")) {
7897 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]); 7984 change = new SourceChange.fromJson(
7985 jsonDecoder, jsonPath + ".change", json["change"]);
7898 } else { 7986 } else {
7899 throw jsonDecoder.missingKey(jsonPath, "id"); 7987 throw jsonDecoder.mismatch(jsonPath, "change");
7900 } 7988 }
7901 String file; 7989 bool whitespaceOnly;
7902 if (json.containsKey("file")) { 7990 if (json.containsKey("whitespaceOnly")) {
7903 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 7991 whitespaceOnly = jsonDecoder.decodeBool(
7992 jsonPath + ".whitespaceOnly", json["whitespaceOnly"]);
7993 } else {
7994 throw jsonDecoder.mismatch(jsonPath, "whitespaceOnly");
7904 } 7995 }
7905 String uri; 7996 return new EditGetStatementCompletionResult(change, whitespaceOnly);
7906 if (json.containsKey("uri")) {
7907 uri = jsonDecoder.decodeString(jsonPath + ".uri", json["uri"]);
7908 }
7909 return new ExecutionMapUriParams(id, file: file, uri: uri);
7910 } else { 7997 } else {
7911 throw jsonDecoder.mismatch(jsonPath, "execution.mapUri params", json); 7998 throw jsonDecoder.mismatch(
7999 jsonPath, "edit.getStatementCompletion result", json);
7912 } 8000 }
7913 } 8001 }
7914 8002
7915 factory ExecutionMapUriParams.fromRequest(Request request) { 8003 factory EditGetStatementCompletionResult.fromResponse(Response response) {
7916 return new ExecutionMapUriParams.fromJson( 8004 return new EditGetStatementCompletionResult.fromJson(
7917 new RequestDecoder(request), "params", request._params); 8005 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
8006 "result",
8007 response.result);
7918 } 8008 }
7919 8009
8010 @override
7920 Map<String, dynamic> toJson() { 8011 Map<String, dynamic> toJson() {
7921 Map<String, dynamic> result = {}; 8012 Map<String, dynamic> result = {};
7922 result["id"] = id; 8013 result["change"] = change.toJson();
7923 if (file != null) { 8014 result["whitespaceOnly"] = whitespaceOnly;
7924 result["file"] = file;
7925 }
7926 if (uri != null) {
7927 result["uri"] = uri;
7928 }
7929 return result; 8015 return result;
7930 } 8016 }
7931 8017
7932 Request toRequest(String id) { 8018 @override
7933 return new Request(id, "execution.mapUri", toJson()); 8019 Response toResponse(String id) {
8020 return new Response(id, result: toJson());
7934 } 8021 }
7935 8022
7936 @override 8023 @override
7937 String toString() => JSON.encode(toJson()); 8024 String toString() => JSON.encode(toJson());
7938 8025
7939 @override 8026 @override
7940 bool operator ==(other) { 8027 bool operator ==(other) {
7941 if (other is ExecutionMapUriParams) { 8028 if (other is EditGetStatementCompletionResult) {
7942 return id == other.id && file == other.file && uri == other.uri; 8029 return change == other.change && whitespaceOnly == other.whitespaceOnly;
7943 } 8030 }
7944 return false; 8031 return false;
7945 } 8032 }
7946 8033
7947 @override 8034 @override
7948 int get hashCode { 8035 int get hashCode {
7949 int hash = 0; 8036 int hash = 0;
7950 hash = JenkinsSmiHash.combine(hash, id.hashCode); 8037 hash = JenkinsSmiHash.combine(hash, change.hashCode);
7951 hash = JenkinsSmiHash.combine(hash, file.hashCode); 8038 hash = JenkinsSmiHash.combine(hash, whitespaceOnly.hashCode);
7952 hash = JenkinsSmiHash.combine(hash, uri.hashCode);
7953 return JenkinsSmiHash.finish(hash); 8039 return JenkinsSmiHash.finish(hash);
7954 } 8040 }
7955 } 8041 }
7956 8042
7957 /** 8043 /**
7958 * execution.mapUri result 8044 * edit.organizeDirectives params
7959 * 8045 *
7960 * { 8046 * {
7961 * "file": optional FilePath 8047 * "file": FilePath
7962 * "uri": optional String
7963 * } 8048 * }
7964 * 8049 *
7965 * Clients may not extend, implement or mix-in this class. 8050 * Clients may not extend, implement or mix-in this class.
7966 */ 8051 */
7967 class ExecutionMapUriResult implements HasToJson { 8052 class EditOrganizeDirectivesParams implements RequestParams {
7968 String _file; 8053 String _file;
7969 8054
7970 String _uri;
7971
7972 /** 8055 /**
7973 * The file to which the URI was mapped. This field is omitted if the uri 8056 * The Dart file to organize directives in.
7974 * field was not given in the request.
7975 */ 8057 */
7976 String get file => _file; 8058 String get file => _file;
7977 8059
7978 /** 8060 /**
7979 * The file to which the URI was mapped. This field is omitted if the uri 8061 * The Dart file to organize directives in.
7980 * field was not given in the request.
7981 */ 8062 */
7982 void set file(String value) { 8063 void set file(String value) {
8064 assert(value != null);
7983 this._file = value; 8065 this._file = value;
7984 } 8066 }
7985 8067
7986 /** 8068 EditOrganizeDirectivesParams(String file) {
7987 * The URI to which the file path was mapped. This field is omitted if the 8069 this.file = file;
7988 * file field was not given in the request.
7989 */
7990 String get uri => _uri;
7991
7992 /**
7993 * The URI to which the file path was mapped. This field is omitted if the
7994 * file field was not given in the request.
7995 */
7996 void set uri(String value) {
7997 this._uri = value;
7998 } 8070 }
7999 8071
8000 ExecutionMapUriResult({String file, String uri}) { 8072 factory EditOrganizeDirectivesParams.fromJson(
8001 this.file = file;
8002 this.uri = uri;
8003 }
8004
8005 factory ExecutionMapUriResult.fromJson(
8006 JsonDecoder jsonDecoder, String jsonPath, Object json) { 8073 JsonDecoder jsonDecoder, String jsonPath, Object json) {
8007 if (json == null) { 8074 if (json == null) {
8008 json = {}; 8075 json = {};
8009 } 8076 }
8010 if (json is Map) { 8077 if (json is Map) {
8011 String file; 8078 String file;
8012 if (json.containsKey("file")) { 8079 if (json.containsKey("file")) {
8013 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 8080 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
8081 } else {
8082 throw jsonDecoder.mismatch(jsonPath, "file");
8014 } 8083 }
8015 String uri; 8084 return new EditOrganizeDirectivesParams(file);
8016 if (json.containsKey("uri")) {
8017 uri = jsonDecoder.decodeString(jsonPath + ".uri", json["uri"]);
8018 }
8019 return new ExecutionMapUriResult(file: file, uri: uri);
8020 } else { 8085 } else {
8021 throw jsonDecoder.mismatch(jsonPath, "execution.mapUri result", json); 8086 throw jsonDecoder.mismatch(
8087 jsonPath, "edit.organizeDirectives params", json);
8022 } 8088 }
8023 } 8089 }
8024 8090
8025 factory ExecutionMapUriResult.fromResponse(Response response) { 8091 factory EditOrganizeDirectivesParams.fromRequest(Request request) {
8026 return new ExecutionMapUriResult.fromJson( 8092 return new EditOrganizeDirectivesParams.fromJson(
8027 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), 8093 new RequestDecoder(request), "params", request.params);
8028 "result",
8029 response._result);
8030 } 8094 }
8031 8095
8096 @override
8032 Map<String, dynamic> toJson() { 8097 Map<String, dynamic> toJson() {
8033 Map<String, dynamic> result = {}; 8098 Map<String, dynamic> result = {};
8034 if (file != null) { 8099 result["file"] = file;
8035 result["file"] = file;
8036 }
8037 if (uri != null) {
8038 result["uri"] = uri;
8039 }
8040 return result; 8100 return result;
8041 } 8101 }
8042 8102
8043 Response toResponse(String id) { 8103 @override
8044 return new Response(id, result: toJson()); 8104 Request toRequest(String id) {
8105 return new Request(id, "edit.organizeDirectives", toJson());
8045 } 8106 }
8046 8107
8047 @override 8108 @override
8048 String toString() => JSON.encode(toJson()); 8109 String toString() => JSON.encode(toJson());
8049 8110
8050 @override 8111 @override
8051 bool operator ==(other) { 8112 bool operator ==(other) {
8052 if (other is ExecutionMapUriResult) { 8113 if (other is EditOrganizeDirectivesParams) {
8053 return file == other.file && uri == other.uri; 8114 return file == other.file;
8054 } 8115 }
8055 return false; 8116 return false;
8056 } 8117 }
8057 8118
8058 @override 8119 @override
8059 int get hashCode { 8120 int get hashCode {
8060 int hash = 0; 8121 int hash = 0;
8061 hash = JenkinsSmiHash.combine(hash, file.hashCode); 8122 hash = JenkinsSmiHash.combine(hash, file.hashCode);
8062 hash = JenkinsSmiHash.combine(hash, uri.hashCode);
8063 return JenkinsSmiHash.finish(hash); 8123 return JenkinsSmiHash.finish(hash);
8064 } 8124 }
8065 } 8125 }
8066 8126
8067 /** 8127 /**
8068 * execution.setSubscriptions params 8128 * edit.organizeDirectives result
8069 * 8129 *
8070 * { 8130 * {
8071 * "subscriptions": List<ExecutionService> 8131 * "edit": SourceFileEdit
8072 * } 8132 * }
8073 * 8133 *
8074 * Clients may not extend, implement or mix-in this class. 8134 * Clients may not extend, implement or mix-in this class.
8075 */ 8135 */
8076 class ExecutionSetSubscriptionsParams implements HasToJson { 8136 class EditOrganizeDirectivesResult implements ResponseResult {
8077 List<ExecutionService> _subscriptions; 8137 SourceFileEdit _edit;
8078 8138
8079 /** 8139 /**
8080 * A list of the services being subscribed to. 8140 * The file edit that is to be applied to the given file to effect the
8141 * organizing.
8081 */ 8142 */
8082 List<ExecutionService> get subscriptions => _subscriptions; 8143 SourceFileEdit get edit => _edit;
8083 8144
8084 /** 8145 /**
8085 * A list of the services being subscribed to. 8146 * The file edit that is to be applied to the given file to effect the
8147 * organizing.
8086 */ 8148 */
8087 void set subscriptions(List<ExecutionService> value) { 8149 void set edit(SourceFileEdit value) {
8088 assert(value != null); 8150 assert(value != null);
8089 this._subscriptions = value; 8151 this._edit = value;
8090 } 8152 }
8091 8153
8092 ExecutionSetSubscriptionsParams(List<ExecutionService> subscriptions) { 8154 EditOrganizeDirectivesResult(SourceFileEdit edit) {
8093 this.subscriptions = subscriptions; 8155 this.edit = edit;
8094 } 8156 }
8095 8157
8096 factory ExecutionSetSubscriptionsParams.fromJson( 8158 factory EditOrganizeDirectivesResult.fromJson(
8097 JsonDecoder jsonDecoder, String jsonPath, Object json) { 8159 JsonDecoder jsonDecoder, String jsonPath, Object json) {
8098 if (json == null) { 8160 if (json == null) {
8099 json = {}; 8161 json = {};
8100 } 8162 }
8101 if (json is Map) { 8163 if (json is Map) {
8102 List<ExecutionService> subscriptions; 8164 SourceFileEdit edit;
8103 if (json.containsKey("subscriptions")) { 8165 if (json.containsKey("edit")) {
8104 subscriptions = jsonDecoder.decodeList( 8166 edit = new SourceFileEdit.fromJson(
8105 jsonPath + ".subscriptions", 8167 jsonDecoder, jsonPath + ".edit", json["edit"]);
8106 json["subscriptions"],
8107 (String jsonPath, Object json) =>
8108 new ExecutionService.fromJson(jsonDecoder, jsonPath, json));
8109 } else { 8168 } else {
8110 throw jsonDecoder.missingKey(jsonPath, "subscriptions"); 8169 throw jsonDecoder.mismatch(jsonPath, "edit");
8111 } 8170 }
8112 return new ExecutionSetSubscriptionsParams(subscriptions); 8171 return new EditOrganizeDirectivesResult(edit);
8113 } else { 8172 } else {
8114 throw jsonDecoder.mismatch( 8173 throw jsonDecoder.mismatch(
8115 jsonPath, "execution.setSubscriptions params", json); 8174 jsonPath, "edit.organizeDirectives result", json);
8116 } 8175 }
8117 } 8176 }
8118 8177
8119 factory ExecutionSetSubscriptionsParams.fromRequest(Request request) { 8178 factory EditOrganizeDirectivesResult.fromResponse(Response response) {
8120 return new ExecutionSetSubscriptionsParams.fromJson( 8179 return new EditOrganizeDirectivesResult.fromJson(
8121 new RequestDecoder(request), "params", request._params); 8180 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
8181 "result",
8182 response.result);
8122 } 8183 }
8123 8184
8185 @override
8124 Map<String, dynamic> toJson() { 8186 Map<String, dynamic> toJson() {
8125 Map<String, dynamic> result = {}; 8187 Map<String, dynamic> result = {};
8126 result["subscriptions"] = 8188 result["edit"] = edit.toJson();
8127 subscriptions.map((ExecutionService value) => value.toJson()).toList();
8128 return result; 8189 return result;
8129 } 8190 }
8130 8191
8131 Request toRequest(String id) { 8192 @override
8132 return new Request(id, "execution.setSubscriptions", toJson()); 8193 Response toResponse(String id) {
8194 return new Response(id, result: toJson());
8133 } 8195 }
8134 8196
8135 @override 8197 @override
8136 String toString() => JSON.encode(toJson()); 8198 String toString() => JSON.encode(toJson());
8137 8199
8138 @override 8200 @override
8139 bool operator ==(other) { 8201 bool operator ==(other) {
8140 if (other is ExecutionSetSubscriptionsParams) { 8202 if (other is EditOrganizeDirectivesResult) {
8141 return listEqual(subscriptions, other.subscriptions, 8203 return edit == other.edit;
8142 (ExecutionService a, ExecutionService b) => a == b);
8143 } 8204 }
8144 return false; 8205 return false;
8145 } 8206 }
8146 8207
8147 @override 8208 @override
8148 int get hashCode { 8209 int get hashCode {
8149 int hash = 0; 8210 int hash = 0;
8150 hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode); 8211 hash = JenkinsSmiHash.combine(hash, edit.hashCode);
8151 return JenkinsSmiHash.finish(hash); 8212 return JenkinsSmiHash.finish(hash);
8152 } 8213 }
8153 } 8214 }
8154 8215
8155 /** 8216 /**
8156 * execution.setSubscriptions result 8217 * edit.sortMembers params
8157 *
8158 * Clients may not extend, implement or mix-in this class.
8159 */
8160 class ExecutionSetSubscriptionsResult {
8161 Response toResponse(String id) {
8162 return new Response(id, result: null);
8163 }
8164
8165 @override
8166 bool operator ==(other) {
8167 if (other is ExecutionSetSubscriptionsResult) {
8168 return true;
8169 }
8170 return false;
8171 }
8172
8173 @override
8174 int get hashCode {
8175 return 287678780;
8176 }
8177 }
8178
8179 /**
8180 * execution.launchData params
8181 * 8218 *
8182 * { 8219 * {
8183 * "file": FilePath 8220 * "file": FilePath
8184 * "kind": optional ExecutableKind
8185 * "referencedFiles": optional List<FilePath>
8186 * } 8221 * }
8187 * 8222 *
8188 * Clients may not extend, implement or mix-in this class. 8223 * Clients may not extend, implement or mix-in this class.
8189 */ 8224 */
8190 class ExecutionLaunchDataParams implements HasToJson { 8225 class EditSortMembersParams implements RequestParams {
8191 String _file; 8226 String _file;
8192 8227
8193 ExecutableKind _kind;
8194
8195 List<String> _referencedFiles;
8196
8197 /** 8228 /**
8198 * The file for which launch data is being provided. This will either be a 8229 * The Dart file to sort.
8199 * Dart library or an HTML file.
8200 */ 8230 */
8201 String get file => _file; 8231 String get file => _file;
8202 8232
8203 /** 8233 /**
8204 * The file for which launch data is being provided. This will either be a 8234 * The Dart file to sort.
8205 * Dart library or an HTML file.
8206 */ 8235 */
8207 void set file(String value) { 8236 void set file(String value) {
8208 assert(value != null); 8237 assert(value != null);
8209 this._file = value; 8238 this._file = value;
8210 } 8239 }
8211 8240
8212 /** 8241 EditSortMembersParams(String file) {
8213 * The kind of the executable file. This field is omitted if the file is not 8242 this.file = file;
8214 * a Dart file.
8215 */
8216 ExecutableKind get kind => _kind;
8217
8218 /**
8219 * The kind of the executable file. This field is omitted if the file is not
8220 * a Dart file.
8221 */
8222 void set kind(ExecutableKind value) {
8223 this._kind = value;
8224 } 8243 }
8225 8244
8226 /** 8245 factory EditSortMembersParams.fromJson(
8227 * A list of the Dart files that are referenced by the file. This field is
8228 * omitted if the file is not an HTML file.
8229 */
8230 List<String> get referencedFiles => _referencedFiles;
8231
8232 /**
8233 * A list of the Dart files that are referenced by the file. This field is
8234 * omitted if the file is not an HTML file.
8235 */
8236 void set referencedFiles(List<String> value) {
8237 this._referencedFiles = value;
8238 }
8239
8240 ExecutionLaunchDataParams(String file,
8241 {ExecutableKind kind, List<String> referencedFiles}) {
8242 this.file = file;
8243 this.kind = kind;
8244 this.referencedFiles = referencedFiles;
8245 }
8246
8247 factory ExecutionLaunchDataParams.fromJson(
8248 JsonDecoder jsonDecoder, String jsonPath, Object json) { 8246 JsonDecoder jsonDecoder, String jsonPath, Object json) {
8249 if (json == null) { 8247 if (json == null) {
8250 json = {}; 8248 json = {};
8251 } 8249 }
8252 if (json is Map) { 8250 if (json is Map) {
8253 String file; 8251 String file;
8254 if (json.containsKey("file")) { 8252 if (json.containsKey("file")) {
8255 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 8253 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
8256 } else { 8254 } else {
8257 throw jsonDecoder.missingKey(jsonPath, "file"); 8255 throw jsonDecoder.mismatch(jsonPath, "file");
8258 } 8256 }
8259 ExecutableKind kind; 8257 return new EditSortMembersParams(file);
8260 if (json.containsKey("kind")) {
8261 kind = new ExecutableKind.fromJson(
8262 jsonDecoder, jsonPath + ".kind", json["kind"]);
8263 }
8264 List<String> referencedFiles;
8265 if (json.containsKey("referencedFiles")) {
8266 referencedFiles = jsonDecoder.decodeList(jsonPath + ".referencedFiles",
8267 json["referencedFiles"], jsonDecoder.decodeString);
8268 }
8269 return new ExecutionLaunchDataParams(file,
8270 kind: kind, referencedFiles: referencedFiles);
8271 } else { 8258 } else {
8272 throw jsonDecoder.mismatch(jsonPath, "execution.launchData params", json); 8259 throw jsonDecoder.mismatch(jsonPath, "edit.sortMembers params", json);
8273 } 8260 }
8274 } 8261 }
8275 8262
8276 factory ExecutionLaunchDataParams.fromNotification( 8263 factory EditSortMembersParams.fromRequest(Request request) {
8277 Notification notification) { 8264 return new EditSortMembersParams.fromJson(
8278 return new ExecutionLaunchDataParams.fromJson( 8265 new RequestDecoder(request), "params", request.params);
8279 new ResponseDecoder(null), "params", notification._params);
8280 } 8266 }
8281 8267
8268 @override
8282 Map<String, dynamic> toJson() { 8269 Map<String, dynamic> toJson() {
8283 Map<String, dynamic> result = {}; 8270 Map<String, dynamic> result = {};
8284 result["file"] = file; 8271 result["file"] = file;
8285 if (kind != null) {
8286 result["kind"] = kind.toJson();
8287 }
8288 if (referencedFiles != null) {
8289 result["referencedFiles"] = referencedFiles;
8290 }
8291 return result; 8272 return result;
8292 } 8273 }
8293 8274
8294 Notification toNotification() { 8275 @override
8295 return new Notification("execution.launchData", toJson()); 8276 Request toRequest(String id) {
8277 return new Request(id, "edit.sortMembers", toJson());
8296 } 8278 }
8297 8279
8298 @override 8280 @override
8299 String toString() => JSON.encode(toJson()); 8281 String toString() => JSON.encode(toJson());
8300 8282
8301 @override 8283 @override
8302 bool operator ==(other) { 8284 bool operator ==(other) {
8303 if (other is ExecutionLaunchDataParams) { 8285 if (other is EditSortMembersParams) {
8304 return file == other.file && 8286 return file == other.file;
8305 kind == other.kind &&
8306 listEqual(referencedFiles, other.referencedFiles,
8307 (String a, String b) => a == b);
8308 } 8287 }
8309 return false; 8288 return false;
8310 } 8289 }
8311 8290
8312 @override 8291 @override
8313 int get hashCode { 8292 int get hashCode {
8314 int hash = 0; 8293 int hash = 0;
8315 hash = JenkinsSmiHash.combine(hash, file.hashCode); 8294 hash = JenkinsSmiHash.combine(hash, file.hashCode);
8316 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
8317 hash = JenkinsSmiHash.combine(hash, referencedFiles.hashCode);
8318 return JenkinsSmiHash.finish(hash); 8295 return JenkinsSmiHash.finish(hash);
8319 } 8296 }
8320 } 8297 }
8321 8298
8322 /** 8299 /**
8323 * diagnostic.getDiagnostics params 8300 * edit.sortMembers result
8324 *
8325 * Clients may not extend, implement or mix-in this class.
8326 */
8327 class DiagnosticGetDiagnosticsParams {
8328 Request toRequest(String id) {
8329 return new Request(id, "diagnostic.getDiagnostics", null);
8330 }
8331
8332 @override
8333 bool operator ==(other) {
8334 if (other is DiagnosticGetDiagnosticsParams) {
8335 return true;
8336 }
8337 return false;
8338 }
8339
8340 @override
8341 int get hashCode {
8342 return 587526202;
8343 }
8344 }
8345
8346 /**
8347 * diagnostic.getDiagnostics result
8348 * 8301 *
8349 * { 8302 * {
8350 * "contexts": List<ContextData> 8303 * "edit": SourceFileEdit
8351 * } 8304 * }
8352 * 8305 *
8353 * Clients may not extend, implement or mix-in this class. 8306 * Clients may not extend, implement or mix-in this class.
8354 */ 8307 */
8355 class DiagnosticGetDiagnosticsResult implements HasToJson { 8308 class EditSortMembersResult implements ResponseResult {
8356 List<ContextData> _contexts; 8309 SourceFileEdit _edit;
8357 8310
8358 /** 8311 /**
8359 * The list of analysis contexts. 8312 * The file edit that is to be applied to the given file to effect the
8313 * sorting.
8360 */ 8314 */
8361 List<ContextData> get contexts => _contexts; 8315 SourceFileEdit get edit => _edit;
8362 8316
8363 /** 8317 /**
8364 * The list of analysis contexts. 8318 * The file edit that is to be applied to the given file to effect the
8319 * sorting.
8365 */ 8320 */
8366 void set contexts(List<ContextData> value) { 8321 void set edit(SourceFileEdit value) {
8367 assert(value != null); 8322 assert(value != null);
8368 this._contexts = value; 8323 this._edit = value;
8369 } 8324 }
8370 8325
8371 DiagnosticGetDiagnosticsResult(List<ContextData> contexts) { 8326 EditSortMembersResult(SourceFileEdit edit) {
8372 this.contexts = contexts; 8327 this.edit = edit;
8373 } 8328 }
8374 8329
8375 factory DiagnosticGetDiagnosticsResult.fromJson( 8330 factory EditSortMembersResult.fromJson(
8376 JsonDecoder jsonDecoder, String jsonPath, Object json) { 8331 JsonDecoder jsonDecoder, String jsonPath, Object json) {
8377 if (json == null) { 8332 if (json == null) {
8378 json = {}; 8333 json = {};
8379 } 8334 }
8380 if (json is Map) { 8335 if (json is Map) {
8381 List<ContextData> contexts; 8336 SourceFileEdit edit;
8382 if (json.containsKey("contexts")) { 8337 if (json.containsKey("edit")) {
8383 contexts = jsonDecoder.decodeList( 8338 edit = new SourceFileEdit.fromJson(
8384 jsonPath + ".contexts", 8339 jsonDecoder, jsonPath + ".edit", json["edit"]);
8385 json["contexts"],
8386 (String jsonPath, Object json) =>
8387 new ContextData.fromJson(jsonDecoder, jsonPath, json));
8388 } else { 8340 } else {
8389 throw jsonDecoder.missingKey(jsonPath, "contexts"); 8341 throw jsonDecoder.mismatch(jsonPath, "edit");
8390 } 8342 }
8391 return new DiagnosticGetDiagnosticsResult(contexts); 8343 return new EditSortMembersResult(edit);
8392 } else { 8344 } else {
8393 throw jsonDecoder.mismatch( 8345 throw jsonDecoder.mismatch(jsonPath, "edit.sortMembers result", json);
8394 jsonPath, "diagnostic.getDiagnostics result", json);
8395 } 8346 }
8396 } 8347 }
8397 8348
8398 factory DiagnosticGetDiagnosticsResult.fromResponse(Response response) { 8349 factory EditSortMembersResult.fromResponse(Response response) {
8399 return new DiagnosticGetDiagnosticsResult.fromJson( 8350 return new EditSortMembersResult.fromJson(
8400 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), 8351 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
8401 "result", 8352 "result",
8402 response._result); 8353 response.result);
8403 } 8354 }
8404 8355
8356 @override
8405 Map<String, dynamic> toJson() { 8357 Map<String, dynamic> toJson() {
8406 Map<String, dynamic> result = {}; 8358 Map<String, dynamic> result = {};
8407 result["contexts"] = 8359 result["edit"] = edit.toJson();
8408 contexts.map((ContextData value) => value.toJson()).toList();
8409 return result; 8360 return result;
8410 } 8361 }
8411 8362
8363 @override
8412 Response toResponse(String id) { 8364 Response toResponse(String id) {
8413 return new Response(id, result: toJson()); 8365 return new Response(id, result: toJson());
8414 } 8366 }
8415 8367
8416 @override 8368 @override
8417 String toString() => JSON.encode(toJson()); 8369 String toString() => JSON.encode(toJson());
8418 8370
8419 @override 8371 @override
8420 bool operator ==(other) { 8372 bool operator ==(other) {
8421 if (other is DiagnosticGetDiagnosticsResult) { 8373 if (other is EditSortMembersResult) {
8422 return listEqual( 8374 return edit == other.edit;
8423 contexts, other.contexts, (ContextData a, ContextData b) => a == b);
8424 } 8375 }
8425 return false; 8376 return false;
8426 } 8377 }
8427 8378
8428 @override 8379 @override
8429 int get hashCode { 8380 int get hashCode {
8430 int hash = 0; 8381 int hash = 0;
8431 hash = JenkinsSmiHash.combine(hash, contexts.hashCode); 8382 hash = JenkinsSmiHash.combine(hash, edit.hashCode);
8432 return JenkinsSmiHash.finish(hash); 8383 return JenkinsSmiHash.finish(hash);
8433 } 8384 }
8434 } 8385 }
8435 8386
8436 /** 8387 /**
8437 * diagnostic.getServerPort params 8388 * Element
8438 *
8439 * Clients may not extend, implement or mix-in this class.
8440 */
8441 class DiagnosticGetServerPortParams {
8442 Request toRequest(String id) {
8443 return new Request(id, "diagnostic.getServerPort", null);
8444 }
8445
8446 @override
8447 bool operator ==(other) {
8448 if (other is DiagnosticGetServerPortParams) {
8449 return true;
8450 }
8451 return false;
8452 }
8453
8454 @override
8455 int get hashCode {
8456 return 367508704;
8457 }
8458 }
8459
8460 /**
8461 * diagnostic.getServerPort result
8462 * 8389 *
8463 * { 8390 * {
8464 * "port": int 8391 * "kind": ElementKind
8392 * "name": String
8393 * "location": optional Location
8394 * "flags": int
8395 * "parameters": optional String
8396 * "returnType": optional String
8397 * "typeParameters": optional String
8465 * } 8398 * }
8466 * 8399 *
8467 * Clients may not extend, implement or mix-in this class. 8400 * Clients may not extend, implement or mix-in this class.
8468 */ 8401 */
8469 class DiagnosticGetServerPortResult implements HasToJson { 8402 class Element implements HasToJson {
8470 int _port; 8403 static const int FLAG_ABSTRACT = 0x01;
8471 8404 static const int FLAG_CONST = 0x02;
8472 /** 8405 static const int FLAG_FINAL = 0x04;
8473 * The diagnostic server port. 8406 static const int FLAG_STATIC = 0x08;
8474 */ 8407 static const int FLAG_PRIVATE = 0x10;
8475 int get port => _port; 8408 static const int FLAG_DEPRECATED = 0x20;
8476 8409
8477 /** 8410 static int makeFlags(
8478 * The diagnostic server port. 8411 {isAbstract: false,
8479 */ 8412 isConst: false,
8480 void set port(int value) { 8413 isFinal: false,
8414 isStatic: false,
8415 isPrivate: false,
8416 isDeprecated: false}) {
8417 int flags = 0;
8418 if (isAbstract) flags |= FLAG_ABSTRACT;
8419 if (isConst) flags |= FLAG_CONST;
8420 if (isFinal) flags |= FLAG_FINAL;
8421 if (isStatic) flags |= FLAG_STATIC;
8422 if (isPrivate) flags |= FLAG_PRIVATE;
8423 if (isDeprecated) flags |= FLAG_DEPRECATED;
8424 return flags;
8425 }
8426
8427 ElementKind _kind;
8428
8429 String _name;
8430
8431 Location _location;
8432
8433 int _flags;
8434
8435 String _parameters;
8436
8437 String _returnType;
8438
8439 String _typeParameters;
8440
8441 /**
8442 * The kind of the element.
8443 */
8444 ElementKind get kind => _kind;
8445
8446 /**
8447 * The kind of the element.
8448 */
8449 void set kind(ElementKind value) {
8481 assert(value != null); 8450 assert(value != null);
8482 this._port = value; 8451 this._kind = value;
8483 } 8452 }
8484 8453
8485 DiagnosticGetServerPortResult(int port) { 8454 /**
8486 this.port = port; 8455 * The name of the element. This is typically used as the label in the
8487 } 8456 * outline.
8488 8457 */
8489 factory DiagnosticGetServerPortResult.fromJson( 8458 String get name => _name;
8459
8460 /**
8461 * The name of the element. This is typically used as the label in the
8462 * outline.
8463 */
8464 void set name(String value) {
8465 assert(value != null);
8466 this._name = value;
8467 }
8468
8469 /**
8470 * The location of the name in the declaration of the element.
8471 */
8472 Location get location => _location;
8473
8474 /**
8475 * The location of the name in the declaration of the element.
8476 */
8477 void set location(Location value) {
8478 this._location = value;
8479 }
8480
8481 /**
8482 * A bit-map containing the following flags:
8483 *
8484 * - 0x01 - set if the element is explicitly or implicitly abstract
8485 * - 0x02 - set if the element was declared to be ‘const’
8486 * - 0x04 - set if the element was declared to be ‘final’
8487 * - 0x08 - set if the element is a static member of a class or is a
8488 * top-level function or field
8489 * - 0x10 - set if the element is private
8490 * - 0x20 - set if the element is deprecated
8491 */
8492 int get flags => _flags;
8493
8494 /**
8495 * A bit-map containing the following flags:
8496 *
8497 * - 0x01 - set if the element is explicitly or implicitly abstract
8498 * - 0x02 - set if the element was declared to be ‘const’
8499 * - 0x04 - set if the element was declared to be ‘final’
8500 * - 0x08 - set if the element is a static member of a class or is a
8501 * top-level function or field
8502 * - 0x10 - set if the element is private
8503 * - 0x20 - set if the element is deprecated
8504 */
8505 void set flags(int value) {
8506 assert(value != null);
8507 this._flags = value;
8508 }
8509
8510 /**
8511 * The parameter list for the element. If the element is not a method or
8512 * function this field will not be defined. If the element doesn't have
8513 * parameters (e.g. getter), this field will not be defined. If the element
8514 * has zero parameters, this field will have a value of "()".
8515 */
8516 String get parameters => _parameters;
8517
8518 /**
8519 * The parameter list for the element. If the element is not a method or
8520 * function this field will not be defined. If the element doesn't have
8521 * parameters (e.g. getter), this field will not be defined. If the element
8522 * has zero parameters, this field will have a value of "()".
8523 */
8524 void set parameters(String value) {
8525 this._parameters = value;
8526 }
8527
8528 /**
8529 * The return type of the element. If the element is not a method or function
8530 * this field will not be defined. If the element does not have a declared
8531 * return type, this field will contain an empty string.
8532 */
8533 String get returnType => _returnType;
8534
8535 /**
8536 * The return type of the element. If the element is not a method or function
8537 * this field will not be defined. If the element does not have a declared
8538 * return type, this field will contain an empty string.
8539 */
8540 void set returnType(String value) {
8541 this._returnType = value;
8542 }
8543
8544 /**
8545 * The type parameter list for the element. If the element doesn't have type
8546 * parameters, this field will not be defined.
8547 */
8548 String get typeParameters => _typeParameters;
8549
8550 /**
8551 * The type parameter list for the element. If the element doesn't have type
8552 * parameters, this field will not be defined.
8553 */
8554 void set typeParameters(String value) {
8555 this._typeParameters = value;
8556 }
8557
8558 Element(ElementKind kind, String name, int flags,
8559 {Location location,
8560 String parameters,
8561 String returnType,
8562 String typeParameters}) {
8563 this.kind = kind;
8564 this.name = name;
8565 this.location = location;
8566 this.flags = flags;
8567 this.parameters = parameters;
8568 this.returnType = returnType;
8569 this.typeParameters = typeParameters;
8570 }
8571
8572 factory Element.fromJson(
8490 JsonDecoder jsonDecoder, String jsonPath, Object json) { 8573 JsonDecoder jsonDecoder, String jsonPath, Object json) {
8491 if (json == null) { 8574 if (json == null) {
8492 json = {}; 8575 json = {};
8493 } 8576 }
8494 if (json is Map) { 8577 if (json is Map) {
8495 int port; 8578 ElementKind kind;
8496 if (json.containsKey("port")) { 8579 if (json.containsKey("kind")) {
8497 port = jsonDecoder.decodeInt(jsonPath + ".port", json["port"]); 8580 kind = new ElementKind.fromJson(
8581 jsonDecoder, jsonPath + ".kind", json["kind"]);
8498 } else { 8582 } else {
8499 throw jsonDecoder.missingKey(jsonPath, "port"); 8583 throw jsonDecoder.mismatch(jsonPath, "kind");
8500 } 8584 }
8501 return new DiagnosticGetServerPortResult(port); 8585 String name;
8502 } else { 8586 if (json.containsKey("name")) {
8503 throw jsonDecoder.mismatch( 8587 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]);
8504 jsonPath, "diagnostic.getServerPort result", json);
8505 }
8506 }
8507
8508 factory DiagnosticGetServerPortResult.fromResponse(Response response) {
8509 return new DiagnosticGetServerPortResult.fromJson(
8510 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
8511 "result",
8512 response._result);
8513 }
8514
8515 Map<String, dynamic> toJson() {
8516 Map<String, dynamic> result = {};
8517 result["port"] = port;
8518 return result;
8519 }
8520
8521 Response toResponse(String id) {
8522 return new Response(id, result: toJson());
8523 }
8524
8525 @override
8526 String toString() => JSON.encode(toJson());
8527
8528 @override
8529 bool operator ==(other) {
8530 if (other is DiagnosticGetServerPortResult) {
8531 return port == other.port;
8532 }
8533 return false;
8534 }
8535
8536 @override
8537 int get hashCode {
8538 int hash = 0;
8539 hash = JenkinsSmiHash.combine(hash, port.hashCode);
8540 return JenkinsSmiHash.finish(hash);
8541 }
8542 }
8543
8544 /**
8545 * AddContentOverlay
8546 *
8547 * {
8548 * "type": "add"
8549 * "content": String
8550 * }
8551 *
8552 * Clients may not extend, implement or mix-in this class.
8553 */
8554 class AddContentOverlay implements HasToJson {
8555 String _content;
8556
8557 /**
8558 * The new content of the file.
8559 */
8560 String get content => _content;
8561
8562 /**
8563 * The new content of the file.
8564 */
8565 void set content(String value) {
8566 assert(value != null);
8567 this._content = value;
8568 }
8569
8570 AddContentOverlay(String content) {
8571 this.content = content;
8572 }
8573
8574 factory AddContentOverlay.fromJson(
8575 JsonDecoder jsonDecoder, String jsonPath, Object json) {
8576 if (json == null) {
8577 json = {};
8578 }
8579 if (json is Map) {
8580 if (json["type"] != "add") {
8581 throw jsonDecoder.mismatch(jsonPath, "equal " + "add", json);
8582 }
8583 String content;
8584 if (json.containsKey("content")) {
8585 content =
8586 jsonDecoder.decodeString(jsonPath + ".content", json["content"]);
8587 } else { 8588 } else {
8588 throw jsonDecoder.missingKey(jsonPath, "content"); 8589 throw jsonDecoder.mismatch(jsonPath, "name");
8589 }
8590 return new AddContentOverlay(content);
8591 } else {
8592 throw jsonDecoder.mismatch(jsonPath, "AddContentOverlay", json);
8593 }
8594 }
8595
8596 Map<String, dynamic> toJson() {
8597 Map<String, dynamic> result = {};
8598 result["type"] = "add";
8599 result["content"] = content;
8600 return result;
8601 }
8602
8603 @override
8604 String toString() => JSON.encode(toJson());
8605
8606 @override
8607 bool operator ==(other) {
8608 if (other is AddContentOverlay) {
8609 return content == other.content;
8610 }
8611 return false;
8612 }
8613
8614 @override
8615 int get hashCode {
8616 int hash = 0;
8617 hash = JenkinsSmiHash.combine(hash, 704418402);
8618 hash = JenkinsSmiHash.combine(hash, content.hashCode);
8619 return JenkinsSmiHash.finish(hash);
8620 }
8621 }
8622
8623 /**
8624 * AnalysisError
8625 *
8626 * {
8627 * "severity": AnalysisErrorSeverity
8628 * "type": AnalysisErrorType
8629 * "location": Location
8630 * "message": String
8631 * "correction": optional String
8632 * "code": String
8633 * "hasFix": optional bool
8634 * }
8635 *
8636 * Clients may not extend, implement or mix-in this class.
8637 */
8638 class AnalysisError implements HasToJson {
8639 AnalysisErrorSeverity _severity;
8640
8641 AnalysisErrorType _type;
8642
8643 Location _location;
8644
8645 String _message;
8646
8647 String _correction;
8648
8649 String _code;
8650
8651 bool _hasFix;
8652
8653 /**
8654 * The severity of the error.
8655 */
8656 AnalysisErrorSeverity get severity => _severity;
8657
8658 /**
8659 * The severity of the error.
8660 */
8661 void set severity(AnalysisErrorSeverity value) {
8662 assert(value != null);
8663 this._severity = value;
8664 }
8665
8666 /**
8667 * The type of the error.
8668 */
8669 AnalysisErrorType get type => _type;
8670
8671 /**
8672 * The type of the error.
8673 */
8674 void set type(AnalysisErrorType value) {
8675 assert(value != null);
8676 this._type = value;
8677 }
8678
8679 /**
8680 * The location associated with the error.
8681 */
8682 Location get location => _location;
8683
8684 /**
8685 * The location associated with the error.
8686 */
8687 void set location(Location value) {
8688 assert(value != null);
8689 this._location = value;
8690 }
8691
8692 /**
8693 * The message to be displayed for this error. The message should indicate
8694 * what is wrong with the code and why it is wrong.
8695 */
8696 String get message => _message;
8697
8698 /**
8699 * The message to be displayed for this error. The message should indicate
8700 * what is wrong with the code and why it is wrong.
8701 */
8702 void set message(String value) {
8703 assert(value != null);
8704 this._message = value;
8705 }
8706
8707 /**
8708 * The correction message to be displayed for this error. The correction
8709 * message should indicate how the user can fix the error. The field is
8710 * omitted if there is no correction message associated with the error code.
8711 */
8712 String get correction => _correction;
8713
8714 /**
8715 * The correction message to be displayed for this error. The correction
8716 * message should indicate how the user can fix the error. The field is
8717 * omitted if there is no correction message associated with the error code.
8718 */
8719 void set correction(String value) {
8720 this._correction = value;
8721 }
8722
8723 /**
8724 * The name, as a string, of the error code associated with this error.
8725 */
8726 String get code => _code;
8727
8728 /**
8729 * The name, as a string, of the error code associated with this error.
8730 */
8731 void set code(String value) {
8732 assert(value != null);
8733 this._code = value;
8734 }
8735
8736 /**
8737 * A hint to indicate to interested clients that this error has an associated
8738 * fix (or fixes). The absence of this field implies there are not known to
8739 * be fixes. Note that since the operation to calculate whether fixes apply
8740 * needs to be performant it is possible that complicated tests will be
8741 * skipped and a false negative returned. For this reason, this attribute
8742 * should be treated as a "hint". Despite the possibility of false negatives,
8743 * no false positives should be returned. If a client sees this flag set they
8744 * can proceed with the confidence that there are in fact associated fixes.
8745 */
8746 bool get hasFix => _hasFix;
8747
8748 /**
8749 * A hint to indicate to interested clients that this error has an associated
8750 * fix (or fixes). The absence of this field implies there are not known to
8751 * be fixes. Note that since the operation to calculate whether fixes apply
8752 * needs to be performant it is possible that complicated tests will be
8753 * skipped and a false negative returned. For this reason, this attribute
8754 * should be treated as a "hint". Despite the possibility of false negatives,
8755 * no false positives should be returned. If a client sees this flag set they
8756 * can proceed with the confidence that there are in fact associated fixes.
8757 */
8758 void set hasFix(bool value) {
8759 this._hasFix = value;
8760 }
8761
8762 AnalysisError(AnalysisErrorSeverity severity, AnalysisErrorType type,
8763 Location location, String message, String code,
8764 {String correction, bool hasFix}) {
8765 this.severity = severity;
8766 this.type = type;
8767 this.location = location;
8768 this.message = message;
8769 this.correction = correction;
8770 this.code = code;
8771 this.hasFix = hasFix;
8772 }
8773
8774 factory AnalysisError.fromJson(
8775 JsonDecoder jsonDecoder, String jsonPath, Object json) {
8776 if (json == null) {
8777 json = {};
8778 }
8779 if (json is Map) {
8780 AnalysisErrorSeverity severity;
8781 if (json.containsKey("severity")) {
8782 severity = new AnalysisErrorSeverity.fromJson(
8783 jsonDecoder, jsonPath + ".severity", json["severity"]);
8784 } else {
8785 throw jsonDecoder.missingKey(jsonPath, "severity");
8786 }
8787 AnalysisErrorType type;
8788 if (json.containsKey("type")) {
8789 type = new AnalysisErrorType.fromJson(
8790 jsonDecoder, jsonPath + ".type", json["type"]);
8791 } else {
8792 throw jsonDecoder.missingKey(jsonPath, "type");
8793 } 8590 }
8794 Location location; 8591 Location location;
8795 if (json.containsKey("location")) { 8592 if (json.containsKey("location")) {
8796 location = new Location.fromJson( 8593 location = new Location.fromJson(
8797 jsonDecoder, jsonPath + ".location", json["location"]); 8594 jsonDecoder, jsonPath + ".location", json["location"]);
8595 }
8596 int flags;
8597 if (json.containsKey("flags")) {
8598 flags = jsonDecoder.decodeInt(jsonPath + ".flags", json["flags"]);
8798 } else { 8599 } else {
8799 throw jsonDecoder.missingKey(jsonPath, "location"); 8600 throw jsonDecoder.mismatch(jsonPath, "flags");
8800 } 8601 }
8801 String message; 8602 String parameters;
8802 if (json.containsKey("message")) { 8603 if (json.containsKey("parameters")) {
8803 message = 8604 parameters = jsonDecoder.decodeString(
8804 jsonDecoder.decodeString(jsonPath + ".message", json["message"]); 8605 jsonPath + ".parameters", json["parameters"]);
8805 } else { 8606 }
8806 throw jsonDecoder.missingKey(jsonPath, "message"); 8607 String returnType;
8807 } 8608 if (json.containsKey("returnType")) {
8808 String correction; 8609 returnType = jsonDecoder.decodeString(
8809 if (json.containsKey("correction")) { 8610 jsonPath + ".returnType", json["returnType"]);
8810 correction = jsonDecoder.decodeString( 8611 }
8811 jsonPath + ".correction", json["correction"]); 8612 String typeParameters;
8812 } 8613 if (json.containsKey("typeParameters")) {
8813 String code; 8614 typeParameters = jsonDecoder.decodeString(
8814 if (json.containsKey("code")) { 8615 jsonPath + ".typeParameters", json["typeParameters"]);
8815 code = jsonDecoder.decodeString(jsonPath + ".code", json["code"]); 8616 }
8816 } else { 8617 return new Element(kind, name, flags,
8817 throw jsonDecoder.missingKey(jsonPath, "code"); 8618 location: location,
8818 } 8619 parameters: parameters,
8819 bool hasFix; 8620 returnType: returnType,
8820 if (json.containsKey("hasFix")) { 8621 typeParameters: typeParameters);
8821 hasFix = jsonDecoder.decodeBool(jsonPath + ".hasFix", json["hasFix"]);
8822 }
8823 return new AnalysisError(severity, type, location, message, code,
8824 correction: correction, hasFix: hasFix);
8825 } else { 8622 } else {
8826 throw jsonDecoder.mismatch(jsonPath, "AnalysisError", json); 8623 throw jsonDecoder.mismatch(jsonPath, "Element", json);
8827 } 8624 }
8828 } 8625 }
8829 8626
8627 bool get isAbstract => (flags & FLAG_ABSTRACT) != 0;
8628 bool get isConst => (flags & FLAG_CONST) != 0;
8629 bool get isFinal => (flags & FLAG_FINAL) != 0;
8630 bool get isStatic => (flags & FLAG_STATIC) != 0;
8631 bool get isPrivate => (flags & FLAG_PRIVATE) != 0;
8632 bool get isDeprecated => (flags & FLAG_DEPRECATED) != 0;
8633
8634 @override
8830 Map<String, dynamic> toJson() { 8635 Map<String, dynamic> toJson() {
8831 Map<String, dynamic> result = {}; 8636 Map<String, dynamic> result = {};
8832 result["severity"] = severity.toJson(); 8637 result["kind"] = kind.toJson();
8833 result["type"] = type.toJson(); 8638 result["name"] = name;
8834 result["location"] = location.toJson(); 8639 if (location != null) {
8835 result["message"] = message; 8640 result["location"] = location.toJson();
8836 if (correction != null) { 8641 }
8837 result["correction"] = correction; 8642 result["flags"] = flags;
8838 } 8643 if (parameters != null) {
8839 result["code"] = code; 8644 result["parameters"] = parameters;
8840 if (hasFix != null) { 8645 }
8841 result["hasFix"] = hasFix; 8646 if (returnType != null) {
8647 result["returnType"] = returnType;
8648 }
8649 if (typeParameters != null) {
8650 result["typeParameters"] = typeParameters;
8842 } 8651 }
8843 return result; 8652 return result;
8844 } 8653 }
8845 8654
8846 @override 8655 @override
8847 String toString() => JSON.encode(toJson()); 8656 String toString() => JSON.encode(toJson());
8848 8657
8849 @override 8658 @override
8850 bool operator ==(other) { 8659 bool operator ==(other) {
8851 if (other is AnalysisError) { 8660 if (other is Element) {
8852 return severity == other.severity && 8661 return kind == other.kind &&
8853 type == other.type && 8662 name == other.name &&
8854 location == other.location && 8663 location == other.location &&
8855 message == other.message && 8664 flags == other.flags &&
8856 correction == other.correction && 8665 parameters == other.parameters &&
8857 code == other.code && 8666 returnType == other.returnType &&
8858 hasFix == other.hasFix; 8667 typeParameters == other.typeParameters;
8859 } 8668 }
8860 return false; 8669 return false;
8861 } 8670 }
8862 8671
8863 @override 8672 @override
8864 int get hashCode { 8673 int get hashCode {
8865 int hash = 0; 8674 int hash = 0;
8866 hash = JenkinsSmiHash.combine(hash, severity.hashCode); 8675 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
8867 hash = JenkinsSmiHash.combine(hash, type.hashCode); 8676 hash = JenkinsSmiHash.combine(hash, name.hashCode);
8868 hash = JenkinsSmiHash.combine(hash, location.hashCode); 8677 hash = JenkinsSmiHash.combine(hash, location.hashCode);
8869 hash = JenkinsSmiHash.combine(hash, message.hashCode); 8678 hash = JenkinsSmiHash.combine(hash, flags.hashCode);
8870 hash = JenkinsSmiHash.combine(hash, correction.hashCode); 8679 hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
8871 hash = JenkinsSmiHash.combine(hash, code.hashCode); 8680 hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
8872 hash = JenkinsSmiHash.combine(hash, hasFix.hashCode); 8681 hash = JenkinsSmiHash.combine(hash, typeParameters.hashCode);
8873 return JenkinsSmiHash.finish(hash); 8682 return JenkinsSmiHash.finish(hash);
8874 } 8683 }
8875 } 8684 }
8876 8685
8877 /** 8686 /**
8878 * AnalysisErrorFixes 8687 * ElementKind
8879 * 8688 *
8880 * { 8689 * enum {
8881 * "error": AnalysisError 8690 * CLASS
8882 * "fixes": List<SourceChange> 8691 * CLASS_TYPE_ALIAS
8692 * COMPILATION_UNIT
8693 * CONSTRUCTOR
8694 * ENUM
8695 * ENUM_CONSTANT
8696 * FIELD
8697 * FILE
8698 * FUNCTION
8699 * FUNCTION_TYPE_ALIAS
8700 * GETTER
8701 * LABEL
8702 * LIBRARY
8703 * LOCAL_VARIABLE
8704 * METHOD
8705 * PARAMETER
8706 * PREFIX
8707 * SETTER
8708 * TOP_LEVEL_VARIABLE
8709 * TYPE_PARAMETER
8710 * UNIT_TEST_GROUP
8711 * UNIT_TEST_TEST
8712 * UNKNOWN
8883 * } 8713 * }
8884 * 8714 *
8885 * Clients may not extend, implement or mix-in this class. 8715 * Clients may not extend, implement or mix-in this class.
8886 */ 8716 */
8887 class AnalysisErrorFixes implements HasToJson { 8717 class ElementKind implements Enum {
8888 AnalysisError _error; 8718 static const ElementKind CLASS = const ElementKind._("CLASS");
8889 8719
8890 List<SourceChange> _fixes; 8720 static const ElementKind CLASS_TYPE_ALIAS =
8891 8721 const ElementKind._("CLASS_TYPE_ALIAS");
8892 /** 8722
8893 * The error with which the fixes are associated. 8723 static const ElementKind COMPILATION_UNIT =
8894 */ 8724 const ElementKind._("COMPILATION_UNIT");
8895 AnalysisError get error => _error; 8725
8896 8726 static const ElementKind CONSTRUCTOR = const ElementKind._("CONSTRUCTOR");
8897 /** 8727
8898 * The error with which the fixes are associated. 8728 static const ElementKind ENUM = const ElementKind._("ENUM");
8899 */ 8729
8900 void set error(AnalysisError value) { 8730 static const ElementKind ENUM_CONSTANT = const ElementKind._("ENUM_CONSTANT");
8731
8732 static const ElementKind FIELD = const ElementKind._("FIELD");
8733
8734 static const ElementKind FILE = const ElementKind._("FILE");
8735
8736 static const ElementKind FUNCTION = const ElementKind._("FUNCTION");
8737
8738 static const ElementKind FUNCTION_TYPE_ALIAS =
8739 const ElementKind._("FUNCTION_TYPE_ALIAS");
8740
8741 static const ElementKind GETTER = const ElementKind._("GETTER");
8742
8743 static const ElementKind LABEL = const ElementKind._("LABEL");
8744
8745 static const ElementKind LIBRARY = const ElementKind._("LIBRARY");
8746
8747 static const ElementKind LOCAL_VARIABLE =
8748 const ElementKind._("LOCAL_VARIABLE");
8749
8750 static const ElementKind METHOD = const ElementKind._("METHOD");
8751
8752 static const ElementKind PARAMETER = const ElementKind._("PARAMETER");
8753
8754 static const ElementKind PREFIX = const ElementKind._("PREFIX");
8755
8756 static const ElementKind SETTER = const ElementKind._("SETTER");
8757
8758 static const ElementKind TOP_LEVEL_VARIABLE =
8759 const ElementKind._("TOP_LEVEL_VARIABLE");
8760
8761 static const ElementKind TYPE_PARAMETER =
8762 const ElementKind._("TYPE_PARAMETER");
8763
8764 /**
8765 * Deprecated: support for tests was removed.
8766 */
8767 static const ElementKind UNIT_TEST_GROUP =
8768 const ElementKind._("UNIT_TEST_GROUP");
8769
8770 /**
8771 * Deprecated: support for tests was removed.
8772 */
8773 static const ElementKind UNIT_TEST_TEST =
8774 const ElementKind._("UNIT_TEST_TEST");
8775
8776 static const ElementKind UNKNOWN = const ElementKind._("UNKNOWN");
8777
8778 /**
8779 * A list containing all of the enum values that are defined.
8780 */
8781 static const List<ElementKind> VALUES = const <ElementKind>[
8782 CLASS,
8783 CLASS_TYPE_ALIAS,
8784 COMPILATION_UNIT,
8785 CONSTRUCTOR,
8786 ENUM,
8787 ENUM_CONSTANT,
8788 FIELD,
8789 FILE,
8790 FUNCTION,
8791 FUNCTION_TYPE_ALIAS,
8792 GETTER,
8793 LABEL,
8794 LIBRARY,
8795 LOCAL_VARIABLE,
8796 METHOD,
8797 PARAMETER,
8798 PREFIX,
8799 SETTER,
8800 TOP_LEVEL_VARIABLE,
8801 TYPE_PARAMETER,
8802 UNIT_TEST_GROUP,
8803 UNIT_TEST_TEST,
8804 UNKNOWN
8805 ];
8806
8807 @override
8808 final String name;
8809
8810 const ElementKind._(this.name);
8811
8812 factory ElementKind(String name) {
8813 switch (name) {
8814 case "CLASS":
8815 return CLASS;
8816 case "CLASS_TYPE_ALIAS":
8817 return CLASS_TYPE_ALIAS;
8818 case "COMPILATION_UNIT":
8819 return COMPILATION_UNIT;
8820 case "CONSTRUCTOR":
8821 return CONSTRUCTOR;
8822 case "ENUM":
8823 return ENUM;
8824 case "ENUM_CONSTANT":
8825 return ENUM_CONSTANT;
8826 case "FIELD":
8827 return FIELD;
8828 case "FILE":
8829 return FILE;
8830 case "FUNCTION":
8831 return FUNCTION;
8832 case "FUNCTION_TYPE_ALIAS":
8833 return FUNCTION_TYPE_ALIAS;
8834 case "GETTER":
8835 return GETTER;
8836 case "LABEL":
8837 return LABEL;
8838 case "LIBRARY":
8839 return LIBRARY;
8840 case "LOCAL_VARIABLE":
8841 return LOCAL_VARIABLE;
8842 case "METHOD":
8843 return METHOD;
8844 case "PARAMETER":
8845 return PARAMETER;
8846 case "PREFIX":
8847 return PREFIX;
8848 case "SETTER":
8849 return SETTER;
8850 case "TOP_LEVEL_VARIABLE":
8851 return TOP_LEVEL_VARIABLE;
8852 case "TYPE_PARAMETER":
8853 return TYPE_PARAMETER;
8854 case "UNIT_TEST_GROUP":
8855 return UNIT_TEST_GROUP;
8856 case "UNIT_TEST_TEST":
8857 return UNIT_TEST_TEST;
8858 case "UNKNOWN":
8859 return UNKNOWN;
8860 }
8861 throw new Exception('Illegal enum value: $name');
8862 }
8863
8864 factory ElementKind.fromJson(
8865 JsonDecoder jsonDecoder, String jsonPath, Object json) {
8866 if (json is String) {
8867 try {
8868 return new ElementKind(json);
8869 } catch (_) {
8870 // Fall through
8871 }
8872 }
8873 throw jsonDecoder.mismatch(jsonPath, "ElementKind", json);
8874 }
8875
8876 @override
8877 String toString() => "ElementKind.$name";
8878
8879 String toJson() => name;
8880 }
8881
8882 /**
8883 * ExecutableFile
8884 *
8885 * {
8886 * "file": FilePath
8887 * "kind": ExecutableKind
8888 * }
8889 *
8890 * Clients may not extend, implement or mix-in this class.
8891 */
8892 class ExecutableFile implements HasToJson {
8893 String _file;
8894
8895 ExecutableKind _kind;
8896
8897 /**
8898 * The path of the executable file.
8899 */
8900 String get file => _file;
8901
8902 /**
8903 * The path of the executable file.
8904 */
8905 void set file(String value) {
8901 assert(value != null); 8906 assert(value != null);
8902 this._error = value; 8907 this._file = value;
8903 } 8908 }
8904 8909
8905 /** 8910 /**
8906 * The fixes associated with the error. 8911 * The kind of the executable file.
8907 */ 8912 */
8908 List<SourceChange> get fixes => _fixes; 8913 ExecutableKind get kind => _kind;
8909 8914
8910 /** 8915 /**
8911 * The fixes associated with the error. 8916 * The kind of the executable file.
8912 */ 8917 */
8913 void set fixes(List<SourceChange> value) { 8918 void set kind(ExecutableKind value) {
8914 assert(value != null); 8919 assert(value != null);
8915 this._fixes = value; 8920 this._kind = value;
8916 } 8921 }
8917 8922
8918 AnalysisErrorFixes(AnalysisError error, {List<SourceChange> fixes}) { 8923 ExecutableFile(String file, ExecutableKind kind) {
8919 this.error = error; 8924 this.file = file;
8920 if (fixes == null) { 8925 this.kind = kind;
8921 this.fixes = <SourceChange>[]; 8926 }
8922 } else { 8927
8923 this.fixes = fixes; 8928 factory ExecutableFile.fromJson(
8924 }
8925 }
8926
8927 factory AnalysisErrorFixes.fromJson(
8928 JsonDecoder jsonDecoder, String jsonPath, Object json) { 8929 JsonDecoder jsonDecoder, String jsonPath, Object json) {
8929 if (json == null) { 8930 if (json == null) {
8930 json = {}; 8931 json = {};
8931 } 8932 }
8932 if (json is Map) { 8933 if (json is Map) {
8933 AnalysisError error; 8934 String file;
8934 if (json.containsKey("error")) { 8935 if (json.containsKey("file")) {
8935 error = new AnalysisError.fromJson( 8936 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
8936 jsonDecoder, jsonPath + ".error", json["error"]);
8937 } else { 8937 } else {
8938 throw jsonDecoder.missingKey(jsonPath, "error"); 8938 throw jsonDecoder.mismatch(jsonPath, "file");
8939 } 8939 }
8940 List<SourceChange> fixes; 8940 ExecutableKind kind;
8941 if (json.containsKey("fixes")) { 8941 if (json.containsKey("kind")) {
8942 fixes = jsonDecoder.decodeList( 8942 kind = new ExecutableKind.fromJson(
8943 jsonPath + ".fixes", 8943 jsonDecoder, jsonPath + ".kind", json["kind"]);
8944 json["fixes"],
8945 (String jsonPath, Object json) =>
8946 new SourceChange.fromJson(jsonDecoder, jsonPath, json));
8947 } else { 8944 } else {
8948 throw jsonDecoder.missingKey(jsonPath, "fixes"); 8945 throw jsonDecoder.mismatch(jsonPath, "kind");
8949 } 8946 }
8950 return new AnalysisErrorFixes(error, fixes: fixes); 8947 return new ExecutableFile(file, kind);
8951 } else { 8948 } else {
8952 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorFixes", json); 8949 throw jsonDecoder.mismatch(jsonPath, "ExecutableFile", json);
8953 } 8950 }
8954 } 8951 }
8955 8952
8953 @override
8956 Map<String, dynamic> toJson() { 8954 Map<String, dynamic> toJson() {
8957 Map<String, dynamic> result = {}; 8955 Map<String, dynamic> result = {};
8958 result["error"] = error.toJson(); 8956 result["file"] = file;
8959 result["fixes"] = 8957 result["kind"] = kind.toJson();
8960 fixes.map((SourceChange value) => value.toJson()).toList();
8961 return result; 8958 return result;
8962 } 8959 }
8963 8960
8964 @override 8961 @override
8965 String toString() => JSON.encode(toJson()); 8962 String toString() => JSON.encode(toJson());
8966 8963
8967 @override 8964 @override
8968 bool operator ==(other) { 8965 bool operator ==(other) {
8969 if (other is AnalysisErrorFixes) { 8966 if (other is ExecutableFile) {
8970 return error == other.error && 8967 return file == other.file && kind == other.kind;
8971 listEqual(
8972 fixes, other.fixes, (SourceChange a, SourceChange b) => a == b);
8973 } 8968 }
8974 return false; 8969 return false;
8975 } 8970 }
8976 8971
8977 @override 8972 @override
8978 int get hashCode { 8973 int get hashCode {
8979 int hash = 0; 8974 int hash = 0;
8980 hash = JenkinsSmiHash.combine(hash, error.hashCode); 8975 hash = JenkinsSmiHash.combine(hash, file.hashCode);
8981 hash = JenkinsSmiHash.combine(hash, fixes.hashCode); 8976 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
8982 return JenkinsSmiHash.finish(hash); 8977 return JenkinsSmiHash.finish(hash);
8983 } 8978 }
8984 } 8979 }
8985 8980
8986 /** 8981 /**
8987 * AnalysisErrorSeverity 8982 * ExecutableKind
8988 * 8983 *
8989 * enum { 8984 * enum {
8990 * INFO 8985 * CLIENT
8991 * WARNING 8986 * EITHER
8992 * ERROR 8987 * NOT_EXECUTABLE
8988 * SERVER
8993 * } 8989 * }
8994 * 8990 *
8995 * Clients may not extend, implement or mix-in this class. 8991 * Clients may not extend, implement or mix-in this class.
8996 */ 8992 */
8997 class AnalysisErrorSeverity implements Enum { 8993 class ExecutableKind implements Enum {
8998 static const AnalysisErrorSeverity INFO = 8994 static const ExecutableKind CLIENT = const ExecutableKind._("CLIENT");
8999 const AnalysisErrorSeverity._("INFO"); 8995
9000 8996 static const ExecutableKind EITHER = const ExecutableKind._("EITHER");
9001 static const AnalysisErrorSeverity WARNING = 8997
9002 const AnalysisErrorSeverity._("WARNING"); 8998 static const ExecutableKind NOT_EXECUTABLE =
9003 8999 const ExecutableKind._("NOT_EXECUTABLE");
9004 static const AnalysisErrorSeverity ERROR = 9000
9005 const AnalysisErrorSeverity._("ERROR"); 9001 static const ExecutableKind SERVER = const ExecutableKind._("SERVER");
9006 9002
9007 /** 9003 /**
9008 * A list containing all of the enum values that are defined. 9004 * A list containing all of the enum values that are defined.
9009 */ 9005 */
9010 static const List<AnalysisErrorSeverity> VALUES = 9006 static const List<ExecutableKind> VALUES = const <ExecutableKind>[
9011 const <AnalysisErrorSeverity>[INFO, WARNING, ERROR]; 9007 CLIENT,
9012 9008 EITHER,
9009 NOT_EXECUTABLE,
9010 SERVER
9011 ];
9012
9013 @override
9013 final String name; 9014 final String name;
9014 9015
9015 const AnalysisErrorSeverity._(this.name); 9016 const ExecutableKind._(this.name);
9016 9017
9017 factory AnalysisErrorSeverity(String name) { 9018 factory ExecutableKind(String name) {
9018 switch (name) { 9019 switch (name) {
9019 case "INFO": 9020 case "CLIENT":
9020 return INFO; 9021 return CLIENT;
9021 case "WARNING": 9022 case "EITHER":
9022 return WARNING; 9023 return EITHER;
9023 case "ERROR": 9024 case "NOT_EXECUTABLE":
9024 return ERROR; 9025 return NOT_EXECUTABLE;
9026 case "SERVER":
9027 return SERVER;
9025 } 9028 }
9026 throw new Exception('Illegal enum value: $name'); 9029 throw new Exception('Illegal enum value: $name');
9027 } 9030 }
9028 9031
9029 factory AnalysisErrorSeverity.fromJson( 9032 factory ExecutableKind.fromJson(
9030 JsonDecoder jsonDecoder, String jsonPath, Object json) { 9033 JsonDecoder jsonDecoder, String jsonPath, Object json) {
9031 if (json is String) { 9034 if (json is String) {
9032 try { 9035 try {
9033 return new AnalysisErrorSeverity(json); 9036 return new ExecutableKind(json);
9034 } catch (_) { 9037 } catch (_) {
9035 // Fall through 9038 // Fall through
9036 } 9039 }
9037 } 9040 }
9038 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorSeverity", json); 9041 throw jsonDecoder.mismatch(jsonPath, "ExecutableKind", json);
9039 } 9042 }
9040 9043
9041 @override 9044 @override
9042 String toString() => "AnalysisErrorSeverity.$name"; 9045 String toString() => "ExecutableKind.$name";
9043 9046
9044 String toJson() => name; 9047 String toJson() => name;
9045 } 9048 }
9046 9049
9047 /** 9050 /**
9048 * AnalysisErrorType 9051 * execution.createContext params
9049 * 9052 *
9050 * enum { 9053 * {
9051 * CHECKED_MODE_COMPILE_TIME_ERROR 9054 * "contextRoot": FilePath
9052 * COMPILE_TIME_ERROR
9053 * HINT
9054 * LINT
9055 * STATIC_TYPE_WARNING
9056 * STATIC_WARNING
9057 * SYNTACTIC_ERROR
9058 * TODO
9059 * } 9055 * }
9060 * 9056 *
9061 * Clients may not extend, implement or mix-in this class. 9057 * Clients may not extend, implement or mix-in this class.
9062 */ 9058 */
9063 class AnalysisErrorType implements Enum { 9059 class ExecutionCreateContextParams implements RequestParams {
9064 static const AnalysisErrorType CHECKED_MODE_COMPILE_TIME_ERROR = 9060 String _contextRoot;
9065 const AnalysisErrorType._("CHECKED_MODE_COMPILE_TIME_ERROR"); 9061
9066 9062 /**
9067 static const AnalysisErrorType COMPILE_TIME_ERROR = 9063 * The path of the Dart or HTML file that will be launched, or the path of
9068 const AnalysisErrorType._("COMPILE_TIME_ERROR"); 9064 * the directory containing the file.
9069 9065 */
9070 static const AnalysisErrorType HINT = const AnalysisErrorType._("HINT"); 9066 String get contextRoot => _contextRoot;
9071 9067
9072 static const AnalysisErrorType LINT = const AnalysisErrorType._("LINT"); 9068 /**
9073 9069 * The path of the Dart or HTML file that will be launched, or the path of
9074 static const AnalysisErrorType STATIC_TYPE_WARNING = 9070 * the directory containing the file.
9075 const AnalysisErrorType._("STATIC_TYPE_WARNING"); 9071 */
9076 9072 void set contextRoot(String value) {
9077 static const AnalysisErrorType STATIC_WARNING = 9073 assert(value != null);
9078 const AnalysisErrorType._("STATIC_WARNING"); 9074 this._contextRoot = value;
9079 9075 }
9080 static const AnalysisErrorType SYNTACTIC_ERROR = 9076
9081 const AnalysisErrorType._("SYNTACTIC_ERROR"); 9077 ExecutionCreateContextParams(String contextRoot) {
9082 9078 this.contextRoot = contextRoot;
9083 static const AnalysisErrorType TODO = const AnalysisErrorType._("TODO"); 9079 }
9084 9080
9085 /** 9081 factory ExecutionCreateContextParams.fromJson(
9086 * A list containing all of the enum values that are defined.
9087 */
9088 static const List<AnalysisErrorType> VALUES = const <AnalysisErrorType>[
9089 CHECKED_MODE_COMPILE_TIME_ERROR,
9090 COMPILE_TIME_ERROR,
9091 HINT,
9092 LINT,
9093 STATIC_TYPE_WARNING,
9094 STATIC_WARNING,
9095 SYNTACTIC_ERROR,
9096 TODO
9097 ];
9098
9099 final String name;
9100
9101 const AnalysisErrorType._(this.name);
9102
9103 factory AnalysisErrorType(String name) {
9104 switch (name) {
9105 case "CHECKED_MODE_COMPILE_TIME_ERROR":
9106 return CHECKED_MODE_COMPILE_TIME_ERROR;
9107 case "COMPILE_TIME_ERROR":
9108 return COMPILE_TIME_ERROR;
9109 case "HINT":
9110 return HINT;
9111 case "LINT":
9112 return LINT;
9113 case "STATIC_TYPE_WARNING":
9114 return STATIC_TYPE_WARNING;
9115 case "STATIC_WARNING":
9116 return STATIC_WARNING;
9117 case "SYNTACTIC_ERROR":
9118 return SYNTACTIC_ERROR;
9119 case "TODO":
9120 return TODO;
9121 }
9122 throw new Exception('Illegal enum value: $name');
9123 }
9124
9125 factory AnalysisErrorType.fromJson(
9126 JsonDecoder jsonDecoder, String jsonPath, Object json) {
9127 if (json is String) {
9128 try {
9129 return new AnalysisErrorType(json);
9130 } catch (_) {
9131 // Fall through
9132 }
9133 }
9134 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorType", json);
9135 }
9136
9137 @override
9138 String toString() => "AnalysisErrorType.$name";
9139
9140 String toJson() => name;
9141 }
9142
9143 /**
9144 * AnalysisOptions
9145 *
9146 * {
9147 * "enableAsync": optional bool
9148 * "enableDeferredLoading": optional bool
9149 * "enableEnums": optional bool
9150 * "enableNullAwareOperators": optional bool
9151 * "enableSuperMixins": optional bool
9152 * "generateDart2jsHints": optional bool
9153 * "generateHints": optional bool
9154 * "generateLints": optional bool
9155 * }
9156 *
9157 * Clients may not extend, implement or mix-in this class.
9158 */
9159 class AnalysisOptions implements HasToJson {
9160 bool _enableAsync;
9161
9162 bool _enableDeferredLoading;
9163
9164 bool _enableEnums;
9165
9166 bool _enableNullAwareOperators;
9167
9168 bool _enableSuperMixins;
9169
9170 bool _generateDart2jsHints;
9171
9172 bool _generateHints;
9173
9174 bool _generateLints;
9175
9176 /**
9177 * Deprecated: this feature is always enabled.
9178 *
9179 * True if the client wants to enable support for the proposed async feature.
9180 */
9181 bool get enableAsync => _enableAsync;
9182
9183 /**
9184 * Deprecated: this feature is always enabled.
9185 *
9186 * True if the client wants to enable support for the proposed async feature.
9187 */
9188 void set enableAsync(bool value) {
9189 this._enableAsync = value;
9190 }
9191
9192 /**
9193 * Deprecated: this feature is always enabled.
9194 *
9195 * True if the client wants to enable support for the proposed deferred
9196 * loading feature.
9197 */
9198 bool get enableDeferredLoading => _enableDeferredLoading;
9199
9200 /**
9201 * Deprecated: this feature is always enabled.
9202 *
9203 * True if the client wants to enable support for the proposed deferred
9204 * loading feature.
9205 */
9206 void set enableDeferredLoading(bool value) {
9207 this._enableDeferredLoading = value;
9208 }
9209
9210 /**
9211 * Deprecated: this feature is always enabled.
9212 *
9213 * True if the client wants to enable support for the proposed enum feature.
9214 */
9215 bool get enableEnums => _enableEnums;
9216
9217 /**
9218 * Deprecated: this feature is always enabled.
9219 *
9220 * True if the client wants to enable support for the proposed enum feature.
9221 */
9222 void set enableEnums(bool value) {
9223 this._enableEnums = value;
9224 }
9225
9226 /**
9227 * Deprecated: this feature is always enabled.
9228 *
9229 * True if the client wants to enable support for the proposed "null aware
9230 * operators" feature.
9231 */
9232 bool get enableNullAwareOperators => _enableNullAwareOperators;
9233
9234 /**
9235 * Deprecated: this feature is always enabled.
9236 *
9237 * True if the client wants to enable support for the proposed "null aware
9238 * operators" feature.
9239 */
9240 void set enableNullAwareOperators(bool value) {
9241 this._enableNullAwareOperators = value;
9242 }
9243
9244 /**
9245 * True if the client wants to enable support for the proposed "less
9246 * restricted mixins" proposal (DEP 34).
9247 */
9248 bool get enableSuperMixins => _enableSuperMixins;
9249
9250 /**
9251 * True if the client wants to enable support for the proposed "less
9252 * restricted mixins" proposal (DEP 34).
9253 */
9254 void set enableSuperMixins(bool value) {
9255 this._enableSuperMixins = value;
9256 }
9257
9258 /**
9259 * True if hints that are specific to dart2js should be generated. This
9260 * option is ignored if generateHints is false.
9261 */
9262 bool get generateDart2jsHints => _generateDart2jsHints;
9263
9264 /**
9265 * True if hints that are specific to dart2js should be generated. This
9266 * option is ignored if generateHints is false.
9267 */
9268 void set generateDart2jsHints(bool value) {
9269 this._generateDart2jsHints = value;
9270 }
9271
9272 /**
9273 * True if hints should be generated as part of generating errors and
9274 * warnings.
9275 */
9276 bool get generateHints => _generateHints;
9277
9278 /**
9279 * True if hints should be generated as part of generating errors and
9280 * warnings.
9281 */
9282 void set generateHints(bool value) {
9283 this._generateHints = value;
9284 }
9285
9286 /**
9287 * True if lints should be generated as part of generating errors and
9288 * warnings.
9289 */
9290 bool get generateLints => _generateLints;
9291
9292 /**
9293 * True if lints should be generated as part of generating errors and
9294 * warnings.
9295 */
9296 void set generateLints(bool value) {
9297 this._generateLints = value;
9298 }
9299
9300 AnalysisOptions(
9301 {bool enableAsync,
9302 bool enableDeferredLoading,
9303 bool enableEnums,
9304 bool enableNullAwareOperators,
9305 bool enableSuperMixins,
9306 bool generateDart2jsHints,
9307 bool generateHints,
9308 bool generateLints}) {
9309 this.enableAsync = enableAsync;
9310 this.enableDeferredLoading = enableDeferredLoading;
9311 this.enableEnums = enableEnums;
9312 this.enableNullAwareOperators = enableNullAwareOperators;
9313 this.enableSuperMixins = enableSuperMixins;
9314 this.generateDart2jsHints = generateDart2jsHints;
9315 this.generateHints = generateHints;
9316 this.generateLints = generateLints;
9317 }
9318
9319 factory AnalysisOptions.fromJson(
9320 JsonDecoder jsonDecoder, String jsonPath, Object json) { 9082 JsonDecoder jsonDecoder, String jsonPath, Object json) {
9321 if (json == null) { 9083 if (json == null) {
9322 json = {}; 9084 json = {};
9323 } 9085 }
9324 if (json is Map) { 9086 if (json is Map) {
9325 bool enableAsync; 9087 String contextRoot;
9326 if (json.containsKey("enableAsync")) { 9088 if (json.containsKey("contextRoot")) {
9327 enableAsync = jsonDecoder.decodeBool( 9089 contextRoot = jsonDecoder.decodeString(
9328 jsonPath + ".enableAsync", json["enableAsync"]); 9090 jsonPath + ".contextRoot", json["contextRoot"]);
9329 } 9091 } else {
9330 bool enableDeferredLoading; 9092 throw jsonDecoder.mismatch(jsonPath, "contextRoot");
9331 if (json.containsKey("enableDeferredLoading")) { 9093 }
9332 enableDeferredLoading = jsonDecoder.decodeBool( 9094 return new ExecutionCreateContextParams(contextRoot);
9333 jsonPath + ".enableDeferredLoading", json["enableDeferredLoading"]);
9334 }
9335 bool enableEnums;
9336 if (json.containsKey("enableEnums")) {
9337 enableEnums = jsonDecoder.decodeBool(
9338 jsonPath + ".enableEnums", json["enableEnums"]);
9339 }
9340 bool enableNullAwareOperators;
9341 if (json.containsKey("enableNullAwareOperators")) {
9342 enableNullAwareOperators = jsonDecoder.decodeBool(
9343 jsonPath + ".enableNullAwareOperators",
9344 json["enableNullAwareOperators"]);
9345 }
9346 bool enableSuperMixins;
9347 if (json.containsKey("enableSuperMixins")) {
9348 enableSuperMixins = jsonDecoder.decodeBool(
9349 jsonPath + ".enableSuperMixins", json["enableSuperMixins"]);
9350 }
9351 bool generateDart2jsHints;
9352 if (json.containsKey("generateDart2jsHints")) {
9353 generateDart2jsHints = jsonDecoder.decodeBool(
9354 jsonPath + ".generateDart2jsHints", json["generateDart2jsHints"]);
9355 }
9356 bool generateHints;
9357 if (json.containsKey("generateHints")) {
9358 generateHints = jsonDecoder.decodeBool(
9359 jsonPath + ".generateHints", json["generateHints"]);
9360 }
9361 bool generateLints;
9362 if (json.containsKey("generateLints")) {
9363 generateLints = jsonDecoder.decodeBool(
9364 jsonPath + ".generateLints", json["generateLints"]);
9365 }
9366 return new AnalysisOptions(
9367 enableAsync: enableAsync,
9368 enableDeferredLoading: enableDeferredLoading,
9369 enableEnums: enableEnums,
9370 enableNullAwareOperators: enableNullAwareOperators,
9371 enableSuperMixins: enableSuperMixins,
9372 generateDart2jsHints: generateDart2jsHints,
9373 generateHints: generateHints,
9374 generateLints: generateLints);
9375 } else { 9095 } else {
9376 throw jsonDecoder.mismatch(jsonPath, "AnalysisOptions", json); 9096 throw jsonDecoder.mismatch(
9377 } 9097 jsonPath, "execution.createContext params", json);
9378 } 9098 }
9379 9099 }
9100
9101 factory ExecutionCreateContextParams.fromRequest(Request request) {
9102 return new ExecutionCreateContextParams.fromJson(
9103 new RequestDecoder(request), "params", request.params);
9104 }
9105
9106 @override
9380 Map<String, dynamic> toJson() { 9107 Map<String, dynamic> toJson() {
9381 Map<String, dynamic> result = {}; 9108 Map<String, dynamic> result = {};
9382 if (enableAsync != null) { 9109 result["contextRoot"] = contextRoot;
9383 result["enableAsync"] = enableAsync;
9384 }
9385 if (enableDeferredLoading != null) {
9386 result["enableDeferredLoading"] = enableDeferredLoading;
9387 }
9388 if (enableEnums != null) {
9389 result["enableEnums"] = enableEnums;
9390 }
9391 if (enableNullAwareOperators != null) {
9392 result["enableNullAwareOperators"] = enableNullAwareOperators;
9393 }
9394 if (enableSuperMixins != null) {
9395 result["enableSuperMixins"] = enableSuperMixins;
9396 }
9397 if (generateDart2jsHints != null) {
9398 result["generateDart2jsHints"] = generateDart2jsHints;
9399 }
9400 if (generateHints != null) {
9401 result["generateHints"] = generateHints;
9402 }
9403 if (generateLints != null) {
9404 result["generateLints"] = generateLints;
9405 }
9406 return result; 9110 return result;
9407 } 9111 }
9408 9112
9409 @override 9113 @override
9114 Request toRequest(String id) {
9115 return new Request(id, "execution.createContext", toJson());
9116 }
9117
9118 @override
9410 String toString() => JSON.encode(toJson()); 9119 String toString() => JSON.encode(toJson());
9411 9120
9412 @override 9121 @override
9413 bool operator ==(other) { 9122 bool operator ==(other) {
9414 if (other is AnalysisOptions) { 9123 if (other is ExecutionCreateContextParams) {
9415 return enableAsync == other.enableAsync && 9124 return contextRoot == other.contextRoot;
9416 enableDeferredLoading == other.enableDeferredLoading &&
9417 enableEnums == other.enableEnums &&
9418 enableNullAwareOperators == other.enableNullAwareOperators &&
9419 enableSuperMixins == other.enableSuperMixins &&
9420 generateDart2jsHints == other.generateDart2jsHints &&
9421 generateHints == other.generateHints &&
9422 generateLints == other.generateLints;
9423 } 9125 }
9424 return false; 9126 return false;
9425 } 9127 }
9128
9129 @override
9130 int get hashCode {
9131 int hash = 0;
9132 hash = JenkinsSmiHash.combine(hash, contextRoot.hashCode);
9133 return JenkinsSmiHash.finish(hash);
9134 }
9135 }
9136
9137 /**
9138 * execution.createContext result
9139 *
9140 * {
9141 * "id": ExecutionContextId
9142 * }
9143 *
9144 * Clients may not extend, implement or mix-in this class.
9145 */
9146 class ExecutionCreateContextResult implements ResponseResult {
9147 String _id;
9148
9149 /**
9150 * The identifier used to refer to the execution context that was created.
9151 */
9152 String get id => _id;
9153
9154 /**
9155 * The identifier used to refer to the execution context that was created.
9156 */
9157 void set id(String value) {
9158 assert(value != null);
9159 this._id = value;
9160 }
9161
9162 ExecutionCreateContextResult(String id) {
9163 this.id = id;
9164 }
9165
9166 factory ExecutionCreateContextResult.fromJson(
9167 JsonDecoder jsonDecoder, String jsonPath, Object json) {
9168 if (json == null) {
9169 json = {};
9170 }
9171 if (json is Map) {
9172 String id;
9173 if (json.containsKey("id")) {
9174 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
9175 } else {
9176 throw jsonDecoder.mismatch(jsonPath, "id");
9177 }
9178 return new ExecutionCreateContextResult(id);
9179 } else {
9180 throw jsonDecoder.mismatch(
9181 jsonPath, "execution.createContext result", json);
9182 }
9183 }
9184
9185 factory ExecutionCreateContextResult.fromResponse(Response response) {
9186 return new ExecutionCreateContextResult.fromJson(
9187 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
9188 "result",
9189 response.result);
9190 }
9191
9192 @override
9193 Map<String, dynamic> toJson() {
9194 Map<String, dynamic> result = {};
9195 result["id"] = id;
9196 return result;
9197 }
9198
9199 @override
9200 Response toResponse(String id) {
9201 return new Response(id, result: toJson());
9202 }
9203
9204 @override
9205 String toString() => JSON.encode(toJson());
9206
9207 @override
9208 bool operator ==(other) {
9209 if (other is ExecutionCreateContextResult) {
9210 return id == other.id;
9211 }
9212 return false;
9213 }
9214
9215 @override
9216 int get hashCode {
9217 int hash = 0;
9218 hash = JenkinsSmiHash.combine(hash, id.hashCode);
9219 return JenkinsSmiHash.finish(hash);
9220 }
9221 }
9222
9223 /**
9224 * execution.deleteContext params
9225 *
9226 * {
9227 * "id": ExecutionContextId
9228 * }
9229 *
9230 * Clients may not extend, implement or mix-in this class.
9231 */
9232 class ExecutionDeleteContextParams implements RequestParams {
9233 String _id;
9234
9235 /**
9236 * The identifier of the execution context that is to be deleted.
9237 */
9238 String get id => _id;
9239
9240 /**
9241 * The identifier of the execution context that is to be deleted.
9242 */
9243 void set id(String value) {
9244 assert(value != null);
9245 this._id = value;
9246 }
9247
9248 ExecutionDeleteContextParams(String id) {
9249 this.id = id;
9250 }
9251
9252 factory ExecutionDeleteContextParams.fromJson(
9253 JsonDecoder jsonDecoder, String jsonPath, Object json) {
9254 if (json == null) {
9255 json = {};
9256 }
9257 if (json is Map) {
9258 String id;
9259 if (json.containsKey("id")) {
9260 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
9261 } else {
9262 throw jsonDecoder.mismatch(jsonPath, "id");
9263 }
9264 return new ExecutionDeleteContextParams(id);
9265 } else {
9266 throw jsonDecoder.mismatch(
9267 jsonPath, "execution.deleteContext params", json);
9268 }
9269 }
9270
9271 factory ExecutionDeleteContextParams.fromRequest(Request request) {
9272 return new ExecutionDeleteContextParams.fromJson(
9273 new RequestDecoder(request), "params", request.params);
9274 }
9275
9276 @override
9277 Map<String, dynamic> toJson() {
9278 Map<String, dynamic> result = {};
9279 result["id"] = id;
9280 return result;
9281 }
9282
9283 @override
9284 Request toRequest(String id) {
9285 return new Request(id, "execution.deleteContext", toJson());
9286 }
9287
9288 @override
9289 String toString() => JSON.encode(toJson());
9290
9291 @override
9292 bool operator ==(other) {
9293 if (other is ExecutionDeleteContextParams) {
9294 return id == other.id;
9295 }
9296 return false;
9297 }
9298
9299 @override
9300 int get hashCode {
9301 int hash = 0;
9302 hash = JenkinsSmiHash.combine(hash, id.hashCode);
9303 return JenkinsSmiHash.finish(hash);
9304 }
9305 }
9306
9307 /**
9308 * execution.deleteContext result
9309 *
9310 * Clients may not extend, implement or mix-in this class.
9311 */
9312 class ExecutionDeleteContextResult implements ResponseResult {
9313 @override
9314 Map<String, dynamic> toJson() => <String, dynamic>{};
9315
9316 @override
9317 Response toResponse(String id) {
9318 return new Response(id, result: null);
9319 }
9320
9321 @override
9322 bool operator ==(other) {
9323 if (other is ExecutionDeleteContextResult) {
9324 return true;
9325 }
9326 return false;
9327 }
9328
9329 @override
9330 int get hashCode {
9331 return 479954425;
9332 }
9333 }
9334
9335 /**
9336 * execution.launchData params
9337 *
9338 * {
9339 * "file": FilePath
9340 * "kind": optional ExecutableKind
9341 * "referencedFiles": optional List<FilePath>
9342 * }
9343 *
9344 * Clients may not extend, implement or mix-in this class.
9345 */
9346 class ExecutionLaunchDataParams implements HasToJson {
9347 String _file;
9348
9349 ExecutableKind _kind;
9350
9351 List<String> _referencedFiles;
9352
9353 /**
9354 * The file for which launch data is being provided. This will either be a
9355 * Dart library or an HTML file.
9356 */
9357 String get file => _file;
9358
9359 /**
9360 * The file for which launch data is being provided. This will either be a
9361 * Dart library or an HTML file.
9362 */
9363 void set file(String value) {
9364 assert(value != null);
9365 this._file = value;
9366 }
9367
9368 /**
9369 * The kind of the executable file. This field is omitted if the file is not
9370 * a Dart file.
9371 */
9372 ExecutableKind get kind => _kind;
9373
9374 /**
9375 * The kind of the executable file. This field is omitted if the file is not
9376 * a Dart file.
9377 */
9378 void set kind(ExecutableKind value) {
9379 this._kind = value;
9380 }
9381
9382 /**
9383 * A list of the Dart files that are referenced by the file. This field is
9384 * omitted if the file is not an HTML file.
9385 */
9386 List<String> get referencedFiles => _referencedFiles;
9387
9388 /**
9389 * A list of the Dart files that are referenced by the file. This field is
9390 * omitted if the file is not an HTML file.
9391 */
9392 void set referencedFiles(List<String> value) {
9393 this._referencedFiles = value;
9394 }
9395
9396 ExecutionLaunchDataParams(String file,
9397 {ExecutableKind kind, List<String> referencedFiles}) {
9398 this.file = file;
9399 this.kind = kind;
9400 this.referencedFiles = referencedFiles;
9401 }
9402
9403 factory ExecutionLaunchDataParams.fromJson(
9404 JsonDecoder jsonDecoder, String jsonPath, Object json) {
9405 if (json == null) {
9406 json = {};
9407 }
9408 if (json is Map) {
9409 String file;
9410 if (json.containsKey("file")) {
9411 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
9412 } else {
9413 throw jsonDecoder.mismatch(jsonPath, "file");
9414 }
9415 ExecutableKind kind;
9416 if (json.containsKey("kind")) {
9417 kind = new ExecutableKind.fromJson(
9418 jsonDecoder, jsonPath + ".kind", json["kind"]);
9419 }
9420 List<String> referencedFiles;
9421 if (json.containsKey("referencedFiles")) {
9422 referencedFiles = jsonDecoder.decodeList(jsonPath + ".referencedFiles",
9423 json["referencedFiles"], jsonDecoder.decodeString);
9424 }
9425 return new ExecutionLaunchDataParams(file,
9426 kind: kind, referencedFiles: referencedFiles);
9427 } else {
9428 throw jsonDecoder.mismatch(jsonPath, "execution.launchData params", json);
9429 }
9430 }
9431
9432 factory ExecutionLaunchDataParams.fromNotification(
9433 Notification notification) {
9434 return new ExecutionLaunchDataParams.fromJson(
9435 new ResponseDecoder(null), "params", notification.params);
9436 }
9437
9438 @override
9439 Map<String, dynamic> toJson() {
9440 Map<String, dynamic> result = {};
9441 result["file"] = file;
9442 if (kind != null) {
9443 result["kind"] = kind.toJson();
9444 }
9445 if (referencedFiles != null) {
9446 result["referencedFiles"] = referencedFiles;
9447 }
9448 return result;
9449 }
9450
9451 Notification toNotification() {
9452 return new Notification("execution.launchData", toJson());
9453 }
9454
9455 @override
9456 String toString() => JSON.encode(toJson());
9457
9458 @override
9459 bool operator ==(other) {
9460 if (other is ExecutionLaunchDataParams) {
9461 return file == other.file &&
9462 kind == other.kind &&
9463 listEqual(referencedFiles, other.referencedFiles,
9464 (String a, String b) => a == b);
9465 }
9466 return false;
9467 }
9426 9468
9427 @override 9469 @override
9428 int get hashCode { 9470 int get hashCode {
9429 int hash = 0; 9471 int hash = 0;
9430 hash = JenkinsSmiHash.combine(hash, enableAsync.hashCode); 9472 hash = JenkinsSmiHash.combine(hash, file.hashCode);
9431 hash = JenkinsSmiHash.combine(hash, enableDeferredLoading.hashCode); 9473 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
9432 hash = JenkinsSmiHash.combine(hash, enableEnums.hashCode); 9474 hash = JenkinsSmiHash.combine(hash, referencedFiles.hashCode);
9433 hash = JenkinsSmiHash.combine(hash, enableNullAwareOperators.hashCode);
9434 hash = JenkinsSmiHash.combine(hash, enableSuperMixins.hashCode);
9435 hash = JenkinsSmiHash.combine(hash, generateDart2jsHints.hashCode);
9436 hash = JenkinsSmiHash.combine(hash, generateHints.hashCode);
9437 hash = JenkinsSmiHash.combine(hash, generateLints.hashCode);
9438 return JenkinsSmiHash.finish(hash); 9475 return JenkinsSmiHash.finish(hash);
9439 } 9476 }
9440 } 9477 }
9441 9478
9442 /** 9479 /**
9443 * AnalysisService 9480 * execution.mapUri params
9444 * 9481 *
9445 * enum { 9482 * {
9446 * FOLDING 9483 * "id": ExecutionContextId
9447 * HIGHLIGHTS 9484 * "file": optional FilePath
9448 * IMPLEMENTED 9485 * "uri": optional String
9449 * INVALIDATE
9450 * NAVIGATION
9451 * OCCURRENCES
9452 * OUTLINE
9453 * OVERRIDES
9454 * } 9486 * }
9455 * 9487 *
9456 * Clients may not extend, implement or mix-in this class. 9488 * Clients may not extend, implement or mix-in this class.
9457 */ 9489 */
9458 class AnalysisService implements Enum { 9490 class ExecutionMapUriParams implements RequestParams {
9459 static const AnalysisService FOLDING = const AnalysisService._("FOLDING"); 9491 String _id;
9460 9492
9461 static const AnalysisService HIGHLIGHTS = 9493 String _file;
9462 const AnalysisService._("HIGHLIGHTS");
9463 9494
9464 static const AnalysisService IMPLEMENTED = 9495 String _uri;
9465 const AnalysisService._("IMPLEMENTED");
9466 9496
9467 /** 9497 /**
9468 * This service is not currently implemented and will become a 9498 * The identifier of the execution context in which the URI is to be mapped.
9469 * GeneralAnalysisService in a future release.
9470 */ 9499 */
9471 static const AnalysisService INVALIDATE = 9500 String get id => _id;
9472 const AnalysisService._("INVALIDATE");
9473
9474 static const AnalysisService NAVIGATION =
9475 const AnalysisService._("NAVIGATION");
9476
9477 static const AnalysisService OCCURRENCES =
9478 const AnalysisService._("OCCURRENCES");
9479
9480 static const AnalysisService OUTLINE = const AnalysisService._("OUTLINE");
9481
9482 static const AnalysisService OVERRIDES = const AnalysisService._("OVERRIDES");
9483 9501
9484 /** 9502 /**
9485 * A list containing all of the enum values that are defined. 9503 * The identifier of the execution context in which the URI is to be mapped.
9486 */ 9504 */
9487 static const List<AnalysisService> VALUES = const <AnalysisService>[ 9505 void set id(String value) {
9488 FOLDING,
9489 HIGHLIGHTS,
9490 IMPLEMENTED,
9491 INVALIDATE,
9492 NAVIGATION,
9493 OCCURRENCES,
9494 OUTLINE,
9495 OVERRIDES
9496 ];
9497
9498 final String name;
9499
9500 const AnalysisService._(this.name);
9501
9502 factory AnalysisService(String name) {
9503 switch (name) {
9504 case "FOLDING":
9505 return FOLDING;
9506 case "HIGHLIGHTS":
9507 return HIGHLIGHTS;
9508 case "IMPLEMENTED":
9509 return IMPLEMENTED;
9510 case "INVALIDATE":
9511 return INVALIDATE;
9512 case "NAVIGATION":
9513 return NAVIGATION;
9514 case "OCCURRENCES":
9515 return OCCURRENCES;
9516 case "OUTLINE":
9517 return OUTLINE;
9518 case "OVERRIDES":
9519 return OVERRIDES;
9520 }
9521 throw new Exception('Illegal enum value: $name');
9522 }
9523
9524 factory AnalysisService.fromJson(
9525 JsonDecoder jsonDecoder, String jsonPath, Object json) {
9526 if (json is String) {
9527 try {
9528 return new AnalysisService(json);
9529 } catch (_) {
9530 // Fall through
9531 }
9532 }
9533 throw jsonDecoder.mismatch(jsonPath, "AnalysisService", json);
9534 }
9535
9536 @override
9537 String toString() => "AnalysisService.$name";
9538
9539 String toJson() => name;
9540 }
9541
9542 /**
9543 * AnalysisStatus
9544 *
9545 * {
9546 * "isAnalyzing": bool
9547 * "analysisTarget": optional String
9548 * }
9549 *
9550 * Clients may not extend, implement or mix-in this class.
9551 */
9552 class AnalysisStatus implements HasToJson {
9553 bool _isAnalyzing;
9554
9555 String _analysisTarget;
9556
9557 /**
9558 * True if analysis is currently being performed.
9559 */
9560 bool get isAnalyzing => _isAnalyzing;
9561
9562 /**
9563 * True if analysis is currently being performed.
9564 */
9565 void set isAnalyzing(bool value) {
9566 assert(value != null); 9506 assert(value != null);
9567 this._isAnalyzing = value; 9507 this._id = value;
9568 } 9508 }
9569 9509
9570 /** 9510 /**
9571 * The name of the current target of analysis. This field is omitted if 9511 * The path of the file to be mapped into a URI.
9572 * analyzing is false.
9573 */ 9512 */
9574 String get analysisTarget => _analysisTarget; 9513 String get file => _file;
9575 9514
9576 /** 9515 /**
9577 * The name of the current target of analysis. This field is omitted if 9516 * The path of the file to be mapped into a URI.
9578 * analyzing is false.
9579 */ 9517 */
9580 void set analysisTarget(String value) { 9518 void set file(String value) {
9581 this._analysisTarget = value; 9519 this._file = value;
9582 } 9520 }
9583 9521
9584 AnalysisStatus(bool isAnalyzing, {String analysisTarget}) { 9522 /**
9585 this.isAnalyzing = isAnalyzing; 9523 * The URI to be mapped into a file path.
9586 this.analysisTarget = analysisTarget; 9524 */
9525 String get uri => _uri;
9526
9527 /**
9528 * The URI to be mapped into a file path.
9529 */
9530 void set uri(String value) {
9531 this._uri = value;
9587 } 9532 }
9588 9533
9589 factory AnalysisStatus.fromJson( 9534 ExecutionMapUriParams(String id, {String file, String uri}) {
9535 this.id = id;
9536 this.file = file;
9537 this.uri = uri;
9538 }
9539
9540 factory ExecutionMapUriParams.fromJson(
9590 JsonDecoder jsonDecoder, String jsonPath, Object json) { 9541 JsonDecoder jsonDecoder, String jsonPath, Object json) {
9591 if (json == null) { 9542 if (json == null) {
9592 json = {}; 9543 json = {};
9593 } 9544 }
9594 if (json is Map) { 9545 if (json is Map) {
9595 bool isAnalyzing; 9546 String id;
9596 if (json.containsKey("isAnalyzing")) { 9547 if (json.containsKey("id")) {
9597 isAnalyzing = jsonDecoder.decodeBool( 9548 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
9598 jsonPath + ".isAnalyzing", json["isAnalyzing"]);
9599 } else { 9549 } else {
9600 throw jsonDecoder.missingKey(jsonPath, "isAnalyzing"); 9550 throw jsonDecoder.mismatch(jsonPath, "id");
9601 } 9551 }
9602 String analysisTarget; 9552 String file;
9603 if (json.containsKey("analysisTarget")) { 9553 if (json.containsKey("file")) {
9604 analysisTarget = jsonDecoder.decodeString( 9554 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
9605 jsonPath + ".analysisTarget", json["analysisTarget"]);
9606 } 9555 }
9607 return new AnalysisStatus(isAnalyzing, analysisTarget: analysisTarget); 9556 String uri;
9557 if (json.containsKey("uri")) {
9558 uri = jsonDecoder.decodeString(jsonPath + ".uri", json["uri"]);
9559 }
9560 return new ExecutionMapUriParams(id, file: file, uri: uri);
9608 } else { 9561 } else {
9609 throw jsonDecoder.mismatch(jsonPath, "AnalysisStatus", json); 9562 throw jsonDecoder.mismatch(jsonPath, "execution.mapUri params", json);
9610 } 9563 }
9611 } 9564 }
9612 9565
9566 factory ExecutionMapUriParams.fromRequest(Request request) {
9567 return new ExecutionMapUriParams.fromJson(
9568 new RequestDecoder(request), "params", request.params);
9569 }
9570
9571 @override
9613 Map<String, dynamic> toJson() { 9572 Map<String, dynamic> toJson() {
9614 Map<String, dynamic> result = {}; 9573 Map<String, dynamic> result = {};
9615 result["isAnalyzing"] = isAnalyzing; 9574 result["id"] = id;
9616 if (analysisTarget != null) { 9575 if (file != null) {
9617 result["analysisTarget"] = analysisTarget; 9576 result["file"] = file;
9577 }
9578 if (uri != null) {
9579 result["uri"] = uri;
9618 } 9580 }
9619 return result; 9581 return result;
9620 } 9582 }
9621 9583
9622 @override 9584 @override
9585 Request toRequest(String id) {
9586 return new Request(id, "execution.mapUri", toJson());
9587 }
9588
9589 @override
9623 String toString() => JSON.encode(toJson()); 9590 String toString() => JSON.encode(toJson());
9624 9591
9625 @override 9592 @override
9626 bool operator ==(other) { 9593 bool operator ==(other) {
9627 if (other is AnalysisStatus) { 9594 if (other is ExecutionMapUriParams) {
9628 return isAnalyzing == other.isAnalyzing && 9595 return id == other.id && file == other.file && uri == other.uri;
9629 analysisTarget == other.analysisTarget;
9630 } 9596 }
9631 return false; 9597 return false;
9632 } 9598 }
9633 9599
9634 @override 9600 @override
9635 int get hashCode { 9601 int get hashCode {
9636 int hash = 0; 9602 int hash = 0;
9637 hash = JenkinsSmiHash.combine(hash, isAnalyzing.hashCode); 9603 hash = JenkinsSmiHash.combine(hash, id.hashCode);
9638 hash = JenkinsSmiHash.combine(hash, analysisTarget.hashCode); 9604 hash = JenkinsSmiHash.combine(hash, file.hashCode);
9605 hash = JenkinsSmiHash.combine(hash, uri.hashCode);
9639 return JenkinsSmiHash.finish(hash); 9606 return JenkinsSmiHash.finish(hash);
9640 } 9607 }
9641 } 9608 }
9642 9609
9643 /** 9610 /**
9644 * ChangeContentOverlay 9611 * execution.mapUri result
9645 * 9612 *
9646 * { 9613 * {
9647 * "type": "change" 9614 * "file": optional FilePath
9648 * "edits": List<SourceEdit> 9615 * "uri": optional String
9649 * } 9616 * }
9650 * 9617 *
9651 * Clients may not extend, implement or mix-in this class. 9618 * Clients may not extend, implement or mix-in this class.
9652 */ 9619 */
9653 class ChangeContentOverlay implements HasToJson { 9620 class ExecutionMapUriResult implements ResponseResult {
9654 List<SourceEdit> _edits; 9621 String _file;
9622
9623 String _uri;
9655 9624
9656 /** 9625 /**
9657 * The edits to be applied to the file. 9626 * The file to which the URI was mapped. This field is omitted if the uri
9627 * field was not given in the request.
9658 */ 9628 */
9659 List<SourceEdit> get edits => _edits; 9629 String get file => _file;
9660 9630
9661 /** 9631 /**
9662 * The edits to be applied to the file. 9632 * The file to which the URI was mapped. This field is omitted if the uri
9633 * field was not given in the request.
9663 */ 9634 */
9664 void set edits(List<SourceEdit> value) { 9635 void set file(String value) {
9665 assert(value != null); 9636 this._file = value;
9666 this._edits = value;
9667 } 9637 }
9668 9638
9669 ChangeContentOverlay(List<SourceEdit> edits) { 9639 /**
9670 this.edits = edits; 9640 * The URI to which the file path was mapped. This field is omitted if the
9641 * file field was not given in the request.
9642 */
9643 String get uri => _uri;
9644
9645 /**
9646 * The URI to which the file path was mapped. This field is omitted if the
9647 * file field was not given in the request.
9648 */
9649 void set uri(String value) {
9650 this._uri = value;
9671 } 9651 }
9672 9652
9673 factory ChangeContentOverlay.fromJson( 9653 ExecutionMapUriResult({String file, String uri}) {
9654 this.file = file;
9655 this.uri = uri;
9656 }
9657
9658 factory ExecutionMapUriResult.fromJson(
9674 JsonDecoder jsonDecoder, String jsonPath, Object json) { 9659 JsonDecoder jsonDecoder, String jsonPath, Object json) {
9675 if (json == null) { 9660 if (json == null) {
9676 json = {}; 9661 json = {};
9677 } 9662 }
9678 if (json is Map) { 9663 if (json is Map) {
9679 if (json["type"] != "change") { 9664 String file;
9680 throw jsonDecoder.mismatch(jsonPath, "equal " + "change", json); 9665 if (json.containsKey("file")) {
9666 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
9681 } 9667 }
9682 List<SourceEdit> edits; 9668 String uri;
9683 if (json.containsKey("edits")) { 9669 if (json.containsKey("uri")) {
9684 edits = jsonDecoder.decodeList( 9670 uri = jsonDecoder.decodeString(jsonPath + ".uri", json["uri"]);
9685 jsonPath + ".edits",
9686 json["edits"],
9687 (String jsonPath, Object json) =>
9688 new SourceEdit.fromJson(jsonDecoder, jsonPath, json));
9689 } else {
9690 throw jsonDecoder.missingKey(jsonPath, "edits");
9691 } 9671 }
9692 return new ChangeContentOverlay(edits); 9672 return new ExecutionMapUriResult(file: file, uri: uri);
9693 } else { 9673 } else {
9694 throw jsonDecoder.mismatch(jsonPath, "ChangeContentOverlay", json); 9674 throw jsonDecoder.mismatch(jsonPath, "execution.mapUri result", json);
9695 } 9675 }
9696 } 9676 }
9697 9677
9678 factory ExecutionMapUriResult.fromResponse(Response response) {
9679 return new ExecutionMapUriResult.fromJson(
9680 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
9681 "result",
9682 response.result);
9683 }
9684
9685 @override
9698 Map<String, dynamic> toJson() { 9686 Map<String, dynamic> toJson() {
9699 Map<String, dynamic> result = {}; 9687 Map<String, dynamic> result = {};
9700 result["type"] = "change"; 9688 if (file != null) {
9701 result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList(); 9689 result["file"] = file;
9690 }
9691 if (uri != null) {
9692 result["uri"] = uri;
9693 }
9702 return result; 9694 return result;
9703 } 9695 }
9704 9696
9705 @override 9697 @override
9698 Response toResponse(String id) {
9699 return new Response(id, result: toJson());
9700 }
9701
9702 @override
9706 String toString() => JSON.encode(toJson()); 9703 String toString() => JSON.encode(toJson());
9707 9704
9708 @override 9705 @override
9709 bool operator ==(other) { 9706 bool operator ==(other) {
9710 if (other is ChangeContentOverlay) { 9707 if (other is ExecutionMapUriResult) {
9711 return listEqual( 9708 return file == other.file && uri == other.uri;
9712 edits, other.edits, (SourceEdit a, SourceEdit b) => a == b);
9713 } 9709 }
9714 return false; 9710 return false;
9715 } 9711 }
9716 9712
9717 @override 9713 @override
9718 int get hashCode { 9714 int get hashCode {
9719 int hash = 0; 9715 int hash = 0;
9720 hash = JenkinsSmiHash.combine(hash, 873118866); 9716 hash = JenkinsSmiHash.combine(hash, file.hashCode);
9721 hash = JenkinsSmiHash.combine(hash, edits.hashCode); 9717 hash = JenkinsSmiHash.combine(hash, uri.hashCode);
9722 return JenkinsSmiHash.finish(hash); 9718 return JenkinsSmiHash.finish(hash);
9723 } 9719 }
9724 } 9720 }
9725 9721
9726 /** 9722 /**
9727 * CompletionSuggestion 9723 * ExecutionService
9728 * 9724 *
9729 * { 9725 * enum {
9730 * "kind": CompletionSuggestionKind 9726 * LAUNCH_DATA
9731 * "relevance": int
9732 * "completion": String
9733 * "selectionOffset": int
9734 * "selectionLength": int
9735 * "isDeprecated": bool
9736 * "isPotential": bool
9737 * "docSummary": optional String
9738 * "docComplete": optional String
9739 * "declaringType": optional String
9740 * "defaultArgumentListString": optional String
9741 * "defaultArgumentListTextRanges": optional List<int>
9742 * "element": optional Element
9743 * "returnType": optional String
9744 * "parameterNames": optional List<String>
9745 * "parameterTypes": optional List<String>
9746 * "requiredParameterCount": optional int
9747 * "hasNamedParameters": optional bool
9748 * "parameterName": optional String
9749 * "parameterType": optional String
9750 * "importUri": optional String
9751 * } 9727 * }
9752 * 9728 *
9753 * Clients may not extend, implement or mix-in this class. 9729 * Clients may not extend, implement or mix-in this class.
9754 */ 9730 */
9755 class CompletionSuggestion implements HasToJson { 9731 class ExecutionService implements Enum {
9756 CompletionSuggestionKind _kind; 9732 static const ExecutionService LAUNCH_DATA =
9757 9733 const ExecutionService._("LAUNCH_DATA");
9758 int _relevance; 9734
9759 9735 /**
9760 String _completion; 9736 * A list containing all of the enum values that are defined.
9761 9737 */
9762 int _selectionOffset; 9738 static const List<ExecutionService> VALUES = const <ExecutionService>[
9763 9739 LAUNCH_DATA
9764 int _selectionLength; 9740 ];
9765 9741
9766 bool _isDeprecated; 9742 @override
9767 9743 final String name;
9768 bool _isPotential; 9744
9769 9745 const ExecutionService._(this.name);
9770 String _docSummary; 9746
9771 9747 factory ExecutionService(String name) {
9772 String _docComplete; 9748 switch (name) {
9773 9749 case "LAUNCH_DATA":
9774 String _declaringType; 9750 return LAUNCH_DATA;
9775 9751 }
9776 String _defaultArgumentListString; 9752 throw new Exception('Illegal enum value: $name');
9777 9753 }
9778 List<int> _defaultArgumentListTextRanges; 9754
9779 9755 factory ExecutionService.fromJson(
9780 Element _element; 9756 JsonDecoder jsonDecoder, String jsonPath, Object json) {
9781 9757 if (json is String) {
9782 String _returnType; 9758 try {
9783 9759 return new ExecutionService(json);
9784 List<String> _parameterNames; 9760 } catch (_) {
9785 9761 // Fall through
9786 List<String> _parameterTypes; 9762 }
9787 9763 }
9788 int _requiredParameterCount; 9764 throw jsonDecoder.mismatch(jsonPath, "ExecutionService", json);
9789 9765 }
9790 bool _hasNamedParameters; 9766
9791 9767 @override
9792 String _parameterName; 9768 String toString() => "ExecutionService.$name";
9793 9769
9794 String _parameterType; 9770 String toJson() => name;
9795 9771 }
9796 String _importUri; 9772
9797 9773 /**
9798 /** 9774 * execution.setSubscriptions params
9799 * The kind of element being suggested. 9775 *
9800 */ 9776 * {
9801 CompletionSuggestionKind get kind => _kind; 9777 * "subscriptions": List<ExecutionService>
9802 9778 * }
9803 /** 9779 *
9804 * The kind of element being suggested. 9780 * Clients may not extend, implement or mix-in this class.
9805 */ 9781 */
9806 void set kind(CompletionSuggestionKind value) { 9782 class ExecutionSetSubscriptionsParams implements RequestParams {
9807 assert(value != null); 9783 List<ExecutionService> _subscriptions;
9808 this._kind = value; 9784
9809 } 9785 /**
9810 9786 * A list of the services being subscribed to.
9811 /** 9787 */
9812 * The relevance of this completion suggestion where a higher number 9788 List<ExecutionService> get subscriptions => _subscriptions;
9813 * indicates a higher relevance. 9789
9814 */ 9790 /**
9815 int get relevance => _relevance; 9791 * A list of the services being subscribed to.
9816 9792 */
9817 /** 9793 void set subscriptions(List<ExecutionService> value) {
9818 * The relevance of this completion suggestion where a higher number 9794 assert(value != null);
9819 * indicates a higher relevance. 9795 this._subscriptions = value;
9820 */ 9796 }
9821 void set relevance(int value) { 9797
9822 assert(value != null); 9798 ExecutionSetSubscriptionsParams(List<ExecutionService> subscriptions) {
9823 this._relevance = value; 9799 this.subscriptions = subscriptions;
9824 } 9800 }
9825 9801
9826 /** 9802 factory ExecutionSetSubscriptionsParams.fromJson(
9827 * The identifier to be inserted if the suggestion is selected. If the
9828 * suggestion is for a method or function, the client might want to
9829 * additionally insert a template for the parameters. The information
9830 * required in order to do so is contained in other fields.
9831 */
9832 String get completion => _completion;
9833
9834 /**
9835 * The identifier to be inserted if the suggestion is selected. If the
9836 * suggestion is for a method or function, the client might want to
9837 * additionally insert a template for the parameters. The information
9838 * required in order to do so is contained in other fields.
9839 */
9840 void set completion(String value) {
9841 assert(value != null);
9842 this._completion = value;
9843 }
9844
9845 /**
9846 * The offset, relative to the beginning of the completion, of where the
9847 * selection should be placed after insertion.
9848 */
9849 int get selectionOffset => _selectionOffset;
9850
9851 /**
9852 * The offset, relative to the beginning of the completion, of where the
9853 * selection should be placed after insertion.
9854 */
9855 void set selectionOffset(int value) {
9856 assert(value != null);
9857 this._selectionOffset = value;
9858 }
9859
9860 /**
9861 * The number of characters that should be selected after insertion.
9862 */
9863 int get selectionLength => _selectionLength;
9864
9865 /**
9866 * The number of characters that should be selected after insertion.
9867 */
9868 void set selectionLength(int value) {
9869 assert(value != null);
9870 this._selectionLength = value;
9871 }
9872
9873 /**
9874 * True if the suggested element is deprecated.
9875 */
9876 bool get isDeprecated => _isDeprecated;
9877
9878 /**
9879 * True if the suggested element is deprecated.
9880 */
9881 void set isDeprecated(bool value) {
9882 assert(value != null);
9883 this._isDeprecated = value;
9884 }
9885
9886 /**
9887 * True if the element is not known to be valid for the target. This happens
9888 * if the type of the target is dynamic.
9889 */
9890 bool get isPotential => _isPotential;
9891
9892 /**
9893 * True if the element is not known to be valid for the target. This happens
9894 * if the type of the target is dynamic.
9895 */
9896 void set isPotential(bool value) {
9897 assert(value != null);
9898 this._isPotential = value;
9899 }
9900
9901 /**
9902 * An abbreviated version of the Dartdoc associated with the element being
9903 * suggested, This field is omitted if there is no Dartdoc associated with
9904 * the element.
9905 */
9906 String get docSummary => _docSummary;
9907
9908 /**
9909 * An abbreviated version of the Dartdoc associated with the element being
9910 * suggested, This field is omitted if there is no Dartdoc associated with
9911 * the element.
9912 */
9913 void set docSummary(String value) {
9914 this._docSummary = value;
9915 }
9916
9917 /**
9918 * The Dartdoc associated with the element being suggested, This field is
9919 * omitted if there is no Dartdoc associated with the element.
9920 */
9921 String get docComplete => _docComplete;
9922
9923 /**
9924 * The Dartdoc associated with the element being suggested, This field is
9925 * omitted if there is no Dartdoc associated with the element.
9926 */
9927 void set docComplete(String value) {
9928 this._docComplete = value;
9929 }
9930
9931 /**
9932 * The class that declares the element being suggested. This field is omitted
9933 * if the suggested element is not a member of a class.
9934 */
9935 String get declaringType => _declaringType;
9936
9937 /**
9938 * The class that declares the element being suggested. This field is omitted
9939 * if the suggested element is not a member of a class.
9940 */
9941 void set declaringType(String value) {
9942 this._declaringType = value;
9943 }
9944
9945 /**
9946 * A default String for use in generating argument list source contents on
9947 * the client side.
9948 */
9949 String get defaultArgumentListString => _defaultArgumentListString;
9950
9951 /**
9952 * A default String for use in generating argument list source contents on
9953 * the client side.
9954 */
9955 void set defaultArgumentListString(String value) {
9956 this._defaultArgumentListString = value;
9957 }
9958
9959 /**
9960 * Pairs of offsets and lengths describing 'defaultArgumentListString' text
9961 * ranges suitable for use by clients to set up linked edits of default
9962 * argument source contents. For example, given an argument list string 'x,
9963 * y', the corresponding text range [0, 1, 3, 1], indicates two text ranges
9964 * of length 1, starting at offsets 0 and 3. Clients can use these ranges to
9965 * treat the 'x' and 'y' values specially for linked edits.
9966 */
9967 List<int> get defaultArgumentListTextRanges => _defaultArgumentListTextRanges;
9968
9969 /**
9970 * Pairs of offsets and lengths describing 'defaultArgumentListString' text
9971 * ranges suitable for use by clients to set up linked edits of default
9972 * argument source contents. For example, given an argument list string 'x,
9973 * y', the corresponding text range [0, 1, 3, 1], indicates two text ranges
9974 * of length 1, starting at offsets 0 and 3. Clients can use these ranges to
9975 * treat the 'x' and 'y' values specially for linked edits.
9976 */
9977 void set defaultArgumentListTextRanges(List<int> value) {
9978 this._defaultArgumentListTextRanges = value;
9979 }
9980
9981 /**
9982 * Information about the element reference being suggested.
9983 */
9984 Element get element => _element;
9985
9986 /**
9987 * Information about the element reference being suggested.
9988 */
9989 void set element(Element value) {
9990 this._element = value;
9991 }
9992
9993 /**
9994 * The return type of the getter, function or method or the type of the field
9995 * being suggested. This field is omitted if the suggested element is not a
9996 * getter, function or method.
9997 */
9998 String get returnType => _returnType;
9999
10000 /**
10001 * The return type of the getter, function or method or the type of the field
10002 * being suggested. This field is omitted if the suggested element is not a
10003 * getter, function or method.
10004 */
10005 void set returnType(String value) {
10006 this._returnType = value;
10007 }
10008
10009 /**
10010 * The names of the parameters of the function or method being suggested.
10011 * This field is omitted if the suggested element is not a setter, function
10012 * or method.
10013 */
10014 List<String> get parameterNames => _parameterNames;
10015
10016 /**
10017 * The names of the parameters of the function or method being suggested.
10018 * This field is omitted if the suggested element is not a setter, function
10019 * or method.
10020 */
10021 void set parameterNames(List<String> value) {
10022 this._parameterNames = value;
10023 }
10024
10025 /**
10026 * The types of the parameters of the function or method being suggested.
10027 * This field is omitted if the parameterNames field is omitted.
10028 */
10029 List<String> get parameterTypes => _parameterTypes;
10030
10031 /**
10032 * The types of the parameters of the function or method being suggested.
10033 * This field is omitted if the parameterNames field is omitted.
10034 */
10035 void set parameterTypes(List<String> value) {
10036 this._parameterTypes = value;
10037 }
10038
10039 /**
10040 * The number of required parameters for the function or method being
10041 * suggested. This field is omitted if the parameterNames field is omitted.
10042 */
10043 int get requiredParameterCount => _requiredParameterCount;
10044
10045 /**
10046 * The number of required parameters for the function or method being
10047 * suggested. This field is omitted if the parameterNames field is omitted.
10048 */
10049 void set requiredParameterCount(int value) {
10050 this._requiredParameterCount = value;
10051 }
10052
10053 /**
10054 * True if the function or method being suggested has at least one named
10055 * parameter. This field is omitted if the parameterNames field is omitted.
10056 */
10057 bool get hasNamedParameters => _hasNamedParameters;
10058
10059 /**
10060 * True if the function or method being suggested has at least one named
10061 * parameter. This field is omitted if the parameterNames field is omitted.
10062 */
10063 void set hasNamedParameters(bool value) {
10064 this._hasNamedParameters = value;
10065 }
10066
10067 /**
10068 * The name of the optional parameter being suggested. This field is omitted
10069 * if the suggestion is not the addition of an optional argument within an
10070 * argument list.
10071 */
10072 String get parameterName => _parameterName;
10073
10074 /**
10075 * The name of the optional parameter being suggested. This field is omitted
10076 * if the suggestion is not the addition of an optional argument within an
10077 * argument list.
10078 */
10079 void set parameterName(String value) {
10080 this._parameterName = value;
10081 }
10082
10083 /**
10084 * The type of the options parameter being suggested. This field is omitted
10085 * if the parameterName field is omitted.
10086 */
10087 String get parameterType => _parameterType;
10088
10089 /**
10090 * The type of the options parameter being suggested. This field is omitted
10091 * if the parameterName field is omitted.
10092 */
10093 void set parameterType(String value) {
10094 this._parameterType = value;
10095 }
10096
10097 /**
10098 * The import to be added if the suggestion is out of scope and needs an
10099 * import to be added to be in scope.
10100 */
10101 String get importUri => _importUri;
10102
10103 /**
10104 * The import to be added if the suggestion is out of scope and needs an
10105 * import to be added to be in scope.
10106 */
10107 void set importUri(String value) {
10108 this._importUri = value;
10109 }
10110
10111 CompletionSuggestion(
10112 CompletionSuggestionKind kind,
10113 int relevance,
10114 String completion,
10115 int selectionOffset,
10116 int selectionLength,
10117 bool isDeprecated,
10118 bool isPotential,
10119 {String docSummary,
10120 String docComplete,
10121 String declaringType,
10122 String defaultArgumentListString,
10123 List<int> defaultArgumentListTextRanges,
10124 Element element,
10125 String returnType,
10126 List<String> parameterNames,
10127 List<String> parameterTypes,
10128 int requiredParameterCount,
10129 bool hasNamedParameters,
10130 String parameterName,
10131 String parameterType,
10132 String importUri}) {
10133 this.kind = kind;
10134 this.relevance = relevance;
10135 this.completion = completion;
10136 this.selectionOffset = selectionOffset;
10137 this.selectionLength = selectionLength;
10138 this.isDeprecated = isDeprecated;
10139 this.isPotential = isPotential;
10140 this.docSummary = docSummary;
10141 this.docComplete = docComplete;
10142 this.declaringType = declaringType;
10143 this.defaultArgumentListString = defaultArgumentListString;
10144 this.defaultArgumentListTextRanges = defaultArgumentListTextRanges;
10145 this.element = element;
10146 this.returnType = returnType;
10147 this.parameterNames = parameterNames;
10148 this.parameterTypes = parameterTypes;
10149 this.requiredParameterCount = requiredParameterCount;
10150 this.hasNamedParameters = hasNamedParameters;
10151 this.parameterName = parameterName;
10152 this.parameterType = parameterType;
10153 this.importUri = importUri;
10154 }
10155
10156 factory CompletionSuggestion.fromJson(
10157 JsonDecoder jsonDecoder, String jsonPath, Object json) { 9803 JsonDecoder jsonDecoder, String jsonPath, Object json) {
10158 if (json == null) { 9804 if (json == null) {
10159 json = {}; 9805 json = {};
10160 } 9806 }
10161 if (json is Map) { 9807 if (json is Map) {
10162 CompletionSuggestionKind kind; 9808 List<ExecutionService> subscriptions;
10163 if (json.containsKey("kind")) { 9809 if (json.containsKey("subscriptions")) {
10164 kind = new CompletionSuggestionKind.fromJson( 9810 subscriptions = jsonDecoder.decodeList(
10165 jsonDecoder, jsonPath + ".kind", json["kind"]); 9811 jsonPath + ".subscriptions",
10166 } else { 9812 json["subscriptions"],
10167 throw jsonDecoder.missingKey(jsonPath, "kind"); 9813 (String jsonPath, Object json) =>
10168 } 9814 new ExecutionService.fromJson(jsonDecoder, jsonPath, json));
10169 int relevance; 9815 } else {
10170 if (json.containsKey("relevance")) { 9816 throw jsonDecoder.mismatch(jsonPath, "subscriptions");
10171 relevance = 9817 }
10172 jsonDecoder.decodeInt(jsonPath + ".relevance", json["relevance"]); 9818 return new ExecutionSetSubscriptionsParams(subscriptions);
10173 } else {
10174 throw jsonDecoder.missingKey(jsonPath, "relevance");
10175 }
10176 String completion;
10177 if (json.containsKey("completion")) {
10178 completion = jsonDecoder.decodeString(
10179 jsonPath + ".completion", json["completion"]);
10180 } else {
10181 throw jsonDecoder.missingKey(jsonPath, "completion");
10182 }
10183 int selectionOffset;
10184 if (json.containsKey("selectionOffset")) {
10185 selectionOffset = jsonDecoder.decodeInt(
10186 jsonPath + ".selectionOffset", json["selectionOffset"]);
10187 } else {
10188 throw jsonDecoder.missingKey(jsonPath, "selectionOffset");
10189 }
10190 int selectionLength;
10191 if (json.containsKey("selectionLength")) {
10192 selectionLength = jsonDecoder.decodeInt(
10193 jsonPath + ".selectionLength", json["selectionLength"]);
10194 } else {
10195 throw jsonDecoder.missingKey(jsonPath, "selectionLength");
10196 }
10197 bool isDeprecated;
10198 if (json.containsKey("isDeprecated")) {
10199 isDeprecated = jsonDecoder.decodeBool(
10200 jsonPath + ".isDeprecated", json["isDeprecated"]);
10201 } else {
10202 throw jsonDecoder.missingKey(jsonPath, "isDeprecated");
10203 }
10204 bool isPotential;
10205 if (json.containsKey("isPotential")) {
10206 isPotential = jsonDecoder.decodeBool(
10207 jsonPath + ".isPotential", json["isPotential"]);
10208 } else {
10209 throw jsonDecoder.missingKey(jsonPath, "isPotential");
10210 }
10211 String docSummary;
10212 if (json.containsKey("docSummary")) {
10213 docSummary = jsonDecoder.decodeString(
10214 jsonPath + ".docSummary", json["docSummary"]);
10215 }
10216 String docComplete;
10217 if (json.containsKey("docComplete")) {
10218 docComplete = jsonDecoder.decodeString(
10219 jsonPath + ".docComplete", json["docComplete"]);
10220 }
10221 String declaringType;
10222 if (json.containsKey("declaringType")) {
10223 declaringType = jsonDecoder.decodeString(
10224 jsonPath + ".declaringType", json["declaringType"]);
10225 }
10226 String defaultArgumentListString;
10227 if (json.containsKey("defaultArgumentListString")) {
10228 defaultArgumentListString = jsonDecoder.decodeString(
10229 jsonPath + ".defaultArgumentListString",
10230 json["defaultArgumentListString"]);
10231 }
10232 List<int> defaultArgumentListTextRanges;
10233 if (json.containsKey("defaultArgumentListTextRanges")) {
10234 defaultArgumentListTextRanges = jsonDecoder.decodeList(
10235 jsonPath + ".defaultArgumentListTextRanges",
10236 json["defaultArgumentListTextRanges"],
10237 jsonDecoder.decodeInt);
10238 }
10239 Element element;
10240 if (json.containsKey("element")) {
10241 element = new Element.fromJson(
10242 jsonDecoder, jsonPath + ".element", json["element"]);
10243 }
10244 String returnType;
10245 if (json.containsKey("returnType")) {
10246 returnType = jsonDecoder.decodeString(
10247 jsonPath + ".returnType", json["returnType"]);
10248 }
10249 List<String> parameterNames;
10250 if (json.containsKey("parameterNames")) {
10251 parameterNames = jsonDecoder.decodeList(jsonPath + ".parameterNames",
10252 json["parameterNames"], jsonDecoder.decodeString);
10253 }
10254 List<String> parameterTypes;
10255 if (json.containsKey("parameterTypes")) {
10256 parameterTypes = jsonDecoder.decodeList(jsonPath + ".parameterTypes",
10257 json["parameterTypes"], jsonDecoder.decodeString);
10258 }
10259 int requiredParameterCount;
10260 if (json.containsKey("requiredParameterCount")) {
10261 requiredParameterCount = jsonDecoder.decodeInt(
10262 jsonPath + ".requiredParameterCount",
10263 json["requiredParameterCount"]);
10264 }
10265 bool hasNamedParameters;
10266 if (json.containsKey("hasNamedParameters")) {
10267 hasNamedParameters = jsonDecoder.decodeBool(
10268 jsonPath + ".hasNamedParameters", json["hasNamedParameters"]);
10269 }
10270 String parameterName;
10271 if (json.containsKey("parameterName")) {
10272 parameterName = jsonDecoder.decodeString(
10273 jsonPath + ".parameterName", json["parameterName"]);
10274 }
10275 String parameterType;
10276 if (json.containsKey("parameterType")) {
10277 parameterType = jsonDecoder.decodeString(
10278 jsonPath + ".parameterType", json["parameterType"]);
10279 }
10280 String importUri;
10281 if (json.containsKey("importUri")) {
10282 importUri = jsonDecoder.decodeString(
10283 jsonPath + ".importUri", json["importUri"]);
10284 }
10285 return new CompletionSuggestion(kind, relevance, completion,
10286 selectionOffset, selectionLength, isDeprecated, isPotential,
10287 docSummary: docSummary,
10288 docComplete: docComplete,
10289 declaringType: declaringType,
10290 defaultArgumentListString: defaultArgumentListString,
10291 defaultArgumentListTextRanges: defaultArgumentListTextRanges,
10292 element: element,
10293 returnType: returnType,
10294 parameterNames: parameterNames,
10295 parameterTypes: parameterTypes,
10296 requiredParameterCount: requiredParameterCount,
10297 hasNamedParameters: hasNamedParameters,
10298 parameterName: parameterName,
10299 parameterType: parameterType,
10300 importUri: importUri);
10301 } else { 9819 } else {
10302 throw jsonDecoder.mismatch(jsonPath, "CompletionSuggestion", json); 9820 throw jsonDecoder.mismatch(
10303 } 9821 jsonPath, "execution.setSubscriptions params", json);
10304 } 9822 }
10305 9823 }
9824
9825 factory ExecutionSetSubscriptionsParams.fromRequest(Request request) {
9826 return new ExecutionSetSubscriptionsParams.fromJson(
9827 new RequestDecoder(request), "params", request.params);
9828 }
9829
9830 @override
10306 Map<String, dynamic> toJson() { 9831 Map<String, dynamic> toJson() {
10307 Map<String, dynamic> result = {}; 9832 Map<String, dynamic> result = {};
10308 result["kind"] = kind.toJson(); 9833 result["subscriptions"] =
10309 result["relevance"] = relevance; 9834 subscriptions.map((ExecutionService value) => value.toJson()).toList();
10310 result["completion"] = completion;
10311 result["selectionOffset"] = selectionOffset;
10312 result["selectionLength"] = selectionLength;
10313 result["isDeprecated"] = isDeprecated;
10314 result["isPotential"] = isPotential;
10315 if (docSummary != null) {
10316 result["docSummary"] = docSummary;
10317 }
10318 if (docComplete != null) {
10319 result["docComplete"] = docComplete;
10320 }
10321 if (declaringType != null) {
10322 result["declaringType"] = declaringType;
10323 }
10324 if (defaultArgumentListString != null) {
10325 result["defaultArgumentListString"] = defaultArgumentListString;
10326 }
10327 if (defaultArgumentListTextRanges != null) {
10328 result["defaultArgumentListTextRanges"] = defaultArgumentListTextRanges;
10329 }
10330 if (element != null) {
10331 result["element"] = element.toJson();
10332 }
10333 if (returnType != null) {
10334 result["returnType"] = returnType;
10335 }
10336 if (parameterNames != null) {
10337 result["parameterNames"] = parameterNames;
10338 }
10339 if (parameterTypes != null) {
10340 result["parameterTypes"] = parameterTypes;
10341 }
10342 if (requiredParameterCount != null) {
10343 result["requiredParameterCount"] = requiredParameterCount;
10344 }
10345 if (hasNamedParameters != null) {
10346 result["hasNamedParameters"] = hasNamedParameters;
10347 }
10348 if (parameterName != null) {
10349 result["parameterName"] = parameterName;
10350 }
10351 if (parameterType != null) {
10352 result["parameterType"] = parameterType;
10353 }
10354 if (importUri != null) {
10355 result["importUri"] = importUri;
10356 }
10357 return result; 9835 return result;
10358 } 9836 }
10359 9837
9838 @override
9839 Request toRequest(String id) {
9840 return new Request(id, "execution.setSubscriptions", toJson());
9841 }
9842
9843 @override
9844 String toString() => JSON.encode(toJson());
9845
9846 @override
9847 bool operator ==(other) {
9848 if (other is ExecutionSetSubscriptionsParams) {
9849 return listEqual(subscriptions, other.subscriptions,
9850 (ExecutionService a, ExecutionService b) => a == b);
9851 }
9852 return false;
9853 }
9854
9855 @override
9856 int get hashCode {
9857 int hash = 0;
9858 hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
9859 return JenkinsSmiHash.finish(hash);
9860 }
9861 }
9862
9863 /**
9864 * execution.setSubscriptions result
9865 *
9866 * Clients may not extend, implement or mix-in this class.
9867 */
9868 class ExecutionSetSubscriptionsResult implements ResponseResult {
9869 @override
9870 Map<String, dynamic> toJson() => <String, dynamic>{};
9871
9872 @override
9873 Response toResponse(String id) {
9874 return new Response(id, result: null);
9875 }
9876
9877 @override
9878 bool operator ==(other) {
9879 if (other is ExecutionSetSubscriptionsResult) {
9880 return true;
9881 }
9882 return false;
9883 }
9884
9885 @override
9886 int get hashCode {
9887 return 287678780;
9888 }
9889 }
9890
9891 /**
9892 * extractLocalVariable feedback
9893 *
9894 * {
9895 * "coveringExpressionOffsets": optional List<int>
9896 * "coveringExpressionLengths": optional List<int>
9897 * "names": List<String>
9898 * "offsets": List<int>
9899 * "lengths": List<int>
9900 * }
9901 *
9902 * Clients may not extend, implement or mix-in this class.
9903 */
9904 class ExtractLocalVariableFeedback extends RefactoringFeedback {
9905 List<int> _coveringExpressionOffsets;
9906
9907 List<int> _coveringExpressionLengths;
9908
9909 List<String> _names;
9910
9911 List<int> _offsets;
9912
9913 List<int> _lengths;
9914
9915 /**
9916 * The offsets of the expressions that cover the specified selection, from
9917 * the down most to the up most.
9918 */
9919 List<int> get coveringExpressionOffsets => _coveringExpressionOffsets;
9920
9921 /**
9922 * The offsets of the expressions that cover the specified selection, from
9923 * the down most to the up most.
9924 */
9925 void set coveringExpressionOffsets(List<int> value) {
9926 this._coveringExpressionOffsets = value;
9927 }
9928
9929 /**
9930 * The lengths of the expressions that cover the specified selection, from
9931 * the down most to the up most.
9932 */
9933 List<int> get coveringExpressionLengths => _coveringExpressionLengths;
9934
9935 /**
9936 * The lengths of the expressions that cover the specified selection, from
9937 * the down most to the up most.
9938 */
9939 void set coveringExpressionLengths(List<int> value) {
9940 this._coveringExpressionLengths = value;
9941 }
9942
9943 /**
9944 * The proposed names for the local variable.
9945 */
9946 List<String> get names => _names;
9947
9948 /**
9949 * The proposed names for the local variable.
9950 */
9951 void set names(List<String> value) {
9952 assert(value != null);
9953 this._names = value;
9954 }
9955
9956 /**
9957 * The offsets of the expressions that would be replaced by a reference to
9958 * the variable.
9959 */
9960 List<int> get offsets => _offsets;
9961
9962 /**
9963 * The offsets of the expressions that would be replaced by a reference to
9964 * the variable.
9965 */
9966 void set offsets(List<int> value) {
9967 assert(value != null);
9968 this._offsets = value;
9969 }
9970
9971 /**
9972 * The lengths of the expressions that would be replaced by a reference to
9973 * the variable. The lengths correspond to the offsets. In other words, for a
9974 * given expression, if the offset of that expression is offsets[i], then the
9975 * length of that expression is lengths[i].
9976 */
9977 List<int> get lengths => _lengths;
9978
9979 /**
9980 * The lengths of the expressions that would be replaced by a reference to
9981 * the variable. The lengths correspond to the offsets. In other words, for a
9982 * given expression, if the offset of that expression is offsets[i], then the
9983 * length of that expression is lengths[i].
9984 */
9985 void set lengths(List<int> value) {
9986 assert(value != null);
9987 this._lengths = value;
9988 }
9989
9990 ExtractLocalVariableFeedback(
9991 List<String> names, List<int> offsets, List<int> lengths,
9992 {List<int> coveringExpressionOffsets,
9993 List<int> coveringExpressionLengths}) {
9994 this.coveringExpressionOffsets = coveringExpressionOffsets;
9995 this.coveringExpressionLengths = coveringExpressionLengths;
9996 this.names = names;
9997 this.offsets = offsets;
9998 this.lengths = lengths;
9999 }
10000
10001 factory ExtractLocalVariableFeedback.fromJson(
10002 JsonDecoder jsonDecoder, String jsonPath, Object json) {
10003 if (json == null) {
10004 json = {};
10005 }
10006 if (json is Map) {
10007 List<int> coveringExpressionOffsets;
10008 if (json.containsKey("coveringExpressionOffsets")) {
10009 coveringExpressionOffsets = jsonDecoder.decodeList(
10010 jsonPath + ".coveringExpressionOffsets",
10011 json["coveringExpressionOffsets"],
10012 jsonDecoder.decodeInt);
10013 }
10014 List<int> coveringExpressionLengths;
10015 if (json.containsKey("coveringExpressionLengths")) {
10016 coveringExpressionLengths = jsonDecoder.decodeList(
10017 jsonPath + ".coveringExpressionLengths",
10018 json["coveringExpressionLengths"],
10019 jsonDecoder.decodeInt);
10020 }
10021 List<String> names;
10022 if (json.containsKey("names")) {
10023 names = jsonDecoder.decodeList(
10024 jsonPath + ".names", json["names"], jsonDecoder.decodeString);
10025 } else {
10026 throw jsonDecoder.mismatch(jsonPath, "names");
10027 }
10028 List<int> offsets;
10029 if (json.containsKey("offsets")) {
10030 offsets = jsonDecoder.decodeList(
10031 jsonPath + ".offsets", json["offsets"], jsonDecoder.decodeInt);
10032 } else {
10033 throw jsonDecoder.mismatch(jsonPath, "offsets");
10034 }
10035 List<int> lengths;
10036 if (json.containsKey("lengths")) {
10037 lengths = jsonDecoder.decodeList(
10038 jsonPath + ".lengths", json["lengths"], jsonDecoder.decodeInt);
10039 } else {
10040 throw jsonDecoder.mismatch(jsonPath, "lengths");
10041 }
10042 return new ExtractLocalVariableFeedback(names, offsets, lengths,
10043 coveringExpressionOffsets: coveringExpressionOffsets,
10044 coveringExpressionLengths: coveringExpressionLengths);
10045 } else {
10046 throw jsonDecoder.mismatch(
10047 jsonPath, "extractLocalVariable feedback", json);
10048 }
10049 }
10050
10051 @override
10052 Map<String, dynamic> toJson() {
10053 Map<String, dynamic> result = {};
10054 if (coveringExpressionOffsets != null) {
10055 result["coveringExpressionOffsets"] = coveringExpressionOffsets;
10056 }
10057 if (coveringExpressionLengths != null) {
10058 result["coveringExpressionLengths"] = coveringExpressionLengths;
10059 }
10060 result["names"] = names;
10061 result["offsets"] = offsets;
10062 result["lengths"] = lengths;
10063 return result;
10064 }
10065
10066 @override
10067 String toString() => JSON.encode(toJson());
10068
10069 @override
10070 bool operator ==(other) {
10071 if (other is ExtractLocalVariableFeedback) {
10072 return listEqual(coveringExpressionOffsets,
10073 other.coveringExpressionOffsets, (int a, int b) => a == b) &&
10074 listEqual(coveringExpressionLengths, other.coveringExpressionLengths,
10075 (int a, int b) => a == b) &&
10076 listEqual(names, other.names, (String a, String b) => a == b) &&
10077 listEqual(offsets, other.offsets, (int a, int b) => a == b) &&
10078 listEqual(lengths, other.lengths, (int a, int b) => a == b);
10079 }
10080 return false;
10081 }
10082
10083 @override
10084 int get hashCode {
10085 int hash = 0;
10086 hash = JenkinsSmiHash.combine(hash, coveringExpressionOffsets.hashCode);
10087 hash = JenkinsSmiHash.combine(hash, coveringExpressionLengths.hashCode);
10088 hash = JenkinsSmiHash.combine(hash, names.hashCode);
10089 hash = JenkinsSmiHash.combine(hash, offsets.hashCode);
10090 hash = JenkinsSmiHash.combine(hash, lengths.hashCode);
10091 return JenkinsSmiHash.finish(hash);
10092 }
10093 }
10094
10095 /**
10096 * extractLocalVariable options
10097 *
10098 * {
10099 * "name": String
10100 * "extractAll": bool
10101 * }
10102 *
10103 * Clients may not extend, implement or mix-in this class.
10104 */
10105 class ExtractLocalVariableOptions extends RefactoringOptions {
10106 String _name;
10107
10108 bool _extractAll;
10109
10110 /**
10111 * The name that the local variable should be given.
10112 */
10113 String get name => _name;
10114
10115 /**
10116 * The name that the local variable should be given.
10117 */
10118 void set name(String value) {
10119 assert(value != null);
10120 this._name = value;
10121 }
10122
10123 /**
10124 * True if all occurrences of the expression within the scope in which the
10125 * variable will be defined should be replaced by a reference to the local
10126 * variable. The expression used to initiate the refactoring will always be
10127 * replaced.
10128 */
10129 bool get extractAll => _extractAll;
10130
10131 /**
10132 * True if all occurrences of the expression within the scope in which the
10133 * variable will be defined should be replaced by a reference to the local
10134 * variable. The expression used to initiate the refactoring will always be
10135 * replaced.
10136 */
10137 void set extractAll(bool value) {
10138 assert(value != null);
10139 this._extractAll = value;
10140 }
10141
10142 ExtractLocalVariableOptions(String name, bool extractAll) {
10143 this.name = name;
10144 this.extractAll = extractAll;
10145 }
10146
10147 factory ExtractLocalVariableOptions.fromJson(
10148 JsonDecoder jsonDecoder, String jsonPath, Object json) {
10149 if (json == null) {
10150 json = {};
10151 }
10152 if (json is Map) {
10153 String name;
10154 if (json.containsKey("name")) {
10155 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]);
10156 } else {
10157 throw jsonDecoder.mismatch(jsonPath, "name");
10158 }
10159 bool extractAll;
10160 if (json.containsKey("extractAll")) {
10161 extractAll = jsonDecoder.decodeBool(
10162 jsonPath + ".extractAll", json["extractAll"]);
10163 } else {
10164 throw jsonDecoder.mismatch(jsonPath, "extractAll");
10165 }
10166 return new ExtractLocalVariableOptions(name, extractAll);
10167 } else {
10168 throw jsonDecoder.mismatch(
10169 jsonPath, "extractLocalVariable options", json);
10170 }
10171 }
10172
10173 factory ExtractLocalVariableOptions.fromRefactoringParams(
10174 EditGetRefactoringParams refactoringParams, Request request) {
10175 return new ExtractLocalVariableOptions.fromJson(
10176 new RequestDecoder(request), "options", refactoringParams.options);
10177 }
10178
10179 @override
10180 Map<String, dynamic> toJson() {
10181 Map<String, dynamic> result = {};
10182 result["name"] = name;
10183 result["extractAll"] = extractAll;
10184 return result;
10185 }
10186
10360 @override 10187 @override
10361 String toString() => JSON.encode(toJson()); 10188 String toString() => JSON.encode(toJson());
10362 10189
10363 @override 10190 @override
10364 bool operator ==(other) { 10191 bool operator ==(other) {
10365 if (other is CompletionSuggestion) { 10192 if (other is ExtractLocalVariableOptions) {
10366 return kind == other.kind && 10193 return name == other.name && extractAll == other.extractAll;
10367 relevance == other.relevance &&
10368 completion == other.completion &&
10369 selectionOffset == other.selectionOffset &&
10370 selectionLength == other.selectionLength &&
10371 isDeprecated == other.isDeprecated &&
10372 isPotential == other.isPotential &&
10373 docSummary == other.docSummary &&
10374 docComplete == other.docComplete &&
10375 declaringType == other.declaringType &&
10376 defaultArgumentListString == other.defaultArgumentListString &&
10377 listEqual(defaultArgumentListTextRanges,
10378 other.defaultArgumentListTextRanges, (int a, int b) => a == b) &&
10379 element == other.element &&
10380 returnType == other.returnType &&
10381 listEqual(parameterNames, other.parameterNames,
10382 (String a, String b) => a == b) &&
10383 listEqual(parameterTypes, other.parameterTypes,
10384 (String a, String b) => a == b) &&
10385 requiredParameterCount == other.requiredParameterCount &&
10386 hasNamedParameters == other.hasNamedParameters &&
10387 parameterName == other.parameterName &&
10388 parameterType == other.parameterType &&
10389 importUri == other.importUri;
10390 } 10194 }
10391 return false; 10195 return false;
10392 } 10196 }
10393 10197
10394 @override 10198 @override
10395 int get hashCode { 10199 int get hashCode {
10396 int hash = 0; 10200 int hash = 0;
10397 hash = JenkinsSmiHash.combine(hash, kind.hashCode); 10201 hash = JenkinsSmiHash.combine(hash, name.hashCode);
10398 hash = JenkinsSmiHash.combine(hash, relevance.hashCode); 10202 hash = JenkinsSmiHash.combine(hash, extractAll.hashCode);
10399 hash = JenkinsSmiHash.combine(hash, completion.hashCode);
10400 hash = JenkinsSmiHash.combine(hash, selectionOffset.hashCode);
10401 hash = JenkinsSmiHash.combine(hash, selectionLength.hashCode);
10402 hash = JenkinsSmiHash.combine(hash, isDeprecated.hashCode);
10403 hash = JenkinsSmiHash.combine(hash, isPotential.hashCode);
10404 hash = JenkinsSmiHash.combine(hash, docSummary.hashCode);
10405 hash = JenkinsSmiHash.combine(hash, docComplete.hashCode);
10406 hash = JenkinsSmiHash.combine(hash, declaringType.hashCode);
10407 hash = JenkinsSmiHash.combine(hash, defaultArgumentListString.hashCode);
10408 hash = JenkinsSmiHash.combine(hash, defaultArgumentListTextRanges.hashCode);
10409 hash = JenkinsSmiHash.combine(hash, element.hashCode);
10410 hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
10411 hash = JenkinsSmiHash.combine(hash, parameterNames.hashCode);
10412 hash = JenkinsSmiHash.combine(hash, parameterTypes.hashCode);
10413 hash = JenkinsSmiHash.combine(hash, requiredParameterCount.hashCode);
10414 hash = JenkinsSmiHash.combine(hash, hasNamedParameters.hashCode);
10415 hash = JenkinsSmiHash.combine(hash, parameterName.hashCode);
10416 hash = JenkinsSmiHash.combine(hash, parameterType.hashCode);
10417 hash = JenkinsSmiHash.combine(hash, importUri.hashCode);
10418 return JenkinsSmiHash.finish(hash); 10203 return JenkinsSmiHash.finish(hash);
10419 } 10204 }
10420 } 10205 }
10421 10206
10422 /** 10207 /**
10423 * CompletionSuggestionKind 10208 * extractMethod feedback
10424 * 10209 *
10425 * enum { 10210 * {
10426 * ARGUMENT_LIST 10211 * "offset": int
10427 * IMPORT 10212 * "length": int
10428 * IDENTIFIER 10213 * "returnType": String
10429 * INVOCATION 10214 * "names": List<String>
10430 * KEYWORD 10215 * "canCreateGetter": bool
10431 * NAMED_ARGUMENT 10216 * "parameters": List<RefactoringMethodParameter>
10432 * OPTIONAL_ARGUMENT 10217 * "offsets": List<int>
10433 * PARAMETER 10218 * "lengths": List<int>
10434 * } 10219 * }
10435 * 10220 *
10436 * Clients may not extend, implement or mix-in this class. 10221 * Clients may not extend, implement or mix-in this class.
10437 */ 10222 */
10438 class CompletionSuggestionKind implements Enum { 10223 class ExtractMethodFeedback extends RefactoringFeedback {
10439 /** 10224 int _offset;
10440 * A list of arguments for the method or function that is being invoked. For 10225
10441 * this suggestion kind, the completion field is a textual representation of 10226 int _length;
10442 * the invocation and the parameterNames, parameterTypes, and 10227
10443 * requiredParameterCount attributes are defined. 10228 String _returnType;
10444 */ 10229
10445 static const CompletionSuggestionKind ARGUMENT_LIST = 10230 List<String> _names;
10446 const CompletionSuggestionKind._("ARGUMENT_LIST"); 10231
10447 10232 bool _canCreateGetter;
10448 static const CompletionSuggestionKind IMPORT = 10233
10449 const CompletionSuggestionKind._("IMPORT"); 10234 List<RefactoringMethodParameter> _parameters;
10450 10235
10451 /** 10236 List<int> _offsets;
10452 * The element identifier should be inserted at the completion location. For 10237
10453 * example "someMethod" in import 'myLib.dart' show someMethod; . For 10238 List<int> _lengths;
10454 * suggestions of this kind, the element attribute is defined and the 10239
10455 * completion field is the element's identifier. 10240 /**
10456 */ 10241 * The offset to the beginning of the expression or statements that will be
10457 static const CompletionSuggestionKind IDENTIFIER = 10242 * extracted.
10458 const CompletionSuggestionKind._("IDENTIFIER"); 10243 */
10459 10244 int get offset => _offset;
10460 /** 10245
10461 * The element is being invoked at the completion location. For example, 10246 /**
10462 * "someMethod" in x.someMethod(); . For suggestions of this kind, the 10247 * The offset to the beginning of the expression or statements that will be
10463 * element attribute is defined and the completion field is the element's 10248 * extracted.
10464 * identifier. 10249 */
10465 */ 10250 void set offset(int value) {
10466 static const CompletionSuggestionKind INVOCATION = 10251 assert(value != null);
10467 const CompletionSuggestionKind._("INVOCATION"); 10252 this._offset = value;
10468 10253 }
10469 /** 10254
10470 * A keyword is being suggested. For suggestions of this kind, the completion 10255 /**
10471 * is the keyword. 10256 * The length of the expression or statements that will be extracted.
10472 */ 10257 */
10473 static const CompletionSuggestionKind KEYWORD = 10258 int get length => _length;
10474 const CompletionSuggestionKind._("KEYWORD"); 10259
10475 10260 /**
10476 /** 10261 * The length of the expression or statements that will be extracted.
10477 * A named argument for the current callsite is being suggested. For 10262 */
10478 * suggestions of this kind, the completion is the named argument identifier 10263 void set length(int value) {
10479 * including a trailing ':' and space. 10264 assert(value != null);
10480 */ 10265 this._length = value;
10481 static const CompletionSuggestionKind NAMED_ARGUMENT = 10266 }
10482 const CompletionSuggestionKind._("NAMED_ARGUMENT"); 10267
10483 10268 /**
10484 static const CompletionSuggestionKind OPTIONAL_ARGUMENT = 10269 * The proposed return type for the method. If the returned element does not
10485 const CompletionSuggestionKind._("OPTIONAL_ARGUMENT"); 10270 * have a declared return type, this field will contain an empty string.
10486 10271 */
10487 static const CompletionSuggestionKind PARAMETER = 10272 String get returnType => _returnType;
10488 const CompletionSuggestionKind._("PARAMETER"); 10273
10489 10274 /**
10490 /** 10275 * The proposed return type for the method. If the returned element does not
10491 * A list containing all of the enum values that are defined. 10276 * have a declared return type, this field will contain an empty string.
10492 */ 10277 */
10493 static const List<CompletionSuggestionKind> VALUES = 10278 void set returnType(String value) {
10494 const <CompletionSuggestionKind>[ 10279 assert(value != null);
10495 ARGUMENT_LIST, 10280 this._returnType = value;
10496 IMPORT, 10281 }
10497 IDENTIFIER, 10282
10498 INVOCATION, 10283 /**
10499 KEYWORD, 10284 * The proposed names for the method.
10500 NAMED_ARGUMENT, 10285 */
10501 OPTIONAL_ARGUMENT, 10286 List<String> get names => _names;
10502 PARAMETER 10287
10503 ]; 10288 /**
10504 10289 * The proposed names for the method.
10505 final String name; 10290 */
10506 10291 void set names(List<String> value) {
10507 const CompletionSuggestionKind._(this.name); 10292 assert(value != null);
10508 10293 this._names = value;
10509 factory CompletionSuggestionKind(String name) { 10294 }
10510 switch (name) { 10295
10511 case "ARGUMENT_LIST": 10296 /**
10512 return ARGUMENT_LIST; 10297 * True if a getter could be created rather than a method.
10513 case "IMPORT": 10298 */
10514 return IMPORT; 10299 bool get canCreateGetter => _canCreateGetter;
10515 case "IDENTIFIER": 10300
10516 return IDENTIFIER; 10301 /**
10517 case "INVOCATION": 10302 * True if a getter could be created rather than a method.
10518 return INVOCATION; 10303 */
10519 case "KEYWORD": 10304 void set canCreateGetter(bool value) {
10520 return KEYWORD; 10305 assert(value != null);
10521 case "NAMED_ARGUMENT": 10306 this._canCreateGetter = value;
10522 return NAMED_ARGUMENT; 10307 }
10523 case "OPTIONAL_ARGUMENT": 10308
10524 return OPTIONAL_ARGUMENT; 10309 /**
10525 case "PARAMETER": 10310 * The proposed parameters for the method.
10526 return PARAMETER; 10311 */
10527 } 10312 List<RefactoringMethodParameter> get parameters => _parameters;
10528 throw new Exception('Illegal enum value: $name'); 10313
10529 } 10314 /**
10530 10315 * The proposed parameters for the method.
10531 factory CompletionSuggestionKind.fromJson( 10316 */
10532 JsonDecoder jsonDecoder, String jsonPath, Object json) { 10317 void set parameters(List<RefactoringMethodParameter> value) {
10533 if (json is String) { 10318 assert(value != null);
10534 try { 10319 this._parameters = value;
10535 return new CompletionSuggestionKind(json); 10320 }
10536 } catch (_) { 10321
10537 // Fall through 10322 /**
10538 } 10323 * The offsets of the expressions or statements that would be replaced by an
10539 } 10324 * invocation of the method.
10540 throw jsonDecoder.mismatch(jsonPath, "CompletionSuggestionKind", json); 10325 */
10541 } 10326 List<int> get offsets => _offsets;
10542 10327
10543 @override 10328 /**
10544 String toString() => "CompletionSuggestionKind.$name"; 10329 * The offsets of the expressions or statements that would be replaced by an
10545 10330 * invocation of the method.
10546 String toJson() => name; 10331 */
10547 } 10332 void set offsets(List<int> value) {
10548 10333 assert(value != null);
10549 /** 10334 this._offsets = value;
10550 * ContextData 10335 }
10551 * 10336
10552 * { 10337 /**
10553 * "name": String 10338 * The lengths of the expressions or statements that would be replaced by an
10554 * "explicitFileCount": int 10339 * invocation of the method. The lengths correspond to the offsets. In other
10555 * "implicitFileCount": int 10340 * words, for a given expression (or block of statements), if the offset of
10556 * "workItemQueueLength": int 10341 * that expression is offsets[i], then the length of that expression is
10557 * "cacheEntryExceptions": List<String> 10342 * lengths[i].
10558 * } 10343 */
10559 * 10344 List<int> get lengths => _lengths;
10560 * Clients may not extend, implement or mix-in this class. 10345
10561 */ 10346 /**
10562 class ContextData implements HasToJson { 10347 * The lengths of the expressions or statements that would be replaced by an
10563 String _name; 10348 * invocation of the method. The lengths correspond to the offsets. In other
10564 10349 * words, for a given expression (or block of statements), if the offset of
10565 int _explicitFileCount; 10350 * that expression is offsets[i], then the length of that expression is
10566 10351 * lengths[i].
10567 int _implicitFileCount; 10352 */
10568 10353 void set lengths(List<int> value) {
10569 int _workItemQueueLength; 10354 assert(value != null);
10570 10355 this._lengths = value;
10571 List<String> _cacheEntryExceptions; 10356 }
10572 10357
10573 /** 10358 ExtractMethodFeedback(
10574 * The name of the context. 10359 int offset,
10575 */ 10360 int length,
10576 String get name => _name; 10361 String returnType,
10577 10362 List<String> names,
10578 /** 10363 bool canCreateGetter,
10579 * The name of the context. 10364 List<RefactoringMethodParameter> parameters,
10580 */ 10365 List<int> offsets,
10581 void set name(String value) { 10366 List<int> lengths) {
10582 assert(value != null); 10367 this.offset = offset;
10583 this._name = value; 10368 this.length = length;
10584 } 10369 this.returnType = returnType;
10585 10370 this.names = names;
10586 /** 10371 this.canCreateGetter = canCreateGetter;
10587 * Explicitly analyzed files. 10372 this.parameters = parameters;
10588 */ 10373 this.offsets = offsets;
10589 int get explicitFileCount => _explicitFileCount; 10374 this.lengths = lengths;
10590 10375 }
10591 /** 10376
10592 * Explicitly analyzed files. 10377 factory ExtractMethodFeedback.fromJson(
10593 */
10594 void set explicitFileCount(int value) {
10595 assert(value != null);
10596 this._explicitFileCount = value;
10597 }
10598
10599 /**
10600 * Implicitly analyzed files.
10601 */
10602 int get implicitFileCount => _implicitFileCount;
10603
10604 /**
10605 * Implicitly analyzed files.
10606 */
10607 void set implicitFileCount(int value) {
10608 assert(value != null);
10609 this._implicitFileCount = value;
10610 }
10611
10612 /**
10613 * The number of work items in the queue.
10614 */
10615 int get workItemQueueLength => _workItemQueueLength;
10616
10617 /**
10618 * The number of work items in the queue.
10619 */
10620 void set workItemQueueLength(int value) {
10621 assert(value != null);
10622 this._workItemQueueLength = value;
10623 }
10624
10625 /**
10626 * Exceptions associated with cache entries.
10627 */
10628 List<String> get cacheEntryExceptions => _cacheEntryExceptions;
10629
10630 /**
10631 * Exceptions associated with cache entries.
10632 */
10633 void set cacheEntryExceptions(List<String> value) {
10634 assert(value != null);
10635 this._cacheEntryExceptions = value;
10636 }
10637
10638 ContextData(String name, int explicitFileCount, int implicitFileCount,
10639 int workItemQueueLength, List<String> cacheEntryExceptions) {
10640 this.name = name;
10641 this.explicitFileCount = explicitFileCount;
10642 this.implicitFileCount = implicitFileCount;
10643 this.workItemQueueLength = workItemQueueLength;
10644 this.cacheEntryExceptions = cacheEntryExceptions;
10645 }
10646
10647 factory ContextData.fromJson(
10648 JsonDecoder jsonDecoder, String jsonPath, Object json) { 10378 JsonDecoder jsonDecoder, String jsonPath, Object json) {
10649 if (json == null) { 10379 if (json == null) {
10650 json = {}; 10380 json = {};
10651 } 10381 }
10652 if (json is Map) { 10382 if (json is Map) {
10653 String name; 10383 int offset;
10654 if (json.containsKey("name")) { 10384 if (json.containsKey("offset")) {
10655 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]); 10385 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
10656 } else { 10386 } else {
10657 throw jsonDecoder.missingKey(jsonPath, "name"); 10387 throw jsonDecoder.mismatch(jsonPath, "offset");
10658 } 10388 }
10659 int explicitFileCount; 10389 int length;
10660 if (json.containsKey("explicitFileCount")) { 10390 if (json.containsKey("length")) {
10661 explicitFileCount = jsonDecoder.decodeInt( 10391 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
10662 jsonPath + ".explicitFileCount", json["explicitFileCount"]); 10392 } else {
10663 } else { 10393 throw jsonDecoder.mismatch(jsonPath, "length");
10664 throw jsonDecoder.missingKey(jsonPath, "explicitFileCount"); 10394 }
10665 } 10395 String returnType;
10666 int implicitFileCount; 10396 if (json.containsKey("returnType")) {
10667 if (json.containsKey("implicitFileCount")) { 10397 returnType = jsonDecoder.decodeString(
10668 implicitFileCount = jsonDecoder.decodeInt( 10398 jsonPath + ".returnType", json["returnType"]);
10669 jsonPath + ".implicitFileCount", json["implicitFileCount"]); 10399 } else {
10670 } else { 10400 throw jsonDecoder.mismatch(jsonPath, "returnType");
10671 throw jsonDecoder.missingKey(jsonPath, "implicitFileCount"); 10401 }
10672 } 10402 List<String> names;
10673 int workItemQueueLength; 10403 if (json.containsKey("names")) {
10674 if (json.containsKey("workItemQueueLength")) { 10404 names = jsonDecoder.decodeList(
10675 workItemQueueLength = jsonDecoder.decodeInt( 10405 jsonPath + ".names", json["names"], jsonDecoder.decodeString);
10676 jsonPath + ".workItemQueueLength", json["workItemQueueLength"]); 10406 } else {
10677 } else { 10407 throw jsonDecoder.mismatch(jsonPath, "names");
10678 throw jsonDecoder.missingKey(jsonPath, "workItemQueueLength"); 10408 }
10679 } 10409 bool canCreateGetter;
10680 List<String> cacheEntryExceptions; 10410 if (json.containsKey("canCreateGetter")) {
10681 if (json.containsKey("cacheEntryExceptions")) { 10411 canCreateGetter = jsonDecoder.decodeBool(
10682 cacheEntryExceptions = jsonDecoder.decodeList( 10412 jsonPath + ".canCreateGetter", json["canCreateGetter"]);
10683 jsonPath + ".cacheEntryExceptions", 10413 } else {
10684 json["cacheEntryExceptions"], 10414 throw jsonDecoder.mismatch(jsonPath, "canCreateGetter");
10685 jsonDecoder.decodeString); 10415 }
10686 } else { 10416 List<RefactoringMethodParameter> parameters;
10687 throw jsonDecoder.missingKey(jsonPath, "cacheEntryExceptions"); 10417 if (json.containsKey("parameters")) {
10688 } 10418 parameters = jsonDecoder.decodeList(
10689 return new ContextData(name, explicitFileCount, implicitFileCount, 10419 jsonPath + ".parameters",
10690 workItemQueueLength, cacheEntryExceptions); 10420 json["parameters"],
10421 (String jsonPath, Object json) =>
10422 new RefactoringMethodParameter.fromJson(
10423 jsonDecoder, jsonPath, json));
10424 } else {
10425 throw jsonDecoder.mismatch(jsonPath, "parameters");
10426 }
10427 List<int> offsets;
10428 if (json.containsKey("offsets")) {
10429 offsets = jsonDecoder.decodeList(
10430 jsonPath + ".offsets", json["offsets"], jsonDecoder.decodeInt);
10431 } else {
10432 throw jsonDecoder.mismatch(jsonPath, "offsets");
10433 }
10434 List<int> lengths;
10435 if (json.containsKey("lengths")) {
10436 lengths = jsonDecoder.decodeList(
10437 jsonPath + ".lengths", json["lengths"], jsonDecoder.decodeInt);
10438 } else {
10439 throw jsonDecoder.mismatch(jsonPath, "lengths");
10440 }
10441 return new ExtractMethodFeedback(offset, length, returnType, names,
10442 canCreateGetter, parameters, offsets, lengths);
10691 } else { 10443 } else {
10692 throw jsonDecoder.mismatch(jsonPath, "ContextData", json); 10444 throw jsonDecoder.mismatch(jsonPath, "extractMethod feedback", json);
10693 } 10445 }
10694 } 10446 }
10695 10447
10448 @override
10696 Map<String, dynamic> toJson() { 10449 Map<String, dynamic> toJson() {
10697 Map<String, dynamic> result = {}; 10450 Map<String, dynamic> result = {};
10698 result["name"] = name; 10451 result["offset"] = offset;
10699 result["explicitFileCount"] = explicitFileCount; 10452 result["length"] = length;
10700 result["implicitFileCount"] = implicitFileCount; 10453 result["returnType"] = returnType;
10701 result["workItemQueueLength"] = workItemQueueLength; 10454 result["names"] = names;
10702 result["cacheEntryExceptions"] = cacheEntryExceptions; 10455 result["canCreateGetter"] = canCreateGetter;
10456 result["parameters"] = parameters
10457 .map((RefactoringMethodParameter value) => value.toJson())
10458 .toList();
10459 result["offsets"] = offsets;
10460 result["lengths"] = lengths;
10703 return result; 10461 return result;
10704 } 10462 }
10705 10463
10706 @override 10464 @override
10707 String toString() => JSON.encode(toJson()); 10465 String toString() => JSON.encode(toJson());
10708 10466
10709 @override 10467 @override
10710 bool operator ==(other) { 10468 bool operator ==(other) {
10711 if (other is ContextData) { 10469 if (other is ExtractMethodFeedback) {
10712 return name == other.name && 10470 return offset == other.offset &&
10713 explicitFileCount == other.explicitFileCount && 10471 length == other.length &&
10714 implicitFileCount == other.implicitFileCount && 10472 returnType == other.returnType &&
10715 workItemQueueLength == other.workItemQueueLength && 10473 listEqual(names, other.names, (String a, String b) => a == b) &&
10716 listEqual(cacheEntryExceptions, other.cacheEntryExceptions, 10474 canCreateGetter == other.canCreateGetter &&
10717 (String a, String b) => a == b); 10475 listEqual(
10476 parameters,
10477 other.parameters,
10478 (RefactoringMethodParameter a, RefactoringMethodParameter b) =>
10479 a == b) &&
10480 listEqual(offsets, other.offsets, (int a, int b) => a == b) &&
10481 listEqual(lengths, other.lengths, (int a, int b) => a == b);
10718 } 10482 }
10719 return false; 10483 return false;
10720 } 10484 }
10721 10485
10722 @override 10486 @override
10723 int get hashCode { 10487 int get hashCode {
10724 int hash = 0; 10488 int hash = 0;
10725 hash = JenkinsSmiHash.combine(hash, name.hashCode); 10489 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
10726 hash = JenkinsSmiHash.combine(hash, explicitFileCount.hashCode); 10490 hash = JenkinsSmiHash.combine(hash, length.hashCode);
10727 hash = JenkinsSmiHash.combine(hash, implicitFileCount.hashCode); 10491 hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
10728 hash = JenkinsSmiHash.combine(hash, workItemQueueLength.hashCode); 10492 hash = JenkinsSmiHash.combine(hash, names.hashCode);
10729 hash = JenkinsSmiHash.combine(hash, cacheEntryExceptions.hashCode); 10493 hash = JenkinsSmiHash.combine(hash, canCreateGetter.hashCode);
10494 hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
10495 hash = JenkinsSmiHash.combine(hash, offsets.hashCode);
10496 hash = JenkinsSmiHash.combine(hash, lengths.hashCode);
10730 return JenkinsSmiHash.finish(hash); 10497 return JenkinsSmiHash.finish(hash);
10731 } 10498 }
10732 } 10499 }
10733 10500
10734 /** 10501 /**
10735 * Element 10502 * extractMethod options
10736 * 10503 *
10737 * { 10504 * {
10738 * "kind": ElementKind 10505 * "returnType": String
10506 * "createGetter": bool
10739 * "name": String 10507 * "name": String
10740 * "location": optional Location 10508 * "parameters": List<RefactoringMethodParameter>
10741 * "flags": int 10509 * "extractAll": bool
10742 * "parameters": optional String
10743 * "returnType": optional String
10744 * "typeParameters": optional String
10745 * } 10510 * }
10746 * 10511 *
10747 * Clients may not extend, implement or mix-in this class. 10512 * Clients may not extend, implement or mix-in this class.
10748 */ 10513 */
10749 class Element implements HasToJson { 10514 class ExtractMethodOptions extends RefactoringOptions {
10750 static const int FLAG_ABSTRACT = 0x01; 10515 String _returnType;
10751 static const int FLAG_CONST = 0x02; 10516
10752 static const int FLAG_FINAL = 0x04; 10517 bool _createGetter;
10753 static const int FLAG_STATIC = 0x08;
10754 static const int FLAG_PRIVATE = 0x10;
10755 static const int FLAG_DEPRECATED = 0x20;
10756
10757 static int makeFlags(
10758 {isAbstract: false,
10759 isConst: false,
10760 isFinal: false,
10761 isStatic: false,
10762 isPrivate: false,
10763 isDeprecated: false}) {
10764 int flags = 0;
10765 if (isAbstract) flags |= FLAG_ABSTRACT;
10766 if (isConst) flags |= FLAG_CONST;
10767 if (isFinal) flags |= FLAG_FINAL;
10768 if (isStatic) flags |= FLAG_STATIC;
10769 if (isPrivate) flags |= FLAG_PRIVATE;
10770 if (isDeprecated) flags |= FLAG_DEPRECATED;
10771 return flags;
10772 }
10773
10774 ElementKind _kind;
10775 10518
10776 String _name; 10519 String _name;
10777 10520
10778 Location _location; 10521 List<RefactoringMethodParameter> _parameters;
10779 10522
10780 int _flags; 10523 bool _extractAll;
10781 10524
10782 String _parameters; 10525 /**
10783 10526 * The return type that should be defined for the method.
10784 String _returnType; 10527 */
10785 10528 String get returnType => _returnType;
10786 String _typeParameters; 10529
10787 10530 /**
10788 /** 10531 * The return type that should be defined for the method.
10789 * The kind of the element. 10532 */
10790 */ 10533 void set returnType(String value) {
10791 ElementKind get kind => _kind; 10534 assert(value != null);
10792 10535 this._returnType = value;
10793 /** 10536 }
10794 * The kind of the element. 10537
10795 */ 10538 /**
10796 void set kind(ElementKind value) { 10539 * True if a getter should be created rather than a method. It is an error if
10797 assert(value != null); 10540 * this field is true and the list of parameters is non-empty.
10798 this._kind = value; 10541 */
10799 } 10542 bool get createGetter => _createGetter;
10800 10543
10801 /** 10544 /**
10802 * The name of the element. This is typically used as the label in the 10545 * True if a getter should be created rather than a method. It is an error if
10803 * outline. 10546 * this field is true and the list of parameters is non-empty.
10547 */
10548 void set createGetter(bool value) {
10549 assert(value != null);
10550 this._createGetter = value;
10551 }
10552
10553 /**
10554 * The name that the method should be given.
10804 */ 10555 */
10805 String get name => _name; 10556 String get name => _name;
10806 10557
10807 /** 10558 /**
10808 * The name of the element. This is typically used as the label in the 10559 * The name that the method should be given.
10809 * outline.
10810 */ 10560 */
10811 void set name(String value) { 10561 void set name(String value) {
10812 assert(value != null); 10562 assert(value != null);
10813 this._name = value; 10563 this._name = value;
10814 } 10564 }
10815 10565
10816 /** 10566 /**
10817 * The location of the name in the declaration of the element. 10567 * The parameters that should be defined for the method.
10818 */ 10568 *
10819 Location get location => _location; 10569 * It is an error if a REQUIRED or NAMED parameter follows a POSITIONAL
10820 10570 * parameter. It is an error if a REQUIRED or POSITIONAL parameter follows a
10821 /** 10571 * NAMED parameter.
10822 * The location of the name in the declaration of the element. 10572 *
10823 */ 10573 * - To change the order and/or update proposed parameters, add parameters
10824 void set location(Location value) { 10574 * with the same identifiers as proposed.
10825 this._location = value; 10575 * - To add new parameters, omit their identifier.
10826 } 10576 * - To remove some parameters, omit them in this list.
10827 10577 */
10828 /** 10578 List<RefactoringMethodParameter> get parameters => _parameters;
10829 * A bit-map containing the following flags: 10579
10830 * 10580 /**
10831 * - 0x01 - set if the element is explicitly or implicitly abstract 10581 * The parameters that should be defined for the method.
10832 * - 0x02 - set if the element was declared to be ‘const’ 10582 *
10833 * - 0x04 - set if the element was declared to be ‘final’ 10583 * It is an error if a REQUIRED or NAMED parameter follows a POSITIONAL
10834 * - 0x08 - set if the element is a static member of a class or is a 10584 * parameter. It is an error if a REQUIRED or POSITIONAL parameter follows a
10835 * top-level function or field 10585 * NAMED parameter.
10836 * - 0x10 - set if the element is private 10586 *
10837 * - 0x20 - set if the element is deprecated 10587 * - To change the order and/or update proposed parameters, add parameters
10838 */ 10588 * with the same identifiers as proposed.
10839 int get flags => _flags; 10589 * - To add new parameters, omit their identifier.
10840 10590 * - To remove some parameters, omit them in this list.
10841 /** 10591 */
10842 * A bit-map containing the following flags: 10592 void set parameters(List<RefactoringMethodParameter> value) {
10843 * 10593 assert(value != null);
10844 * - 0x01 - set if the element is explicitly or implicitly abstract
10845 * - 0x02 - set if the element was declared to be ‘const’
10846 * - 0x04 - set if the element was declared to be ‘final’
10847 * - 0x08 - set if the element is a static member of a class or is a
10848 * top-level function or field
10849 * - 0x10 - set if the element is private
10850 * - 0x20 - set if the element is deprecated
10851 */
10852 void set flags(int value) {
10853 assert(value != null);
10854 this._flags = value;
10855 }
10856
10857 /**
10858 * The parameter list for the element. If the element is not a method or
10859 * function this field will not be defined. If the element doesn't have
10860 * parameters (e.g. getter), this field will not be defined. If the element
10861 * has zero parameters, this field will have a value of "()".
10862 */
10863 String get parameters => _parameters;
10864
10865 /**
10866 * The parameter list for the element. If the element is not a method or
10867 * function this field will not be defined. If the element doesn't have
10868 * parameters (e.g. getter), this field will not be defined. If the element
10869 * has zero parameters, this field will have a value of "()".
10870 */
10871 void set parameters(String value) {
10872 this._parameters = value; 10594 this._parameters = value;
10873 } 10595 }
10874 10596
10875 /** 10597 /**
10876 * The return type of the element. If the element is not a method or function 10598 * True if all occurrences of the expression or statements should be replaced
10877 * this field will not be defined. If the element does not have a declared 10599 * by an invocation of the method. The expression or statements used to
10878 * return type, this field will contain an empty string. 10600 * initiate the refactoring will always be replaced.
10879 */ 10601 */
10880 String get returnType => _returnType; 10602 bool get extractAll => _extractAll;
10881 10603
10882 /** 10604 /**
10883 * The return type of the element. If the element is not a method or function 10605 * True if all occurrences of the expression or statements should be replaced
10884 * this field will not be defined. If the element does not have a declared 10606 * by an invocation of the method. The expression or statements used to
10885 * return type, this field will contain an empty string. 10607 * initiate the refactoring will always be replaced.
10886 */ 10608 */
10887 void set returnType(String value) { 10609 void set extractAll(bool value) {
10888 this._returnType = value; 10610 assert(value != null);
10889 } 10611 this._extractAll = value;
10890 10612 }
10891 /** 10613
10892 * The type parameter list for the element. If the element doesn't have type 10614 ExtractMethodOptions(String returnType, bool createGetter, String name,
10893 * parameters, this field will not be defined. 10615 List<RefactoringMethodParameter> parameters, bool extractAll) {
10894 */ 10616 this.returnType = returnType;
10895 String get typeParameters => _typeParameters; 10617 this.createGetter = createGetter;
10896
10897 /**
10898 * The type parameter list for the element. If the element doesn't have type
10899 * parameters, this field will not be defined.
10900 */
10901 void set typeParameters(String value) {
10902 this._typeParameters = value;
10903 }
10904
10905 Element(ElementKind kind, String name, int flags,
10906 {Location location,
10907 String parameters,
10908 String returnType,
10909 String typeParameters}) {
10910 this.kind = kind;
10911 this.name = name; 10618 this.name = name;
10912 this.location = location;
10913 this.flags = flags;
10914 this.parameters = parameters; 10619 this.parameters = parameters;
10915 this.returnType = returnType; 10620 this.extractAll = extractAll;
10916 this.typeParameters = typeParameters; 10621 }
10917 } 10622
10918 10623 factory ExtractMethodOptions.fromJson(
10919 factory Element.fromJson(
10920 JsonDecoder jsonDecoder, String jsonPath, Object json) { 10624 JsonDecoder jsonDecoder, String jsonPath, Object json) {
10921 if (json == null) { 10625 if (json == null) {
10922 json = {}; 10626 json = {};
10923 } 10627 }
10924 if (json is Map) { 10628 if (json is Map) {
10925 ElementKind kind;
10926 if (json.containsKey("kind")) {
10927 kind = new ElementKind.fromJson(
10928 jsonDecoder, jsonPath + ".kind", json["kind"]);
10929 } else {
10930 throw jsonDecoder.missingKey(jsonPath, "kind");
10931 }
10932 String name;
10933 if (json.containsKey("name")) {
10934 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]);
10935 } else {
10936 throw jsonDecoder.missingKey(jsonPath, "name");
10937 }
10938 Location location;
10939 if (json.containsKey("location")) {
10940 location = new Location.fromJson(
10941 jsonDecoder, jsonPath + ".location", json["location"]);
10942 }
10943 int flags;
10944 if (json.containsKey("flags")) {
10945 flags = jsonDecoder.decodeInt(jsonPath + ".flags", json["flags"]);
10946 } else {
10947 throw jsonDecoder.missingKey(jsonPath, "flags");
10948 }
10949 String parameters;
10950 if (json.containsKey("parameters")) {
10951 parameters = jsonDecoder.decodeString(
10952 jsonPath + ".parameters", json["parameters"]);
10953 }
10954 String returnType; 10629 String returnType;
10955 if (json.containsKey("returnType")) { 10630 if (json.containsKey("returnType")) {
10956 returnType = jsonDecoder.decodeString( 10631 returnType = jsonDecoder.decodeString(
10957 jsonPath + ".returnType", json["returnType"]); 10632 jsonPath + ".returnType", json["returnType"]);
10958 } 10633 } else {
10959 String typeParameters; 10634 throw jsonDecoder.mismatch(jsonPath, "returnType");
10960 if (json.containsKey("typeParameters")) { 10635 }
10961 typeParameters = jsonDecoder.decodeString( 10636 bool createGetter;
10962 jsonPath + ".typeParameters", json["typeParameters"]); 10637 if (json.containsKey("createGetter")) {
10963 } 10638 createGetter = jsonDecoder.decodeBool(
10964 return new Element(kind, name, flags, 10639 jsonPath + ".createGetter", json["createGetter"]);
10965 location: location, 10640 } else {
10966 parameters: parameters, 10641 throw jsonDecoder.mismatch(jsonPath, "createGetter");
10967 returnType: returnType, 10642 }
10968 typeParameters: typeParameters); 10643 String name;
10644 if (json.containsKey("name")) {
10645 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]);
10646 } else {
10647 throw jsonDecoder.mismatch(jsonPath, "name");
10648 }
10649 List<RefactoringMethodParameter> parameters;
10650 if (json.containsKey("parameters")) {
10651 parameters = jsonDecoder.decodeList(
10652 jsonPath + ".parameters",
10653 json["parameters"],
10654 (String jsonPath, Object json) =>
10655 new RefactoringMethodParameter.fromJson(
10656 jsonDecoder, jsonPath, json));
10657 } else {
10658 throw jsonDecoder.mismatch(jsonPath, "parameters");
10659 }
10660 bool extractAll;
10661 if (json.containsKey("extractAll")) {
10662 extractAll = jsonDecoder.decodeBool(
10663 jsonPath + ".extractAll", json["extractAll"]);
10664 } else {
10665 throw jsonDecoder.mismatch(jsonPath, "extractAll");
10666 }
10667 return new ExtractMethodOptions(
10668 returnType, createGetter, name, parameters, extractAll);
10969 } else { 10669 } else {
10970 throw jsonDecoder.mismatch(jsonPath, "Element", json); 10670 throw jsonDecoder.mismatch(jsonPath, "extractMethod options", json);
10971 } 10671 }
10972 } 10672 }
10973 10673
10974 bool get isAbstract => (flags & FLAG_ABSTRACT) != 0; 10674 factory ExtractMethodOptions.fromRefactoringParams(
10975 bool get isConst => (flags & FLAG_CONST) != 0; 10675 EditGetRefactoringParams refactoringParams, Request request) {
10976 bool get isFinal => (flags & FLAG_FINAL) != 0; 10676 return new ExtractMethodOptions.fromJson(
10977 bool get isStatic => (flags & FLAG_STATIC) != 0; 10677 new RequestDecoder(request), "options", refactoringParams.options);
10978 bool get isPrivate => (flags & FLAG_PRIVATE) != 0; 10678 }
10979 bool get isDeprecated => (flags & FLAG_DEPRECATED) != 0; 10679
10980 10680 @override
10981 Map<String, dynamic> toJson() { 10681 Map<String, dynamic> toJson() {
10982 Map<String, dynamic> result = {}; 10682 Map<String, dynamic> result = {};
10983 result["kind"] = kind.toJson(); 10683 result["returnType"] = returnType;
10684 result["createGetter"] = createGetter;
10984 result["name"] = name; 10685 result["name"] = name;
10985 if (location != null) { 10686 result["parameters"] = parameters
10986 result["location"] = location.toJson(); 10687 .map((RefactoringMethodParameter value) => value.toJson())
10987 } 10688 .toList();
10988 result["flags"] = flags; 10689 result["extractAll"] = extractAll;
10989 if (parameters != null) {
10990 result["parameters"] = parameters;
10991 }
10992 if (returnType != null) {
10993 result["returnType"] = returnType;
10994 }
10995 if (typeParameters != null) {
10996 result["typeParameters"] = typeParameters;
10997 }
10998 return result; 10690 return result;
10999 } 10691 }
11000 10692
11001 @override 10693 @override
11002 String toString() => JSON.encode(toJson()); 10694 String toString() => JSON.encode(toJson());
11003 10695
11004 @override 10696 @override
11005 bool operator ==(other) { 10697 bool operator ==(other) {
11006 if (other is Element) { 10698 if (other is ExtractMethodOptions) {
11007 return kind == other.kind && 10699 return returnType == other.returnType &&
10700 createGetter == other.createGetter &&
11008 name == other.name && 10701 name == other.name &&
11009 location == other.location && 10702 listEqual(
11010 flags == other.flags && 10703 parameters,
11011 parameters == other.parameters && 10704 other.parameters,
11012 returnType == other.returnType && 10705 (RefactoringMethodParameter a, RefactoringMethodParameter b) =>
11013 typeParameters == other.typeParameters; 10706 a == b) &&
10707 extractAll == other.extractAll;
11014 } 10708 }
11015 return false; 10709 return false;
11016 } 10710 }
11017 10711
11018 @override 10712 @override
11019 int get hashCode { 10713 int get hashCode {
11020 int hash = 0; 10714 int hash = 0;
11021 hash = JenkinsSmiHash.combine(hash, kind.hashCode); 10715 hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
10716 hash = JenkinsSmiHash.combine(hash, createGetter.hashCode);
11022 hash = JenkinsSmiHash.combine(hash, name.hashCode); 10717 hash = JenkinsSmiHash.combine(hash, name.hashCode);
11023 hash = JenkinsSmiHash.combine(hash, location.hashCode);
11024 hash = JenkinsSmiHash.combine(hash, flags.hashCode);
11025 hash = JenkinsSmiHash.combine(hash, parameters.hashCode); 10718 hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
11026 hash = JenkinsSmiHash.combine(hash, returnType.hashCode); 10719 hash = JenkinsSmiHash.combine(hash, extractAll.hashCode);
11027 hash = JenkinsSmiHash.combine(hash, typeParameters.hashCode);
11028 return JenkinsSmiHash.finish(hash); 10720 return JenkinsSmiHash.finish(hash);
11029 } 10721 }
11030 } 10722 }
11031 10723
11032 /** 10724 /**
11033 * ElementKind 10725 * FileKind
11034 * 10726 *
11035 * enum { 10727 * enum {
11036 * CLASS
11037 * CLASS_TYPE_ALIAS
11038 * COMPILATION_UNIT
11039 * CONSTRUCTOR
11040 * ENUM
11041 * ENUM_CONSTANT
11042 * FIELD
11043 * FILE
11044 * FUNCTION
11045 * FUNCTION_TYPE_ALIAS
11046 * GETTER
11047 * LABEL
11048 * LIBRARY 10728 * LIBRARY
11049 * LOCAL_VARIABLE 10729 * PART
11050 * METHOD
11051 * PARAMETER
11052 * PREFIX
11053 * SETTER
11054 * TOP_LEVEL_VARIABLE
11055 * TYPE_PARAMETER
11056 * UNIT_TEST_GROUP
11057 * UNIT_TEST_TEST
11058 * UNKNOWN
11059 * } 10730 * }
11060 * 10731 *
11061 * Clients may not extend, implement or mix-in this class. 10732 * Clients may not extend, implement or mix-in this class.
11062 */ 10733 */
11063 class ElementKind implements Enum { 10734 class FileKind implements Enum {
11064 static const ElementKind CLASS = const ElementKind._("CLASS"); 10735 static const FileKind LIBRARY = const FileKind._("LIBRARY");
11065 10736
11066 static const ElementKind CLASS_TYPE_ALIAS = 10737 static const FileKind PART = const FileKind._("PART");
11067 const ElementKind._("CLASS_TYPE_ALIAS");
11068
11069 static const ElementKind COMPILATION_UNIT =
11070 const ElementKind._("COMPILATION_UNIT");
11071
11072 static const ElementKind CONSTRUCTOR = const ElementKind._("CONSTRUCTOR");
11073
11074 static const ElementKind ENUM = const ElementKind._("ENUM");
11075
11076 static const ElementKind ENUM_CONSTANT = const ElementKind._("ENUM_CONSTANT");
11077
11078 static const ElementKind FIELD = const ElementKind._("FIELD");
11079
11080 static const ElementKind FILE = const ElementKind._("FILE");
11081
11082 static const ElementKind FUNCTION = const ElementKind._("FUNCTION");
11083
11084 static const ElementKind FUNCTION_TYPE_ALIAS =
11085 const ElementKind._("FUNCTION_TYPE_ALIAS");
11086
11087 static const ElementKind GETTER = const ElementKind._("GETTER");
11088
11089 static const ElementKind LABEL = const ElementKind._("LABEL");
11090
11091 static const ElementKind LIBRARY = const ElementKind._("LIBRARY");
11092
11093 static const ElementKind LOCAL_VARIABLE =
11094 const ElementKind._("LOCAL_VARIABLE");
11095
11096 static const ElementKind METHOD = const ElementKind._("METHOD");
11097
11098 static const ElementKind PARAMETER = const ElementKind._("PARAMETER");
11099
11100 static const ElementKind PREFIX = const ElementKind._("PREFIX");
11101
11102 static const ElementKind SETTER = const ElementKind._("SETTER");
11103
11104 static const ElementKind TOP_LEVEL_VARIABLE =
11105 const ElementKind._("TOP_LEVEL_VARIABLE");
11106
11107 static const ElementKind TYPE_PARAMETER =
11108 const ElementKind._("TYPE_PARAMETER");
11109
11110 /**
11111 * Deprecated: support for tests was removed.
11112 */
11113 static const ElementKind UNIT_TEST_GROUP =
11114 const ElementKind._("UNIT_TEST_GROUP");
11115
11116 /**
11117 * Deprecated: support for tests was removed.
11118 */
11119 static const ElementKind UNIT_TEST_TEST =
11120 const ElementKind._("UNIT_TEST_TEST");
11121
11122 static const ElementKind UNKNOWN = const ElementKind._("UNKNOWN");
11123 10738
11124 /** 10739 /**
11125 * A list containing all of the enum values that are defined. 10740 * A list containing all of the enum values that are defined.
11126 */ 10741 */
11127 static const List<ElementKind> VALUES = const <ElementKind>[ 10742 static const List<FileKind> VALUES = const <FileKind>[LIBRARY, PART];
11128 CLASS, 10743
11129 CLASS_TYPE_ALIAS, 10744 @override
11130 COMPILATION_UNIT,
11131 CONSTRUCTOR,
11132 ENUM,
11133 ENUM_CONSTANT,
11134 FIELD,
11135 FILE,
11136 FUNCTION,
11137 FUNCTION_TYPE_ALIAS,
11138 GETTER,
11139 LABEL,
11140 LIBRARY,
11141 LOCAL_VARIABLE,
11142 METHOD,
11143 PARAMETER,
11144 PREFIX,
11145 SETTER,
11146 TOP_LEVEL_VARIABLE,
11147 TYPE_PARAMETER,
11148 UNIT_TEST_GROUP,
11149 UNIT_TEST_TEST,
11150 UNKNOWN
11151 ];
11152
11153 final String name; 10745 final String name;
11154 10746
11155 const ElementKind._(this.name); 10747 const FileKind._(this.name);
11156 10748
11157 factory ElementKind(String name) { 10749 factory FileKind(String name) {
11158 switch (name) { 10750 switch (name) {
11159 case "CLASS":
11160 return CLASS;
11161 case "CLASS_TYPE_ALIAS":
11162 return CLASS_TYPE_ALIAS;
11163 case "COMPILATION_UNIT":
11164 return COMPILATION_UNIT;
11165 case "CONSTRUCTOR":
11166 return CONSTRUCTOR;
11167 case "ENUM":
11168 return ENUM;
11169 case "ENUM_CONSTANT":
11170 return ENUM_CONSTANT;
11171 case "FIELD":
11172 return FIELD;
11173 case "FILE":
11174 return FILE;
11175 case "FUNCTION":
11176 return FUNCTION;
11177 case "FUNCTION_TYPE_ALIAS":
11178 return FUNCTION_TYPE_ALIAS;
11179 case "GETTER":
11180 return GETTER;
11181 case "LABEL":
11182 return LABEL;
11183 case "LIBRARY": 10751 case "LIBRARY":
11184 return LIBRARY; 10752 return LIBRARY;
11185 case "LOCAL_VARIABLE": 10753 case "PART":
11186 return LOCAL_VARIABLE; 10754 return PART;
11187 case "METHOD":
11188 return METHOD;
11189 case "PARAMETER":
11190 return PARAMETER;
11191 case "PREFIX":
11192 return PREFIX;
11193 case "SETTER":
11194 return SETTER;
11195 case "TOP_LEVEL_VARIABLE":
11196 return TOP_LEVEL_VARIABLE;
11197 case "TYPE_PARAMETER":
11198 return TYPE_PARAMETER;
11199 case "UNIT_TEST_GROUP":
11200 return UNIT_TEST_GROUP;
11201 case "UNIT_TEST_TEST":
11202 return UNIT_TEST_TEST;
11203 case "UNKNOWN":
11204 return UNKNOWN;
11205 } 10755 }
11206 throw new Exception('Illegal enum value: $name'); 10756 throw new Exception('Illegal enum value: $name');
11207 } 10757 }
11208 10758
11209 factory ElementKind.fromJson( 10759 factory FileKind.fromJson(
11210 JsonDecoder jsonDecoder, String jsonPath, Object json) { 10760 JsonDecoder jsonDecoder, String jsonPath, Object json) {
11211 if (json is String) { 10761 if (json is String) {
11212 try { 10762 try {
11213 return new ElementKind(json); 10763 return new FileKind(json);
11214 } catch (_) { 10764 } catch (_) {
11215 // Fall through 10765 // Fall through
11216 } 10766 }
11217 } 10767 }
11218 throw jsonDecoder.mismatch(jsonPath, "ElementKind", json); 10768 throw jsonDecoder.mismatch(jsonPath, "FileKind", json);
11219 } 10769 }
11220 10770
11221 @override 10771 @override
11222 String toString() => "ElementKind.$name"; 10772 String toString() => "FileKind.$name";
11223 10773
11224 String toJson() => name; 10774 String toJson() => name;
11225 } 10775 }
11226 10776
11227 /** 10777 /**
11228 * ExecutableFile 10778 * FoldingKind
11229 * 10779 *
11230 * { 10780 * enum {
11231 * "file": FilePath 10781 * COMMENT
11232 * "kind": ExecutableKind 10782 * CLASS_MEMBER
10783 * DIRECTIVES
10784 * DOCUMENTATION_COMMENT
10785 * TOP_LEVEL_DECLARATION
11233 * } 10786 * }
11234 * 10787 *
11235 * Clients may not extend, implement or mix-in this class. 10788 * Clients may not extend, implement or mix-in this class.
11236 */ 10789 */
11237 class ExecutableFile implements HasToJson { 10790 class FoldingKind implements Enum {
11238 String _file; 10791 static const FoldingKind COMMENT = const FoldingKind._("COMMENT");
11239 10792
11240 ExecutableKind _kind; 10793 static const FoldingKind CLASS_MEMBER = const FoldingKind._("CLASS_MEMBER");
11241 10794
11242 /** 10795 static const FoldingKind DIRECTIVES = const FoldingKind._("DIRECTIVES");
11243 * The path of the executable file. 10796
11244 */ 10797 static const FoldingKind DOCUMENTATION_COMMENT =
11245 String get file => _file; 10798 const FoldingKind._("DOCUMENTATION_COMMENT");
11246 10799
11247 /** 10800 static const FoldingKind TOP_LEVEL_DECLARATION =
11248 * The path of the executable file. 10801 const FoldingKind._("TOP_LEVEL_DECLARATION");
11249 */ 10802
11250 void set file(String value) { 10803 /**
11251 assert(value != null); 10804 * A list containing all of the enum values that are defined.
11252 this._file = value; 10805 */
11253 } 10806 static const List<FoldingKind> VALUES = const <FoldingKind>[
11254 10807 COMMENT,
11255 /** 10808 CLASS_MEMBER,
11256 * The kind of the executable file. 10809 DIRECTIVES,
11257 */ 10810 DOCUMENTATION_COMMENT,
11258 ExecutableKind get kind => _kind; 10811 TOP_LEVEL_DECLARATION
11259 10812 ];
11260 /** 10813
11261 * The kind of the executable file. 10814 @override
11262 */ 10815 final String name;
11263 void set kind(ExecutableKind value) { 10816
10817 const FoldingKind._(this.name);
10818
10819 factory FoldingKind(String name) {
10820 switch (name) {
10821 case "COMMENT":
10822 return COMMENT;
10823 case "CLASS_MEMBER":
10824 return CLASS_MEMBER;
10825 case "DIRECTIVES":
10826 return DIRECTIVES;
10827 case "DOCUMENTATION_COMMENT":
10828 return DOCUMENTATION_COMMENT;
10829 case "TOP_LEVEL_DECLARATION":
10830 return TOP_LEVEL_DECLARATION;
10831 }
10832 throw new Exception('Illegal enum value: $name');
10833 }
10834
10835 factory FoldingKind.fromJson(
10836 JsonDecoder jsonDecoder, String jsonPath, Object json) {
10837 if (json is String) {
10838 try {
10839 return new FoldingKind(json);
10840 } catch (_) {
10841 // Fall through
10842 }
10843 }
10844 throw jsonDecoder.mismatch(jsonPath, "FoldingKind", json);
10845 }
10846
10847 @override
10848 String toString() => "FoldingKind.$name";
10849
10850 String toJson() => name;
10851 }
10852
10853 /**
10854 * FoldingRegion
10855 *
10856 * {
10857 * "kind": FoldingKind
10858 * "offset": int
10859 * "length": int
10860 * }
10861 *
10862 * Clients may not extend, implement or mix-in this class.
10863 */
10864 class FoldingRegion implements HasToJson {
10865 FoldingKind _kind;
10866
10867 int _offset;
10868
10869 int _length;
10870
10871 /**
10872 * The kind of the region.
10873 */
10874 FoldingKind get kind => _kind;
10875
10876 /**
10877 * The kind of the region.
10878 */
10879 void set kind(FoldingKind value) {
11264 assert(value != null); 10880 assert(value != null);
11265 this._kind = value; 10881 this._kind = value;
11266 } 10882 }
11267 10883
11268 ExecutableFile(String file, ExecutableKind kind) { 10884 /**
11269 this.file = file; 10885 * The offset of the region to be folded.
10886 */
10887 int get offset => _offset;
10888
10889 /**
10890 * The offset of the region to be folded.
10891 */
10892 void set offset(int value) {
10893 assert(value != null);
10894 this._offset = value;
10895 }
10896
10897 /**
10898 * The length of the region to be folded.
10899 */
10900 int get length => _length;
10901
10902 /**
10903 * The length of the region to be folded.
10904 */
10905 void set length(int value) {
10906 assert(value != null);
10907 this._length = value;
10908 }
10909
10910 FoldingRegion(FoldingKind kind, int offset, int length) {
11270 this.kind = kind; 10911 this.kind = kind;
11271 } 10912 this.offset = offset;
11272 10913 this.length = length;
11273 factory ExecutableFile.fromJson( 10914 }
10915
10916 factory FoldingRegion.fromJson(
11274 JsonDecoder jsonDecoder, String jsonPath, Object json) { 10917 JsonDecoder jsonDecoder, String jsonPath, Object json) {
11275 if (json == null) { 10918 if (json == null) {
11276 json = {}; 10919 json = {};
11277 } 10920 }
11278 if (json is Map) { 10921 if (json is Map) {
11279 String file; 10922 FoldingKind kind;
11280 if (json.containsKey("file")) {
11281 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
11282 } else {
11283 throw jsonDecoder.missingKey(jsonPath, "file");
11284 }
11285 ExecutableKind kind;
11286 if (json.containsKey("kind")) { 10923 if (json.containsKey("kind")) {
11287 kind = new ExecutableKind.fromJson( 10924 kind = new FoldingKind.fromJson(
11288 jsonDecoder, jsonPath + ".kind", json["kind"]); 10925 jsonDecoder, jsonPath + ".kind", json["kind"]);
11289 } else { 10926 } else {
11290 throw jsonDecoder.missingKey(jsonPath, "kind"); 10927 throw jsonDecoder.mismatch(jsonPath, "kind");
11291 } 10928 }
11292 return new ExecutableFile(file, kind); 10929 int offset;
10930 if (json.containsKey("offset")) {
10931 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
10932 } else {
10933 throw jsonDecoder.mismatch(jsonPath, "offset");
10934 }
10935 int length;
10936 if (json.containsKey("length")) {
10937 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
10938 } else {
10939 throw jsonDecoder.mismatch(jsonPath, "length");
10940 }
10941 return new FoldingRegion(kind, offset, length);
11293 } else { 10942 } else {
11294 throw jsonDecoder.mismatch(jsonPath, "ExecutableFile", json); 10943 throw jsonDecoder.mismatch(jsonPath, "FoldingRegion", json);
11295 } 10944 }
11296 } 10945 }
11297 10946
10947 @override
11298 Map<String, dynamic> toJson() { 10948 Map<String, dynamic> toJson() {
11299 Map<String, dynamic> result = {}; 10949 Map<String, dynamic> result = {};
11300 result["file"] = file;
11301 result["kind"] = kind.toJson(); 10950 result["kind"] = kind.toJson();
10951 result["offset"] = offset;
10952 result["length"] = length;
11302 return result; 10953 return result;
11303 } 10954 }
11304 10955
11305 @override 10956 @override
11306 String toString() => JSON.encode(toJson()); 10957 String toString() => JSON.encode(toJson());
11307 10958
11308 @override 10959 @override
11309 bool operator ==(other) { 10960 bool operator ==(other) {
11310 if (other is ExecutableFile) { 10961 if (other is FoldingRegion) {
11311 return file == other.file && kind == other.kind; 10962 return kind == other.kind &&
10963 offset == other.offset &&
10964 length == other.length;
11312 } 10965 }
11313 return false; 10966 return false;
11314 } 10967 }
11315 10968
11316 @override 10969 @override
11317 int get hashCode { 10970 int get hashCode {
11318 int hash = 0; 10971 int hash = 0;
11319 hash = JenkinsSmiHash.combine(hash, file.hashCode);
11320 hash = JenkinsSmiHash.combine(hash, kind.hashCode); 10972 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
10973 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
10974 hash = JenkinsSmiHash.combine(hash, length.hashCode);
11321 return JenkinsSmiHash.finish(hash); 10975 return JenkinsSmiHash.finish(hash);
11322 } 10976 }
11323 } 10977 }
11324 10978
11325 /** 10979 /**
11326 * ExecutableKind 10980 * GeneralAnalysisService
11327 * 10981 *
11328 * enum { 10982 * enum {
11329 * CLIENT 10983 * ANALYZED_FILES
11330 * EITHER
11331 * NOT_EXECUTABLE
11332 * SERVER
11333 * } 10984 * }
11334 * 10985 *
11335 * Clients may not extend, implement or mix-in this class. 10986 * Clients may not extend, implement or mix-in this class.
11336 */ 10987 */
11337 class ExecutableKind implements Enum { 10988 class GeneralAnalysisService implements Enum {
11338 static const ExecutableKind CLIENT = const ExecutableKind._("CLIENT"); 10989 static const GeneralAnalysisService ANALYZED_FILES =
11339 10990 const GeneralAnalysisService._("ANALYZED_FILES");
11340 static const ExecutableKind EITHER = const ExecutableKind._("EITHER");
11341
11342 static const ExecutableKind NOT_EXECUTABLE =
11343 const ExecutableKind._("NOT_EXECUTABLE");
11344
11345 static const ExecutableKind SERVER = const ExecutableKind._("SERVER");
11346 10991
11347 /** 10992 /**
11348 * A list containing all of the enum values that are defined. 10993 * A list containing all of the enum values that are defined.
11349 */ 10994 */
11350 static const List<ExecutableKind> VALUES = const <ExecutableKind>[ 10995 static const List<GeneralAnalysisService> VALUES =
11351 CLIENT, 10996 const <GeneralAnalysisService>[ANALYZED_FILES];
11352 EITHER,
11353 NOT_EXECUTABLE,
11354 SERVER
11355 ];
11356 10997
10998 @override
11357 final String name; 10999 final String name;
11358 11000
11359 const ExecutableKind._(this.name); 11001 const GeneralAnalysisService._(this.name);
11360 11002
11361 factory ExecutableKind(String name) { 11003 factory GeneralAnalysisService(String name) {
11362 switch (name) { 11004 switch (name) {
11363 case "CLIENT": 11005 case "ANALYZED_FILES":
11364 return CLIENT; 11006 return ANALYZED_FILES;
11365 case "EITHER":
11366 return EITHER;
11367 case "NOT_EXECUTABLE":
11368 return NOT_EXECUTABLE;
11369 case "SERVER":
11370 return SERVER;
11371 } 11007 }
11372 throw new Exception('Illegal enum value: $name'); 11008 throw new Exception('Illegal enum value: $name');
11373 } 11009 }
11374 11010
11375 factory ExecutableKind.fromJson( 11011 factory GeneralAnalysisService.fromJson(
11376 JsonDecoder jsonDecoder, String jsonPath, Object json) { 11012 JsonDecoder jsonDecoder, String jsonPath, Object json) {
11377 if (json is String) { 11013 if (json is String) {
11378 try { 11014 try {
11379 return new ExecutableKind(json); 11015 return new GeneralAnalysisService(json);
11380 } catch (_) { 11016 } catch (_) {
11381 // Fall through 11017 // Fall through
11382 } 11018 }
11383 } 11019 }
11384 throw jsonDecoder.mismatch(jsonPath, "ExecutableKind", json); 11020 throw jsonDecoder.mismatch(jsonPath, "GeneralAnalysisService", json);
11385 } 11021 }
11386 11022
11387 @override 11023 @override
11388 String toString() => "ExecutableKind.$name"; 11024 String toString() => "GeneralAnalysisService.$name";
11389 11025
11390 String toJson() => name; 11026 String toJson() => name;
11391 } 11027 }
11392 11028
11393 /** 11029 /**
11394 * ExecutionService 11030 * HighlightRegion
11395 *
11396 * enum {
11397 * LAUNCH_DATA
11398 * }
11399 *
11400 * Clients may not extend, implement or mix-in this class.
11401 */
11402 class ExecutionService implements Enum {
11403 static const ExecutionService LAUNCH_DATA =
11404 const ExecutionService._("LAUNCH_DATA");
11405
11406 /**
11407 * A list containing all of the enum values that are defined.
11408 */
11409 static const List<ExecutionService> VALUES = const <ExecutionService>[
11410 LAUNCH_DATA
11411 ];
11412
11413 final String name;
11414
11415 const ExecutionService._(this.name);
11416
11417 factory ExecutionService(String name) {
11418 switch (name) {
11419 case "LAUNCH_DATA":
11420 return LAUNCH_DATA;
11421 }
11422 throw new Exception('Illegal enum value: $name');
11423 }
11424
11425 factory ExecutionService.fromJson(
11426 JsonDecoder jsonDecoder, String jsonPath, Object json) {
11427 if (json is String) {
11428 try {
11429 return new ExecutionService(json);
11430 } catch (_) {
11431 // Fall through
11432 }
11433 }
11434 throw jsonDecoder.mismatch(jsonPath, "ExecutionService", json);
11435 }
11436
11437 @override
11438 String toString() => "ExecutionService.$name";
11439
11440 String toJson() => name;
11441 }
11442
11443 /**
11444 * FileKind
11445 *
11446 * enum {
11447 * LIBRARY
11448 * PART
11449 * }
11450 *
11451 * Clients may not extend, implement or mix-in this class.
11452 */
11453 class FileKind implements Enum {
11454 static const FileKind LIBRARY = const FileKind._("LIBRARY");
11455
11456 static const FileKind PART = const FileKind._("PART");
11457
11458 /**
11459 * A list containing all of the enum values that are defined.
11460 */
11461 static const List<FileKind> VALUES = const <FileKind>[LIBRARY, PART];
11462
11463 final String name;
11464
11465 const FileKind._(this.name);
11466
11467 factory FileKind(String name) {
11468 switch (name) {
11469 case "LIBRARY":
11470 return LIBRARY;
11471 case "PART":
11472 return PART;
11473 }
11474 throw new Exception('Illegal enum value: $name');
11475 }
11476
11477 factory FileKind.fromJson(
11478 JsonDecoder jsonDecoder, String jsonPath, Object json) {
11479 if (json is String) {
11480 try {
11481 return new FileKind(json);
11482 } catch (_) {
11483 // Fall through
11484 }
11485 }
11486 throw jsonDecoder.mismatch(jsonPath, "FileKind", json);
11487 }
11488
11489 @override
11490 String toString() => "FileKind.$name";
11491
11492 String toJson() => name;
11493 }
11494
11495 /**
11496 * FoldingKind
11497 *
11498 * enum {
11499 * COMMENT
11500 * CLASS_MEMBER
11501 * DIRECTIVES
11502 * DOCUMENTATION_COMMENT
11503 * TOP_LEVEL_DECLARATION
11504 * }
11505 *
11506 * Clients may not extend, implement or mix-in this class.
11507 */
11508 class FoldingKind implements Enum {
11509 static const FoldingKind COMMENT = const FoldingKind._("COMMENT");
11510
11511 static const FoldingKind CLASS_MEMBER = const FoldingKind._("CLASS_MEMBER");
11512
11513 static const FoldingKind DIRECTIVES = const FoldingKind._("DIRECTIVES");
11514
11515 static const FoldingKind DOCUMENTATION_COMMENT =
11516 const FoldingKind._("DOCUMENTATION_COMMENT");
11517
11518 static const FoldingKind TOP_LEVEL_DECLARATION =
11519 const FoldingKind._("TOP_LEVEL_DECLARATION");
11520
11521 /**
11522 * A list containing all of the enum values that are defined.
11523 */
11524 static const List<FoldingKind> VALUES = const <FoldingKind>[
11525 COMMENT,
11526 CLASS_MEMBER,
11527 DIRECTIVES,
11528 DOCUMENTATION_COMMENT,
11529 TOP_LEVEL_DECLARATION
11530 ];
11531
11532 final String name;
11533
11534 const FoldingKind._(this.name);
11535
11536 factory FoldingKind(String name) {
11537 switch (name) {
11538 case "COMMENT":
11539 return COMMENT;
11540 case "CLASS_MEMBER":
11541 return CLASS_MEMBER;
11542 case "DIRECTIVES":
11543 return DIRECTIVES;
11544 case "DOCUMENTATION_COMMENT":
11545 return DOCUMENTATION_COMMENT;
11546 case "TOP_LEVEL_DECLARATION":
11547 return TOP_LEVEL_DECLARATION;
11548 }
11549 throw new Exception('Illegal enum value: $name');
11550 }
11551
11552 factory FoldingKind.fromJson(
11553 JsonDecoder jsonDecoder, String jsonPath, Object json) {
11554 if (json is String) {
11555 try {
11556 return new FoldingKind(json);
11557 } catch (_) {
11558 // Fall through
11559 }
11560 }
11561 throw jsonDecoder.mismatch(jsonPath, "FoldingKind", json);
11562 }
11563
11564 @override
11565 String toString() => "FoldingKind.$name";
11566
11567 String toJson() => name;
11568 }
11569
11570 /**
11571 * FoldingRegion
11572 * 11031 *
11573 * { 11032 * {
11574 * "kind": FoldingKind 11033 * "type": HighlightRegionType
11575 * "offset": int 11034 * "offset": int
11576 * "length": int 11035 * "length": int
11577 * } 11036 * }
11578 * 11037 *
11579 * Clients may not extend, implement or mix-in this class. 11038 * Clients may not extend, implement or mix-in this class.
11580 */ 11039 */
11581 class FoldingRegion implements HasToJson { 11040 class HighlightRegion implements HasToJson {
11582 FoldingKind _kind; 11041 HighlightRegionType _type;
11583 11042
11584 int _offset; 11043 int _offset;
11585 11044
11586 int _length; 11045 int _length;
11587 11046
11588 /** 11047 /**
11589 * The kind of the region. 11048 * The type of highlight associated with the region.
11590 */ 11049 */
11591 FoldingKind get kind => _kind; 11050 HighlightRegionType get type => _type;
11592 11051
11593 /** 11052 /**
11594 * The kind of the region. 11053 * The type of highlight associated with the region.
11595 */ 11054 */
11596 void set kind(FoldingKind value) { 11055 void set type(HighlightRegionType value) {
11597 assert(value != null); 11056 assert(value != null);
11598 this._kind = value; 11057 this._type = value;
11599 } 11058 }
11600 11059
11601 /** 11060 /**
11602 * The offset of the region to be folded. 11061 * The offset of the region to be highlighted.
11603 */ 11062 */
11604 int get offset => _offset; 11063 int get offset => _offset;
11605 11064
11606 /** 11065 /**
11607 * The offset of the region to be folded. 11066 * The offset of the region to be highlighted.
11608 */ 11067 */
11609 void set offset(int value) { 11068 void set offset(int value) {
11610 assert(value != null); 11069 assert(value != null);
11611 this._offset = value; 11070 this._offset = value;
11612 } 11071 }
11613 11072
11614 /** 11073 /**
11615 * The length of the region to be folded. 11074 * The length of the region to be highlighted.
11616 */ 11075 */
11617 int get length => _length; 11076 int get length => _length;
11618 11077
11619 /** 11078 /**
11620 * The length of the region to be folded. 11079 * The length of the region to be highlighted.
11621 */ 11080 */
11622 void set length(int value) { 11081 void set length(int value) {
11623 assert(value != null); 11082 assert(value != null);
11624 this._length = value; 11083 this._length = value;
11625 } 11084 }
11626 11085
11627 FoldingRegion(FoldingKind kind, int offset, int length) { 11086 HighlightRegion(HighlightRegionType type, int offset, int length) {
11628 this.kind = kind; 11087 this.type = type;
11629 this.offset = offset; 11088 this.offset = offset;
11630 this.length = length; 11089 this.length = length;
11631 } 11090 }
11632 11091
11633 factory FoldingRegion.fromJson( 11092 factory HighlightRegion.fromJson(
11634 JsonDecoder jsonDecoder, String jsonPath, Object json) { 11093 JsonDecoder jsonDecoder, String jsonPath, Object json) {
11635 if (json == null) { 11094 if (json == null) {
11636 json = {}; 11095 json = {};
11637 } 11096 }
11638 if (json is Map) { 11097 if (json is Map) {
11639 FoldingKind kind; 11098 HighlightRegionType type;
11640 if (json.containsKey("kind")) { 11099 if (json.containsKey("type")) {
11641 kind = new FoldingKind.fromJson( 11100 type = new HighlightRegionType.fromJson(
11642 jsonDecoder, jsonPath + ".kind", json["kind"]); 11101 jsonDecoder, jsonPath + ".type", json["type"]);
11643 } else { 11102 } else {
11644 throw jsonDecoder.missingKey(jsonPath, "kind"); 11103 throw jsonDecoder.mismatch(jsonPath, "type");
11645 } 11104 }
11646 int offset; 11105 int offset;
11647 if (json.containsKey("offset")) { 11106 if (json.containsKey("offset")) {
11648 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 11107 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
11649 } else { 11108 } else {
11650 throw jsonDecoder.missingKey(jsonPath, "offset"); 11109 throw jsonDecoder.mismatch(jsonPath, "offset");
11651 } 11110 }
11652 int length; 11111 int length;
11653 if (json.containsKey("length")) { 11112 if (json.containsKey("length")) {
11654 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); 11113 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
11655 } else { 11114 } else {
11656 throw jsonDecoder.missingKey(jsonPath, "length"); 11115 throw jsonDecoder.mismatch(jsonPath, "length");
11657 } 11116 }
11658 return new FoldingRegion(kind, offset, length); 11117 return new HighlightRegion(type, offset, length);
11659 } else { 11118 } else {
11660 throw jsonDecoder.mismatch(jsonPath, "FoldingRegion", json); 11119 throw jsonDecoder.mismatch(jsonPath, "HighlightRegion", json);
11661 } 11120 }
11662 } 11121 }
11663 11122
11123 @override
11664 Map<String, dynamic> toJson() { 11124 Map<String, dynamic> toJson() {
11665 Map<String, dynamic> result = {}; 11125 Map<String, dynamic> result = {};
11666 result["kind"] = kind.toJson(); 11126 result["type"] = type.toJson();
11667 result["offset"] = offset; 11127 result["offset"] = offset;
11668 result["length"] = length; 11128 result["length"] = length;
11669 return result; 11129 return result;
11670 } 11130 }
11671 11131
11672 @override 11132 @override
11673 String toString() => JSON.encode(toJson()); 11133 String toString() => JSON.encode(toJson());
11674 11134
11675 @override 11135 @override
11676 bool operator ==(other) { 11136 bool operator ==(other) {
11677 if (other is FoldingRegion) { 11137 if (other is HighlightRegion) {
11678 return kind == other.kind && 11138 return type == other.type &&
11679 offset == other.offset && 11139 offset == other.offset &&
11680 length == other.length; 11140 length == other.length;
11681 } 11141 }
11682 return false; 11142 return false;
11683 } 11143 }
11684 11144
11685 @override 11145 @override
11686 int get hashCode { 11146 int get hashCode {
11687 int hash = 0; 11147 int hash = 0;
11688 hash = JenkinsSmiHash.combine(hash, kind.hashCode); 11148 hash = JenkinsSmiHash.combine(hash, type.hashCode);
11689 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 11149 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
11690 hash = JenkinsSmiHash.combine(hash, length.hashCode); 11150 hash = JenkinsSmiHash.combine(hash, length.hashCode);
11691 return JenkinsSmiHash.finish(hash); 11151 return JenkinsSmiHash.finish(hash);
11692 } 11152 }
11693 } 11153 }
11694 11154
11695 /** 11155 /**
11696 * GeneralAnalysisService
11697 *
11698 * enum {
11699 * ANALYZED_FILES
11700 * }
11701 *
11702 * Clients may not extend, implement or mix-in this class.
11703 */
11704 class GeneralAnalysisService implements Enum {
11705 static const GeneralAnalysisService ANALYZED_FILES =
11706 const GeneralAnalysisService._("ANALYZED_FILES");
11707
11708 /**
11709 * A list containing all of the enum values that are defined.
11710 */
11711 static const List<GeneralAnalysisService> VALUES =
11712 const <GeneralAnalysisService>[ANALYZED_FILES];
11713
11714 final String name;
11715
11716 const GeneralAnalysisService._(this.name);
11717
11718 factory GeneralAnalysisService(String name) {
11719 switch (name) {
11720 case "ANALYZED_FILES":
11721 return ANALYZED_FILES;
11722 }
11723 throw new Exception('Illegal enum value: $name');
11724 }
11725
11726 factory GeneralAnalysisService.fromJson(
11727 JsonDecoder jsonDecoder, String jsonPath, Object json) {
11728 if (json is String) {
11729 try {
11730 return new GeneralAnalysisService(json);
11731 } catch (_) {
11732 // Fall through
11733 }
11734 }
11735 throw jsonDecoder.mismatch(jsonPath, "GeneralAnalysisService", json);
11736 }
11737
11738 @override
11739 String toString() => "GeneralAnalysisService.$name";
11740
11741 String toJson() => name;
11742 }
11743
11744 /**
11745 * HighlightRegion
11746 *
11747 * {
11748 * "type": HighlightRegionType
11749 * "offset": int
11750 * "length": int
11751 * }
11752 *
11753 * Clients may not extend, implement or mix-in this class.
11754 */
11755 class HighlightRegion implements HasToJson {
11756 HighlightRegionType _type;
11757
11758 int _offset;
11759
11760 int _length;
11761
11762 /**
11763 * The type of highlight associated with the region.
11764 */
11765 HighlightRegionType get type => _type;
11766
11767 /**
11768 * The type of highlight associated with the region.
11769 */
11770 void set type(HighlightRegionType value) {
11771 assert(value != null);
11772 this._type = value;
11773 }
11774
11775 /**
11776 * The offset of the region to be highlighted.
11777 */
11778 int get offset => _offset;
11779
11780 /**
11781 * The offset of the region to be highlighted.
11782 */
11783 void set offset(int value) {
11784 assert(value != null);
11785 this._offset = value;
11786 }
11787
11788 /**
11789 * The length of the region to be highlighted.
11790 */
11791 int get length => _length;
11792
11793 /**
11794 * The length of the region to be highlighted.
11795 */
11796 void set length(int value) {
11797 assert(value != null);
11798 this._length = value;
11799 }
11800
11801 HighlightRegion(HighlightRegionType type, int offset, int length) {
11802 this.type = type;
11803 this.offset = offset;
11804 this.length = length;
11805 }
11806
11807 factory HighlightRegion.fromJson(
11808 JsonDecoder jsonDecoder, String jsonPath, Object json) {
11809 if (json == null) {
11810 json = {};
11811 }
11812 if (json is Map) {
11813 HighlightRegionType type;
11814 if (json.containsKey("type")) {
11815 type = new HighlightRegionType.fromJson(
11816 jsonDecoder, jsonPath + ".type", json["type"]);
11817 } else {
11818 throw jsonDecoder.missingKey(jsonPath, "type");
11819 }
11820 int offset;
11821 if (json.containsKey("offset")) {
11822 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
11823 } else {
11824 throw jsonDecoder.missingKey(jsonPath, "offset");
11825 }
11826 int length;
11827 if (json.containsKey("length")) {
11828 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
11829 } else {
11830 throw jsonDecoder.missingKey(jsonPath, "length");
11831 }
11832 return new HighlightRegion(type, offset, length);
11833 } else {
11834 throw jsonDecoder.mismatch(jsonPath, "HighlightRegion", json);
11835 }
11836 }
11837
11838 Map<String, dynamic> toJson() {
11839 Map<String, dynamic> result = {};
11840 result["type"] = type.toJson();
11841 result["offset"] = offset;
11842 result["length"] = length;
11843 return result;
11844 }
11845
11846 @override
11847 String toString() => JSON.encode(toJson());
11848
11849 @override
11850 bool operator ==(other) {
11851 if (other is HighlightRegion) {
11852 return type == other.type &&
11853 offset == other.offset &&
11854 length == other.length;
11855 }
11856 return false;
11857 }
11858
11859 @override
11860 int get hashCode {
11861 int hash = 0;
11862 hash = JenkinsSmiHash.combine(hash, type.hashCode);
11863 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
11864 hash = JenkinsSmiHash.combine(hash, length.hashCode);
11865 return JenkinsSmiHash.finish(hash);
11866 }
11867 }
11868
11869 /**
11870 * HighlightRegionType 11156 * HighlightRegionType
11871 * 11157 *
11872 * enum { 11158 * enum {
11873 * ANNOTATION 11159 * ANNOTATION
11874 * BUILT_IN 11160 * BUILT_IN
11875 * CLASS 11161 * CLASS
11876 * COMMENT_BLOCK 11162 * COMMENT_BLOCK
11877 * COMMENT_DOCUMENTATION 11163 * COMMENT_DOCUMENTATION
11878 * COMMENT_END_OF_LINE 11164 * COMMENT_END_OF_LINE
11879 * CONSTRUCTOR 11165 * CONSTRUCTOR
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
12382 TOP_LEVEL_GETTER_REFERENCE, 11668 TOP_LEVEL_GETTER_REFERENCE,
12383 TOP_LEVEL_SETTER_DECLARATION, 11669 TOP_LEVEL_SETTER_DECLARATION,
12384 TOP_LEVEL_SETTER_REFERENCE, 11670 TOP_LEVEL_SETTER_REFERENCE,
12385 TOP_LEVEL_VARIABLE_DECLARATION, 11671 TOP_LEVEL_VARIABLE_DECLARATION,
12386 TYPE_NAME_DYNAMIC, 11672 TYPE_NAME_DYNAMIC,
12387 TYPE_PARAMETER, 11673 TYPE_PARAMETER,
12388 UNRESOLVED_INSTANCE_MEMBER_REFERENCE, 11674 UNRESOLVED_INSTANCE_MEMBER_REFERENCE,
12389 VALID_STRING_ESCAPE 11675 VALID_STRING_ESCAPE
12390 ]; 11676 ];
12391 11677
11678 @override
12392 final String name; 11679 final String name;
12393 11680
12394 const HighlightRegionType._(this.name); 11681 const HighlightRegionType._(this.name);
12395 11682
12396 factory HighlightRegionType(String name) { 11683 factory HighlightRegionType(String name) {
12397 switch (name) { 11684 switch (name) {
12398 case "ANNOTATION": 11685 case "ANNOTATION":
12399 return ANNOTATION; 11686 return ANNOTATION;
12400 case "BUILT_IN": 11687 case "BUILT_IN":
12401 return BUILT_IN; 11688 return BUILT_IN;
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
12820 factory HoverInformation.fromJson( 12107 factory HoverInformation.fromJson(
12821 JsonDecoder jsonDecoder, String jsonPath, Object json) { 12108 JsonDecoder jsonDecoder, String jsonPath, Object json) {
12822 if (json == null) { 12109 if (json == null) {
12823 json = {}; 12110 json = {};
12824 } 12111 }
12825 if (json is Map) { 12112 if (json is Map) {
12826 int offset; 12113 int offset;
12827 if (json.containsKey("offset")) { 12114 if (json.containsKey("offset")) {
12828 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 12115 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
12829 } else { 12116 } else {
12830 throw jsonDecoder.missingKey(jsonPath, "offset"); 12117 throw jsonDecoder.mismatch(jsonPath, "offset");
12831 } 12118 }
12832 int length; 12119 int length;
12833 if (json.containsKey("length")) { 12120 if (json.containsKey("length")) {
12834 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); 12121 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
12835 } else { 12122 } else {
12836 throw jsonDecoder.missingKey(jsonPath, "length"); 12123 throw jsonDecoder.mismatch(jsonPath, "length");
12837 } 12124 }
12838 String containingLibraryPath; 12125 String containingLibraryPath;
12839 if (json.containsKey("containingLibraryPath")) { 12126 if (json.containsKey("containingLibraryPath")) {
12840 containingLibraryPath = jsonDecoder.decodeString( 12127 containingLibraryPath = jsonDecoder.decodeString(
12841 jsonPath + ".containingLibraryPath", json["containingLibraryPath"]); 12128 jsonPath + ".containingLibraryPath", json["containingLibraryPath"]);
12842 } 12129 }
12843 String containingLibraryName; 12130 String containingLibraryName;
12844 if (json.containsKey("containingLibraryName")) { 12131 if (json.containsKey("containingLibraryName")) {
12845 containingLibraryName = jsonDecoder.decodeString( 12132 containingLibraryName = jsonDecoder.decodeString(
12846 jsonPath + ".containingLibraryName", json["containingLibraryName"]); 12133 jsonPath + ".containingLibraryName", json["containingLibraryName"]);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
12895 elementKind: elementKind, 12182 elementKind: elementKind,
12896 isDeprecated: isDeprecated, 12183 isDeprecated: isDeprecated,
12897 parameter: parameter, 12184 parameter: parameter,
12898 propagatedType: propagatedType, 12185 propagatedType: propagatedType,
12899 staticType: staticType); 12186 staticType: staticType);
12900 } else { 12187 } else {
12901 throw jsonDecoder.mismatch(jsonPath, "HoverInformation", json); 12188 throw jsonDecoder.mismatch(jsonPath, "HoverInformation", json);
12902 } 12189 }
12903 } 12190 }
12904 12191
12192 @override
12905 Map<String, dynamic> toJson() { 12193 Map<String, dynamic> toJson() {
12906 Map<String, dynamic> result = {}; 12194 Map<String, dynamic> result = {};
12907 result["offset"] = offset; 12195 result["offset"] = offset;
12908 result["length"] = length; 12196 result["length"] = length;
12909 if (containingLibraryPath != null) { 12197 if (containingLibraryPath != null) {
12910 result["containingLibraryPath"] = containingLibraryPath; 12198 result["containingLibraryPath"] = containingLibraryPath;
12911 } 12199 }
12912 if (containingLibraryName != null) { 12200 if (containingLibraryName != null) {
12913 result["containingLibraryName"] = containingLibraryName; 12201 result["containingLibraryName"] = containingLibraryName;
12914 } 12202 }
(...skipping 17 matching lines...) Expand all
12932 } 12220 }
12933 if (propagatedType != null) { 12221 if (propagatedType != null) {
12934 result["propagatedType"] = propagatedType; 12222 result["propagatedType"] = propagatedType;
12935 } 12223 }
12936 if (staticType != null) { 12224 if (staticType != null) {
12937 result["staticType"] = staticType; 12225 result["staticType"] = staticType;
12938 } 12226 }
12939 return result; 12227 return result;
12940 } 12228 }
12941 12229
12230 @override
12231 String toString() => JSON.encode(toJson());
12232
12233 @override
12234 bool operator ==(other) {
12235 if (other is HoverInformation) {
12236 return offset == other.offset &&
12237 length == other.length &&
12238 containingLibraryPath == other.containingLibraryPath &&
12239 containingLibraryName == other.containingLibraryName &&
12240 containingClassDescription == other.containingClassDescription &&
12241 dartdoc == other.dartdoc &&
12242 elementDescription == other.elementDescription &&
12243 elementKind == other.elementKind &&
12244 isDeprecated == other.isDeprecated &&
12245 parameter == other.parameter &&
12246 propagatedType == other.propagatedType &&
12247 staticType == other.staticType;
12248 }
12249 return false;
12250 }
12251
12252 @override
12253 int get hashCode {
12254 int hash = 0;
12255 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
12256 hash = JenkinsSmiHash.combine(hash, length.hashCode);
12257 hash = JenkinsSmiHash.combine(hash, containingLibraryPath.hashCode);
12258 hash = JenkinsSmiHash.combine(hash, containingLibraryName.hashCode);
12259 hash = JenkinsSmiHash.combine(hash, containingClassDescription.hashCode);
12260 hash = JenkinsSmiHash.combine(hash, dartdoc.hashCode);
12261 hash = JenkinsSmiHash.combine(hash, elementDescription.hashCode);
12262 hash = JenkinsSmiHash.combine(hash, elementKind.hashCode);
12263 hash = JenkinsSmiHash.combine(hash, isDeprecated.hashCode);
12264 hash = JenkinsSmiHash.combine(hash, parameter.hashCode);
12265 hash = JenkinsSmiHash.combine(hash, propagatedType.hashCode);
12266 hash = JenkinsSmiHash.combine(hash, staticType.hashCode);
12267 return JenkinsSmiHash.finish(hash);
12268 }
12269 }
12270
12271 /**
12272 * ImplementedClass
12273 *
12274 * {
12275 * "offset": int
12276 * "length": int
12277 * }
12278 *
12279 * Clients may not extend, implement or mix-in this class.
12280 */
12281 class ImplementedClass implements HasToJson {
12282 int _offset;
12283
12284 int _length;
12285
12286 /**
12287 * The offset of the name of the implemented class.
12288 */
12289 int get offset => _offset;
12290
12291 /**
12292 * The offset of the name of the implemented class.
12293 */
12294 void set offset(int value) {
12295 assert(value != null);
12296 this._offset = value;
12297 }
12298
12299 /**
12300 * The length of the name of the implemented class.
12301 */
12302 int get length => _length;
12303
12304 /**
12305 * The length of the name of the implemented class.
12306 */
12307 void set length(int value) {
12308 assert(value != null);
12309 this._length = value;
12310 }
12311
12312 ImplementedClass(int offset, int length) {
12313 this.offset = offset;
12314 this.length = length;
12315 }
12316
12317 factory ImplementedClass.fromJson(
12318 JsonDecoder jsonDecoder, String jsonPath, Object json) {
12319 if (json == null) {
12320 json = {};
12321 }
12322 if (json is Map) {
12323 int offset;
12324 if (json.containsKey("offset")) {
12325 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
12326 } else {
12327 throw jsonDecoder.mismatch(jsonPath, "offset");
12328 }
12329 int length;
12330 if (json.containsKey("length")) {
12331 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
12332 } else {
12333 throw jsonDecoder.mismatch(jsonPath, "length");
12334 }
12335 return new ImplementedClass(offset, length);
12336 } else {
12337 throw jsonDecoder.mismatch(jsonPath, "ImplementedClass", json);
12338 }
12339 }
12340
12341 @override
12342 Map<String, dynamic> toJson() {
12343 Map<String, dynamic> result = {};
12344 result["offset"] = offset;
12345 result["length"] = length;
12346 return result;
12347 }
12348
12349 @override
12350 String toString() => JSON.encode(toJson());
12351
12352 @override
12353 bool operator ==(other) {
12354 if (other is ImplementedClass) {
12355 return offset == other.offset && length == other.length;
12356 }
12357 return false;
12358 }
12359
12360 @override
12361 int get hashCode {
12362 int hash = 0;
12363 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
12364 hash = JenkinsSmiHash.combine(hash, length.hashCode);
12365 return JenkinsSmiHash.finish(hash);
12366 }
12367 }
12368
12369 /**
12370 * ImplementedMember
12371 *
12372 * {
12373 * "offset": int
12374 * "length": int
12375 * }
12376 *
12377 * Clients may not extend, implement or mix-in this class.
12378 */
12379 class ImplementedMember implements HasToJson {
12380 int _offset;
12381
12382 int _length;
12383
12384 /**
12385 * The offset of the name of the implemented member.
12386 */
12387 int get offset => _offset;
12388
12389 /**
12390 * The offset of the name of the implemented member.
12391 */
12392 void set offset(int value) {
12393 assert(value != null);
12394 this._offset = value;
12395 }
12396
12397 /**
12398 * The length of the name of the implemented member.
12399 */
12400 int get length => _length;
12401
12402 /**
12403 * The length of the name of the implemented member.
12404 */
12405 void set length(int value) {
12406 assert(value != null);
12407 this._length = value;
12408 }
12409
12410 ImplementedMember(int offset, int length) {
12411 this.offset = offset;
12412 this.length = length;
12413 }
12414
12415 factory ImplementedMember.fromJson(
12416 JsonDecoder jsonDecoder, String jsonPath, Object json) {
12417 if (json == null) {
12418 json = {};
12419 }
12420 if (json is Map) {
12421 int offset;
12422 if (json.containsKey("offset")) {
12423 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
12424 } else {
12425 throw jsonDecoder.mismatch(jsonPath, "offset");
12426 }
12427 int length;
12428 if (json.containsKey("length")) {
12429 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
12430 } else {
12431 throw jsonDecoder.mismatch(jsonPath, "length");
12432 }
12433 return new ImplementedMember(offset, length);
12434 } else {
12435 throw jsonDecoder.mismatch(jsonPath, "ImplementedMember", json);
12436 }
12437 }
12438
12439 @override
12440 Map<String, dynamic> toJson() {
12441 Map<String, dynamic> result = {};
12442 result["offset"] = offset;
12443 result["length"] = length;
12444 return result;
12445 }
12446
12447 @override
12448 String toString() => JSON.encode(toJson());
12449
12450 @override
12451 bool operator ==(other) {
12452 if (other is ImplementedMember) {
12453 return offset == other.offset && length == other.length;
12454 }
12455 return false;
12456 }
12457
12458 @override
12459 int get hashCode {
12460 int hash = 0;
12461 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
12462 hash = JenkinsSmiHash.combine(hash, length.hashCode);
12463 return JenkinsSmiHash.finish(hash);
12464 }
12465 }
12466
12467 /**
12468 * inlineLocalVariable feedback
12469 *
12470 * {
12471 * "name": String
12472 * "occurrences": int
12473 * }
12474 *
12475 * Clients may not extend, implement or mix-in this class.
12476 */
12477 class InlineLocalVariableFeedback extends RefactoringFeedback {
12478 String _name;
12479
12480 int _occurrences;
12481
12482 /**
12483 * The name of the variable being inlined.
12484 */
12485 String get name => _name;
12486
12487 /**
12488 * The name of the variable being inlined.
12489 */
12490 void set name(String value) {
12491 assert(value != null);
12492 this._name = value;
12493 }
12494
12495 /**
12496 * The number of times the variable occurs.
12497 */
12498 int get occurrences => _occurrences;
12499
12500 /**
12501 * The number of times the variable occurs.
12502 */
12503 void set occurrences(int value) {
12504 assert(value != null);
12505 this._occurrences = value;
12506 }
12507
12508 InlineLocalVariableFeedback(String name, int occurrences) {
12509 this.name = name;
12510 this.occurrences = occurrences;
12511 }
12512
12513 factory InlineLocalVariableFeedback.fromJson(
12514 JsonDecoder jsonDecoder, String jsonPath, Object json) {
12515 if (json == null) {
12516 json = {};
12517 }
12518 if (json is Map) {
12519 String name;
12520 if (json.containsKey("name")) {
12521 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]);
12522 } else {
12523 throw jsonDecoder.mismatch(jsonPath, "name");
12524 }
12525 int occurrences;
12526 if (json.containsKey("occurrences")) {
12527 occurrences = jsonDecoder.decodeInt(
12528 jsonPath + ".occurrences", json["occurrences"]);
12529 } else {
12530 throw jsonDecoder.mismatch(jsonPath, "occurrences");
12531 }
12532 return new InlineLocalVariableFeedback(name, occurrences);
12533 } else {
12534 throw jsonDecoder.mismatch(
12535 jsonPath, "inlineLocalVariable feedback", json);
12536 }
12537 }
12538
12539 @override
12540 Map<String, dynamic> toJson() {
12541 Map<String, dynamic> result = {};
12542 result["name"] = name;
12543 result["occurrences"] = occurrences;
12544 return result;
12545 }
12546
12547 @override
12548 String toString() => JSON.encode(toJson());
12549
12550 @override
12551 bool operator ==(other) {
12552 if (other is InlineLocalVariableFeedback) {
12553 return name == other.name && occurrences == other.occurrences;
12554 }
12555 return false;
12556 }
12557
12558 @override
12559 int get hashCode {
12560 int hash = 0;
12561 hash = JenkinsSmiHash.combine(hash, name.hashCode);
12562 hash = JenkinsSmiHash.combine(hash, occurrences.hashCode);
12563 return JenkinsSmiHash.finish(hash);
12564 }
12565 }
12566
12567 /**
12568 * inlineLocalVariable options
12569 *
12570 * Clients may not extend, implement or mix-in this class.
12571 */
12572 class InlineLocalVariableOptions extends RefactoringOptions
12573 implements HasToJson {
12574 @override
12575 bool operator ==(other) {
12576 if (other is InlineLocalVariableOptions) {
12577 return true;
12578 }
12579 return false;
12580 }
12581
12582 @override
12583 int get hashCode {
12584 return 540364977;
12585 }
12586 }
12587
12588 /**
12589 * inlineMethod feedback
12590 *
12591 * {
12592 * "className": optional String
12593 * "methodName": String
12594 * "isDeclaration": bool
12595 * }
12596 *
12597 * Clients may not extend, implement or mix-in this class.
12598 */
12599 class InlineMethodFeedback extends RefactoringFeedback {
12600 String _className;
12601
12602 String _methodName;
12603
12604 bool _isDeclaration;
12605
12606 /**
12607 * The name of the class enclosing the method being inlined. If not a class
12608 * member is being inlined, this field will be absent.
12609 */
12610 String get className => _className;
12611
12612 /**
12613 * The name of the class enclosing the method being inlined. If not a class
12614 * member is being inlined, this field will be absent.
12615 */
12616 void set className(String value) {
12617 this._className = value;
12618 }
12619
12620 /**
12621 * The name of the method (or function) being inlined.
12622 */
12623 String get methodName => _methodName;
12624
12625 /**
12626 * The name of the method (or function) being inlined.
12627 */
12628 void set methodName(String value) {
12629 assert(value != null);
12630 this._methodName = value;
12631 }
12632
12633 /**
12634 * True if the declaration of the method is selected. So all references
12635 * should be inlined.
12636 */
12637 bool get isDeclaration => _isDeclaration;
12638
12639 /**
12640 * True if the declaration of the method is selected. So all references
12641 * should be inlined.
12642 */
12643 void set isDeclaration(bool value) {
12644 assert(value != null);
12645 this._isDeclaration = value;
12646 }
12647
12648 InlineMethodFeedback(String methodName, bool isDeclaration,
12649 {String className}) {
12650 this.className = className;
12651 this.methodName = methodName;
12652 this.isDeclaration = isDeclaration;
12653 }
12654
12655 factory InlineMethodFeedback.fromJson(
12656 JsonDecoder jsonDecoder, String jsonPath, Object json) {
12657 if (json == null) {
12658 json = {};
12659 }
12660 if (json is Map) {
12661 String className;
12662 if (json.containsKey("className")) {
12663 className = jsonDecoder.decodeString(
12664 jsonPath + ".className", json["className"]);
12665 }
12666 String methodName;
12667 if (json.containsKey("methodName")) {
12668 methodName = jsonDecoder.decodeString(
12669 jsonPath + ".methodName", json["methodName"]);
12670 } else {
12671 throw jsonDecoder.mismatch(jsonPath, "methodName");
12672 }
12673 bool isDeclaration;
12674 if (json.containsKey("isDeclaration")) {
12675 isDeclaration = jsonDecoder.decodeBool(
12676 jsonPath + ".isDeclaration", json["isDeclaration"]);
12677 } else {
12678 throw jsonDecoder.mismatch(jsonPath, "isDeclaration");
12679 }
12680 return new InlineMethodFeedback(methodName, isDeclaration,
12681 className: className);
12682 } else {
12683 throw jsonDecoder.mismatch(jsonPath, "inlineMethod feedback", json);
12684 }
12685 }
12686
12687 @override
12688 Map<String, dynamic> toJson() {
12689 Map<String, dynamic> result = {};
12690 if (className != null) {
12691 result["className"] = className;
12692 }
12693 result["methodName"] = methodName;
12694 result["isDeclaration"] = isDeclaration;
12695 return result;
12696 }
12697
12698 @override
12699 String toString() => JSON.encode(toJson());
12700
12701 @override
12702 bool operator ==(other) {
12703 if (other is InlineMethodFeedback) {
12704 return className == other.className &&
12705 methodName == other.methodName &&
12706 isDeclaration == other.isDeclaration;
12707 }
12708 return false;
12709 }
12710
12711 @override
12712 int get hashCode {
12713 int hash = 0;
12714 hash = JenkinsSmiHash.combine(hash, className.hashCode);
12715 hash = JenkinsSmiHash.combine(hash, methodName.hashCode);
12716 hash = JenkinsSmiHash.combine(hash, isDeclaration.hashCode);
12717 return JenkinsSmiHash.finish(hash);
12718 }
12719 }
12720
12721 /**
12722 * inlineMethod options
12723 *
12724 * {
12725 * "deleteSource": bool
12726 * "inlineAll": bool
12727 * }
12728 *
12729 * Clients may not extend, implement or mix-in this class.
12730 */
12731 class InlineMethodOptions extends RefactoringOptions {
12732 bool _deleteSource;
12733
12734 bool _inlineAll;
12735
12736 /**
12737 * True if the method being inlined should be removed. It is an error if this
12738 * field is true and inlineAll is false.
12739 */
12740 bool get deleteSource => _deleteSource;
12741
12742 /**
12743 * True if the method being inlined should be removed. It is an error if this
12744 * field is true and inlineAll is false.
12745 */
12746 void set deleteSource(bool value) {
12747 assert(value != null);
12748 this._deleteSource = value;
12749 }
12750
12751 /**
12752 * True if all invocations of the method should be inlined, or false if only
12753 * the invocation site used to create this refactoring should be inlined.
12754 */
12755 bool get inlineAll => _inlineAll;
12756
12757 /**
12758 * True if all invocations of the method should be inlined, or false if only
12759 * the invocation site used to create this refactoring should be inlined.
12760 */
12761 void set inlineAll(bool value) {
12762 assert(value != null);
12763 this._inlineAll = value;
12764 }
12765
12766 InlineMethodOptions(bool deleteSource, bool inlineAll) {
12767 this.deleteSource = deleteSource;
12768 this.inlineAll = inlineAll;
12769 }
12770
12771 factory InlineMethodOptions.fromJson(
12772 JsonDecoder jsonDecoder, String jsonPath, Object json) {
12773 if (json == null) {
12774 json = {};
12775 }
12776 if (json is Map) {
12777 bool deleteSource;
12778 if (json.containsKey("deleteSource")) {
12779 deleteSource = jsonDecoder.decodeBool(
12780 jsonPath + ".deleteSource", json["deleteSource"]);
12781 } else {
12782 throw jsonDecoder.mismatch(jsonPath, "deleteSource");
12783 }
12784 bool inlineAll;
12785 if (json.containsKey("inlineAll")) {
12786 inlineAll =
12787 jsonDecoder.decodeBool(jsonPath + ".inlineAll", json["inlineAll"]);
12788 } else {
12789 throw jsonDecoder.mismatch(jsonPath, "inlineAll");
12790 }
12791 return new InlineMethodOptions(deleteSource, inlineAll);
12792 } else {
12793 throw jsonDecoder.mismatch(jsonPath, "inlineMethod options", json);
12794 }
12795 }
12796
12797 factory InlineMethodOptions.fromRefactoringParams(
12798 EditGetRefactoringParams refactoringParams, Request request) {
12799 return new InlineMethodOptions.fromJson(
12800 new RequestDecoder(request), "options", refactoringParams.options);
12801 }
12802
12803 @override
12804 Map<String, dynamic> toJson() {
12805 Map<String, dynamic> result = {};
12806 result["deleteSource"] = deleteSource;
12807 result["inlineAll"] = inlineAll;
12808 return result;
12809 }
12810
12811 @override
12812 String toString() => JSON.encode(toJson());
12813
12814 @override
12815 bool operator ==(other) {
12816 if (other is InlineMethodOptions) {
12817 return deleteSource == other.deleteSource && inlineAll == other.inlineAll;
12818 }
12819 return false;
12820 }
12821
12822 @override
12823 int get hashCode {
12824 int hash = 0;
12825 hash = JenkinsSmiHash.combine(hash, deleteSource.hashCode);
12826 hash = JenkinsSmiHash.combine(hash, inlineAll.hashCode);
12827 return JenkinsSmiHash.finish(hash);
12828 }
12829 }
12830
12831 /**
12832 * LinkedEditGroup
12833 *
12834 * {
12835 * "positions": List<Position>
12836 * "length": int
12837 * "suggestions": List<LinkedEditSuggestion>
12838 * }
12839 *
12840 * Clients may not extend, implement or mix-in this class.
12841 */
12842 class LinkedEditGroup implements HasToJson {
12843 List<Position> _positions;
12844
12845 int _length;
12846
12847 List<LinkedEditSuggestion> _suggestions;
12848
12849 /**
12850 * The positions of the regions that should be edited simultaneously.
12851 */
12852 List<Position> get positions => _positions;
12853
12854 /**
12855 * The positions of the regions that should be edited simultaneously.
12856 */
12857 void set positions(List<Position> value) {
12858 assert(value != null);
12859 this._positions = value;
12860 }
12861
12862 /**
12863 * The length of the regions that should be edited simultaneously.
12864 */
12865 int get length => _length;
12866
12867 /**
12868 * The length of the regions that should be edited simultaneously.
12869 */
12870 void set length(int value) {
12871 assert(value != null);
12872 this._length = value;
12873 }
12874
12875 /**
12876 * Pre-computed suggestions for what every region might want to be changed
12877 * to.
12878 */
12879 List<LinkedEditSuggestion> get suggestions => _suggestions;
12880
12881 /**
12882 * Pre-computed suggestions for what every region might want to be changed
12883 * to.
12884 */
12885 void set suggestions(List<LinkedEditSuggestion> value) {
12886 assert(value != null);
12887 this._suggestions = value;
12888 }
12889
12890 LinkedEditGroup(List<Position> positions, int length,
12891 List<LinkedEditSuggestion> suggestions) {
12892 this.positions = positions;
12893 this.length = length;
12894 this.suggestions = suggestions;
12895 }
12896
12897 factory LinkedEditGroup.fromJson(
12898 JsonDecoder jsonDecoder, String jsonPath, Object json) {
12899 if (json == null) {
12900 json = {};
12901 }
12902 if (json is Map) {
12903 List<Position> positions;
12904 if (json.containsKey("positions")) {
12905 positions = jsonDecoder.decodeList(
12906 jsonPath + ".positions",
12907 json["positions"],
12908 (String jsonPath, Object json) =>
12909 new Position.fromJson(jsonDecoder, jsonPath, json));
12910 } else {
12911 throw jsonDecoder.mismatch(jsonPath, "positions");
12912 }
12913 int length;
12914 if (json.containsKey("length")) {
12915 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
12916 } else {
12917 throw jsonDecoder.mismatch(jsonPath, "length");
12918 }
12919 List<LinkedEditSuggestion> suggestions;
12920 if (json.containsKey("suggestions")) {
12921 suggestions = jsonDecoder.decodeList(
12922 jsonPath + ".suggestions",
12923 json["suggestions"],
12924 (String jsonPath, Object json) =>
12925 new LinkedEditSuggestion.fromJson(jsonDecoder, jsonPath, json));
12926 } else {
12927 throw jsonDecoder.mismatch(jsonPath, "suggestions");
12928 }
12929 return new LinkedEditGroup(positions, length, suggestions);
12930 } else {
12931 throw jsonDecoder.mismatch(jsonPath, "LinkedEditGroup", json);
12932 }
12933 }
12934
12935 /**
12936 * Construct an empty LinkedEditGroup.
12937 */
12938 LinkedEditGroup.empty() : this(<Position>[], 0, <LinkedEditSuggestion>[]);
12939
12940 @override
12941 Map<String, dynamic> toJson() {
12942 Map<String, dynamic> result = {};
12943 result["positions"] =
12944 positions.map((Position value) => value.toJson()).toList();
12945 result["length"] = length;
12946 result["suggestions"] = suggestions
12947 .map((LinkedEditSuggestion value) => value.toJson())
12948 .toList();
12949 return result;
12950 }
12951
12952 /**
12953 * Add a new position and change the length.
12954 */
12955 void addPosition(Position position, int length) {
12956 positions.add(position);
12957 this.length = length;
12958 }
12959
12960 /**
12961 * Add a new suggestion.
12962 */
12963 void addSuggestion(LinkedEditSuggestion suggestion) {
12964 suggestions.add(suggestion);
12965 }
12966
12967 @override
12968 String toString() => JSON.encode(toJson());
12969
12970 @override
12971 bool operator ==(other) {
12972 if (other is LinkedEditGroup) {
12973 return listEqual(
12974 positions, other.positions, (Position a, Position b) => a == b) &&
12975 length == other.length &&
12976 listEqual(suggestions, other.suggestions,
12977 (LinkedEditSuggestion a, LinkedEditSuggestion b) => a == b);
12978 }
12979 return false;
12980 }
12981
12982 @override
12983 int get hashCode {
12984 int hash = 0;
12985 hash = JenkinsSmiHash.combine(hash, positions.hashCode);
12986 hash = JenkinsSmiHash.combine(hash, length.hashCode);
12987 hash = JenkinsSmiHash.combine(hash, suggestions.hashCode);
12988 return JenkinsSmiHash.finish(hash);
12989 }
12990 }
12991
12992 /**
12993 * LinkedEditSuggestion
12994 *
12995 * {
12996 * "value": String
12997 * "kind": LinkedEditSuggestionKind
12998 * }
12999 *
13000 * Clients may not extend, implement or mix-in this class.
13001 */
13002 class LinkedEditSuggestion implements HasToJson {
13003 String _value;
13004
13005 LinkedEditSuggestionKind _kind;
13006
13007 /**
13008 * The value that could be used to replace all of the linked edit regions.
13009 */
13010 String get value => _value;
13011
13012 /**
13013 * The value that could be used to replace all of the linked edit regions.
13014 */
13015 void set value(String value) {
13016 assert(value != null);
13017 this._value = value;
13018 }
13019
13020 /**
13021 * The kind of value being proposed.
13022 */
13023 LinkedEditSuggestionKind get kind => _kind;
13024
13025 /**
13026 * The kind of value being proposed.
13027 */
13028 void set kind(LinkedEditSuggestionKind value) {
13029 assert(value != null);
13030 this._kind = value;
13031 }
13032
13033 LinkedEditSuggestion(String value, LinkedEditSuggestionKind kind) {
13034 this.value = value;
13035 this.kind = kind;
13036 }
13037
13038 factory LinkedEditSuggestion.fromJson(
13039 JsonDecoder jsonDecoder, String jsonPath, Object json) {
13040 if (json == null) {
13041 json = {};
13042 }
13043 if (json is Map) {
13044 String value;
13045 if (json.containsKey("value")) {
13046 value = jsonDecoder.decodeString(jsonPath + ".value", json["value"]);
13047 } else {
13048 throw jsonDecoder.mismatch(jsonPath, "value");
13049 }
13050 LinkedEditSuggestionKind kind;
13051 if (json.containsKey("kind")) {
13052 kind = new LinkedEditSuggestionKind.fromJson(
13053 jsonDecoder, jsonPath + ".kind", json["kind"]);
13054 } else {
13055 throw jsonDecoder.mismatch(jsonPath, "kind");
13056 }
13057 return new LinkedEditSuggestion(value, kind);
13058 } else {
13059 throw jsonDecoder.mismatch(jsonPath, "LinkedEditSuggestion", json);
13060 }
13061 }
13062
13063 @override
13064 Map<String, dynamic> toJson() {
13065 Map<String, dynamic> result = {};
13066 result["value"] = value;
13067 result["kind"] = kind.toJson();
13068 return result;
13069 }
13070
13071 @override
13072 String toString() => JSON.encode(toJson());
13073
13074 @override
13075 bool operator ==(other) {
13076 if (other is LinkedEditSuggestion) {
13077 return value == other.value && kind == other.kind;
13078 }
13079 return false;
13080 }
13081
13082 @override
13083 int get hashCode {
13084 int hash = 0;
13085 hash = JenkinsSmiHash.combine(hash, value.hashCode);
13086 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
13087 return JenkinsSmiHash.finish(hash);
13088 }
13089 }
13090
13091 /**
13092 * LinkedEditSuggestionKind
13093 *
13094 * enum {
13095 * METHOD
13096 * PARAMETER
13097 * TYPE
13098 * VARIABLE
13099 * }
13100 *
13101 * Clients may not extend, implement or mix-in this class.
13102 */
13103 class LinkedEditSuggestionKind implements Enum {
13104 static const LinkedEditSuggestionKind METHOD =
13105 const LinkedEditSuggestionKind._("METHOD");
13106
13107 static const LinkedEditSuggestionKind PARAMETER =
13108 const LinkedEditSuggestionKind._("PARAMETER");
13109
13110 static const LinkedEditSuggestionKind TYPE =
13111 const LinkedEditSuggestionKind._("TYPE");
13112
13113 static const LinkedEditSuggestionKind VARIABLE =
13114 const LinkedEditSuggestionKind._("VARIABLE");
13115
13116 /**
13117 * A list containing all of the enum values that are defined.
13118 */
13119 static const List<LinkedEditSuggestionKind> VALUES =
13120 const <LinkedEditSuggestionKind>[METHOD, PARAMETER, TYPE, VARIABLE];
13121
13122 @override
13123 final String name;
13124
13125 const LinkedEditSuggestionKind._(this.name);
13126
13127 factory LinkedEditSuggestionKind(String name) {
13128 switch (name) {
13129 case "METHOD":
13130 return METHOD;
13131 case "PARAMETER":
13132 return PARAMETER;
13133 case "TYPE":
13134 return TYPE;
13135 case "VARIABLE":
13136 return VARIABLE;
13137 }
13138 throw new Exception('Illegal enum value: $name');
13139 }
13140
13141 factory LinkedEditSuggestionKind.fromJson(
13142 JsonDecoder jsonDecoder, String jsonPath, Object json) {
13143 if (json is String) {
13144 try {
13145 return new LinkedEditSuggestionKind(json);
13146 } catch (_) {
13147 // Fall through
13148 }
13149 }
13150 throw jsonDecoder.mismatch(jsonPath, "LinkedEditSuggestionKind", json);
13151 }
13152
13153 @override
13154 String toString() => "LinkedEditSuggestionKind.$name";
13155
13156 String toJson() => name;
13157 }
13158
13159 /**
13160 * Location
13161 *
13162 * {
13163 * "file": FilePath
13164 * "offset": int
13165 * "length": int
13166 * "startLine": int
13167 * "startColumn": int
13168 * }
13169 *
13170 * Clients may not extend, implement or mix-in this class.
13171 */
13172 class Location implements HasToJson {
13173 String _file;
13174
13175 int _offset;
13176
13177 int _length;
13178
13179 int _startLine;
13180
13181 int _startColumn;
13182
13183 /**
13184 * The file containing the range.
13185 */
13186 String get file => _file;
13187
13188 /**
13189 * The file containing the range.
13190 */
13191 void set file(String value) {
13192 assert(value != null);
13193 this._file = value;
13194 }
13195
13196 /**
13197 * The offset of the range.
13198 */
13199 int get offset => _offset;
13200
13201 /**
13202 * The offset of the range.
13203 */
13204 void set offset(int value) {
13205 assert(value != null);
13206 this._offset = value;
13207 }
13208
13209 /**
13210 * The length of the range.
13211 */
13212 int get length => _length;
13213
13214 /**
13215 * The length of the range.
13216 */
13217 void set length(int value) {
13218 assert(value != null);
13219 this._length = value;
13220 }
13221
13222 /**
13223 * The one-based index of the line containing the first character of the
13224 * range.
13225 */
13226 int get startLine => _startLine;
13227
13228 /**
13229 * The one-based index of the line containing the first character of the
13230 * range.
13231 */
13232 void set startLine(int value) {
13233 assert(value != null);
13234 this._startLine = value;
13235 }
13236
13237 /**
13238 * The one-based index of the column containing the first character of the
13239 * range.
13240 */
13241 int get startColumn => _startColumn;
13242
13243 /**
13244 * The one-based index of the column containing the first character of the
13245 * range.
13246 */
13247 void set startColumn(int value) {
13248 assert(value != null);
13249 this._startColumn = value;
13250 }
13251
13252 Location(
13253 String file, int offset, int length, int startLine, int startColumn) {
13254 this.file = file;
13255 this.offset = offset;
13256 this.length = length;
13257 this.startLine = startLine;
13258 this.startColumn = startColumn;
13259 }
13260
13261 factory Location.fromJson(
13262 JsonDecoder jsonDecoder, String jsonPath, Object json) {
13263 if (json == null) {
13264 json = {};
13265 }
13266 if (json is Map) {
13267 String file;
13268 if (json.containsKey("file")) {
13269 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
13270 } else {
13271 throw jsonDecoder.mismatch(jsonPath, "file");
13272 }
13273 int offset;
13274 if (json.containsKey("offset")) {
13275 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
13276 } else {
13277 throw jsonDecoder.mismatch(jsonPath, "offset");
13278 }
13279 int length;
13280 if (json.containsKey("length")) {
13281 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
13282 } else {
13283 throw jsonDecoder.mismatch(jsonPath, "length");
13284 }
13285 int startLine;
13286 if (json.containsKey("startLine")) {
13287 startLine =
13288 jsonDecoder.decodeInt(jsonPath + ".startLine", json["startLine"]);
13289 } else {
13290 throw jsonDecoder.mismatch(jsonPath, "startLine");
13291 }
13292 int startColumn;
13293 if (json.containsKey("startColumn")) {
13294 startColumn = jsonDecoder.decodeInt(
13295 jsonPath + ".startColumn", json["startColumn"]);
13296 } else {
13297 throw jsonDecoder.mismatch(jsonPath, "startColumn");
13298 }
13299 return new Location(file, offset, length, startLine, startColumn);
13300 } else {
13301 throw jsonDecoder.mismatch(jsonPath, "Location", json);
13302 }
13303 }
13304
13305 @override
13306 Map<String, dynamic> toJson() {
13307 Map<String, dynamic> result = {};
13308 result["file"] = file;
13309 result["offset"] = offset;
13310 result["length"] = length;
13311 result["startLine"] = startLine;
13312 result["startColumn"] = startColumn;
13313 return result;
13314 }
13315
12942 @override 13316 @override
12943 String toString() => JSON.encode(toJson()); 13317 String toString() => JSON.encode(toJson());
12944 13318
12945 @override 13319 @override
12946 bool operator ==(other) { 13320 bool operator ==(other) {
12947 if (other is HoverInformation) { 13321 if (other is Location) {
12948 return offset == other.offset && 13322 return file == other.file &&
13323 offset == other.offset &&
12949 length == other.length && 13324 length == other.length &&
12950 containingLibraryPath == other.containingLibraryPath && 13325 startLine == other.startLine &&
12951 containingLibraryName == other.containingLibraryName && 13326 startColumn == other.startColumn;
12952 containingClassDescription == other.containingClassDescription &&
12953 dartdoc == other.dartdoc &&
12954 elementDescription == other.elementDescription &&
12955 elementKind == other.elementKind &&
12956 isDeprecated == other.isDeprecated &&
12957 parameter == other.parameter &&
12958 propagatedType == other.propagatedType &&
12959 staticType == other.staticType;
12960 } 13327 }
12961 return false; 13328 return false;
12962 } 13329 }
12963 13330
12964 @override 13331 @override
12965 int get hashCode { 13332 int get hashCode {
12966 int hash = 0; 13333 int hash = 0;
13334 hash = JenkinsSmiHash.combine(hash, file.hashCode);
12967 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 13335 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
12968 hash = JenkinsSmiHash.combine(hash, length.hashCode); 13336 hash = JenkinsSmiHash.combine(hash, length.hashCode);
12969 hash = JenkinsSmiHash.combine(hash, containingLibraryPath.hashCode); 13337 hash = JenkinsSmiHash.combine(hash, startLine.hashCode);
12970 hash = JenkinsSmiHash.combine(hash, containingLibraryName.hashCode); 13338 hash = JenkinsSmiHash.combine(hash, startColumn.hashCode);
12971 hash = JenkinsSmiHash.combine(hash, containingClassDescription.hashCode);
12972 hash = JenkinsSmiHash.combine(hash, dartdoc.hashCode);
12973 hash = JenkinsSmiHash.combine(hash, elementDescription.hashCode);
12974 hash = JenkinsSmiHash.combine(hash, elementKind.hashCode);
12975 hash = JenkinsSmiHash.combine(hash, isDeprecated.hashCode);
12976 hash = JenkinsSmiHash.combine(hash, parameter.hashCode);
12977 hash = JenkinsSmiHash.combine(hash, propagatedType.hashCode);
12978 hash = JenkinsSmiHash.combine(hash, staticType.hashCode);
12979 return JenkinsSmiHash.finish(hash); 13339 return JenkinsSmiHash.finish(hash);
12980 } 13340 }
12981 } 13341 }
12982 13342
12983 /** 13343 /**
12984 * ImplementedClass 13344 * moveFile feedback
13345 *
13346 * Clients may not extend, implement or mix-in this class.
13347 */
13348 class MoveFileFeedback extends RefactoringFeedback implements HasToJson {
13349 @override
13350 bool operator ==(other) {
13351 if (other is MoveFileFeedback) {
13352 return true;
13353 }
13354 return false;
13355 }
13356
13357 @override
13358 int get hashCode {
13359 return 438975893;
13360 }
13361 }
13362
13363 /**
13364 * moveFile options
12985 * 13365 *
12986 * { 13366 * {
12987 * "offset": int 13367 * "newFile": FilePath
12988 * "length": int
12989 * } 13368 * }
12990 * 13369 *
12991 * Clients may not extend, implement or mix-in this class. 13370 * Clients may not extend, implement or mix-in this class.
12992 */ 13371 */
12993 class ImplementedClass implements HasToJson { 13372 class MoveFileOptions extends RefactoringOptions {
12994 int _offset; 13373 String _newFile;
12995
12996 int _length;
12997 13374
12998 /** 13375 /**
12999 * The offset of the name of the implemented class. 13376 * The new file path to which the given file is being moved.
13000 */ 13377 */
13001 int get offset => _offset; 13378 String get newFile => _newFile;
13002 13379
13003 /** 13380 /**
13004 * The offset of the name of the implemented class. 13381 * The new file path to which the given file is being moved.
13005 */ 13382 */
13006 void set offset(int value) { 13383 void set newFile(String value) {
13007 assert(value != null); 13384 assert(value != null);
13008 this._offset = value; 13385 this._newFile = value;
13009 } 13386 }
13010 13387
13011 /** 13388 MoveFileOptions(String newFile) {
13012 * The length of the name of the implemented class. 13389 this.newFile = newFile;
13013 */
13014 int get length => _length;
13015
13016 /**
13017 * The length of the name of the implemented class.
13018 */
13019 void set length(int value) {
13020 assert(value != null);
13021 this._length = value;
13022 } 13390 }
13023 13391
13024 ImplementedClass(int offset, int length) { 13392 factory MoveFileOptions.fromJson(
13025 this.offset = offset;
13026 this.length = length;
13027 }
13028
13029 factory ImplementedClass.fromJson(
13030 JsonDecoder jsonDecoder, String jsonPath, Object json) { 13393 JsonDecoder jsonDecoder, String jsonPath, Object json) {
13031 if (json == null) { 13394 if (json == null) {
13032 json = {}; 13395 json = {};
13033 } 13396 }
13034 if (json is Map) { 13397 if (json is Map) {
13035 int offset; 13398 String newFile;
13036 if (json.containsKey("offset")) { 13399 if (json.containsKey("newFile")) {
13037 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 13400 newFile =
13401 jsonDecoder.decodeString(jsonPath + ".newFile", json["newFile"]);
13038 } else { 13402 } else {
13039 throw jsonDecoder.missingKey(jsonPath, "offset"); 13403 throw jsonDecoder.mismatch(jsonPath, "newFile");
13040 } 13404 }
13041 int length; 13405 return new MoveFileOptions(newFile);
13042 if (json.containsKey("length")) {
13043 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
13044 } else {
13045 throw jsonDecoder.missingKey(jsonPath, "length");
13046 }
13047 return new ImplementedClass(offset, length);
13048 } else { 13406 } else {
13049 throw jsonDecoder.mismatch(jsonPath, "ImplementedClass", json); 13407 throw jsonDecoder.mismatch(jsonPath, "moveFile options", json);
13050 } 13408 }
13051 } 13409 }
13052 13410
13411 factory MoveFileOptions.fromRefactoringParams(
13412 EditGetRefactoringParams refactoringParams, Request request) {
13413 return new MoveFileOptions.fromJson(
13414 new RequestDecoder(request), "options", refactoringParams.options);
13415 }
13416
13417 @override
13053 Map<String, dynamic> toJson() { 13418 Map<String, dynamic> toJson() {
13054 Map<String, dynamic> result = {}; 13419 Map<String, dynamic> result = {};
13055 result["offset"] = offset; 13420 result["newFile"] = newFile;
13056 result["length"] = length;
13057 return result; 13421 return result;
13058 } 13422 }
13059 13423
13060 @override 13424 @override
13061 String toString() => JSON.encode(toJson()); 13425 String toString() => JSON.encode(toJson());
13062 13426
13063 @override 13427 @override
13064 bool operator ==(other) { 13428 bool operator ==(other) {
13065 if (other is ImplementedClass) { 13429 if (other is MoveFileOptions) {
13066 return offset == other.offset && length == other.length; 13430 return newFile == other.newFile;
13067 } 13431 }
13068 return false; 13432 return false;
13069 } 13433 }
13070 13434
13071 @override 13435 @override
13072 int get hashCode { 13436 int get hashCode {
13073 int hash = 0; 13437 int hash = 0;
13074 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 13438 hash = JenkinsSmiHash.combine(hash, newFile.hashCode);
13075 hash = JenkinsSmiHash.combine(hash, length.hashCode);
13076 return JenkinsSmiHash.finish(hash); 13439 return JenkinsSmiHash.finish(hash);
13077 } 13440 }
13078 } 13441 }
13079 13442
13080 /** 13443 /**
13081 * ImplementedMember 13444 * NavigationRegion
13082 * 13445 *
13083 * { 13446 * {
13084 * "offset": int 13447 * "offset": int
13085 * "length": int 13448 * "length": int
13449 * "targets": List<int>
13086 * } 13450 * }
13087 * 13451 *
13088 * Clients may not extend, implement or mix-in this class. 13452 * Clients may not extend, implement or mix-in this class.
13089 */ 13453 */
13090 class ImplementedMember implements HasToJson { 13454 class NavigationRegion implements HasToJson {
13091 int _offset; 13455 int _offset;
13092 13456
13093 int _length; 13457 int _length;
13094 13458
13459 List<int> _targets;
13460
13095 /** 13461 /**
13096 * The offset of the name of the implemented member. 13462 * The offset of the region from which the user can navigate.
13097 */ 13463 */
13098 int get offset => _offset; 13464 int get offset => _offset;
13099 13465
13100 /** 13466 /**
13101 * The offset of the name of the implemented member. 13467 * The offset of the region from which the user can navigate.
13102 */ 13468 */
13103 void set offset(int value) { 13469 void set offset(int value) {
13104 assert(value != null); 13470 assert(value != null);
13105 this._offset = value; 13471 this._offset = value;
13106 } 13472 }
13107 13473
13108 /** 13474 /**
13109 * The length of the name of the implemented member. 13475 * The length of the region from which the user can navigate.
13110 */ 13476 */
13111 int get length => _length; 13477 int get length => _length;
13112 13478
13113 /** 13479 /**
13114 * The length of the name of the implemented member. 13480 * The length of the region from which the user can navigate.
13115 */ 13481 */
13116 void set length(int value) { 13482 void set length(int value) {
13117 assert(value != null); 13483 assert(value != null);
13118 this._length = value; 13484 this._length = value;
13119 } 13485 }
13120 13486
13121 ImplementedMember(int offset, int length) { 13487 /**
13488 * The indexes of the targets (in the enclosing navigation response) to which
13489 * the given region is bound. By opening the target, clients can implement
13490 * one form of navigation. This list cannot be empty.
13491 */
13492 List<int> get targets => _targets;
13493
13494 /**
13495 * The indexes of the targets (in the enclosing navigation response) to which
13496 * the given region is bound. By opening the target, clients can implement
13497 * one form of navigation. This list cannot be empty.
13498 */
13499 void set targets(List<int> value) {
13500 assert(value != null);
13501 this._targets = value;
13502 }
13503
13504 NavigationRegion(int offset, int length, List<int> targets) {
13122 this.offset = offset; 13505 this.offset = offset;
13123 this.length = length; 13506 this.length = length;
13507 this.targets = targets;
13124 } 13508 }
13125 13509
13126 factory ImplementedMember.fromJson( 13510 factory NavigationRegion.fromJson(
13127 JsonDecoder jsonDecoder, String jsonPath, Object json) { 13511 JsonDecoder jsonDecoder, String jsonPath, Object json) {
13128 if (json == null) { 13512 if (json == null) {
13129 json = {}; 13513 json = {};
13130 } 13514 }
13131 if (json is Map) { 13515 if (json is Map) {
13132 int offset; 13516 int offset;
13133 if (json.containsKey("offset")) { 13517 if (json.containsKey("offset")) {
13134 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 13518 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
13135 } else { 13519 } else {
13136 throw jsonDecoder.missingKey(jsonPath, "offset"); 13520 throw jsonDecoder.mismatch(jsonPath, "offset");
13137 } 13521 }
13138 int length; 13522 int length;
13139 if (json.containsKey("length")) { 13523 if (json.containsKey("length")) {
13140 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); 13524 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
13141 } else { 13525 } else {
13142 throw jsonDecoder.missingKey(jsonPath, "length"); 13526 throw jsonDecoder.mismatch(jsonPath, "length");
13143 } 13527 }
13144 return new ImplementedMember(offset, length); 13528 List<int> targets;
13529 if (json.containsKey("targets")) {
13530 targets = jsonDecoder.decodeList(
13531 jsonPath + ".targets", json["targets"], jsonDecoder.decodeInt);
13532 } else {
13533 throw jsonDecoder.mismatch(jsonPath, "targets");
13534 }
13535 return new NavigationRegion(offset, length, targets);
13145 } else { 13536 } else {
13146 throw jsonDecoder.mismatch(jsonPath, "ImplementedMember", json); 13537 throw jsonDecoder.mismatch(jsonPath, "NavigationRegion", json);
13147 } 13538 }
13148 } 13539 }
13149 13540
13541 @override
13150 Map<String, dynamic> toJson() { 13542 Map<String, dynamic> toJson() {
13151 Map<String, dynamic> result = {}; 13543 Map<String, dynamic> result = {};
13152 result["offset"] = offset; 13544 result["offset"] = offset;
13153 result["length"] = length; 13545 result["length"] = length;
13546 result["targets"] = targets;
13154 return result; 13547 return result;
13155 } 13548 }
13156 13549
13157 @override 13550 @override
13158 String toString() => JSON.encode(toJson()); 13551 String toString() => JSON.encode(toJson());
13159 13552
13160 @override 13553 @override
13161 bool operator ==(other) { 13554 bool operator ==(other) {
13162 if (other is ImplementedMember) { 13555 if (other is NavigationRegion) {
13163 return offset == other.offset && length == other.length; 13556 return offset == other.offset &&
13557 length == other.length &&
13558 listEqual(targets, other.targets, (int a, int b) => a == b);
13164 } 13559 }
13165 return false; 13560 return false;
13166 } 13561 }
13167 13562
13168 @override 13563 @override
13169 int get hashCode { 13564 int get hashCode {
13170 int hash = 0; 13565 int hash = 0;
13171 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 13566 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
13172 hash = JenkinsSmiHash.combine(hash, length.hashCode); 13567 hash = JenkinsSmiHash.combine(hash, length.hashCode);
13568 hash = JenkinsSmiHash.combine(hash, targets.hashCode);
13173 return JenkinsSmiHash.finish(hash); 13569 return JenkinsSmiHash.finish(hash);
13174 } 13570 }
13175 } 13571 }
13176 13572
13177 /** 13573 /**
13178 * LinkedEditGroup 13574 * NavigationTarget
13179 * 13575 *
13180 * { 13576 * {
13181 * "positions": List<Position> 13577 * "kind": ElementKind
13578 * "fileIndex": int
13579 * "offset": int
13182 * "length": int 13580 * "length": int
13183 * "suggestions": List<LinkedEditSuggestion> 13581 * "startLine": int
13582 * "startColumn": int
13184 * } 13583 * }
13185 * 13584 *
13186 * Clients may not extend, implement or mix-in this class. 13585 * Clients may not extend, implement or mix-in this class.
13187 */ 13586 */
13188 class LinkedEditGroup implements HasToJson { 13587 class NavigationTarget implements HasToJson {
13189 List<Position> _positions; 13588 ElementKind _kind;
13589
13590 int _fileIndex;
13591
13592 int _offset;
13190 13593
13191 int _length; 13594 int _length;
13192 13595
13193 List<LinkedEditSuggestion> _suggestions; 13596 int _startLine;
13597
13598 int _startColumn;
13194 13599
13195 /** 13600 /**
13196 * The positions of the regions that should be edited simultaneously. 13601 * The kind of the element.
13197 */ 13602 */
13198 List<Position> get positions => _positions; 13603 ElementKind get kind => _kind;
13199 13604
13200 /** 13605 /**
13201 * The positions of the regions that should be edited simultaneously. 13606 * The kind of the element.
13202 */ 13607 */
13203 void set positions(List<Position> value) { 13608 void set kind(ElementKind value) {
13204 assert(value != null); 13609 assert(value != null);
13205 this._positions = value; 13610 this._kind = value;
13206 } 13611 }
13207 13612
13208 /** 13613 /**
13209 * The length of the regions that should be edited simultaneously. 13614 * The index of the file (in the enclosing navigation response) to navigate
13615 * to.
13616 */
13617 int get fileIndex => _fileIndex;
13618
13619 /**
13620 * The index of the file (in the enclosing navigation response) to navigate
13621 * to.
13622 */
13623 void set fileIndex(int value) {
13624 assert(value != null);
13625 this._fileIndex = value;
13626 }
13627
13628 /**
13629 * The offset of the region to which the user can navigate.
13630 */
13631 int get offset => _offset;
13632
13633 /**
13634 * The offset of the region to which the user can navigate.
13635 */
13636 void set offset(int value) {
13637 assert(value != null);
13638 this._offset = value;
13639 }
13640
13641 /**
13642 * The length of the region to which the user can navigate.
13210 */ 13643 */
13211 int get length => _length; 13644 int get length => _length;
13212 13645
13213 /** 13646 /**
13214 * The length of the regions that should be edited simultaneously. 13647 * The length of the region to which the user can navigate.
13215 */ 13648 */
13216 void set length(int value) { 13649 void set length(int value) {
13217 assert(value != null); 13650 assert(value != null);
13218 this._length = value; 13651 this._length = value;
13219 } 13652 }
13220 13653
13221 /** 13654 /**
13222 * Pre-computed suggestions for what every region might want to be changed 13655 * The one-based index of the line containing the first character of the
13223 * to. 13656 * region.
13224 */ 13657 */
13225 List<LinkedEditSuggestion> get suggestions => _suggestions; 13658 int get startLine => _startLine;
13226 13659
13227 /** 13660 /**
13228 * Pre-computed suggestions for what every region might want to be changed 13661 * The one-based index of the line containing the first character of the
13229 * to. 13662 * region.
13230 */ 13663 */
13231 void set suggestions(List<LinkedEditSuggestion> value) { 13664 void set startLine(int value) {
13232 assert(value != null); 13665 assert(value != null);
13233 this._suggestions = value; 13666 this._startLine = value;
13234 } 13667 }
13235 13668
13236 LinkedEditGroup(List<Position> positions, int length, 13669 /**
13237 List<LinkedEditSuggestion> suggestions) { 13670 * The one-based index of the column containing the first character of the
13238 this.positions = positions; 13671 * region.
13239 this.length = length; 13672 */
13240 this.suggestions = suggestions; 13673 int get startColumn => _startColumn;
13674
13675 /**
13676 * The one-based index of the column containing the first character of the
13677 * region.
13678 */
13679 void set startColumn(int value) {
13680 assert(value != null);
13681 this._startColumn = value;
13241 } 13682 }
13242 13683
13243 factory LinkedEditGroup.fromJson( 13684 NavigationTarget(ElementKind kind, int fileIndex, int offset, int length,
13685 int startLine, int startColumn) {
13686 this.kind = kind;
13687 this.fileIndex = fileIndex;
13688 this.offset = offset;
13689 this.length = length;
13690 this.startLine = startLine;
13691 this.startColumn = startColumn;
13692 }
13693
13694 factory NavigationTarget.fromJson(
13244 JsonDecoder jsonDecoder, String jsonPath, Object json) { 13695 JsonDecoder jsonDecoder, String jsonPath, Object json) {
13245 if (json == null) { 13696 if (json == null) {
13246 json = {}; 13697 json = {};
13247 } 13698 }
13248 if (json is Map) { 13699 if (json is Map) {
13249 List<Position> positions; 13700 ElementKind kind;
13250 if (json.containsKey("positions")) { 13701 if (json.containsKey("kind")) {
13251 positions = jsonDecoder.decodeList( 13702 kind = new ElementKind.fromJson(
13252 jsonPath + ".positions", 13703 jsonDecoder, jsonPath + ".kind", json["kind"]);
13253 json["positions"],
13254 (String jsonPath, Object json) =>
13255 new Position.fromJson(jsonDecoder, jsonPath, json));
13256 } else { 13704 } else {
13257 throw jsonDecoder.missingKey(jsonPath, "positions"); 13705 throw jsonDecoder.mismatch(jsonPath, "kind");
13706 }
13707 int fileIndex;
13708 if (json.containsKey("fileIndex")) {
13709 fileIndex =
13710 jsonDecoder.decodeInt(jsonPath + ".fileIndex", json["fileIndex"]);
13711 } else {
13712 throw jsonDecoder.mismatch(jsonPath, "fileIndex");
13713 }
13714 int offset;
13715 if (json.containsKey("offset")) {
13716 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
13717 } else {
13718 throw jsonDecoder.mismatch(jsonPath, "offset");
13258 } 13719 }
13259 int length; 13720 int length;
13260 if (json.containsKey("length")) { 13721 if (json.containsKey("length")) {
13261 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); 13722 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
13262 } else { 13723 } else {
13263 throw jsonDecoder.missingKey(jsonPath, "length"); 13724 throw jsonDecoder.mismatch(jsonPath, "length");
13264 } 13725 }
13265 List<LinkedEditSuggestion> suggestions; 13726 int startLine;
13266 if (json.containsKey("suggestions")) { 13727 if (json.containsKey("startLine")) {
13267 suggestions = jsonDecoder.decodeList( 13728 startLine =
13268 jsonPath + ".suggestions", 13729 jsonDecoder.decodeInt(jsonPath + ".startLine", json["startLine"]);
13269 json["suggestions"],
13270 (String jsonPath, Object json) =>
13271 new LinkedEditSuggestion.fromJson(jsonDecoder, jsonPath, json));
13272 } else { 13730 } else {
13273 throw jsonDecoder.missingKey(jsonPath, "suggestions"); 13731 throw jsonDecoder.mismatch(jsonPath, "startLine");
13274 } 13732 }
13275 return new LinkedEditGroup(positions, length, suggestions); 13733 int startColumn;
13734 if (json.containsKey("startColumn")) {
13735 startColumn = jsonDecoder.decodeInt(
13736 jsonPath + ".startColumn", json["startColumn"]);
13737 } else {
13738 throw jsonDecoder.mismatch(jsonPath, "startColumn");
13739 }
13740 return new NavigationTarget(
13741 kind, fileIndex, offset, length, startLine, startColumn);
13276 } else { 13742 } else {
13277 throw jsonDecoder.mismatch(jsonPath, "LinkedEditGroup", json); 13743 throw jsonDecoder.mismatch(jsonPath, "NavigationTarget", json);
13278 } 13744 }
13279 } 13745 }
13280 13746
13281 /** 13747 @override
13282 * Construct an empty LinkedEditGroup.
13283 */
13284 LinkedEditGroup.empty() : this(<Position>[], 0, <LinkedEditSuggestion>[]);
13285
13286 Map<String, dynamic> toJson() { 13748 Map<String, dynamic> toJson() {
13287 Map<String, dynamic> result = {}; 13749 Map<String, dynamic> result = {};
13288 result["positions"] = 13750 result["kind"] = kind.toJson();
13289 positions.map((Position value) => value.toJson()).toList(); 13751 result["fileIndex"] = fileIndex;
13752 result["offset"] = offset;
13290 result["length"] = length; 13753 result["length"] = length;
13291 result["suggestions"] = suggestions 13754 result["startLine"] = startLine;
13292 .map((LinkedEditSuggestion value) => value.toJson()) 13755 result["startColumn"] = startColumn;
13293 .toList();
13294 return result; 13756 return result;
13295 } 13757 }
13296 13758
13297 /**
13298 * Add a new position and change the length.
13299 */
13300 void addPosition(Position position, int length) {
13301 positions.add(position);
13302 this.length = length;
13303 }
13304
13305 /**
13306 * Add a new suggestion.
13307 */
13308 void addSuggestion(LinkedEditSuggestion suggestion) {
13309 suggestions.add(suggestion);
13310 }
13311
13312 @override 13759 @override
13313 String toString() => JSON.encode(toJson()); 13760 String toString() => JSON.encode(toJson());
13314 13761
13315 @override 13762 @override
13316 bool operator ==(other) { 13763 bool operator ==(other) {
13317 if (other is LinkedEditGroup) { 13764 if (other is NavigationTarget) {
13318 return listEqual( 13765 return kind == other.kind &&
13319 positions, other.positions, (Position a, Position b) => a == b) && 13766 fileIndex == other.fileIndex &&
13767 offset == other.offset &&
13320 length == other.length && 13768 length == other.length &&
13321 listEqual(suggestions, other.suggestions, 13769 startLine == other.startLine &&
13322 (LinkedEditSuggestion a, LinkedEditSuggestion b) => a == b); 13770 startColumn == other.startColumn;
13323 } 13771 }
13324 return false; 13772 return false;
13325 } 13773 }
13326 13774
13327 @override 13775 @override
13328 int get hashCode { 13776 int get hashCode {
13329 int hash = 0; 13777 int hash = 0;
13330 hash = JenkinsSmiHash.combine(hash, positions.hashCode); 13778 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
13779 hash = JenkinsSmiHash.combine(hash, fileIndex.hashCode);
13780 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
13331 hash = JenkinsSmiHash.combine(hash, length.hashCode); 13781 hash = JenkinsSmiHash.combine(hash, length.hashCode);
13332 hash = JenkinsSmiHash.combine(hash, suggestions.hashCode); 13782 hash = JenkinsSmiHash.combine(hash, startLine.hashCode);
13783 hash = JenkinsSmiHash.combine(hash, startColumn.hashCode);
13333 return JenkinsSmiHash.finish(hash); 13784 return JenkinsSmiHash.finish(hash);
13334 } 13785 }
13335 } 13786 }
13336 13787
13337 /** 13788 /**
13338 * LinkedEditSuggestion 13789 * Occurrences
13339 * 13790 *
13340 * { 13791 * {
13341 * "value": String 13792 * "element": Element
13342 * "kind": LinkedEditSuggestionKind 13793 * "offsets": List<int>
13794 * "length": int
13343 * } 13795 * }
13344 * 13796 *
13345 * Clients may not extend, implement or mix-in this class. 13797 * Clients may not extend, implement or mix-in this class.
13346 */ 13798 */
13347 class LinkedEditSuggestion implements HasToJson { 13799 class Occurrences implements HasToJson {
13348 String _value; 13800 Element _element;
13349 13801
13350 LinkedEditSuggestionKind _kind; 13802 List<int> _offsets;
13803
13804 int _length;
13351 13805
13352 /** 13806 /**
13353 * The value that could be used to replace all of the linked edit regions. 13807 * The element that was referenced.
13354 */ 13808 */
13355 String get value => _value; 13809 Element get element => _element;
13356 13810
13357 /** 13811 /**
13358 * The value that could be used to replace all of the linked edit regions. 13812 * The element that was referenced.
13359 */ 13813 */
13360 void set value(String value) { 13814 void set element(Element value) {
13361 assert(value != null); 13815 assert(value != null);
13362 this._value = value; 13816 this._element = value;
13363 } 13817 }
13364 13818
13365 /** 13819 /**
13366 * The kind of value being proposed. 13820 * The offsets of the name of the referenced element within the file.
13367 */ 13821 */
13368 LinkedEditSuggestionKind get kind => _kind; 13822 List<int> get offsets => _offsets;
13369 13823
13370 /** 13824 /**
13371 * The kind of value being proposed. 13825 * The offsets of the name of the referenced element within the file.
13372 */ 13826 */
13373 void set kind(LinkedEditSuggestionKind value) { 13827 void set offsets(List<int> value) {
13374 assert(value != null); 13828 assert(value != null);
13375 this._kind = value; 13829 this._offsets = value;
13376 } 13830 }
13377 13831
13378 LinkedEditSuggestion(String value, LinkedEditSuggestionKind kind) { 13832 /**
13379 this.value = value; 13833 * The length of the name of the referenced element.
13380 this.kind = kind; 13834 */
13835 int get length => _length;
13836
13837 /**
13838 * The length of the name of the referenced element.
13839 */
13840 void set length(int value) {
13841 assert(value != null);
13842 this._length = value;
13381 } 13843 }
13382 13844
13383 factory LinkedEditSuggestion.fromJson( 13845 Occurrences(Element element, List<int> offsets, int length) {
13846 this.element = element;
13847 this.offsets = offsets;
13848 this.length = length;
13849 }
13850
13851 factory Occurrences.fromJson(
13384 JsonDecoder jsonDecoder, String jsonPath, Object json) { 13852 JsonDecoder jsonDecoder, String jsonPath, Object json) {
13385 if (json == null) { 13853 if (json == null) {
13386 json = {}; 13854 json = {};
13387 } 13855 }
13388 if (json is Map) { 13856 if (json is Map) {
13389 String value; 13857 Element element;
13390 if (json.containsKey("value")) { 13858 if (json.containsKey("element")) {
13391 value = jsonDecoder.decodeString(jsonPath + ".value", json["value"]); 13859 element = new Element.fromJson(
13860 jsonDecoder, jsonPath + ".element", json["element"]);
13392 } else { 13861 } else {
13393 throw jsonDecoder.missingKey(jsonPath, "value"); 13862 throw jsonDecoder.mismatch(jsonPath, "element");
13394 } 13863 }
13395 LinkedEditSuggestionKind kind; 13864 List<int> offsets;
13396 if (json.containsKey("kind")) { 13865 if (json.containsKey("offsets")) {
13397 kind = new LinkedEditSuggestionKind.fromJson( 13866 offsets = jsonDecoder.decodeList(
13398 jsonDecoder, jsonPath + ".kind", json["kind"]); 13867 jsonPath + ".offsets", json["offsets"], jsonDecoder.decodeInt);
13399 } else { 13868 } else {
13400 throw jsonDecoder.missingKey(jsonPath, "kind"); 13869 throw jsonDecoder.mismatch(jsonPath, "offsets");
13401 } 13870 }
13402 return new LinkedEditSuggestion(value, kind); 13871 int length;
13872 if (json.containsKey("length")) {
13873 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
13874 } else {
13875 throw jsonDecoder.mismatch(jsonPath, "length");
13876 }
13877 return new Occurrences(element, offsets, length);
13403 } else { 13878 } else {
13404 throw jsonDecoder.mismatch(jsonPath, "LinkedEditSuggestion", json); 13879 throw jsonDecoder.mismatch(jsonPath, "Occurrences", json);
13405 } 13880 }
13406 } 13881 }
13407 13882
13883 @override
13408 Map<String, dynamic> toJson() { 13884 Map<String, dynamic> toJson() {
13409 Map<String, dynamic> result = {}; 13885 Map<String, dynamic> result = {};
13410 result["value"] = value; 13886 result["element"] = element.toJson();
13411 result["kind"] = kind.toJson(); 13887 result["offsets"] = offsets;
13888 result["length"] = length;
13412 return result; 13889 return result;
13413 } 13890 }
13414 13891
13415 @override 13892 @override
13416 String toString() => JSON.encode(toJson()); 13893 String toString() => JSON.encode(toJson());
13417 13894
13418 @override 13895 @override
13419 bool operator ==(other) { 13896 bool operator ==(other) {
13420 if (other is LinkedEditSuggestion) { 13897 if (other is Occurrences) {
13421 return value == other.value && kind == other.kind; 13898 return element == other.element &&
13899 listEqual(offsets, other.offsets, (int a, int b) => a == b) &&
13900 length == other.length;
13422 } 13901 }
13423 return false; 13902 return false;
13424 } 13903 }
13425 13904
13426 @override 13905 @override
13427 int get hashCode { 13906 int get hashCode {
13428 int hash = 0; 13907 int hash = 0;
13429 hash = JenkinsSmiHash.combine(hash, value.hashCode); 13908 hash = JenkinsSmiHash.combine(hash, element.hashCode);
13430 hash = JenkinsSmiHash.combine(hash, kind.hashCode); 13909 hash = JenkinsSmiHash.combine(hash, offsets.hashCode);
13910 hash = JenkinsSmiHash.combine(hash, length.hashCode);
13431 return JenkinsSmiHash.finish(hash); 13911 return JenkinsSmiHash.finish(hash);
13432 } 13912 }
13433 } 13913 }
13434 13914
13435 /** 13915 /**
13436 * LinkedEditSuggestionKind 13916 * Outline
13437 * 13917 *
13438 * enum { 13918 * {
13439 * METHOD 13919 * "element": Element
13440 * PARAMETER 13920 * "offset": int
13441 * TYPE 13921 * "length": int
13442 * VARIABLE 13922 * "children": optional List<Outline>
13443 * } 13923 * }
13444 * 13924 *
13445 * Clients may not extend, implement or mix-in this class. 13925 * Clients may not extend, implement or mix-in this class.
13446 */ 13926 */
13447 class LinkedEditSuggestionKind implements Enum { 13927 class Outline implements HasToJson {
13448 static const LinkedEditSuggestionKind METHOD = 13928 Element _element;
13449 const LinkedEditSuggestionKind._("METHOD");
13450
13451 static const LinkedEditSuggestionKind PARAMETER =
13452 const LinkedEditSuggestionKind._("PARAMETER");
13453
13454 static const LinkedEditSuggestionKind TYPE =
13455 const LinkedEditSuggestionKind._("TYPE");
13456
13457 static const LinkedEditSuggestionKind VARIABLE =
13458 const LinkedEditSuggestionKind._("VARIABLE");
13459
13460 /**
13461 * A list containing all of the enum values that are defined.
13462 */
13463 static const List<LinkedEditSuggestionKind> VALUES =
13464 const <LinkedEditSuggestionKind>[METHOD, PARAMETER, TYPE, VARIABLE];
13465
13466 final String name;
13467
13468 const LinkedEditSuggestionKind._(this.name);
13469
13470 factory LinkedEditSuggestionKind(String name) {
13471 switch (name) {
13472 case "METHOD":
13473 return METHOD;
13474 case "PARAMETER":
13475 return PARAMETER;
13476 case "TYPE":
13477 return TYPE;
13478 case "VARIABLE":
13479 return VARIABLE;
13480 }
13481 throw new Exception('Illegal enum value: $name');
13482 }
13483
13484 factory LinkedEditSuggestionKind.fromJson(
13485 JsonDecoder jsonDecoder, String jsonPath, Object json) {
13486 if (json is String) {
13487 try {
13488 return new LinkedEditSuggestionKind(json);
13489 } catch (_) {
13490 // Fall through
13491 }
13492 }
13493 throw jsonDecoder.mismatch(jsonPath, "LinkedEditSuggestionKind", json);
13494 }
13495
13496 @override
13497 String toString() => "LinkedEditSuggestionKind.$name";
13498
13499 String toJson() => name;
13500 }
13501
13502 /**
13503 * Location
13504 *
13505 * {
13506 * "file": FilePath
13507 * "offset": int
13508 * "length": int
13509 * "startLine": int
13510 * "startColumn": int
13511 * }
13512 *
13513 * Clients may not extend, implement or mix-in this class.
13514 */
13515 class Location implements HasToJson {
13516 String _file;
13517 13929
13518 int _offset; 13930 int _offset;
13519 13931
13520 int _length; 13932 int _length;
13521 13933
13522 int _startLine; 13934 List<Outline> _children;
13523
13524 int _startColumn;
13525 13935
13526 /** 13936 /**
13527 * The file containing the range. 13937 * A description of the element represented by this node.
13528 */ 13938 */
13529 String get file => _file; 13939 Element get element => _element;
13530 13940
13531 /** 13941 /**
13532 * The file containing the range. 13942 * A description of the element represented by this node.
13533 */ 13943 */
13534 void set file(String value) { 13944 void set element(Element value) {
13535 assert(value != null); 13945 assert(value != null);
13536 this._file = value; 13946 this._element = value;
13537 } 13947 }
13538 13948
13539 /** 13949 /**
13540 * The offset of the range. 13950 * The offset of the first character of the element. This is different than
13951 * the offset in the Element, which if the offset of the name of the element.
13952 * It can be used, for example, to map locations in the file back to an
13953 * outline.
13541 */ 13954 */
13542 int get offset => _offset; 13955 int get offset => _offset;
13543 13956
13544 /** 13957 /**
13545 * The offset of the range. 13958 * The offset of the first character of the element. This is different than
13959 * the offset in the Element, which if the offset of the name of the element.
13960 * It can be used, for example, to map locations in the file back to an
13961 * outline.
13546 */ 13962 */
13547 void set offset(int value) { 13963 void set offset(int value) {
13548 assert(value != null); 13964 assert(value != null);
13549 this._offset = value; 13965 this._offset = value;
13550 } 13966 }
13551 13967
13552 /** 13968 /**
13553 * The length of the range. 13969 * The length of the element.
13554 */ 13970 */
13555 int get length => _length; 13971 int get length => _length;
13556 13972
13557 /** 13973 /**
13558 * The length of the range. 13974 * The length of the element.
13559 */ 13975 */
13560 void set length(int value) { 13976 void set length(int value) {
13561 assert(value != null); 13977 assert(value != null);
13562 this._length = value; 13978 this._length = value;
13563 } 13979 }
13564 13980
13565 /** 13981 /**
13566 * The one-based index of the line containing the first character of the 13982 * The children of the node. The field will be omitted if the node has no
13567 * range. 13983 * children.
13568 */ 13984 */
13569 int get startLine => _startLine; 13985 List<Outline> get children => _children;
13570 13986
13571 /** 13987 /**
13572 * The one-based index of the line containing the first character of the 13988 * The children of the node. The field will be omitted if the node has no
13573 * range. 13989 * children.
13574 */ 13990 */
13575 void set startLine(int value) { 13991 void set children(List<Outline> value) {
13576 assert(value != null); 13992 this._children = value;
13577 this._startLine = value;
13578 } 13993 }
13579 13994
13580 /** 13995 Outline(Element element, int offset, int length, {List<Outline> children}) {
13581 * The one-based index of the column containing the first character of the 13996 this.element = element;
13582 * range. 13997 this.offset = offset;
13583 */ 13998 this.length = length;
13584 int get startColumn => _startColumn; 13999 this.children = children;
13585
13586 /**
13587 * The one-based index of the column containing the first character of the
13588 * range.
13589 */
13590 void set startColumn(int value) {
13591 assert(value != null);
13592 this._startColumn = value;
13593 } 14000 }
13594 14001
13595 Location( 14002 factory Outline.fromJson(
13596 String file, int offset, int length, int startLine, int startColumn) {
13597 this.file = file;
13598 this.offset = offset;
13599 this.length = length;
13600 this.startLine = startLine;
13601 this.startColumn = startColumn;
13602 }
13603
13604 factory Location.fromJson(
13605 JsonDecoder jsonDecoder, String jsonPath, Object json) { 14003 JsonDecoder jsonDecoder, String jsonPath, Object json) {
13606 if (json == null) { 14004 if (json == null) {
13607 json = {}; 14005 json = {};
13608 } 14006 }
13609 if (json is Map) { 14007 if (json is Map) {
13610 String file; 14008 Element element;
13611 if (json.containsKey("file")) { 14009 if (json.containsKey("element")) {
13612 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 14010 element = new Element.fromJson(
14011 jsonDecoder, jsonPath + ".element", json["element"]);
13613 } else { 14012 } else {
13614 throw jsonDecoder.missingKey(jsonPath, "file"); 14013 throw jsonDecoder.mismatch(jsonPath, "element");
13615 } 14014 }
13616 int offset; 14015 int offset;
13617 if (json.containsKey("offset")) { 14016 if (json.containsKey("offset")) {
13618 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 14017 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
13619 } else { 14018 } else {
13620 throw jsonDecoder.missingKey(jsonPath, "offset"); 14019 throw jsonDecoder.mismatch(jsonPath, "offset");
13621 } 14020 }
13622 int length; 14021 int length;
13623 if (json.containsKey("length")) { 14022 if (json.containsKey("length")) {
13624 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); 14023 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
13625 } else { 14024 } else {
13626 throw jsonDecoder.missingKey(jsonPath, "length"); 14025 throw jsonDecoder.mismatch(jsonPath, "length");
13627 } 14026 }
13628 int startLine; 14027 List<Outline> children;
13629 if (json.containsKey("startLine")) { 14028 if (json.containsKey("children")) {
13630 startLine = 14029 children = jsonDecoder.decodeList(
13631 jsonDecoder.decodeInt(jsonPath + ".startLine", json["startLine"]); 14030 jsonPath + ".children",
13632 } else { 14031 json["children"],
13633 throw jsonDecoder.missingKey(jsonPath, "startLine"); 14032 (String jsonPath, Object json) =>
14033 new Outline.fromJson(jsonDecoder, jsonPath, json));
13634 } 14034 }
13635 int startColumn; 14035 return new Outline(element, offset, length, children: children);
13636 if (json.containsKey("startColumn")) {
13637 startColumn = jsonDecoder.decodeInt(
13638 jsonPath + ".startColumn", json["startColumn"]);
13639 } else {
13640 throw jsonDecoder.missingKey(jsonPath, "startColumn");
13641 }
13642 return new Location(file, offset, length, startLine, startColumn);
13643 } else { 14036 } else {
13644 throw jsonDecoder.mismatch(jsonPath, "Location", json); 14037 throw jsonDecoder.mismatch(jsonPath, "Outline", json);
13645 } 14038 }
13646 } 14039 }
13647 14040
14041 @override
13648 Map<String, dynamic> toJson() { 14042 Map<String, dynamic> toJson() {
13649 Map<String, dynamic> result = {}; 14043 Map<String, dynamic> result = {};
13650 result["file"] = file; 14044 result["element"] = element.toJson();
13651 result["offset"] = offset; 14045 result["offset"] = offset;
13652 result["length"] = length; 14046 result["length"] = length;
13653 result["startLine"] = startLine; 14047 if (children != null) {
13654 result["startColumn"] = startColumn; 14048 result["children"] =
14049 children.map((Outline value) => value.toJson()).toList();
14050 }
13655 return result; 14051 return result;
13656 } 14052 }
13657 14053
13658 @override 14054 @override
13659 String toString() => JSON.encode(toJson()); 14055 String toString() => JSON.encode(toJson());
13660 14056
13661 @override 14057 @override
13662 bool operator ==(other) { 14058 bool operator ==(other) {
13663 if (other is Location) { 14059 if (other is Outline) {
13664 return file == other.file && 14060 return element == other.element &&
13665 offset == other.offset && 14061 offset == other.offset &&
13666 length == other.length && 14062 length == other.length &&
13667 startLine == other.startLine && 14063 listEqual(children, other.children, (Outline a, Outline b) => a == b);
13668 startColumn == other.startColumn;
13669 } 14064 }
13670 return false; 14065 return false;
13671 } 14066 }
13672 14067
13673 @override 14068 @override
13674 int get hashCode { 14069 int get hashCode {
13675 int hash = 0; 14070 int hash = 0;
13676 hash = JenkinsSmiHash.combine(hash, file.hashCode); 14071 hash = JenkinsSmiHash.combine(hash, element.hashCode);
13677 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 14072 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
13678 hash = JenkinsSmiHash.combine(hash, length.hashCode); 14073 hash = JenkinsSmiHash.combine(hash, length.hashCode);
13679 hash = JenkinsSmiHash.combine(hash, startLine.hashCode); 14074 hash = JenkinsSmiHash.combine(hash, children.hashCode);
13680 hash = JenkinsSmiHash.combine(hash, startColumn.hashCode);
13681 return JenkinsSmiHash.finish(hash); 14075 return JenkinsSmiHash.finish(hash);
13682 } 14076 }
13683 } 14077 }
13684 14078
13685 /** 14079 /**
13686 * NavigationRegion 14080 * OverriddenMember
13687 * 14081 *
13688 * { 14082 * {
13689 * "offset": int 14083 * "element": Element
13690 * "length": int 14084 * "className": String
13691 * "targets": List<int>
13692 * } 14085 * }
13693 * 14086 *
13694 * Clients may not extend, implement or mix-in this class. 14087 * Clients may not extend, implement or mix-in this class.
13695 */ 14088 */
13696 class NavigationRegion implements HasToJson { 14089 class OverriddenMember implements HasToJson {
13697 int _offset; 14090 Element _element;
13698 14091
13699 int _length; 14092 String _className;
13700
13701 List<int> _targets;
13702 14093
13703 /** 14094 /**
13704 * The offset of the region from which the user can navigate. 14095 * The element that is being overridden.
13705 */ 14096 */
13706 int get offset => _offset; 14097 Element get element => _element;
13707 14098
13708 /** 14099 /**
13709 * The offset of the region from which the user can navigate. 14100 * The element that is being overridden.
13710 */ 14101 */
13711 void set offset(int value) { 14102 void set element(Element value) {
13712 assert(value != null); 14103 assert(value != null);
13713 this._offset = value; 14104 this._element = value;
13714 } 14105 }
13715 14106
13716 /** 14107 /**
13717 * The length of the region from which the user can navigate. 14108 * The name of the class in which the member is defined.
13718 */ 14109 */
13719 int get length => _length; 14110 String get className => _className;
13720 14111
13721 /** 14112 /**
13722 * The length of the region from which the user can navigate. 14113 * The name of the class in which the member is defined.
13723 */ 14114 */
13724 void set length(int value) { 14115 void set className(String value) {
13725 assert(value != null); 14116 assert(value != null);
13726 this._length = value; 14117 this._className = value;
13727 } 14118 }
13728 14119
13729 /** 14120 OverriddenMember(Element element, String className) {
13730 * The indexes of the targets (in the enclosing navigation response) to which 14121 this.element = element;
13731 * the given region is bound. By opening the target, clients can implement 14122 this.className = className;
13732 * one form of navigation. This list cannot be empty.
13733 */
13734 List<int> get targets => _targets;
13735
13736 /**
13737 * The indexes of the targets (in the enclosing navigation response) to which
13738 * the given region is bound. By opening the target, clients can implement
13739 * one form of navigation. This list cannot be empty.
13740 */
13741 void set targets(List<int> value) {
13742 assert(value != null);
13743 this._targets = value;
13744 } 14123 }
13745 14124
13746 NavigationRegion(int offset, int length, List<int> targets) { 14125 factory OverriddenMember.fromJson(
13747 this.offset = offset;
13748 this.length = length;
13749 this.targets = targets;
13750 }
13751
13752 factory NavigationRegion.fromJson(
13753 JsonDecoder jsonDecoder, String jsonPath, Object json) { 14126 JsonDecoder jsonDecoder, String jsonPath, Object json) {
13754 if (json == null) { 14127 if (json == null) {
13755 json = {}; 14128 json = {};
13756 } 14129 }
13757 if (json is Map) { 14130 if (json is Map) {
13758 int offset; 14131 Element element;
13759 if (json.containsKey("offset")) { 14132 if (json.containsKey("element")) {
13760 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 14133 element = new Element.fromJson(
14134 jsonDecoder, jsonPath + ".element", json["element"]);
13761 } else { 14135 } else {
13762 throw jsonDecoder.missingKey(jsonPath, "offset"); 14136 throw jsonDecoder.mismatch(jsonPath, "element");
13763 } 14137 }
13764 int length; 14138 String className;
13765 if (json.containsKey("length")) { 14139 if (json.containsKey("className")) {
13766 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); 14140 className = jsonDecoder.decodeString(
14141 jsonPath + ".className", json["className"]);
13767 } else { 14142 } else {
13768 throw jsonDecoder.missingKey(jsonPath, "length"); 14143 throw jsonDecoder.mismatch(jsonPath, "className");
13769 } 14144 }
13770 List<int> targets; 14145 return new OverriddenMember(element, className);
13771 if (json.containsKey("targets")) {
13772 targets = jsonDecoder.decodeList(
13773 jsonPath + ".targets", json["targets"], jsonDecoder.decodeInt);
13774 } else {
13775 throw jsonDecoder.missingKey(jsonPath, "targets");
13776 }
13777 return new NavigationRegion(offset, length, targets);
13778 } else { 14146 } else {
13779 throw jsonDecoder.mismatch(jsonPath, "NavigationRegion", json); 14147 throw jsonDecoder.mismatch(jsonPath, "OverriddenMember", json);
13780 } 14148 }
13781 } 14149 }
13782 14150
14151 @override
13783 Map<String, dynamic> toJson() { 14152 Map<String, dynamic> toJson() {
13784 Map<String, dynamic> result = {}; 14153 Map<String, dynamic> result = {};
13785 result["offset"] = offset; 14154 result["element"] = element.toJson();
13786 result["length"] = length; 14155 result["className"] = className;
13787 result["targets"] = targets;
13788 return result; 14156 return result;
13789 } 14157 }
13790 14158
13791 @override 14159 @override
13792 String toString() => JSON.encode(toJson()); 14160 String toString() => JSON.encode(toJson());
13793 14161
13794 @override 14162 @override
13795 bool operator ==(other) { 14163 bool operator ==(other) {
13796 if (other is NavigationRegion) { 14164 if (other is OverriddenMember) {
13797 return offset == other.offset && 14165 return element == other.element && className == other.className;
13798 length == other.length &&
13799 listEqual(targets, other.targets, (int a, int b) => a == b);
13800 } 14166 }
13801 return false; 14167 return false;
13802 } 14168 }
13803 14169
13804 @override 14170 @override
13805 int get hashCode { 14171 int get hashCode {
13806 int hash = 0; 14172 int hash = 0;
13807 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 14173 hash = JenkinsSmiHash.combine(hash, element.hashCode);
13808 hash = JenkinsSmiHash.combine(hash, length.hashCode); 14174 hash = JenkinsSmiHash.combine(hash, className.hashCode);
13809 hash = JenkinsSmiHash.combine(hash, targets.hashCode);
13810 return JenkinsSmiHash.finish(hash); 14175 return JenkinsSmiHash.finish(hash);
13811 } 14176 }
13812 } 14177 }
13813 14178
13814 /** 14179 /**
13815 * NavigationTarget 14180 * Override
13816 * 14181 *
13817 * { 14182 * {
13818 * "kind": ElementKind
13819 * "fileIndex": int
13820 * "offset": int 14183 * "offset": int
13821 * "length": int 14184 * "length": int
13822 * "startLine": int 14185 * "superclassMember": optional OverriddenMember
13823 * "startColumn": int 14186 * "interfaceMembers": optional List<OverriddenMember>
13824 * } 14187 * }
13825 * 14188 *
13826 * Clients may not extend, implement or mix-in this class. 14189 * Clients may not extend, implement or mix-in this class.
13827 */ 14190 */
13828 class NavigationTarget implements HasToJson { 14191 class Override implements HasToJson {
13829 ElementKind _kind;
13830
13831 int _fileIndex;
13832
13833 int _offset; 14192 int _offset;
13834 14193
13835 int _length; 14194 int _length;
13836 14195
13837 int _startLine; 14196 OverriddenMember _superclassMember;
13838 14197
13839 int _startColumn; 14198 List<OverriddenMember> _interfaceMembers;
13840 14199
13841 /** 14200 /**
13842 * The kind of the element. 14201 * The offset of the name of the overriding member.
13843 */
13844 ElementKind get kind => _kind;
13845
13846 /**
13847 * The kind of the element.
13848 */
13849 void set kind(ElementKind value) {
13850 assert(value != null);
13851 this._kind = value;
13852 }
13853
13854 /**
13855 * The index of the file (in the enclosing navigation response) to navigate
13856 * to.
13857 */
13858 int get fileIndex => _fileIndex;
13859
13860 /**
13861 * The index of the file (in the enclosing navigation response) to navigate
13862 * to.
13863 */
13864 void set fileIndex(int value) {
13865 assert(value != null);
13866 this._fileIndex = value;
13867 }
13868
13869 /**
13870 * The offset of the region to which the user can navigate.
13871 */ 14202 */
13872 int get offset => _offset; 14203 int get offset => _offset;
13873 14204
13874 /** 14205 /**
13875 * The offset of the region to which the user can navigate. 14206 * The offset of the name of the overriding member.
13876 */ 14207 */
13877 void set offset(int value) { 14208 void set offset(int value) {
13878 assert(value != null); 14209 assert(value != null);
13879 this._offset = value; 14210 this._offset = value;
13880 } 14211 }
13881 14212
13882 /** 14213 /**
13883 * The length of the region to which the user can navigate. 14214 * The length of the name of the overriding member.
13884 */ 14215 */
13885 int get length => _length; 14216 int get length => _length;
13886 14217
13887 /** 14218 /**
13888 * The length of the region to which the user can navigate. 14219 * The length of the name of the overriding member.
13889 */ 14220 */
13890 void set length(int value) { 14221 void set length(int value) {
13891 assert(value != null); 14222 assert(value != null);
13892 this._length = value; 14223 this._length = value;
13893 } 14224 }
13894 14225
13895 /** 14226 /**
13896 * The one-based index of the line containing the first character of the 14227 * The member inherited from a superclass that is overridden by the
13897 * region. 14228 * overriding member. The field is omitted if there is no superclass member,
14229 * in which case there must be at least one interface member.
13898 */ 14230 */
13899 int get startLine => _startLine; 14231 OverriddenMember get superclassMember => _superclassMember;
13900 14232
13901 /** 14233 /**
13902 * The one-based index of the line containing the first character of the 14234 * The member inherited from a superclass that is overridden by the
13903 * region. 14235 * overriding member. The field is omitted if there is no superclass member,
14236 * in which case there must be at least one interface member.
13904 */ 14237 */
13905 void set startLine(int value) { 14238 void set superclassMember(OverriddenMember value) {
13906 assert(value != null); 14239 this._superclassMember = value;
13907 this._startLine = value;
13908 } 14240 }
13909 14241
13910 /** 14242 /**
13911 * The one-based index of the column containing the first character of the 14243 * The members inherited from interfaces that are overridden by the
13912 * region. 14244 * overriding member. The field is omitted if there are no interface members,
14245 * in which case there must be a superclass member.
13913 */ 14246 */
13914 int get startColumn => _startColumn; 14247 List<OverriddenMember> get interfaceMembers => _interfaceMembers;
13915 14248
13916 /** 14249 /**
13917 * The one-based index of the column containing the first character of the 14250 * The members inherited from interfaces that are overridden by the
13918 * region. 14251 * overriding member. The field is omitted if there are no interface members,
14252 * in which case there must be a superclass member.
13919 */ 14253 */
13920 void set startColumn(int value) { 14254 void set interfaceMembers(List<OverriddenMember> value) {
13921 assert(value != null); 14255 this._interfaceMembers = value;
13922 this._startColumn = value;
13923 } 14256 }
13924 14257
13925 NavigationTarget(ElementKind kind, int fileIndex, int offset, int length, 14258 Override(int offset, int length,
13926 int startLine, int startColumn) { 14259 {OverriddenMember superclassMember,
13927 this.kind = kind; 14260 List<OverriddenMember> interfaceMembers}) {
13928 this.fileIndex = fileIndex;
13929 this.offset = offset; 14261 this.offset = offset;
13930 this.length = length; 14262 this.length = length;
13931 this.startLine = startLine; 14263 this.superclassMember = superclassMember;
13932 this.startColumn = startColumn; 14264 this.interfaceMembers = interfaceMembers;
13933 } 14265 }
13934 14266
13935 factory NavigationTarget.fromJson( 14267 factory Override.fromJson(
13936 JsonDecoder jsonDecoder, String jsonPath, Object json) { 14268 JsonDecoder jsonDecoder, String jsonPath, Object json) {
13937 if (json == null) { 14269 if (json == null) {
13938 json = {}; 14270 json = {};
13939 } 14271 }
13940 if (json is Map) { 14272 if (json is Map) {
13941 ElementKind kind;
13942 if (json.containsKey("kind")) {
13943 kind = new ElementKind.fromJson(
13944 jsonDecoder, jsonPath + ".kind", json["kind"]);
13945 } else {
13946 throw jsonDecoder.missingKey(jsonPath, "kind");
13947 }
13948 int fileIndex;
13949 if (json.containsKey("fileIndex")) {
13950 fileIndex =
13951 jsonDecoder.decodeInt(jsonPath + ".fileIndex", json["fileIndex"]);
13952 } else {
13953 throw jsonDecoder.missingKey(jsonPath, "fileIndex");
13954 }
13955 int offset; 14273 int offset;
13956 if (json.containsKey("offset")) { 14274 if (json.containsKey("offset")) {
13957 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 14275 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
13958 } else { 14276 } else {
13959 throw jsonDecoder.missingKey(jsonPath, "offset"); 14277 throw jsonDecoder.mismatch(jsonPath, "offset");
13960 } 14278 }
13961 int length; 14279 int length;
13962 if (json.containsKey("length")) { 14280 if (json.containsKey("length")) {
13963 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); 14281 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
13964 } else { 14282 } else {
13965 throw jsonDecoder.missingKey(jsonPath, "length"); 14283 throw jsonDecoder.mismatch(jsonPath, "length");
13966 } 14284 }
13967 int startLine; 14285 OverriddenMember superclassMember;
13968 if (json.containsKey("startLine")) { 14286 if (json.containsKey("superclassMember")) {
13969 startLine = 14287 superclassMember = new OverriddenMember.fromJson(jsonDecoder,
13970 jsonDecoder.decodeInt(jsonPath + ".startLine", json["startLine"]); 14288 jsonPath + ".superclassMember", json["superclassMember"]);
13971 } else {
13972 throw jsonDecoder.missingKey(jsonPath, "startLine");
13973 } 14289 }
13974 int startColumn; 14290 List<OverriddenMember> interfaceMembers;
13975 if (json.containsKey("startColumn")) { 14291 if (json.containsKey("interfaceMembers")) {
13976 startColumn = jsonDecoder.decodeInt( 14292 interfaceMembers = jsonDecoder.decodeList(
13977 jsonPath + ".startColumn", json["startColumn"]); 14293 jsonPath + ".interfaceMembers",
13978 } else { 14294 json["interfaceMembers"],
13979 throw jsonDecoder.missingKey(jsonPath, "startColumn"); 14295 (String jsonPath, Object json) =>
14296 new OverriddenMember.fromJson(jsonDecoder, jsonPath, json));
13980 } 14297 }
13981 return new NavigationTarget( 14298 return new Override(offset, length,
13982 kind, fileIndex, offset, length, startLine, startColumn); 14299 superclassMember: superclassMember,
14300 interfaceMembers: interfaceMembers);
13983 } else { 14301 } else {
13984 throw jsonDecoder.mismatch(jsonPath, "NavigationTarget", json); 14302 throw jsonDecoder.mismatch(jsonPath, "Override", json);
13985 } 14303 }
13986 } 14304 }
13987 14305
14306 @override
13988 Map<String, dynamic> toJson() { 14307 Map<String, dynamic> toJson() {
13989 Map<String, dynamic> result = {}; 14308 Map<String, dynamic> result = {};
13990 result["kind"] = kind.toJson();
13991 result["fileIndex"] = fileIndex;
13992 result["offset"] = offset; 14309 result["offset"] = offset;
13993 result["length"] = length; 14310 result["length"] = length;
13994 result["startLine"] = startLine; 14311 if (superclassMember != null) {
13995 result["startColumn"] = startColumn; 14312 result["superclassMember"] = superclassMember.toJson();
14313 }
14314 if (interfaceMembers != null) {
14315 result["interfaceMembers"] = interfaceMembers
14316 .map((OverriddenMember value) => value.toJson())
14317 .toList();
14318 }
13996 return result; 14319 return result;
13997 } 14320 }
13998 14321
13999 @override 14322 @override
14000 String toString() => JSON.encode(toJson()); 14323 String toString() => JSON.encode(toJson());
14001 14324
14002 @override 14325 @override
14003 bool operator ==(other) { 14326 bool operator ==(other) {
14004 if (other is NavigationTarget) { 14327 if (other is Override) {
14005 return kind == other.kind && 14328 return offset == other.offset &&
14006 fileIndex == other.fileIndex &&
14007 offset == other.offset &&
14008 length == other.length && 14329 length == other.length &&
14009 startLine == other.startLine && 14330 superclassMember == other.superclassMember &&
14010 startColumn == other.startColumn; 14331 listEqual(interfaceMembers, other.interfaceMembers,
14332 (OverriddenMember a, OverriddenMember b) => a == b);
14011 } 14333 }
14012 return false; 14334 return false;
14013 } 14335 }
14014 14336
14015 @override 14337 @override
14016 int get hashCode { 14338 int get hashCode {
14017 int hash = 0; 14339 int hash = 0;
14018 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
14019 hash = JenkinsSmiHash.combine(hash, fileIndex.hashCode);
14020 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 14340 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
14021 hash = JenkinsSmiHash.combine(hash, length.hashCode); 14341 hash = JenkinsSmiHash.combine(hash, length.hashCode);
14022 hash = JenkinsSmiHash.combine(hash, startLine.hashCode); 14342 hash = JenkinsSmiHash.combine(hash, superclassMember.hashCode);
14023 hash = JenkinsSmiHash.combine(hash, startColumn.hashCode); 14343 hash = JenkinsSmiHash.combine(hash, interfaceMembers.hashCode);
14024 return JenkinsSmiHash.finish(hash); 14344 return JenkinsSmiHash.finish(hash);
14025 } 14345 }
14026 } 14346 }
14027 14347
14028 /** 14348 /**
14029 * Occurrences 14349 * Position
14030 * 14350 *
14031 * { 14351 * {
14032 * "element": Element 14352 * "file": FilePath
14033 * "offsets": List<int> 14353 * "offset": int
14034 * "length": int
14035 * } 14354 * }
14036 * 14355 *
14037 * Clients may not extend, implement or mix-in this class. 14356 * Clients may not extend, implement or mix-in this class.
14038 */ 14357 */
14039 class Occurrences implements HasToJson { 14358 class Position implements HasToJson {
14040 Element _element; 14359 String _file;
14041 14360
14042 List<int> _offsets; 14361 int _offset;
14043
14044 int _length;
14045 14362
14046 /** 14363 /**
14047 * The element that was referenced. 14364 * The file containing the position.
14048 */ 14365 */
14049 Element get element => _element; 14366 String get file => _file;
14050 14367
14051 /** 14368 /**
14052 * The element that was referenced. 14369 * The file containing the position.
14053 */ 14370 */
14054 void set element(Element value) { 14371 void set file(String value) {
14055 assert(value != null); 14372 assert(value != null);
14056 this._element = value; 14373 this._file = value;
14057 } 14374 }
14058 14375
14059 /** 14376 /**
14060 * The offsets of the name of the referenced element within the file. 14377 * The offset of the position.
14061 */ 14378 */
14062 List<int> get offsets => _offsets; 14379 int get offset => _offset;
14063 14380
14064 /** 14381 /**
14065 * The offsets of the name of the referenced element within the file. 14382 * The offset of the position.
14066 */ 14383 */
14067 void set offsets(List<int> value) { 14384 void set offset(int value) {
14068 assert(value != null); 14385 assert(value != null);
14069 this._offsets = value; 14386 this._offset = value;
14070 } 14387 }
14071 14388
14072 /** 14389 Position(String file, int offset) {
14073 * The length of the name of the referenced element. 14390 this.file = file;
14074 */ 14391 this.offset = offset;
14075 int get length => _length;
14076
14077 /**
14078 * The length of the name of the referenced element.
14079 */
14080 void set length(int value) {
14081 assert(value != null);
14082 this._length = value;
14083 } 14392 }
14084 14393
14085 Occurrences(Element element, List<int> offsets, int length) { 14394 factory Position.fromJson(
14086 this.element = element;
14087 this.offsets = offsets;
14088 this.length = length;
14089 }
14090
14091 factory Occurrences.fromJson(
14092 JsonDecoder jsonDecoder, String jsonPath, Object json) { 14395 JsonDecoder jsonDecoder, String jsonPath, Object json) {
14093 if (json == null) { 14396 if (json == null) {
14094 json = {}; 14397 json = {};
14095 } 14398 }
14096 if (json is Map) { 14399 if (json is Map) {
14097 Element element; 14400 String file;
14098 if (json.containsKey("element")) { 14401 if (json.containsKey("file")) {
14099 element = new Element.fromJson( 14402 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
14100 jsonDecoder, jsonPath + ".element", json["element"]);
14101 } else { 14403 } else {
14102 throw jsonDecoder.missingKey(jsonPath, "element"); 14404 throw jsonDecoder.mismatch(jsonPath, "file");
14103 } 14405 }
14104 List<int> offsets; 14406 int offset;
14105 if (json.containsKey("offsets")) { 14407 if (json.containsKey("offset")) {
14106 offsets = jsonDecoder.decodeList( 14408 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
14107 jsonPath + ".offsets", json["offsets"], jsonDecoder.decodeInt);
14108 } else { 14409 } else {
14109 throw jsonDecoder.missingKey(jsonPath, "offsets"); 14410 throw jsonDecoder.mismatch(jsonPath, "offset");
14110 } 14411 }
14111 int length; 14412 return new Position(file, offset);
14112 if (json.containsKey("length")) {
14113 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
14114 } else {
14115 throw jsonDecoder.missingKey(jsonPath, "length");
14116 }
14117 return new Occurrences(element, offsets, length);
14118 } else { 14413 } else {
14119 throw jsonDecoder.mismatch(jsonPath, "Occurrences", json); 14414 throw jsonDecoder.mismatch(jsonPath, "Position", json);
14120 } 14415 }
14121 } 14416 }
14122 14417
14418 @override
14123 Map<String, dynamic> toJson() { 14419 Map<String, dynamic> toJson() {
14124 Map<String, dynamic> result = {}; 14420 Map<String, dynamic> result = {};
14125 result["element"] = element.toJson(); 14421 result["file"] = file;
14126 result["offsets"] = offsets; 14422 result["offset"] = offset;
14127 result["length"] = length;
14128 return result; 14423 return result;
14129 } 14424 }
14130 14425
14426 @override
14427 String toString() => JSON.encode(toJson());
14428
14429 @override
14430 bool operator ==(other) {
14431 if (other is Position) {
14432 return file == other.file && offset == other.offset;
14433 }
14434 return false;
14435 }
14436
14437 @override
14438 int get hashCode {
14439 int hash = 0;
14440 hash = JenkinsSmiHash.combine(hash, file.hashCode);
14441 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
14442 return JenkinsSmiHash.finish(hash);
14443 }
14444 }
14445
14446 /**
14447 * PubStatus
14448 *
14449 * {
14450 * "isListingPackageDirs": bool
14451 * }
14452 *
14453 * Clients may not extend, implement or mix-in this class.
14454 */
14455 class PubStatus implements HasToJson {
14456 bool _isListingPackageDirs;
14457
14458 /**
14459 * True if the server is currently running pub to produce a list of package
14460 * directories.
14461 */
14462 bool get isListingPackageDirs => _isListingPackageDirs;
14463
14464 /**
14465 * True if the server is currently running pub to produce a list of package
14466 * directories.
14467 */
14468 void set isListingPackageDirs(bool value) {
14469 assert(value != null);
14470 this._isListingPackageDirs = value;
14471 }
14472
14473 PubStatus(bool isListingPackageDirs) {
14474 this.isListingPackageDirs = isListingPackageDirs;
14475 }
14476
14477 factory PubStatus.fromJson(
14478 JsonDecoder jsonDecoder, String jsonPath, Object json) {
14479 if (json == null) {
14480 json = {};
14481 }
14482 if (json is Map) {
14483 bool isListingPackageDirs;
14484 if (json.containsKey("isListingPackageDirs")) {
14485 isListingPackageDirs = jsonDecoder.decodeBool(
14486 jsonPath + ".isListingPackageDirs", json["isListingPackageDirs"]);
14487 } else {
14488 throw jsonDecoder.mismatch(jsonPath, "isListingPackageDirs");
14489 }
14490 return new PubStatus(isListingPackageDirs);
14491 } else {
14492 throw jsonDecoder.mismatch(jsonPath, "PubStatus", json);
14493 }
14494 }
14495
14496 @override
14497 Map<String, dynamic> toJson() {
14498 Map<String, dynamic> result = {};
14499 result["isListingPackageDirs"] = isListingPackageDirs;
14500 return result;
14501 }
14502
14131 @override 14503 @override
14132 String toString() => JSON.encode(toJson()); 14504 String toString() => JSON.encode(toJson());
14133 14505
14134 @override 14506 @override
14135 bool operator ==(other) { 14507 bool operator ==(other) {
14136 if (other is Occurrences) { 14508 if (other is PubStatus) {
14137 return element == other.element && 14509 return isListingPackageDirs == other.isListingPackageDirs;
14138 listEqual(offsets, other.offsets, (int a, int b) => a == b) &&
14139 length == other.length;
14140 } 14510 }
14141 return false; 14511 return false;
14142 } 14512 }
14143 14513
14144 @override 14514 @override
14145 int get hashCode { 14515 int get hashCode {
14146 int hash = 0; 14516 int hash = 0;
14147 hash = JenkinsSmiHash.combine(hash, element.hashCode); 14517 hash = JenkinsSmiHash.combine(hash, isListingPackageDirs.hashCode);
14148 hash = JenkinsSmiHash.combine(hash, offsets.hashCode);
14149 hash = JenkinsSmiHash.combine(hash, length.hashCode);
14150 return JenkinsSmiHash.finish(hash); 14518 return JenkinsSmiHash.finish(hash);
14151 } 14519 }
14152 } 14520 }
14153 14521
14154 /** 14522 /**
14155 * Outline 14523 * RefactoringFeedback
14156 * 14524 *
14157 * { 14525 * {
14158 * "element": Element
14159 * "offset": int
14160 * "length": int
14161 * "children": optional List<Outline>
14162 * } 14526 * }
14163 * 14527 *
14164 * Clients may not extend, implement or mix-in this class. 14528 * Clients may not extend, implement or mix-in this class.
14165 */ 14529 */
14166 class Outline implements HasToJson { 14530 class RefactoringFeedback implements HasToJson {
14167 Element _element; 14531 RefactoringFeedback();
14168 14532
14169 int _offset; 14533 factory RefactoringFeedback.fromJson(
14170 14534 JsonDecoder jsonDecoder, String jsonPath, Object json, Map responseJson) {
14171 int _length; 14535 return refactoringFeedbackFromJson(
14172 14536 jsonDecoder, jsonPath, json, responseJson);
14173 List<Outline> _children; 14537 }
14174 14538
14175 /** 14539 @override
14176 * A description of the element represented by this node. 14540 Map<String, dynamic> toJson() {
14177 */ 14541 Map<String, dynamic> result = {};
14178 Element get element => _element; 14542 return result;
14179 14543 }
14180 /** 14544
14181 * A description of the element represented by this node. 14545 @override
14182 */ 14546 String toString() => JSON.encode(toJson());
14183 void set element(Element value) { 14547
14548 @override
14549 bool operator ==(other) {
14550 if (other is RefactoringFeedback) {
14551 return true;
14552 }
14553 return false;
14554 }
14555
14556 @override
14557 int get hashCode {
14558 int hash = 0;
14559 return JenkinsSmiHash.finish(hash);
14560 }
14561 }
14562
14563 /**
14564 * RefactoringKind
14565 *
14566 * enum {
14567 * CONVERT_GETTER_TO_METHOD
14568 * CONVERT_METHOD_TO_GETTER
14569 * EXTRACT_LOCAL_VARIABLE
14570 * EXTRACT_METHOD
14571 * INLINE_LOCAL_VARIABLE
14572 * INLINE_METHOD
14573 * MOVE_FILE
14574 * RENAME
14575 * SORT_MEMBERS
14576 * }
14577 *
14578 * Clients may not extend, implement or mix-in this class.
14579 */
14580 class RefactoringKind implements Enum {
14581 static const RefactoringKind CONVERT_GETTER_TO_METHOD =
14582 const RefactoringKind._("CONVERT_GETTER_TO_METHOD");
14583
14584 static const RefactoringKind CONVERT_METHOD_TO_GETTER =
14585 const RefactoringKind._("CONVERT_METHOD_TO_GETTER");
14586
14587 static const RefactoringKind EXTRACT_LOCAL_VARIABLE =
14588 const RefactoringKind._("EXTRACT_LOCAL_VARIABLE");
14589
14590 static const RefactoringKind EXTRACT_METHOD =
14591 const RefactoringKind._("EXTRACT_METHOD");
14592
14593 static const RefactoringKind INLINE_LOCAL_VARIABLE =
14594 const RefactoringKind._("INLINE_LOCAL_VARIABLE");
14595
14596 static const RefactoringKind INLINE_METHOD =
14597 const RefactoringKind._("INLINE_METHOD");
14598
14599 static const RefactoringKind MOVE_FILE = const RefactoringKind._("MOVE_FILE");
14600
14601 static const RefactoringKind RENAME = const RefactoringKind._("RENAME");
14602
14603 static const RefactoringKind SORT_MEMBERS =
14604 const RefactoringKind._("SORT_MEMBERS");
14605
14606 /**
14607 * A list containing all of the enum values that are defined.
14608 */
14609 static const List<RefactoringKind> VALUES = const <RefactoringKind>[
14610 CONVERT_GETTER_TO_METHOD,
14611 CONVERT_METHOD_TO_GETTER,
14612 EXTRACT_LOCAL_VARIABLE,
14613 EXTRACT_METHOD,
14614 INLINE_LOCAL_VARIABLE,
14615 INLINE_METHOD,
14616 MOVE_FILE,
14617 RENAME,
14618 SORT_MEMBERS
14619 ];
14620
14621 @override
14622 final String name;
14623
14624 const RefactoringKind._(this.name);
14625
14626 factory RefactoringKind(String name) {
14627 switch (name) {
14628 case "CONVERT_GETTER_TO_METHOD":
14629 return CONVERT_GETTER_TO_METHOD;
14630 case "CONVERT_METHOD_TO_GETTER":
14631 return CONVERT_METHOD_TO_GETTER;
14632 case "EXTRACT_LOCAL_VARIABLE":
14633 return EXTRACT_LOCAL_VARIABLE;
14634 case "EXTRACT_METHOD":
14635 return EXTRACT_METHOD;
14636 case "INLINE_LOCAL_VARIABLE":
14637 return INLINE_LOCAL_VARIABLE;
14638 case "INLINE_METHOD":
14639 return INLINE_METHOD;
14640 case "MOVE_FILE":
14641 return MOVE_FILE;
14642 case "RENAME":
14643 return RENAME;
14644 case "SORT_MEMBERS":
14645 return SORT_MEMBERS;
14646 }
14647 throw new Exception('Illegal enum value: $name');
14648 }
14649
14650 factory RefactoringKind.fromJson(
14651 JsonDecoder jsonDecoder, String jsonPath, Object json) {
14652 if (json is String) {
14653 try {
14654 return new RefactoringKind(json);
14655 } catch (_) {
14656 // Fall through
14657 }
14658 }
14659 throw jsonDecoder.mismatch(jsonPath, "RefactoringKind", json);
14660 }
14661
14662 @override
14663 String toString() => "RefactoringKind.$name";
14664
14665 String toJson() => name;
14666 }
14667
14668 /**
14669 * RefactoringMethodParameter
14670 *
14671 * {
14672 * "id": optional String
14673 * "kind": RefactoringMethodParameterKind
14674 * "type": String
14675 * "name": String
14676 * "parameters": optional String
14677 * }
14678 *
14679 * Clients may not extend, implement or mix-in this class.
14680 */
14681 class RefactoringMethodParameter implements HasToJson {
14682 String _id;
14683
14684 RefactoringMethodParameterKind _kind;
14685
14686 String _type;
14687
14688 String _name;
14689
14690 String _parameters;
14691
14692 /**
14693 * The unique identifier of the parameter. Clients may omit this field for
14694 * the parameters they want to add.
14695 */
14696 String get id => _id;
14697
14698 /**
14699 * The unique identifier of the parameter. Clients may omit this field for
14700 * the parameters they want to add.
14701 */
14702 void set id(String value) {
14703 this._id = value;
14704 }
14705
14706 /**
14707 * The kind of the parameter.
14708 */
14709 RefactoringMethodParameterKind get kind => _kind;
14710
14711 /**
14712 * The kind of the parameter.
14713 */
14714 void set kind(RefactoringMethodParameterKind value) {
14184 assert(value != null); 14715 assert(value != null);
14185 this._element = value; 14716 this._kind = value;
14186 } 14717 }
14187 14718
14188 /** 14719 /**
14189 * The offset of the first character of the element. This is different than 14720 * The type that should be given to the parameter, or the return type of the
14190 * the offset in the Element, which if the offset of the name of the element. 14721 * parameter's function type.
14191 * It can be used, for example, to map locations in the file back to an 14722 */
14192 * outline. 14723 String get type => _type;
14193 */ 14724
14194 int get offset => _offset; 14725 /**
14195 14726 * The type that should be given to the parameter, or the return type of the
14196 /** 14727 * parameter's function type.
14197 * The offset of the first character of the element. This is different than 14728 */
14198 * the offset in the Element, which if the offset of the name of the element. 14729 void set type(String value) {
14199 * It can be used, for example, to map locations in the file back to an
14200 * outline.
14201 */
14202 void set offset(int value) {
14203 assert(value != null); 14730 assert(value != null);
14204 this._offset = value; 14731 this._type = value;
14205 } 14732 }
14206 14733
14207 /** 14734 /**
14208 * The length of the element. 14735 * The name that should be given to the parameter.
14209 */ 14736 */
14210 int get length => _length; 14737 String get name => _name;
14211 14738
14212 /** 14739 /**
14213 * The length of the element. 14740 * The name that should be given to the parameter.
14214 */ 14741 */
14215 void set length(int value) { 14742 void set name(String value) {
14216 assert(value != null); 14743 assert(value != null);
14217 this._length = value; 14744 this._name = value;
14218 } 14745 }
14219 14746
14220 /** 14747 /**
14221 * The children of the node. The field will be omitted if the node has no 14748 * The parameter list of the parameter's function type. If the parameter is
14222 * children. 14749 * not of a function type, this field will not be defined. If the function
14223 */ 14750 * type has zero parameters, this field will have a value of "()".
14224 List<Outline> get children => _children; 14751 */
14225 14752 String get parameters => _parameters;
14226 /** 14753
14227 * The children of the node. The field will be omitted if the node has no 14754 /**
14228 * children. 14755 * The parameter list of the parameter's function type. If the parameter is
14229 */ 14756 * not of a function type, this field will not be defined. If the function
14230 void set children(List<Outline> value) { 14757 * type has zero parameters, this field will have a value of "()".
14231 this._children = value; 14758 */
14232 } 14759 void set parameters(String value) {
14233 14760 this._parameters = value;
14234 Outline(Element element, int offset, int length, {List<Outline> children}) { 14761 }
14235 this.element = element; 14762
14236 this.offset = offset; 14763 RefactoringMethodParameter(
14237 this.length = length; 14764 RefactoringMethodParameterKind kind, String type, String name,
14238 this.children = children; 14765 {String id, String parameters}) {
14239 } 14766 this.id = id;
14240 14767 this.kind = kind;
14241 factory Outline.fromJson( 14768 this.type = type;
14769 this.name = name;
14770 this.parameters = parameters;
14771 }
14772
14773 factory RefactoringMethodParameter.fromJson(
14242 JsonDecoder jsonDecoder, String jsonPath, Object json) { 14774 JsonDecoder jsonDecoder, String jsonPath, Object json) {
14243 if (json == null) { 14775 if (json == null) {
14244 json = {}; 14776 json = {};
14245 } 14777 }
14246 if (json is Map) { 14778 if (json is Map) {
14247 Element element; 14779 String id;
14248 if (json.containsKey("element")) { 14780 if (json.containsKey("id")) {
14249 element = new Element.fromJson( 14781 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
14250 jsonDecoder, jsonPath + ".element", json["element"]); 14782 }
14783 RefactoringMethodParameterKind kind;
14784 if (json.containsKey("kind")) {
14785 kind = new RefactoringMethodParameterKind.fromJson(
14786 jsonDecoder, jsonPath + ".kind", json["kind"]);
14251 } else { 14787 } else {
14252 throw jsonDecoder.missingKey(jsonPath, "element"); 14788 throw jsonDecoder.mismatch(jsonPath, "kind");
14253 } 14789 }
14254 int offset; 14790 String type;
14255 if (json.containsKey("offset")) { 14791 if (json.containsKey("type")) {
14256 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 14792 type = jsonDecoder.decodeString(jsonPath + ".type", json["type"]);
14257 } else { 14793 } else {
14258 throw jsonDecoder.missingKey(jsonPath, "offset"); 14794 throw jsonDecoder.mismatch(jsonPath, "type");
14259 } 14795 }
14260 int length; 14796 String name;
14261 if (json.containsKey("length")) { 14797 if (json.containsKey("name")) {
14262 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); 14798 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]);
14263 } else { 14799 } else {
14264 throw jsonDecoder.missingKey(jsonPath, "length"); 14800 throw jsonDecoder.mismatch(jsonPath, "name");
14265 } 14801 }
14266 List<Outline> children; 14802 String parameters;
14267 if (json.containsKey("children")) { 14803 if (json.containsKey("parameters")) {
14268 children = jsonDecoder.decodeList( 14804 parameters = jsonDecoder.decodeString(
14269 jsonPath + ".children", 14805 jsonPath + ".parameters", json["parameters"]);
14270 json["children"], 14806 }
14271 (String jsonPath, Object json) => 14807 return new RefactoringMethodParameter(kind, type, name,
14272 new Outline.fromJson(jsonDecoder, jsonPath, json)); 14808 id: id, parameters: parameters);
14273 }
14274 return new Outline(element, offset, length, children: children);
14275 } else { 14809 } else {
14276 throw jsonDecoder.mismatch(jsonPath, "Outline", json); 14810 throw jsonDecoder.mismatch(jsonPath, "RefactoringMethodParameter", json);
14277 } 14811 }
14278 } 14812 }
14279 14813
14814 @override
14280 Map<String, dynamic> toJson() { 14815 Map<String, dynamic> toJson() {
14281 Map<String, dynamic> result = {}; 14816 Map<String, dynamic> result = {};
14282 result["element"] = element.toJson(); 14817 if (id != null) {
14283 result["offset"] = offset; 14818 result["id"] = id;
14284 result["length"] = length; 14819 }
14285 if (children != null) { 14820 result["kind"] = kind.toJson();
14286 result["children"] = 14821 result["type"] = type;
14287 children.map((Outline value) => value.toJson()).toList(); 14822 result["name"] = name;
14823 if (parameters != null) {
14824 result["parameters"] = parameters;
14288 } 14825 }
14289 return result; 14826 return result;
14290 } 14827 }
14291 14828
14292 @override
14293 String toString() => JSON.encode(toJson());
14294
14295 @override
14296 bool operator ==(other) {
14297 if (other is Outline) {
14298 return element == other.element &&
14299 offset == other.offset &&
14300 length == other.length &&
14301 listEqual(children, other.children, (Outline a, Outline b) => a == b);
14302 }
14303 return false;
14304 }
14305
14306 @override
14307 int get hashCode {
14308 int hash = 0;
14309 hash = JenkinsSmiHash.combine(hash, element.hashCode);
14310 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
14311 hash = JenkinsSmiHash.combine(hash, length.hashCode);
14312 hash = JenkinsSmiHash.combine(hash, children.hashCode);
14313 return JenkinsSmiHash.finish(hash);
14314 }
14315 }
14316
14317 /**
14318 * Override
14319 *
14320 * {
14321 * "offset": int
14322 * "length": int
14323 * "superclassMember": optional OverriddenMember
14324 * "interfaceMembers": optional List<OverriddenMember>
14325 * }
14326 *
14327 * Clients may not extend, implement or mix-in this class.
14328 */
14329 class Override implements HasToJson {
14330 int _offset;
14331
14332 int _length;
14333
14334 OverriddenMember _superclassMember;
14335
14336 List<OverriddenMember> _interfaceMembers;
14337
14338 /**
14339 * The offset of the name of the overriding member.
14340 */
14341 int get offset => _offset;
14342
14343 /**
14344 * The offset of the name of the overriding member.
14345 */
14346 void set offset(int value) {
14347 assert(value != null);
14348 this._offset = value;
14349 }
14350
14351 /**
14352 * The length of the name of the overriding member.
14353 */
14354 int get length => _length;
14355
14356 /**
14357 * The length of the name of the overriding member.
14358 */
14359 void set length(int value) {
14360 assert(value != null);
14361 this._length = value;
14362 }
14363
14364 /**
14365 * The member inherited from a superclass that is overridden by the
14366 * overriding member. The field is omitted if there is no superclass member,
14367 * in which case there must be at least one interface member.
14368 */
14369 OverriddenMember get superclassMember => _superclassMember;
14370
14371 /**
14372 * The member inherited from a superclass that is overridden by the
14373 * overriding member. The field is omitted if there is no superclass member,
14374 * in which case there must be at least one interface member.
14375 */
14376 void set superclassMember(OverriddenMember value) {
14377 this._superclassMember = value;
14378 }
14379
14380 /**
14381 * The members inherited from interfaces that are overridden by the
14382 * overriding member. The field is omitted if there are no interface members,
14383 * in which case there must be a superclass member.
14384 */
14385 List<OverriddenMember> get interfaceMembers => _interfaceMembers;
14386
14387 /**
14388 * The members inherited from interfaces that are overridden by the
14389 * overriding member. The field is omitted if there are no interface members,
14390 * in which case there must be a superclass member.
14391 */
14392 void set interfaceMembers(List<OverriddenMember> value) {
14393 this._interfaceMembers = value;
14394 }
14395
14396 Override(int offset, int length,
14397 {OverriddenMember superclassMember,
14398 List<OverriddenMember> interfaceMembers}) {
14399 this.offset = offset;
14400 this.length = length;
14401 this.superclassMember = superclassMember;
14402 this.interfaceMembers = interfaceMembers;
14403 }
14404
14405 factory Override.fromJson(
14406 JsonDecoder jsonDecoder, String jsonPath, Object json) {
14407 if (json == null) {
14408 json = {};
14409 }
14410 if (json is Map) {
14411 int offset;
14412 if (json.containsKey("offset")) {
14413 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
14414 } else {
14415 throw jsonDecoder.missingKey(jsonPath, "offset");
14416 }
14417 int length;
14418 if (json.containsKey("length")) {
14419 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
14420 } else {
14421 throw jsonDecoder.missingKey(jsonPath, "length");
14422 }
14423 OverriddenMember superclassMember;
14424 if (json.containsKey("superclassMember")) {
14425 superclassMember = new OverriddenMember.fromJson(jsonDecoder,
14426 jsonPath + ".superclassMember", json["superclassMember"]);
14427 }
14428 List<OverriddenMember> interfaceMembers;
14429 if (json.containsKey("interfaceMembers")) {
14430 interfaceMembers = jsonDecoder.decodeList(
14431 jsonPath + ".interfaceMembers",
14432 json["interfaceMembers"],
14433 (String jsonPath, Object json) =>
14434 new OverriddenMember.fromJson(jsonDecoder, jsonPath, json));
14435 }
14436 return new Override(offset, length,
14437 superclassMember: superclassMember,
14438 interfaceMembers: interfaceMembers);
14439 } else {
14440 throw jsonDecoder.mismatch(jsonPath, "Override", json);
14441 }
14442 }
14443
14444 Map<String, dynamic> toJson() {
14445 Map<String, dynamic> result = {};
14446 result["offset"] = offset;
14447 result["length"] = length;
14448 if (superclassMember != null) {
14449 result["superclassMember"] = superclassMember.toJson();
14450 }
14451 if (interfaceMembers != null) {
14452 result["interfaceMembers"] = interfaceMembers
14453 .map((OverriddenMember value) => value.toJson())
14454 .toList();
14455 }
14456 return result;
14457 }
14458
14459 @override
14460 String toString() => JSON.encode(toJson());
14461
14462 @override
14463 bool operator ==(other) {
14464 if (other is Override) {
14465 return offset == other.offset &&
14466 length == other.length &&
14467 superclassMember == other.superclassMember &&
14468 listEqual(interfaceMembers, other.interfaceMembers,
14469 (OverriddenMember a, OverriddenMember b) => a == b);
14470 }
14471 return false;
14472 }
14473
14474 @override
14475 int get hashCode {
14476 int hash = 0;
14477 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
14478 hash = JenkinsSmiHash.combine(hash, length.hashCode);
14479 hash = JenkinsSmiHash.combine(hash, superclassMember.hashCode);
14480 hash = JenkinsSmiHash.combine(hash, interfaceMembers.hashCode);
14481 return JenkinsSmiHash.finish(hash);
14482 }
14483 }
14484
14485 /**
14486 * OverriddenMember
14487 *
14488 * {
14489 * "element": Element
14490 * "className": String
14491 * }
14492 *
14493 * Clients may not extend, implement or mix-in this class.
14494 */
14495 class OverriddenMember implements HasToJson {
14496 Element _element;
14497
14498 String _className;
14499
14500 /**
14501 * The element that is being overridden.
14502 */
14503 Element get element => _element;
14504
14505 /**
14506 * The element that is being overridden.
14507 */
14508 void set element(Element value) {
14509 assert(value != null);
14510 this._element = value;
14511 }
14512
14513 /**
14514 * The name of the class in which the member is defined.
14515 */
14516 String get className => _className;
14517
14518 /**
14519 * The name of the class in which the member is defined.
14520 */
14521 void set className(String value) {
14522 assert(value != null);
14523 this._className = value;
14524 }
14525
14526 OverriddenMember(Element element, String className) {
14527 this.element = element;
14528 this.className = className;
14529 }
14530
14531 factory OverriddenMember.fromJson(
14532 JsonDecoder jsonDecoder, String jsonPath, Object json) {
14533 if (json == null) {
14534 json = {};
14535 }
14536 if (json is Map) {
14537 Element element;
14538 if (json.containsKey("element")) {
14539 element = new Element.fromJson(
14540 jsonDecoder, jsonPath + ".element", json["element"]);
14541 } else {
14542 throw jsonDecoder.missingKey(jsonPath, "element");
14543 }
14544 String className;
14545 if (json.containsKey("className")) {
14546 className = jsonDecoder.decodeString(
14547 jsonPath + ".className", json["className"]);
14548 } else {
14549 throw jsonDecoder.missingKey(jsonPath, "className");
14550 }
14551 return new OverriddenMember(element, className);
14552 } else {
14553 throw jsonDecoder.mismatch(jsonPath, "OverriddenMember", json);
14554 }
14555 }
14556
14557 Map<String, dynamic> toJson() {
14558 Map<String, dynamic> result = {};
14559 result["element"] = element.toJson();
14560 result["className"] = className;
14561 return result;
14562 }
14563
14564 @override 14829 @override
14565 String toString() => JSON.encode(toJson()); 14830 String toString() => JSON.encode(toJson());
14566 14831
14567 @override 14832 @override
14568 bool operator ==(other) { 14833 bool operator ==(other) {
14569 if (other is OverriddenMember) { 14834 if (other is RefactoringMethodParameter) {
14570 return element == other.element && className == other.className; 14835 return id == other.id &&
14836 kind == other.kind &&
14837 type == other.type &&
14838 name == other.name &&
14839 parameters == other.parameters;
14571 } 14840 }
14572 return false; 14841 return false;
14573 } 14842 }
14574 14843
14575 @override 14844 @override
14576 int get hashCode { 14845 int get hashCode {
14577 int hash = 0; 14846 int hash = 0;
14578 hash = JenkinsSmiHash.combine(hash, element.hashCode); 14847 hash = JenkinsSmiHash.combine(hash, id.hashCode);
14579 hash = JenkinsSmiHash.combine(hash, className.hashCode); 14848 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
14849 hash = JenkinsSmiHash.combine(hash, type.hashCode);
14850 hash = JenkinsSmiHash.combine(hash, name.hashCode);
14851 hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
14580 return JenkinsSmiHash.finish(hash); 14852 return JenkinsSmiHash.finish(hash);
14581 } 14853 }
14582 } 14854 }
14583 14855
14584 /** 14856 /**
14585 * Position 14857 * RefactoringMethodParameterKind
14586 * 14858 *
14587 * { 14859 * enum {
14588 * "file": FilePath 14860 * REQUIRED
14589 * "offset": int 14861 * POSITIONAL
14862 * NAMED
14590 * } 14863 * }
14591 * 14864 *
14592 * Clients may not extend, implement or mix-in this class. 14865 * Clients may not extend, implement or mix-in this class.
14593 */ 14866 */
14594 class Position implements HasToJson { 14867 class RefactoringMethodParameterKind implements Enum {
14595 String _file; 14868 static const RefactoringMethodParameterKind REQUIRED =
14869 const RefactoringMethodParameterKind._("REQUIRED");
14596 14870
14597 int _offset; 14871 static const RefactoringMethodParameterKind POSITIONAL =
14872 const RefactoringMethodParameterKind._("POSITIONAL");
14873
14874 static const RefactoringMethodParameterKind NAMED =
14875 const RefactoringMethodParameterKind._("NAMED");
14598 14876
14599 /** 14877 /**
14600 * The file containing the position. 14878 * A list containing all of the enum values that are defined.
14601 */ 14879 */
14602 String get file => _file; 14880 static const List<RefactoringMethodParameterKind> VALUES =
14881 const <RefactoringMethodParameterKind>[REQUIRED, POSITIONAL, NAMED];
14603 14882
14604 /** 14883 @override
14605 * The file containing the position. 14884 final String name;
14606 */ 14885
14607 void set file(String value) { 14886 const RefactoringMethodParameterKind._(this.name);
14608 assert(value != null); 14887
14609 this._file = value; 14888 factory RefactoringMethodParameterKind(String name) {
14889 switch (name) {
14890 case "REQUIRED":
14891 return REQUIRED;
14892 case "POSITIONAL":
14893 return POSITIONAL;
14894 case "NAMED":
14895 return NAMED;
14896 }
14897 throw new Exception('Illegal enum value: $name');
14610 } 14898 }
14611 14899
14612 /** 14900 factory RefactoringMethodParameterKind.fromJson(
14613 * The offset of the position. 14901 JsonDecoder jsonDecoder, String jsonPath, Object json) {
14614 */ 14902 if (json is String) {
14615 int get offset => _offset; 14903 try {
14616 14904 return new RefactoringMethodParameterKind(json);
14617 /** 14905 } catch (_) {
14618 * The offset of the position. 14906 // Fall through
14619 */ 14907 }
14620 void set offset(int value) { 14908 }
14621 assert(value != null); 14909 throw jsonDecoder.mismatch(
14622 this._offset = value; 14910 jsonPath, "RefactoringMethodParameterKind", json);
14623 } 14911 }
14624 14912
14625 Position(String file, int offset) { 14913 @override
14626 this.file = file; 14914 String toString() => "RefactoringMethodParameterKind.$name";
14627 this.offset = offset; 14915
14916 String toJson() => name;
14917 }
14918
14919 /**
14920 * RefactoringOptions
14921 *
14922 * {
14923 * }
14924 *
14925 * Clients may not extend, implement or mix-in this class.
14926 */
14927 class RefactoringOptions implements HasToJson {
14928 RefactoringOptions();
14929
14930 factory RefactoringOptions.fromJson(JsonDecoder jsonDecoder, String jsonPath,
14931 Object json, RefactoringKind kind) {
14932 return refactoringOptionsFromJson(jsonDecoder, jsonPath, json, kind);
14628 } 14933 }
14629 14934
14630 factory Position.fromJson( 14935 @override
14631 JsonDecoder jsonDecoder, String jsonPath, Object json) {
14632 if (json == null) {
14633 json = {};
14634 }
14635 if (json is Map) {
14636 String file;
14637 if (json.containsKey("file")) {
14638 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
14639 } else {
14640 throw jsonDecoder.missingKey(jsonPath, "file");
14641 }
14642 int offset;
14643 if (json.containsKey("offset")) {
14644 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
14645 } else {
14646 throw jsonDecoder.missingKey(jsonPath, "offset");
14647 }
14648 return new Position(file, offset);
14649 } else {
14650 throw jsonDecoder.mismatch(jsonPath, "Position", json);
14651 }
14652 }
14653
14654 Map<String, dynamic> toJson() { 14936 Map<String, dynamic> toJson() {
14655 Map<String, dynamic> result = {}; 14937 Map<String, dynamic> result = {};
14656 result["file"] = file;
14657 result["offset"] = offset;
14658 return result; 14938 return result;
14659 } 14939 }
14660 14940
14661 @override 14941 @override
14662 String toString() => JSON.encode(toJson()); 14942 String toString() => JSON.encode(toJson());
14663 14943
14664 @override 14944 @override
14665 bool operator ==(other) { 14945 bool operator ==(other) {
14666 if (other is Position) { 14946 if (other is RefactoringOptions) {
14667 return file == other.file && offset == other.offset; 14947 return true;
14668 } 14948 }
14669 return false; 14949 return false;
14670 } 14950 }
14671 14951
14672 @override 14952 @override
14673 int get hashCode { 14953 int get hashCode {
14674 int hash = 0; 14954 int hash = 0;
14675 hash = JenkinsSmiHash.combine(hash, file.hashCode);
14676 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
14677 return JenkinsSmiHash.finish(hash); 14955 return JenkinsSmiHash.finish(hash);
14678 } 14956 }
14679 } 14957 }
14680 14958
14681 /** 14959 /**
14682 * PubStatus 14960 * RefactoringProblem
14683 * 14961 *
14684 * { 14962 * {
14685 * "isListingPackageDirs": bool 14963 * "severity": RefactoringProblemSeverity
14964 * "message": String
14965 * "location": optional Location
14686 * } 14966 * }
14687 * 14967 *
14688 * Clients may not extend, implement or mix-in this class. 14968 * Clients may not extend, implement or mix-in this class.
14689 */ 14969 */
14690 class PubStatus implements HasToJson { 14970 class RefactoringProblem implements HasToJson {
14691 bool _isListingPackageDirs; 14971 RefactoringProblemSeverity _severity;
14972
14973 String _message;
14974
14975 Location _location;
14692 14976
14693 /** 14977 /**
14694 * True if the server is currently running pub to produce a list of package 14978 * The severity of the problem being represented.
14695 * directories.
14696 */ 14979 */
14697 bool get isListingPackageDirs => _isListingPackageDirs; 14980 RefactoringProblemSeverity get severity => _severity;
14698 14981
14699 /** 14982 /**
14700 * True if the server is currently running pub to produce a list of package 14983 * The severity of the problem being represented.
14701 * directories.
14702 */ 14984 */
14703 void set isListingPackageDirs(bool value) { 14985 void set severity(RefactoringProblemSeverity value) {
14704 assert(value != null); 14986 assert(value != null);
14705 this._isListingPackageDirs = value; 14987 this._severity = value;
14706 } 14988 }
14707 14989
14708 PubStatus(bool isListingPackageDirs) { 14990 /**
14709 this.isListingPackageDirs = isListingPackageDirs; 14991 * A human-readable description of the problem being represented.
14992 */
14993 String get message => _message;
14994
14995 /**
14996 * A human-readable description of the problem being represented.
14997 */
14998 void set message(String value) {
14999 assert(value != null);
15000 this._message = value;
14710 } 15001 }
14711 15002
14712 factory PubStatus.fromJson( 15003 /**
15004 * The location of the problem being represented. This field is omitted
15005 * unless there is a specific location associated with the problem (such as a
15006 * location where an element being renamed will be shadowed).
15007 */
15008 Location get location => _location;
15009
15010 /**
15011 * The location of the problem being represented. This field is omitted
15012 * unless there is a specific location associated with the problem (such as a
15013 * location where an element being renamed will be shadowed).
15014 */
15015 void set location(Location value) {
15016 this._location = value;
15017 }
15018
15019 RefactoringProblem(RefactoringProblemSeverity severity, String message,
15020 {Location location}) {
15021 this.severity = severity;
15022 this.message = message;
15023 this.location = location;
15024 }
15025
15026 factory RefactoringProblem.fromJson(
14713 JsonDecoder jsonDecoder, String jsonPath, Object json) { 15027 JsonDecoder jsonDecoder, String jsonPath, Object json) {
14714 if (json == null) { 15028 if (json == null) {
14715 json = {}; 15029 json = {};
14716 } 15030 }
14717 if (json is Map) { 15031 if (json is Map) {
14718 bool isListingPackageDirs; 15032 RefactoringProblemSeverity severity;
14719 if (json.containsKey("isListingPackageDirs")) { 15033 if (json.containsKey("severity")) {
14720 isListingPackageDirs = jsonDecoder.decodeBool( 15034 severity = new RefactoringProblemSeverity.fromJson(
14721 jsonPath + ".isListingPackageDirs", json["isListingPackageDirs"]); 15035 jsonDecoder, jsonPath + ".severity", json["severity"]);
14722 } else { 15036 } else {
14723 throw jsonDecoder.missingKey(jsonPath, "isListingPackageDirs"); 15037 throw jsonDecoder.mismatch(jsonPath, "severity");
14724 } 15038 }
14725 return new PubStatus(isListingPackageDirs); 15039 String message;
15040 if (json.containsKey("message")) {
15041 message =
15042 jsonDecoder.decodeString(jsonPath + ".message", json["message"]);
15043 } else {
15044 throw jsonDecoder.mismatch(jsonPath, "message");
15045 }
15046 Location location;
15047 if (json.containsKey("location")) {
15048 location = new Location.fromJson(
15049 jsonDecoder, jsonPath + ".location", json["location"]);
15050 }
15051 return new RefactoringProblem(severity, message, location: location);
14726 } else { 15052 } else {
14727 throw jsonDecoder.mismatch(jsonPath, "PubStatus", json); 15053 throw jsonDecoder.mismatch(jsonPath, "RefactoringProblem", json);
14728 } 15054 }
14729 } 15055 }
14730 15056
15057 @override
14731 Map<String, dynamic> toJson() { 15058 Map<String, dynamic> toJson() {
14732 Map<String, dynamic> result = {}; 15059 Map<String, dynamic> result = {};
14733 result["isListingPackageDirs"] = isListingPackageDirs; 15060 result["severity"] = severity.toJson();
15061 result["message"] = message;
15062 if (location != null) {
15063 result["location"] = location.toJson();
15064 }
14734 return result; 15065 return result;
14735 } 15066 }
14736 15067
14737 @override 15068 @override
14738 String toString() => JSON.encode(toJson()); 15069 String toString() => JSON.encode(toJson());
14739 15070
14740 @override 15071 @override
14741 bool operator ==(other) { 15072 bool operator ==(other) {
14742 if (other is PubStatus) { 15073 if (other is RefactoringProblem) {
14743 return isListingPackageDirs == other.isListingPackageDirs; 15074 return severity == other.severity &&
15075 message == other.message &&
15076 location == other.location;
14744 } 15077 }
14745 return false; 15078 return false;
14746 } 15079 }
14747 15080
14748 @override 15081 @override
14749 int get hashCode { 15082 int get hashCode {
14750 int hash = 0; 15083 int hash = 0;
14751 hash = JenkinsSmiHash.combine(hash, isListingPackageDirs.hashCode); 15084 hash = JenkinsSmiHash.combine(hash, severity.hashCode);
15085 hash = JenkinsSmiHash.combine(hash, message.hashCode);
15086 hash = JenkinsSmiHash.combine(hash, location.hashCode);
14752 return JenkinsSmiHash.finish(hash); 15087 return JenkinsSmiHash.finish(hash);
14753 } 15088 }
14754 } 15089 }
14755 15090
14756 /** 15091 /**
14757 * RefactoringKind 15092 * RefactoringProblemSeverity
14758 * 15093 *
14759 * enum { 15094 * enum {
14760 * CONVERT_GETTER_TO_METHOD 15095 * INFO
14761 * CONVERT_METHOD_TO_GETTER 15096 * WARNING
14762 * EXTRACT_LOCAL_VARIABLE 15097 * ERROR
14763 * EXTRACT_METHOD 15098 * FATAL
14764 * INLINE_LOCAL_VARIABLE
14765 * INLINE_METHOD
14766 * MOVE_FILE
14767 * RENAME
14768 * SORT_MEMBERS
14769 * } 15099 * }
14770 * 15100 *
14771 * Clients may not extend, implement or mix-in this class. 15101 * Clients may not extend, implement or mix-in this class.
14772 */ 15102 */
14773 class RefactoringKind implements Enum { 15103 class RefactoringProblemSeverity implements Enum {
14774 static const RefactoringKind CONVERT_GETTER_TO_METHOD = 15104 /**
14775 const RefactoringKind._("CONVERT_GETTER_TO_METHOD"); 15105 * A minor code problem. No example, because it is not used yet.
14776 15106 */
14777 static const RefactoringKind CONVERT_METHOD_TO_GETTER = 15107 static const RefactoringProblemSeverity INFO =
14778 const RefactoringKind._("CONVERT_METHOD_TO_GETTER"); 15108 const RefactoringProblemSeverity._("INFO");
14779 15109
14780 static const RefactoringKind EXTRACT_LOCAL_VARIABLE = 15110 /**
14781 const RefactoringKind._("EXTRACT_LOCAL_VARIABLE"); 15111 * A minor code problem. For example names of local variables should be camel
14782 15112 * case and start with a lower case letter. Staring the name of a variable
14783 static const RefactoringKind EXTRACT_METHOD = 15113 * with an upper case is OK from the language point of view, but it is nice
14784 const RefactoringKind._("EXTRACT_METHOD"); 15114 * to warn the user.
14785 15115 */
14786 static const RefactoringKind INLINE_LOCAL_VARIABLE = 15116 static const RefactoringProblemSeverity WARNING =
14787 const RefactoringKind._("INLINE_LOCAL_VARIABLE"); 15117 const RefactoringProblemSeverity._("WARNING");
14788 15118
14789 static const RefactoringKind INLINE_METHOD = 15119 /**
14790 const RefactoringKind._("INLINE_METHOD"); 15120 * The refactoring technically can be performed, but there is a logical
14791 15121 * problem. For example the name of a local variable being extracted
14792 static const RefactoringKind MOVE_FILE = const RefactoringKind._("MOVE_FILE"); 15122 * conflicts with another name in the scope, or duplicate parameter names in
14793 15123 * the method being extracted, or a conflict between a parameter name and a
14794 static const RefactoringKind RENAME = const RefactoringKind._("RENAME"); 15124 * local variable, etc. In some cases the location of the problem is also
14795 15125 * provided, so the IDE can show user the location and the problem, and let
14796 static const RefactoringKind SORT_MEMBERS = 15126 * the user decide whether she wants to perform the refactoring. For example
14797 const RefactoringKind._("SORT_MEMBERS"); 15127 * the name conflict might be expected, and the user wants to fix it
15128 * afterwards.
15129 */
15130 static const RefactoringProblemSeverity ERROR =
15131 const RefactoringProblemSeverity._("ERROR");
15132
15133 /**
15134 * A fatal error, which prevents performing the refactoring. For example the
15135 * name of a local variable being extracted is not a valid identifier, or
15136 * selection is not a valid expression.
15137 */
15138 static const RefactoringProblemSeverity FATAL =
15139 const RefactoringProblemSeverity._("FATAL");
14798 15140
14799 /** 15141 /**
14800 * A list containing all of the enum values that are defined. 15142 * A list containing all of the enum values that are defined.
14801 */ 15143 */
14802 static const List<RefactoringKind> VALUES = const <RefactoringKind>[ 15144 static const List<RefactoringProblemSeverity> VALUES =
14803 CONVERT_GETTER_TO_METHOD, 15145 const <RefactoringProblemSeverity>[INFO, WARNING, ERROR, FATAL];
14804 CONVERT_METHOD_TO_GETTER, 15146
14805 EXTRACT_LOCAL_VARIABLE, 15147 @override
14806 EXTRACT_METHOD,
14807 INLINE_LOCAL_VARIABLE,
14808 INLINE_METHOD,
14809 MOVE_FILE,
14810 RENAME,
14811 SORT_MEMBERS
14812 ];
14813
14814 final String name; 15148 final String name;
14815 15149
14816 const RefactoringKind._(this.name); 15150 const RefactoringProblemSeverity._(this.name);
14817 15151
14818 factory RefactoringKind(String name) { 15152 factory RefactoringProblemSeverity(String name) {
14819 switch (name) { 15153 switch (name) {
14820 case "CONVERT_GETTER_TO_METHOD": 15154 case "INFO":
14821 return CONVERT_GETTER_TO_METHOD; 15155 return INFO;
14822 case "CONVERT_METHOD_TO_GETTER": 15156 case "WARNING":
14823 return CONVERT_METHOD_TO_GETTER; 15157 return WARNING;
14824 case "EXTRACT_LOCAL_VARIABLE": 15158 case "ERROR":
14825 return EXTRACT_LOCAL_VARIABLE; 15159 return ERROR;
14826 case "EXTRACT_METHOD": 15160 case "FATAL":
14827 return EXTRACT_METHOD; 15161 return FATAL;
14828 case "INLINE_LOCAL_VARIABLE":
14829 return INLINE_LOCAL_VARIABLE;
14830 case "INLINE_METHOD":
14831 return INLINE_METHOD;
14832 case "MOVE_FILE":
14833 return MOVE_FILE;
14834 case "RENAME":
14835 return RENAME;
14836 case "SORT_MEMBERS":
14837 return SORT_MEMBERS;
14838 } 15162 }
14839 throw new Exception('Illegal enum value: $name'); 15163 throw new Exception('Illegal enum value: $name');
14840 } 15164 }
14841 15165
14842 factory RefactoringKind.fromJson( 15166 factory RefactoringProblemSeverity.fromJson(
14843 JsonDecoder jsonDecoder, String jsonPath, Object json) { 15167 JsonDecoder jsonDecoder, String jsonPath, Object json) {
14844 if (json is String) { 15168 if (json is String) {
14845 try { 15169 try {
14846 return new RefactoringKind(json); 15170 return new RefactoringProblemSeverity(json);
14847 } catch (_) { 15171 } catch (_) {
14848 // Fall through 15172 // Fall through
14849 } 15173 }
14850 } 15174 }
14851 throw jsonDecoder.mismatch(jsonPath, "RefactoringKind", json); 15175 throw jsonDecoder.mismatch(jsonPath, "RefactoringProblemSeverity", json);
14852 } 15176 }
14853 15177
14854 @override 15178 /**
14855 String toString() => "RefactoringKind.$name"; 15179 * Returns the [RefactoringProblemSeverity] with the maximal severity.
15180 */
15181 static RefactoringProblemSeverity max(
15182 RefactoringProblemSeverity a, RefactoringProblemSeverity b) =>
15183 maxRefactoringProblemSeverity(a, b);
15184
15185 @override
15186 String toString() => "RefactoringProblemSeverity.$name";
14856 15187
14857 String toJson() => name; 15188 String toJson() => name;
14858 } 15189 }
14859 15190
14860 /** 15191 /**
14861 * RefactoringMethodParameter 15192 * RemoveContentOverlay
14862 * 15193 *
14863 * { 15194 * {
14864 * "id": optional String 15195 * "type": "remove"
14865 * "kind": RefactoringMethodParameterKind
14866 * "type": String
14867 * "name": String
14868 * "parameters": optional String
14869 * } 15196 * }
14870 * 15197 *
14871 * Clients may not extend, implement or mix-in this class. 15198 * Clients may not extend, implement or mix-in this class.
14872 */ 15199 */
14873 class RefactoringMethodParameter implements HasToJson { 15200 class RemoveContentOverlay implements HasToJson {
14874 String _id; 15201 RemoveContentOverlay();
14875 15202
14876 RefactoringMethodParameterKind _kind; 15203 factory RemoveContentOverlay.fromJson(
14877
14878 String _type;
14879
14880 String _name;
14881
14882 String _parameters;
14883
14884 /**
14885 * The unique identifier of the parameter. Clients may omit this field for
14886 * the parameters they want to add.
14887 */
14888 String get id => _id;
14889
14890 /**
14891 * The unique identifier of the parameter. Clients may omit this field for
14892 * the parameters they want to add.
14893 */
14894 void set id(String value) {
14895 this._id = value;
14896 }
14897
14898 /**
14899 * The kind of the parameter.
14900 */
14901 RefactoringMethodParameterKind get kind => _kind;
14902
14903 /**
14904 * The kind of the parameter.
14905 */
14906 void set kind(RefactoringMethodParameterKind value) {
14907 assert(value != null);
14908 this._kind = value;
14909 }
14910
14911 /**
14912 * The type that should be given to the parameter, or the return type of the
14913 * parameter's function type.
14914 */
14915 String get type => _type;
14916
14917 /**
14918 * The type that should be given to the parameter, or the return type of the
14919 * parameter's function type.
14920 */
14921 void set type(String value) {
14922 assert(value != null);
14923 this._type = value;
14924 }
14925
14926 /**
14927 * The name that should be given to the parameter.
14928 */
14929 String get name => _name;
14930
14931 /**
14932 * The name that should be given to the parameter.
14933 */
14934 void set name(String value) {
14935 assert(value != null);
14936 this._name = value;
14937 }
14938
14939 /**
14940 * The parameter list of the parameter's function type. If the parameter is
14941 * not of a function type, this field will not be defined. If the function
14942 * type has zero parameters, this field will have a value of "()".
14943 */
14944 String get parameters => _parameters;
14945
14946 /**
14947 * The parameter list of the parameter's function type. If the parameter is
14948 * not of a function type, this field will not be defined. If the function
14949 * type has zero parameters, this field will have a value of "()".
14950 */
14951 void set parameters(String value) {
14952 this._parameters = value;
14953 }
14954
14955 RefactoringMethodParameter(
14956 RefactoringMethodParameterKind kind, String type, String name,
14957 {String id, String parameters}) {
14958 this.id = id;
14959 this.kind = kind;
14960 this.type = type;
14961 this.name = name;
14962 this.parameters = parameters;
14963 }
14964
14965 factory RefactoringMethodParameter.fromJson(
14966 JsonDecoder jsonDecoder, String jsonPath, Object json) { 15204 JsonDecoder jsonDecoder, String jsonPath, Object json) {
14967 if (json == null) { 15205 if (json == null) {
14968 json = {}; 15206 json = {};
14969 } 15207 }
14970 if (json is Map) { 15208 if (json is Map) {
14971 String id; 15209 if (json["type"] != "remove") {
14972 if (json.containsKey("id")) { 15210 throw jsonDecoder.mismatch(jsonPath, "equal " + "remove", json);
14973 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]); 15211 }
14974 } 15212 return new RemoveContentOverlay();
14975 RefactoringMethodParameterKind kind;
14976 if (json.containsKey("kind")) {
14977 kind = new RefactoringMethodParameterKind.fromJson(
14978 jsonDecoder, jsonPath + ".kind", json["kind"]);
14979 } else {
14980 throw jsonDecoder.missingKey(jsonPath, "kind");
14981 }
14982 String type;
14983 if (json.containsKey("type")) {
14984 type = jsonDecoder.decodeString(jsonPath + ".type", json["type"]);
14985 } else {
14986 throw jsonDecoder.missingKey(jsonPath, "type");
14987 }
14988 String name;
14989 if (json.containsKey("name")) {
14990 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]);
14991 } else {
14992 throw jsonDecoder.missingKey(jsonPath, "name");
14993 }
14994 String parameters;
14995 if (json.containsKey("parameters")) {
14996 parameters = jsonDecoder.decodeString(
14997 jsonPath + ".parameters", json["parameters"]);
14998 }
14999 return new RefactoringMethodParameter(kind, type, name,
15000 id: id, parameters: parameters);
15001 } else { 15213 } else {
15002 throw jsonDecoder.mismatch(jsonPath, "RefactoringMethodParameter", json); 15214 throw jsonDecoder.mismatch(jsonPath, "RemoveContentOverlay", json);
15003 } 15215 }
15004 } 15216 }
15005 15217
15218 @override
15006 Map<String, dynamic> toJson() { 15219 Map<String, dynamic> toJson() {
15007 Map<String, dynamic> result = {}; 15220 Map<String, dynamic> result = {};
15008 if (id != null) { 15221 result["type"] = "remove";
15009 result["id"] = id;
15010 }
15011 result["kind"] = kind.toJson();
15012 result["type"] = type;
15013 result["name"] = name;
15014 if (parameters != null) {
15015 result["parameters"] = parameters;
15016 }
15017 return result; 15222 return result;
15018 } 15223 }
15019 15224
15225 @override
15226 String toString() => JSON.encode(toJson());
15227
15228 @override
15229 bool operator ==(other) {
15230 if (other is RemoveContentOverlay) {
15231 return true;
15232 }
15233 return false;
15234 }
15235
15236 @override
15237 int get hashCode {
15238 int hash = 0;
15239 hash = JenkinsSmiHash.combine(hash, 114870849);
15240 return JenkinsSmiHash.finish(hash);
15241 }
15242 }
15243
15244 /**
15245 * rename feedback
15246 *
15247 * {
15248 * "offset": int
15249 * "length": int
15250 * "elementKindName": String
15251 * "oldName": String
15252 * }
15253 *
15254 * Clients may not extend, implement or mix-in this class.
15255 */
15256 class RenameFeedback extends RefactoringFeedback {
15257 int _offset;
15258
15259 int _length;
15260
15261 String _elementKindName;
15262
15263 String _oldName;
15264
15265 /**
15266 * The offset to the beginning of the name selected to be renamed.
15267 */
15268 int get offset => _offset;
15269
15270 /**
15271 * The offset to the beginning of the name selected to be renamed.
15272 */
15273 void set offset(int value) {
15274 assert(value != null);
15275 this._offset = value;
15276 }
15277
15278 /**
15279 * The length of the name selected to be renamed.
15280 */
15281 int get length => _length;
15282
15283 /**
15284 * The length of the name selected to be renamed.
15285 */
15286 void set length(int value) {
15287 assert(value != null);
15288 this._length = value;
15289 }
15290
15291 /**
15292 * The human-readable description of the kind of element being renamed (such
15293 * as "class" or "function type alias").
15294 */
15295 String get elementKindName => _elementKindName;
15296
15297 /**
15298 * The human-readable description of the kind of element being renamed (such
15299 * as "class" or "function type alias").
15300 */
15301 void set elementKindName(String value) {
15302 assert(value != null);
15303 this._elementKindName = value;
15304 }
15305
15306 /**
15307 * The old name of the element before the refactoring.
15308 */
15309 String get oldName => _oldName;
15310
15311 /**
15312 * The old name of the element before the refactoring.
15313 */
15314 void set oldName(String value) {
15315 assert(value != null);
15316 this._oldName = value;
15317 }
15318
15319 RenameFeedback(
15320 int offset, int length, String elementKindName, String oldName) {
15321 this.offset = offset;
15322 this.length = length;
15323 this.elementKindName = elementKindName;
15324 this.oldName = oldName;
15325 }
15326
15327 factory RenameFeedback.fromJson(
15328 JsonDecoder jsonDecoder, String jsonPath, Object json) {
15329 if (json == null) {
15330 json = {};
15331 }
15332 if (json is Map) {
15333 int offset;
15334 if (json.containsKey("offset")) {
15335 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
15336 } else {
15337 throw jsonDecoder.mismatch(jsonPath, "offset");
15338 }
15339 int length;
15340 if (json.containsKey("length")) {
15341 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
15342 } else {
15343 throw jsonDecoder.mismatch(jsonPath, "length");
15344 }
15345 String elementKindName;
15346 if (json.containsKey("elementKindName")) {
15347 elementKindName = jsonDecoder.decodeString(
15348 jsonPath + ".elementKindName", json["elementKindName"]);
15349 } else {
15350 throw jsonDecoder.mismatch(jsonPath, "elementKindName");
15351 }
15352 String oldName;
15353 if (json.containsKey("oldName")) {
15354 oldName =
15355 jsonDecoder.decodeString(jsonPath + ".oldName", json["oldName"]);
15356 } else {
15357 throw jsonDecoder.mismatch(jsonPath, "oldName");
15358 }
15359 return new RenameFeedback(offset, length, elementKindName, oldName);
15360 } else {
15361 throw jsonDecoder.mismatch(jsonPath, "rename feedback", json);
15362 }
15363 }
15364
15365 @override
15366 Map<String, dynamic> toJson() {
15367 Map<String, dynamic> result = {};
15368 result["offset"] = offset;
15369 result["length"] = length;
15370 result["elementKindName"] = elementKindName;
15371 result["oldName"] = oldName;
15372 return result;
15373 }
15374
15020 @override 15375 @override
15021 String toString() => JSON.encode(toJson()); 15376 String toString() => JSON.encode(toJson());
15022 15377
15023 @override 15378 @override
15024 bool operator ==(other) { 15379 bool operator ==(other) {
15025 if (other is RefactoringMethodParameter) { 15380 if (other is RenameFeedback) {
15026 return id == other.id && 15381 return offset == other.offset &&
15027 kind == other.kind && 15382 length == other.length &&
15028 type == other.type && 15383 elementKindName == other.elementKindName &&
15029 name == other.name && 15384 oldName == other.oldName;
15030 parameters == other.parameters;
15031 } 15385 }
15032 return false; 15386 return false;
15033 } 15387 }
15034 15388
15035 @override 15389 @override
15036 int get hashCode { 15390 int get hashCode {
15037 int hash = 0; 15391 int hash = 0;
15038 hash = JenkinsSmiHash.combine(hash, id.hashCode); 15392 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
15039 hash = JenkinsSmiHash.combine(hash, kind.hashCode); 15393 hash = JenkinsSmiHash.combine(hash, length.hashCode);
15040 hash = JenkinsSmiHash.combine(hash, type.hashCode); 15394 hash = JenkinsSmiHash.combine(hash, elementKindName.hashCode);
15041 hash = JenkinsSmiHash.combine(hash, name.hashCode); 15395 hash = JenkinsSmiHash.combine(hash, oldName.hashCode);
15042 hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
15043 return JenkinsSmiHash.finish(hash); 15396 return JenkinsSmiHash.finish(hash);
15044 } 15397 }
15045 } 15398 }
15046 15399
15047 /** 15400 /**
15048 * RefactoringFeedback 15401 * rename options
15049 * 15402 *
15050 * { 15403 * {
15404 * "newName": String
15051 * } 15405 * }
15052 * 15406 *
15053 * Clients may not extend, implement or mix-in this class. 15407 * Clients may not extend, implement or mix-in this class.
15054 */ 15408 */
15055 class RefactoringFeedback implements HasToJson { 15409 class RenameOptions extends RefactoringOptions {
15056 RefactoringFeedback(); 15410 String _newName;
15057 15411
15058 factory RefactoringFeedback.fromJson( 15412 /**
15059 JsonDecoder jsonDecoder, String jsonPath, Object json, Map responseJson) { 15413 * The name that the element should have after the refactoring.
15060 return refactoringFeedbackFromJson( 15414 */
15061 jsonDecoder, jsonPath, json, responseJson); 15415 String get newName => _newName;
15416
15417 /**
15418 * The name that the element should have after the refactoring.
15419 */
15420 void set newName(String value) {
15421 assert(value != null);
15422 this._newName = value;
15062 } 15423 }
15063 15424
15425 RenameOptions(String newName) {
15426 this.newName = newName;
15427 }
15428
15429 factory RenameOptions.fromJson(
15430 JsonDecoder jsonDecoder, String jsonPath, Object json) {
15431 if (json == null) {
15432 json = {};
15433 }
15434 if (json is Map) {
15435 String newName;
15436 if (json.containsKey("newName")) {
15437 newName =
15438 jsonDecoder.decodeString(jsonPath + ".newName", json["newName"]);
15439 } else {
15440 throw jsonDecoder.mismatch(jsonPath, "newName");
15441 }
15442 return new RenameOptions(newName);
15443 } else {
15444 throw jsonDecoder.mismatch(jsonPath, "rename options", json);
15445 }
15446 }
15447
15448 factory RenameOptions.fromRefactoringParams(
15449 EditGetRefactoringParams refactoringParams, Request request) {
15450 return new RenameOptions.fromJson(
15451 new RequestDecoder(request), "options", refactoringParams.options);
15452 }
15453
15454 @override
15064 Map<String, dynamic> toJson() { 15455 Map<String, dynamic> toJson() {
15065 Map<String, dynamic> result = {}; 15456 Map<String, dynamic> result = {};
15457 result["newName"] = newName;
15066 return result; 15458 return result;
15067 } 15459 }
15068 15460
15069 @override
15070 String toString() => JSON.encode(toJson());
15071
15072 @override
15073 bool operator ==(other) {
15074 if (other is RefactoringFeedback) {
15075 return true;
15076 }
15077 return false;
15078 }
15079
15080 @override
15081 int get hashCode {
15082 int hash = 0;
15083 return JenkinsSmiHash.finish(hash);
15084 }
15085 }
15086
15087 /**
15088 * RefactoringOptions
15089 *
15090 * {
15091 * }
15092 *
15093 * Clients may not extend, implement or mix-in this class.
15094 */
15095 class RefactoringOptions implements HasToJson {
15096 RefactoringOptions();
15097
15098 factory RefactoringOptions.fromJson(JsonDecoder jsonDecoder, String jsonPath,
15099 Object json, RefactoringKind kind) {
15100 return refactoringOptionsFromJson(jsonDecoder, jsonPath, json, kind);
15101 }
15102
15103 Map<String, dynamic> toJson() {
15104 Map<String, dynamic> result = {};
15105 return result;
15106 }
15107
15108 @override 15461 @override
15109 String toString() => JSON.encode(toJson()); 15462 String toString() => JSON.encode(toJson());
15110 15463
15111 @override 15464 @override
15112 bool operator ==(other) { 15465 bool operator ==(other) {
15113 if (other is RefactoringOptions) { 15466 if (other is RenameOptions) {
15114 return true; 15467 return newName == other.newName;
15115 } 15468 }
15116 return false; 15469 return false;
15117 } 15470 }
15118 15471
15119 @override 15472 @override
15120 int get hashCode { 15473 int get hashCode {
15121 int hash = 0; 15474 int hash = 0;
15475 hash = JenkinsSmiHash.combine(hash, newName.hashCode);
15122 return JenkinsSmiHash.finish(hash); 15476 return JenkinsSmiHash.finish(hash);
15123 } 15477 }
15124 } 15478 }
15125 15479
15126 /** 15480 /**
15127 * RefactoringMethodParameterKind 15481 * RequestError
15128 * 15482 *
15129 * enum { 15483 * {
15130 * REQUIRED 15484 * "code": RequestErrorCode
15131 * POSITIONAL 15485 * "message": String
15132 * NAMED 15486 * "stackTrace": optional String
15133 * } 15487 * }
15134 * 15488 *
15135 * Clients may not extend, implement or mix-in this class. 15489 * Clients may not extend, implement or mix-in this class.
15136 */ 15490 */
15137 class RefactoringMethodParameterKind implements Enum { 15491 class RequestError implements HasToJson {
15138 static const RefactoringMethodParameterKind REQUIRED = 15492 RequestErrorCode _code;
15139 const RefactoringMethodParameterKind._("REQUIRED");
15140
15141 static const RefactoringMethodParameterKind POSITIONAL =
15142 const RefactoringMethodParameterKind._("POSITIONAL");
15143
15144 static const RefactoringMethodParameterKind NAMED =
15145 const RefactoringMethodParameterKind._("NAMED");
15146
15147 /**
15148 * A list containing all of the enum values that are defined.
15149 */
15150 static const List<RefactoringMethodParameterKind> VALUES =
15151 const <RefactoringMethodParameterKind>[REQUIRED, POSITIONAL, NAMED];
15152
15153 final String name;
15154
15155 const RefactoringMethodParameterKind._(this.name);
15156
15157 factory RefactoringMethodParameterKind(String name) {
15158 switch (name) {
15159 case "REQUIRED":
15160 return REQUIRED;
15161 case "POSITIONAL":
15162 return POSITIONAL;
15163 case "NAMED":
15164 return NAMED;
15165 }
15166 throw new Exception('Illegal enum value: $name');
15167 }
15168
15169 factory RefactoringMethodParameterKind.fromJson(
15170 JsonDecoder jsonDecoder, String jsonPath, Object json) {
15171 if (json is String) {
15172 try {
15173 return new RefactoringMethodParameterKind(json);
15174 } catch (_) {
15175 // Fall through
15176 }
15177 }
15178 throw jsonDecoder.mismatch(
15179 jsonPath, "RefactoringMethodParameterKind", json);
15180 }
15181
15182 @override
15183 String toString() => "RefactoringMethodParameterKind.$name";
15184
15185 String toJson() => name;
15186 }
15187
15188 /**
15189 * RefactoringProblem
15190 *
15191 * {
15192 * "severity": RefactoringProblemSeverity
15193 * "message": String
15194 * "location": optional Location
15195 * }
15196 *
15197 * Clients may not extend, implement or mix-in this class.
15198 */
15199 class RefactoringProblem implements HasToJson {
15200 RefactoringProblemSeverity _severity;
15201 15493
15202 String _message; 15494 String _message;
15203 15495
15204 Location _location; 15496 String _stackTrace;
15205 15497
15206 /** 15498 /**
15207 * The severity of the problem being represented. 15499 * A code that uniquely identifies the error that occurred.
15208 */ 15500 */
15209 RefactoringProblemSeverity get severity => _severity; 15501 RequestErrorCode get code => _code;
15210 15502
15211 /** 15503 /**
15212 * The severity of the problem being represented. 15504 * A code that uniquely identifies the error that occurred.
15213 */ 15505 */
15214 void set severity(RefactoringProblemSeverity value) { 15506 void set code(RequestErrorCode value) {
15215 assert(value != null); 15507 assert(value != null);
15216 this._severity = value; 15508 this._code = value;
15217 } 15509 }
15218 15510
15219 /** 15511 /**
15220 * A human-readable description of the problem being represented. 15512 * A short description of the error.
15221 */ 15513 */
15222 String get message => _message; 15514 String get message => _message;
15223 15515
15224 /** 15516 /**
15225 * A human-readable description of the problem being represented. 15517 * A short description of the error.
15226 */ 15518 */
15227 void set message(String value) { 15519 void set message(String value) {
15228 assert(value != null); 15520 assert(value != null);
15229 this._message = value; 15521 this._message = value;
15230 } 15522 }
15231 15523
15232 /** 15524 /**
15233 * The location of the problem being represented. This field is omitted 15525 * The stack trace associated with processing the request, used for debugging
15234 * unless there is a specific location associated with the problem (such as a 15526 * the server.
15235 * location where an element being renamed will be shadowed).
15236 */ 15527 */
15237 Location get location => _location; 15528 String get stackTrace => _stackTrace;
15238 15529
15239 /** 15530 /**
15240 * The location of the problem being represented. This field is omitted 15531 * The stack trace associated with processing the request, used for debugging
15241 * unless there is a specific location associated with the problem (such as a 15532 * the server.
15242 * location where an element being renamed will be shadowed).
15243 */ 15533 */
15244 void set location(Location value) { 15534 void set stackTrace(String value) {
15245 this._location = value; 15535 this._stackTrace = value;
15246 } 15536 }
15247 15537
15248 RefactoringProblem(RefactoringProblemSeverity severity, String message, 15538 RequestError(RequestErrorCode code, String message, {String stackTrace}) {
15249 {Location location}) { 15539 this.code = code;
15250 this.severity = severity;
15251 this.message = message; 15540 this.message = message;
15252 this.location = location; 15541 this.stackTrace = stackTrace;
15253 } 15542 }
15254 15543
15255 factory RefactoringProblem.fromJson( 15544 factory RequestError.fromJson(
15256 JsonDecoder jsonDecoder, String jsonPath, Object json) { 15545 JsonDecoder jsonDecoder, String jsonPath, Object json) {
15257 if (json == null) { 15546 if (json == null) {
15258 json = {}; 15547 json = {};
15259 } 15548 }
15260 if (json is Map) { 15549 if (json is Map) {
15261 RefactoringProblemSeverity severity; 15550 RequestErrorCode code;
15262 if (json.containsKey("severity")) { 15551 if (json.containsKey("code")) {
15263 severity = new RefactoringProblemSeverity.fromJson( 15552 code = new RequestErrorCode.fromJson(
15264 jsonDecoder, jsonPath + ".severity", json["severity"]); 15553 jsonDecoder, jsonPath + ".code", json["code"]);
15265 } else { 15554 } else {
15266 throw jsonDecoder.missingKey(jsonPath, "severity"); 15555 throw jsonDecoder.mismatch(jsonPath, "code");
15267 } 15556 }
15268 String message; 15557 String message;
15269 if (json.containsKey("message")) { 15558 if (json.containsKey("message")) {
15270 message = 15559 message =
15271 jsonDecoder.decodeString(jsonPath + ".message", json["message"]); 15560 jsonDecoder.decodeString(jsonPath + ".message", json["message"]);
15272 } else { 15561 } else {
15273 throw jsonDecoder.missingKey(jsonPath, "message"); 15562 throw jsonDecoder.mismatch(jsonPath, "message");
15274 } 15563 }
15275 Location location; 15564 String stackTrace;
15276 if (json.containsKey("location")) { 15565 if (json.containsKey("stackTrace")) {
15277 location = new Location.fromJson( 15566 stackTrace = jsonDecoder.decodeString(
15278 jsonDecoder, jsonPath + ".location", json["location"]); 15567 jsonPath + ".stackTrace", json["stackTrace"]);
15279 } 15568 }
15280 return new RefactoringProblem(severity, message, location: location); 15569 return new RequestError(code, message, stackTrace: stackTrace);
15281 } else { 15570 } else {
15282 throw jsonDecoder.mismatch(jsonPath, "RefactoringProblem", json); 15571 throw jsonDecoder.mismatch(jsonPath, "RequestError", json);
15283 } 15572 }
15284 } 15573 }
15285 15574
15575 @override
15286 Map<String, dynamic> toJson() { 15576 Map<String, dynamic> toJson() {
15287 Map<String, dynamic> result = {}; 15577 Map<String, dynamic> result = {};
15288 result["severity"] = severity.toJson(); 15578 result["code"] = code.toJson();
15289 result["message"] = message; 15579 result["message"] = message;
15290 if (location != null) { 15580 if (stackTrace != null) {
15291 result["location"] = location.toJson(); 15581 result["stackTrace"] = stackTrace;
15292 } 15582 }
15293 return result; 15583 return result;
15294 } 15584 }
15295 15585
15296 @override 15586 @override
15297 String toString() => JSON.encode(toJson()); 15587 String toString() => JSON.encode(toJson());
15298 15588
15299 @override 15589 @override
15300 bool operator ==(other) { 15590 bool operator ==(other) {
15301 if (other is RefactoringProblem) { 15591 if (other is RequestError) {
15302 return severity == other.severity && 15592 return code == other.code &&
15303 message == other.message && 15593 message == other.message &&
15304 location == other.location; 15594 stackTrace == other.stackTrace;
15305 } 15595 }
15306 return false; 15596 return false;
15307 } 15597 }
15308 15598
15309 @override 15599 @override
15310 int get hashCode { 15600 int get hashCode {
15311 int hash = 0; 15601 int hash = 0;
15312 hash = JenkinsSmiHash.combine(hash, severity.hashCode); 15602 hash = JenkinsSmiHash.combine(hash, code.hashCode);
15313 hash = JenkinsSmiHash.combine(hash, message.hashCode); 15603 hash = JenkinsSmiHash.combine(hash, message.hashCode);
15314 hash = JenkinsSmiHash.combine(hash, location.hashCode); 15604 hash = JenkinsSmiHash.combine(hash, stackTrace.hashCode);
15315 return JenkinsSmiHash.finish(hash); 15605 return JenkinsSmiHash.finish(hash);
15316 } 15606 }
15317 } 15607 }
15318 15608
15319 /** 15609 /**
15320 * RefactoringProblemSeverity 15610 * RequestErrorCode
15321 * 15611 *
15322 * enum { 15612 * enum {
15323 * INFO 15613 * CONTENT_MODIFIED
15324 * WARNING 15614 * DEBUG_PORT_COULD_NOT_BE_OPENED
15325 * ERROR 15615 * FILE_NOT_ANALYZED
15326 * FATAL 15616 * FORMAT_INVALID_FILE
15617 * FORMAT_WITH_ERRORS
15618 * GET_ERRORS_INVALID_FILE
15619 * GET_NAVIGATION_INVALID_FILE
15620 * GET_REACHABLE_SOURCES_INVALID_FILE
15621 * INVALID_ANALYSIS_ROOT
15622 * INVALID_EXECUTION_CONTEXT
15623 * INVALID_FILE_PATH_FORMAT
15624 * INVALID_OVERLAY_CHANGE
15625 * INVALID_PARAMETER
15626 * INVALID_REQUEST
15627 * NO_INDEX_GENERATED
15628 * ORGANIZE_DIRECTIVES_ERROR
15629 * REFACTORING_REQUEST_CANCELLED
15630 * SERVER_ALREADY_STARTED
15631 * SERVER_ERROR
15632 * SORT_MEMBERS_INVALID_FILE
15633 * SORT_MEMBERS_PARSE_ERRORS
15634 * UNANALYZED_PRIORITY_FILES
15635 * UNKNOWN_REQUEST
15636 * UNKNOWN_SOURCE
15637 * UNSUPPORTED_FEATURE
15327 * } 15638 * }
15328 * 15639 *
15329 * Clients may not extend, implement or mix-in this class. 15640 * Clients may not extend, implement or mix-in this class.
15330 */ 15641 */
15331 class RefactoringProblemSeverity implements Enum { 15642 class RequestErrorCode implements Enum {
15332 /** 15643 /**
15333 * A minor code problem. No example, because it is not used yet. 15644 * An "analysis.getErrors" or "analysis.getNavigation" request could not be
15334 */ 15645 * satisfied because the content of the file changed before the requested
15335 static const RefactoringProblemSeverity INFO = 15646 * results could be computed.
15336 const RefactoringProblemSeverity._("INFO"); 15647 */
15337 15648 static const RequestErrorCode CONTENT_MODIFIED =
15338 /** 15649 const RequestErrorCode._("CONTENT_MODIFIED");
15339 * A minor code problem. For example names of local variables should be camel 15650
15340 * case and start with a lower case letter. Staring the name of a variable 15651 /**
15341 * with an upper case is OK from the language point of view, but it is nice 15652 * The server was unable to open a port for the diagnostic server.
15342 * to warn the user. 15653 */
15343 */ 15654 static const RequestErrorCode DEBUG_PORT_COULD_NOT_BE_OPENED =
15344 static const RefactoringProblemSeverity WARNING = 15655 const RequestErrorCode._("DEBUG_PORT_COULD_NOT_BE_OPENED");
15345 const RefactoringProblemSeverity._("WARNING"); 15656
15346 15657 /**
15347 /** 15658 * A request specified a FilePath which does not match a file in an analysis
15348 * The refactoring technically can be performed, but there is a logical 15659 * root, or the requested operation is not available for the file.
15349 * problem. For example the name of a local variable being extracted 15660 */
15350 * conflicts with another name in the scope, or duplicate parameter names in 15661 static const RequestErrorCode FILE_NOT_ANALYZED =
15351 * the method being extracted, or a conflict between a parameter name and a 15662 const RequestErrorCode._("FILE_NOT_ANALYZED");
15352 * local variable, etc. In some cases the location of the problem is also 15663
15353 * provided, so the IDE can show user the location and the problem, and let 15664 /**
15354 * the user decide whether she wants to perform the refactoring. For example 15665 * An "edit.format" request specified a FilePath which does not match a Dart
15355 * the name conflict might be expected, and the user wants to fix it 15666 * file in an analysis root.
15356 * afterwards. 15667 */
15357 */ 15668 static const RequestErrorCode FORMAT_INVALID_FILE =
15358 static const RefactoringProblemSeverity ERROR = 15669 const RequestErrorCode._("FORMAT_INVALID_FILE");
15359 const RefactoringProblemSeverity._("ERROR"); 15670
15360 15671 /**
15361 /** 15672 * An "edit.format" request specified a file that contains syntax errors.
15362 * A fatal error, which prevents performing the refactoring. For example the 15673 */
15363 * name of a local variable being extracted is not a valid identifier, or 15674 static const RequestErrorCode FORMAT_WITH_ERRORS =
15364 * selection is not a valid expression. 15675 const RequestErrorCode._("FORMAT_WITH_ERRORS");
15365 */ 15676
15366 static const RefactoringProblemSeverity FATAL = 15677 /**
15367 const RefactoringProblemSeverity._("FATAL"); 15678 * An "analysis.getErrors" request specified a FilePath which does not match
15679 * a file currently subject to analysis.
15680 */
15681 static const RequestErrorCode GET_ERRORS_INVALID_FILE =
15682 const RequestErrorCode._("GET_ERRORS_INVALID_FILE");
15683
15684 /**
15685 * An "analysis.getNavigation" request specified a FilePath which does not
15686 * match a file currently subject to analysis.
15687 */
15688 static const RequestErrorCode GET_NAVIGATION_INVALID_FILE =
15689 const RequestErrorCode._("GET_NAVIGATION_INVALID_FILE");
15690
15691 /**
15692 * An "analysis.getReachableSources" request specified a FilePath which does
15693 * not match a file currently subject to analysis.
15694 */
15695 static const RequestErrorCode GET_REACHABLE_SOURCES_INVALID_FILE =
15696 const RequestErrorCode._("GET_REACHABLE_SOURCES_INVALID_FILE");
15697
15698 /**
15699 * A path passed as an argument to a request (such as analysis.reanalyze) is
15700 * required to be an analysis root, but isn't.
15701 */
15702 static const RequestErrorCode INVALID_ANALYSIS_ROOT =
15703 const RequestErrorCode._("INVALID_ANALYSIS_ROOT");
15704
15705 /**
15706 * The context root used to create an execution context does not exist.
15707 */
15708 static const RequestErrorCode INVALID_EXECUTION_CONTEXT =
15709 const RequestErrorCode._("INVALID_EXECUTION_CONTEXT");
15710
15711 /**
15712 * The format of the given file path is invalid, e.g. is not absolute and
15713 * normalized.
15714 */
15715 static const RequestErrorCode INVALID_FILE_PATH_FORMAT =
15716 const RequestErrorCode._("INVALID_FILE_PATH_FORMAT");
15717
15718 /**
15719 * An "analysis.updateContent" request contained a ChangeContentOverlay
15720 * object which can't be applied, due to an edit having an offset or length
15721 * that is out of range.
15722 */
15723 static const RequestErrorCode INVALID_OVERLAY_CHANGE =
15724 const RequestErrorCode._("INVALID_OVERLAY_CHANGE");
15725
15726 /**
15727 * One of the method parameters was invalid.
15728 */
15729 static const RequestErrorCode INVALID_PARAMETER =
15730 const RequestErrorCode._("INVALID_PARAMETER");
15731
15732 /**
15733 * A malformed request was received.
15734 */
15735 static const RequestErrorCode INVALID_REQUEST =
15736 const RequestErrorCode._("INVALID_REQUEST");
15737
15738 /**
15739 * The "--no-index" flag was passed when the analysis server created, but
15740 * this API call requires an index to have been generated.
15741 */
15742 static const RequestErrorCode NO_INDEX_GENERATED =
15743 const RequestErrorCode._("NO_INDEX_GENERATED");
15744
15745 /**
15746 * An "edit.organizeDirectives" request specified a Dart file that cannot be
15747 * analyzed. The reason is described in the message.
15748 */
15749 static const RequestErrorCode ORGANIZE_DIRECTIVES_ERROR =
15750 const RequestErrorCode._("ORGANIZE_DIRECTIVES_ERROR");
15751
15752 /**
15753 * Another refactoring request was received during processing of this one.
15754 */
15755 static const RequestErrorCode REFACTORING_REQUEST_CANCELLED =
15756 const RequestErrorCode._("REFACTORING_REQUEST_CANCELLED");
15757
15758 /**
15759 * The analysis server has already been started (and hence won't accept new
15760 * connections).
15761 *
15762 * This error is included for future expansion; at present the analysis
15763 * server can only speak to one client at a time so this error will never
15764 * occur.
15765 */
15766 static const RequestErrorCode SERVER_ALREADY_STARTED =
15767 const RequestErrorCode._("SERVER_ALREADY_STARTED");
15768
15769 /**
15770 * An internal error occurred in the analysis server. Also see the
15771 * server.error notification.
15772 */
15773 static const RequestErrorCode SERVER_ERROR =
15774 const RequestErrorCode._("SERVER_ERROR");
15775
15776 /**
15777 * An "edit.sortMembers" request specified a FilePath which does not match a
15778 * Dart file in an analysis root.
15779 */
15780 static const RequestErrorCode SORT_MEMBERS_INVALID_FILE =
15781 const RequestErrorCode._("SORT_MEMBERS_INVALID_FILE");
15782
15783 /**
15784 * An "edit.sortMembers" request specified a Dart file that has scan or parse
15785 * errors.
15786 */
15787 static const RequestErrorCode SORT_MEMBERS_PARSE_ERRORS =
15788 const RequestErrorCode._("SORT_MEMBERS_PARSE_ERRORS");
15789
15790 /**
15791 * An "analysis.setPriorityFiles" request includes one or more files that are
15792 * not being analyzed.
15793 *
15794 * This is a legacy error; it will be removed before the API reaches version
15795 * 1.0.
15796 */
15797 static const RequestErrorCode UNANALYZED_PRIORITY_FILES =
15798 const RequestErrorCode._("UNANALYZED_PRIORITY_FILES");
15799
15800 /**
15801 * A request was received which the analysis server does not recognize, or
15802 * cannot handle in its current configuration.
15803 */
15804 static const RequestErrorCode UNKNOWN_REQUEST =
15805 const RequestErrorCode._("UNKNOWN_REQUEST");
15806
15807 /**
15808 * The analysis server was requested to perform an action on a source that
15809 * does not exist.
15810 */
15811 static const RequestErrorCode UNKNOWN_SOURCE =
15812 const RequestErrorCode._("UNKNOWN_SOURCE");
15813
15814 /**
15815 * The analysis server was requested to perform an action which is not
15816 * supported.
15817 *
15818 * This is a legacy error; it will be removed before the API reaches version
15819 * 1.0.
15820 */
15821 static const RequestErrorCode UNSUPPORTED_FEATURE =
15822 const RequestErrorCode._("UNSUPPORTED_FEATURE");
15368 15823
15369 /** 15824 /**
15370 * A list containing all of the enum values that are defined. 15825 * A list containing all of the enum values that are defined.
15371 */ 15826 */
15372 static const List<RefactoringProblemSeverity> VALUES = 15827 static const List<RequestErrorCode> VALUES = const <RequestErrorCode>[
15373 const <RefactoringProblemSeverity>[INFO, WARNING, ERROR, FATAL]; 15828 CONTENT_MODIFIED,
15374 15829 DEBUG_PORT_COULD_NOT_BE_OPENED,
15830 FILE_NOT_ANALYZED,
15831 FORMAT_INVALID_FILE,
15832 FORMAT_WITH_ERRORS,
15833 GET_ERRORS_INVALID_FILE,
15834 GET_NAVIGATION_INVALID_FILE,
15835 GET_REACHABLE_SOURCES_INVALID_FILE,
15836 INVALID_ANALYSIS_ROOT,
15837 INVALID_EXECUTION_CONTEXT,
15838 INVALID_FILE_PATH_FORMAT,
15839 INVALID_OVERLAY_CHANGE,
15840 INVALID_PARAMETER,
15841 INVALID_REQUEST,
15842 NO_INDEX_GENERATED,
15843 ORGANIZE_DIRECTIVES_ERROR,
15844 REFACTORING_REQUEST_CANCELLED,
15845 SERVER_ALREADY_STARTED,
15846 SERVER_ERROR,
15847 SORT_MEMBERS_INVALID_FILE,
15848 SORT_MEMBERS_PARSE_ERRORS,
15849 UNANALYZED_PRIORITY_FILES,
15850 UNKNOWN_REQUEST,
15851 UNKNOWN_SOURCE,
15852 UNSUPPORTED_FEATURE
15853 ];
15854
15855 @override
15375 final String name; 15856 final String name;
15376 15857
15377 const RefactoringProblemSeverity._(this.name); 15858 const RequestErrorCode._(this.name);
15378 15859
15379 factory RefactoringProblemSeverity(String name) { 15860 factory RequestErrorCode(String name) {
15380 switch (name) { 15861 switch (name) {
15381 case "INFO": 15862 case "CONTENT_MODIFIED":
15382 return INFO; 15863 return CONTENT_MODIFIED;
15383 case "WARNING": 15864 case "DEBUG_PORT_COULD_NOT_BE_OPENED":
15384 return WARNING; 15865 return DEBUG_PORT_COULD_NOT_BE_OPENED;
15385 case "ERROR": 15866 case "FILE_NOT_ANALYZED":
15386 return ERROR; 15867 return FILE_NOT_ANALYZED;
15387 case "FATAL": 15868 case "FORMAT_INVALID_FILE":
15388 return FATAL; 15869 return FORMAT_INVALID_FILE;
15870 case "FORMAT_WITH_ERRORS":
15871 return FORMAT_WITH_ERRORS;
15872 case "GET_ERRORS_INVALID_FILE":
15873 return GET_ERRORS_INVALID_FILE;
15874 case "GET_NAVIGATION_INVALID_FILE":
15875 return GET_NAVIGATION_INVALID_FILE;
15876 case "GET_REACHABLE_SOURCES_INVALID_FILE":
15877 return GET_REACHABLE_SOURCES_INVALID_FILE;
15878 case "INVALID_ANALYSIS_ROOT":
15879 return INVALID_ANALYSIS_ROOT;
15880 case "INVALID_EXECUTION_CONTEXT":
15881 return INVALID_EXECUTION_CONTEXT;
15882 case "INVALID_FILE_PATH_FORMAT":
15883 return INVALID_FILE_PATH_FORMAT;
15884 case "INVALID_OVERLAY_CHANGE":
15885 return INVALID_OVERLAY_CHANGE;
15886 case "INVALID_PARAMETER":
15887 return INVALID_PARAMETER;
15888 case "INVALID_REQUEST":
15889 return INVALID_REQUEST;
15890 case "NO_INDEX_GENERATED":
15891 return NO_INDEX_GENERATED;
15892 case "ORGANIZE_DIRECTIVES_ERROR":
15893 return ORGANIZE_DIRECTIVES_ERROR;
15894 case "REFACTORING_REQUEST_CANCELLED":
15895 return REFACTORING_REQUEST_CANCELLED;
15896 case "SERVER_ALREADY_STARTED":
15897 return SERVER_ALREADY_STARTED;
15898 case "SERVER_ERROR":
15899 return SERVER_ERROR;
15900 case "SORT_MEMBERS_INVALID_FILE":
15901 return SORT_MEMBERS_INVALID_FILE;
15902 case "SORT_MEMBERS_PARSE_ERRORS":
15903 return SORT_MEMBERS_PARSE_ERRORS;
15904 case "UNANALYZED_PRIORITY_FILES":
15905 return UNANALYZED_PRIORITY_FILES;
15906 case "UNKNOWN_REQUEST":
15907 return UNKNOWN_REQUEST;
15908 case "UNKNOWN_SOURCE":
15909 return UNKNOWN_SOURCE;
15910 case "UNSUPPORTED_FEATURE":
15911 return UNSUPPORTED_FEATURE;
15389 } 15912 }
15390 throw new Exception('Illegal enum value: $name'); 15913 throw new Exception('Illegal enum value: $name');
15391 } 15914 }
15392 15915
15393 factory RefactoringProblemSeverity.fromJson( 15916 factory RequestErrorCode.fromJson(
15394 JsonDecoder jsonDecoder, String jsonPath, Object json) { 15917 JsonDecoder jsonDecoder, String jsonPath, Object json) {
15395 if (json is String) { 15918 if (json is String) {
15396 try { 15919 try {
15397 return new RefactoringProblemSeverity(json); 15920 return new RequestErrorCode(json);
15398 } catch (_) { 15921 } catch (_) {
15399 // Fall through 15922 // Fall through
15400 } 15923 }
15401 } 15924 }
15402 throw jsonDecoder.mismatch(jsonPath, "RefactoringProblemSeverity", json); 15925 throw jsonDecoder.mismatch(jsonPath, "RequestErrorCode", json);
15403 } 15926 }
15404 15927
15405 /** 15928 @override
15406 * Returns the [RefactoringProblemSeverity] with the maximal severity. 15929 String toString() => "RequestErrorCode.$name";
15407 */
15408 static RefactoringProblemSeverity max(
15409 RefactoringProblemSeverity a, RefactoringProblemSeverity b) =>
15410 maxRefactoringProblemSeverity(a, b);
15411
15412 @override
15413 String toString() => "RefactoringProblemSeverity.$name";
15414 15930
15415 String toJson() => name; 15931 String toJson() => name;
15416 } 15932 }
15417 15933
15418 /** 15934 /**
15419 * RemoveContentOverlay 15935 * search.findElementReferences params
15420 * 15936 *
15421 * { 15937 * {
15422 * "type": "remove" 15938 * "file": FilePath
15939 * "offset": int
15940 * "includePotential": bool
15423 * } 15941 * }
15424 * 15942 *
15425 * Clients may not extend, implement or mix-in this class. 15943 * Clients may not extend, implement or mix-in this class.
15426 */ 15944 */
15427 class RemoveContentOverlay implements HasToJson { 15945 class SearchFindElementReferencesParams implements RequestParams {
15428 RemoveContentOverlay(); 15946 String _file;
15429 15947
15430 factory RemoveContentOverlay.fromJson( 15948 int _offset;
15949
15950 bool _includePotential;
15951
15952 /**
15953 * The file containing the declaration of or reference to the element used to
15954 * define the search.
15955 */
15956 String get file => _file;
15957
15958 /**
15959 * The file containing the declaration of or reference to the element used to
15960 * define the search.
15961 */
15962 void set file(String value) {
15963 assert(value != null);
15964 this._file = value;
15965 }
15966
15967 /**
15968 * The offset within the file of the declaration of or reference to the
15969 * element.
15970 */
15971 int get offset => _offset;
15972
15973 /**
15974 * The offset within the file of the declaration of or reference to the
15975 * element.
15976 */
15977 void set offset(int value) {
15978 assert(value != null);
15979 this._offset = value;
15980 }
15981
15982 /**
15983 * True if potential matches are to be included in the results.
15984 */
15985 bool get includePotential => _includePotential;
15986
15987 /**
15988 * True if potential matches are to be included in the results.
15989 */
15990 void set includePotential(bool value) {
15991 assert(value != null);
15992 this._includePotential = value;
15993 }
15994
15995 SearchFindElementReferencesParams(
15996 String file, int offset, bool includePotential) {
15997 this.file = file;
15998 this.offset = offset;
15999 this.includePotential = includePotential;
16000 }
16001
16002 factory SearchFindElementReferencesParams.fromJson(
15431 JsonDecoder jsonDecoder, String jsonPath, Object json) { 16003 JsonDecoder jsonDecoder, String jsonPath, Object json) {
15432 if (json == null) { 16004 if (json == null) {
15433 json = {}; 16005 json = {};
15434 } 16006 }
15435 if (json is Map) { 16007 if (json is Map) {
15436 if (json["type"] != "remove") { 16008 String file;
15437 throw jsonDecoder.mismatch(jsonPath, "equal " + "remove", json); 16009 if (json.containsKey("file")) {
16010 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
16011 } else {
16012 throw jsonDecoder.mismatch(jsonPath, "file");
15438 } 16013 }
15439 return new RemoveContentOverlay(); 16014 int offset;
16015 if (json.containsKey("offset")) {
16016 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
16017 } else {
16018 throw jsonDecoder.mismatch(jsonPath, "offset");
16019 }
16020 bool includePotential;
16021 if (json.containsKey("includePotential")) {
16022 includePotential = jsonDecoder.decodeBool(
16023 jsonPath + ".includePotential", json["includePotential"]);
16024 } else {
16025 throw jsonDecoder.mismatch(jsonPath, "includePotential");
16026 }
16027 return new SearchFindElementReferencesParams(
16028 file, offset, includePotential);
15440 } else { 16029 } else {
15441 throw jsonDecoder.mismatch(jsonPath, "RemoveContentOverlay", json); 16030 throw jsonDecoder.mismatch(
16031 jsonPath, "search.findElementReferences params", json);
15442 } 16032 }
15443 } 16033 }
15444 16034
16035 factory SearchFindElementReferencesParams.fromRequest(Request request) {
16036 return new SearchFindElementReferencesParams.fromJson(
16037 new RequestDecoder(request), "params", request.params);
16038 }
16039
16040 @override
15445 Map<String, dynamic> toJson() { 16041 Map<String, dynamic> toJson() {
15446 Map<String, dynamic> result = {}; 16042 Map<String, dynamic> result = {};
15447 result["type"] = "remove"; 16043 result["file"] = file;
16044 result["offset"] = offset;
16045 result["includePotential"] = includePotential;
15448 return result; 16046 return result;
15449 } 16047 }
15450 16048
15451 @override 16049 @override
16050 Request toRequest(String id) {
16051 return new Request(id, "search.findElementReferences", toJson());
16052 }
16053
16054 @override
15452 String toString() => JSON.encode(toJson()); 16055 String toString() => JSON.encode(toJson());
15453 16056
15454 @override 16057 @override
15455 bool operator ==(other) { 16058 bool operator ==(other) {
15456 if (other is RemoveContentOverlay) { 16059 if (other is SearchFindElementReferencesParams) {
15457 return true; 16060 return file == other.file &&
16061 offset == other.offset &&
16062 includePotential == other.includePotential;
15458 } 16063 }
15459 return false; 16064 return false;
15460 } 16065 }
15461
15462 @override
15463 int get hashCode {
15464 int hash = 0;
15465 hash = JenkinsSmiHash.combine(hash, 114870849);
15466 return JenkinsSmiHash.finish(hash);
15467 }
15468 }
15469
15470 /**
15471 * RequestError
15472 *
15473 * {
15474 * "code": RequestErrorCode
15475 * "message": String
15476 * "stackTrace": optional String
15477 * }
15478 *
15479 * Clients may not extend, implement or mix-in this class.
15480 */
15481 class RequestError implements HasToJson {
15482 RequestErrorCode _code;
15483
15484 String _message;
15485
15486 String _stackTrace;
15487
15488 /**
15489 * A code that uniquely identifies the error that occurred.
15490 */
15491 RequestErrorCode get code => _code;
15492
15493 /**
15494 * A code that uniquely identifies the error that occurred.
15495 */
15496 void set code(RequestErrorCode value) {
15497 assert(value != null);
15498 this._code = value;
15499 }
15500
15501 /**
15502 * A short description of the error.
15503 */
15504 String get message => _message;
15505
15506 /**
15507 * A short description of the error.
15508 */
15509 void set message(String value) {
15510 assert(value != null);
15511 this._message = value;
15512 }
15513
15514 /**
15515 * The stack trace associated with processing the request, used for debugging
15516 * the server.
15517 */
15518 String get stackTrace => _stackTrace;
15519
15520 /**
15521 * The stack trace associated with processing the request, used for debugging
15522 * the server.
15523 */
15524 void set stackTrace(String value) {
15525 this._stackTrace = value;
15526 }
15527
15528 RequestError(RequestErrorCode code, String message, {String stackTrace}) {
15529 this.code = code;
15530 this.message = message;
15531 this.stackTrace = stackTrace;
15532 }
15533
15534 factory RequestError.fromJson(
15535 JsonDecoder jsonDecoder, String jsonPath, Object json) {
15536 if (json == null) {
15537 json = {};
15538 }
15539 if (json is Map) {
15540 RequestErrorCode code;
15541 if (json.containsKey("code")) {
15542 code = new RequestErrorCode.fromJson(
15543 jsonDecoder, jsonPath + ".code", json["code"]);
15544 } else {
15545 throw jsonDecoder.missingKey(jsonPath, "code");
15546 }
15547 String message;
15548 if (json.containsKey("message")) {
15549 message =
15550 jsonDecoder.decodeString(jsonPath + ".message", json["message"]);
15551 } else {
15552 throw jsonDecoder.missingKey(jsonPath, "message");
15553 }
15554 String stackTrace;
15555 if (json.containsKey("stackTrace")) {
15556 stackTrace = jsonDecoder.decodeString(
15557 jsonPath + ".stackTrace", json["stackTrace"]);
15558 }
15559 return new RequestError(code, message, stackTrace: stackTrace);
15560 } else {
15561 throw jsonDecoder.mismatch(jsonPath, "RequestError", json);
15562 }
15563 }
15564
15565 Map<String, dynamic> toJson() {
15566 Map<String, dynamic> result = {};
15567 result["code"] = code.toJson();
15568 result["message"] = message;
15569 if (stackTrace != null) {
15570 result["stackTrace"] = stackTrace;
15571 }
15572 return result;
15573 }
15574
15575 @override
15576 String toString() => JSON.encode(toJson());
15577
15578 @override
15579 bool operator ==(other) {
15580 if (other is RequestError) {
15581 return code == other.code &&
15582 message == other.message &&
15583 stackTrace == other.stackTrace;
15584 }
15585 return false;
15586 }
15587 16066
15588 @override 16067 @override
15589 int get hashCode { 16068 int get hashCode {
15590 int hash = 0; 16069 int hash = 0;
15591 hash = JenkinsSmiHash.combine(hash, code.hashCode); 16070 hash = JenkinsSmiHash.combine(hash, file.hashCode);
15592 hash = JenkinsSmiHash.combine(hash, message.hashCode); 16071 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
15593 hash = JenkinsSmiHash.combine(hash, stackTrace.hashCode); 16072 hash = JenkinsSmiHash.combine(hash, includePotential.hashCode);
15594 return JenkinsSmiHash.finish(hash); 16073 return JenkinsSmiHash.finish(hash);
15595 } 16074 }
15596 } 16075 }
15597 16076
15598 /** 16077 /**
15599 * RequestErrorCode 16078 * search.findElementReferences result
15600 * 16079 *
15601 * enum { 16080 * {
15602 * CONTENT_MODIFIED 16081 * "id": optional SearchId
15603 * DEBUG_PORT_COULD_NOT_BE_OPENED 16082 * "element": optional Element
15604 * FILE_NOT_ANALYZED
15605 * FORMAT_INVALID_FILE
15606 * FORMAT_WITH_ERRORS
15607 * GET_ERRORS_INVALID_FILE
15608 * GET_NAVIGATION_INVALID_FILE
15609 * GET_REACHABLE_SOURCES_INVALID_FILE
15610 * INVALID_ANALYSIS_ROOT
15611 * INVALID_EXECUTION_CONTEXT
15612 * INVALID_FILE_PATH_FORMAT
15613 * INVALID_OVERLAY_CHANGE
15614 * INVALID_PARAMETER
15615 * INVALID_REQUEST
15616 * NO_INDEX_GENERATED
15617 * ORGANIZE_DIRECTIVES_ERROR
15618 * REFACTORING_REQUEST_CANCELLED
15619 * SERVER_ALREADY_STARTED
15620 * SERVER_ERROR
15621 * SORT_MEMBERS_INVALID_FILE
15622 * SORT_MEMBERS_PARSE_ERRORS
15623 * UNANALYZED_PRIORITY_FILES
15624 * UNKNOWN_REQUEST
15625 * UNKNOWN_SOURCE
15626 * UNSUPPORTED_FEATURE
15627 * } 16083 * }
15628 * 16084 *
15629 * Clients may not extend, implement or mix-in this class. 16085 * Clients may not extend, implement or mix-in this class.
15630 */ 16086 */
15631 class RequestErrorCode implements Enum { 16087 class SearchFindElementReferencesResult implements ResponseResult {
15632 /** 16088 String _id;
15633 * An "analysis.getErrors" or "analysis.getNavigation" request could not be 16089
15634 * satisfied because the content of the file changed before the requested 16090 Element _element;
15635 * results could be computed. 16091
15636 */ 16092 /**
15637 static const RequestErrorCode CONTENT_MODIFIED = 16093 * The identifier used to associate results with this search request.
15638 const RequestErrorCode._("CONTENT_MODIFIED"); 16094 *
15639 16095 * If no element was found at the given location, this field will be absent,
15640 /** 16096 * and no results will be reported via the search.results notification.
15641 * The server was unable to open a port for the diagnostic server. 16097 */
15642 */ 16098 String get id => _id;
15643 static const RequestErrorCode DEBUG_PORT_COULD_NOT_BE_OPENED = 16099
15644 const RequestErrorCode._("DEBUG_PORT_COULD_NOT_BE_OPENED"); 16100 /**
15645 16101 * The identifier used to associate results with this search request.
15646 /** 16102 *
15647 * A request specified a FilePath which does not match a file in an analysis 16103 * If no element was found at the given location, this field will be absent,
15648 * root, or the requested operation is not available for the file. 16104 * and no results will be reported via the search.results notification.
15649 */ 16105 */
15650 static const RequestErrorCode FILE_NOT_ANALYZED = 16106 void set id(String value) {
15651 const RequestErrorCode._("FILE_NOT_ANALYZED"); 16107 this._id = value;
15652 16108 }
15653 /** 16109
15654 * An "edit.format" request specified a FilePath which does not match a Dart 16110 /**
15655 * file in an analysis root. 16111 * The element referenced or defined at the given offset and whose references
15656 */ 16112 * will be returned in the search results.
15657 static const RequestErrorCode FORMAT_INVALID_FILE = 16113 *
15658 const RequestErrorCode._("FORMAT_INVALID_FILE"); 16114 * If no element was found at the given location, this field will be absent.
15659 16115 */
15660 /** 16116 Element get element => _element;
15661 * An "edit.format" request specified a file that contains syntax errors. 16117
15662 */ 16118 /**
15663 static const RequestErrorCode FORMAT_WITH_ERRORS = 16119 * The element referenced or defined at the given offset and whose references
15664 const RequestErrorCode._("FORMAT_WITH_ERRORS"); 16120 * will be returned in the search results.
15665 16121 *
15666 /** 16122 * If no element was found at the given location, this field will be absent.
15667 * An "analysis.getErrors" request specified a FilePath which does not match 16123 */
15668 * a file currently subject to analysis. 16124 void set element(Element value) {
15669 */ 16125 this._element = value;
15670 static const RequestErrorCode GET_ERRORS_INVALID_FILE = 16126 }
15671 const RequestErrorCode._("GET_ERRORS_INVALID_FILE"); 16127
15672 16128 SearchFindElementReferencesResult({String id, Element element}) {
15673 /** 16129 this.id = id;
15674 * An "analysis.getNavigation" request specified a FilePath which does not 16130 this.element = element;
15675 * match a file currently subject to analysis. 16131 }
15676 */ 16132
15677 static const RequestErrorCode GET_NAVIGATION_INVALID_FILE = 16133 factory SearchFindElementReferencesResult.fromJson(
15678 const RequestErrorCode._("GET_NAVIGATION_INVALID_FILE");
15679
15680 /**
15681 * An "analysis.getReachableSources" request specified a FilePath which does
15682 * not match a file currently subject to analysis.
15683 */
15684 static const RequestErrorCode GET_REACHABLE_SOURCES_INVALID_FILE =
15685 const RequestErrorCode._("GET_REACHABLE_SOURCES_INVALID_FILE");
15686
15687 /**
15688 * A path passed as an argument to a request (such as analysis.reanalyze) is
15689 * required to be an analysis root, but isn't.
15690 */
15691 static const RequestErrorCode INVALID_ANALYSIS_ROOT =
15692 const RequestErrorCode._("INVALID_ANALYSIS_ROOT");
15693
15694 /**
15695 * The context root used to create an execution context does not exist.
15696 */
15697 static const RequestErrorCode INVALID_EXECUTION_CONTEXT =
15698 const RequestErrorCode._("INVALID_EXECUTION_CONTEXT");
15699
15700 /**
15701 * The format of the given file path is invalid, e.g. is not absolute and
15702 * normalized.
15703 */
15704 static const RequestErrorCode INVALID_FILE_PATH_FORMAT =
15705 const RequestErrorCode._("INVALID_FILE_PATH_FORMAT");
15706
15707 /**
15708 * An "analysis.updateContent" request contained a ChangeContentOverlay
15709 * object which can't be applied, due to an edit having an offset or length
15710 * that is out of range.
15711 */
15712 static const RequestErrorCode INVALID_OVERLAY_CHANGE =
15713 const RequestErrorCode._("INVALID_OVERLAY_CHANGE");
15714
15715 /**
15716 * One of the method parameters was invalid.
15717 */
15718 static const RequestErrorCode INVALID_PARAMETER =
15719 const RequestErrorCode._("INVALID_PARAMETER");
15720
15721 /**
15722 * A malformed request was received.
15723 */
15724 static const RequestErrorCode INVALID_REQUEST =
15725 const RequestErrorCode._("INVALID_REQUEST");
15726
15727 /**
15728 * The "--no-index" flag was passed when the analysis server created, but
15729 * this API call requires an index to have been generated.
15730 */
15731 static const RequestErrorCode NO_INDEX_GENERATED =
15732 const RequestErrorCode._("NO_INDEX_GENERATED");
15733
15734 /**
15735 * An "edit.organizeDirectives" request specified a Dart file that cannot be
15736 * analyzed. The reason is described in the message.
15737 */
15738 static const RequestErrorCode ORGANIZE_DIRECTIVES_ERROR =
15739 const RequestErrorCode._("ORGANIZE_DIRECTIVES_ERROR");
15740
15741 /**
15742 * Another refactoring request was received during processing of this one.
15743 */
15744 static const RequestErrorCode REFACTORING_REQUEST_CANCELLED =
15745 const RequestErrorCode._("REFACTORING_REQUEST_CANCELLED");
15746
15747 /**
15748 * The analysis server has already been started (and hence won't accept new
15749 * connections).
15750 *
15751 * This error is included for future expansion; at present the analysis
15752 * server can only speak to one client at a time so this error will never
15753 * occur.
15754 */
15755 static const RequestErrorCode SERVER_ALREADY_STARTED =
15756 const RequestErrorCode._("SERVER_ALREADY_STARTED");
15757
15758 /**
15759 * An internal error occurred in the analysis server. Also see the
15760 * server.error notification.
15761 */
15762 static const RequestErrorCode SERVER_ERROR =
15763 const RequestErrorCode._("SERVER_ERROR");
15764
15765 /**
15766 * An "edit.sortMembers" request specified a FilePath which does not match a
15767 * Dart file in an analysis root.
15768 */
15769 static const RequestErrorCode SORT_MEMBERS_INVALID_FILE =
15770 const RequestErrorCode._("SORT_MEMBERS_INVALID_FILE");
15771
15772 /**
15773 * An "edit.sortMembers" request specified a Dart file that has scan or parse
15774 * errors.
15775 */
15776 static const RequestErrorCode SORT_MEMBERS_PARSE_ERRORS =
15777 const RequestErrorCode._("SORT_MEMBERS_PARSE_ERRORS");
15778
15779 /**
15780 * An "analysis.setPriorityFiles" request includes one or more files that are
15781 * not being analyzed.
15782 *
15783 * This is a legacy error; it will be removed before the API reaches version
15784 * 1.0.
15785 */
15786 static const RequestErrorCode UNANALYZED_PRIORITY_FILES =
15787 const RequestErrorCode._("UNANALYZED_PRIORITY_FILES");
15788
15789 /**
15790 * A request was received which the analysis server does not recognize, or
15791 * cannot handle in its current configuration.
15792 */
15793 static const RequestErrorCode UNKNOWN_REQUEST =
15794 const RequestErrorCode._("UNKNOWN_REQUEST");
15795
15796 /**
15797 * The analysis server was requested to perform an action on a source that
15798 * does not exist.
15799 */
15800 static const RequestErrorCode UNKNOWN_SOURCE =
15801 const RequestErrorCode._("UNKNOWN_SOURCE");
15802
15803 /**
15804 * The analysis server was requested to perform an action which is not
15805 * supported.
15806 *
15807 * This is a legacy error; it will be removed before the API reaches version
15808 * 1.0.
15809 */
15810 static const RequestErrorCode UNSUPPORTED_FEATURE =
15811 const RequestErrorCode._("UNSUPPORTED_FEATURE");
15812
15813 /**
15814 * A list containing all of the enum values that are defined.
15815 */
15816 static const List<RequestErrorCode> VALUES = const <RequestErrorCode>[
15817 CONTENT_MODIFIED,
15818 DEBUG_PORT_COULD_NOT_BE_OPENED,
15819 FILE_NOT_ANALYZED,
15820 FORMAT_INVALID_FILE,
15821 FORMAT_WITH_ERRORS,
15822 GET_ERRORS_INVALID_FILE,
15823 GET_NAVIGATION_INVALID_FILE,
15824 GET_REACHABLE_SOURCES_INVALID_FILE,
15825 INVALID_ANALYSIS_ROOT,
15826 INVALID_EXECUTION_CONTEXT,
15827 INVALID_FILE_PATH_FORMAT,
15828 INVALID_OVERLAY_CHANGE,
15829 INVALID_PARAMETER,
15830 INVALID_REQUEST,
15831 NO_INDEX_GENERATED,
15832 ORGANIZE_DIRECTIVES_ERROR,
15833 REFACTORING_REQUEST_CANCELLED,
15834 SERVER_ALREADY_STARTED,
15835 SERVER_ERROR,
15836 SORT_MEMBERS_INVALID_FILE,
15837 SORT_MEMBERS_PARSE_ERRORS,
15838 UNANALYZED_PRIORITY_FILES,
15839 UNKNOWN_REQUEST,
15840 UNKNOWN_SOURCE,
15841 UNSUPPORTED_FEATURE
15842 ];
15843
15844 final String name;
15845
15846 const RequestErrorCode._(this.name);
15847
15848 factory RequestErrorCode(String name) {
15849 switch (name) {
15850 case "CONTENT_MODIFIED":
15851 return CONTENT_MODIFIED;
15852 case "DEBUG_PORT_COULD_NOT_BE_OPENED":
15853 return DEBUG_PORT_COULD_NOT_BE_OPENED;
15854 case "FILE_NOT_ANALYZED":
15855 return FILE_NOT_ANALYZED;
15856 case "FORMAT_INVALID_FILE":
15857 return FORMAT_INVALID_FILE;
15858 case "FORMAT_WITH_ERRORS":
15859 return FORMAT_WITH_ERRORS;
15860 case "GET_ERRORS_INVALID_FILE":
15861 return GET_ERRORS_INVALID_FILE;
15862 case "GET_NAVIGATION_INVALID_FILE":
15863 return GET_NAVIGATION_INVALID_FILE;
15864 case "GET_REACHABLE_SOURCES_INVALID_FILE":
15865 return GET_REACHABLE_SOURCES_INVALID_FILE;
15866 case "INVALID_ANALYSIS_ROOT":
15867 return INVALID_ANALYSIS_ROOT;
15868 case "INVALID_EXECUTION_CONTEXT":
15869 return INVALID_EXECUTION_CONTEXT;
15870 case "INVALID_FILE_PATH_FORMAT":
15871 return INVALID_FILE_PATH_FORMAT;
15872 case "INVALID_OVERLAY_CHANGE":
15873 return INVALID_OVERLAY_CHANGE;
15874 case "INVALID_PARAMETER":
15875 return INVALID_PARAMETER;
15876 case "INVALID_REQUEST":
15877 return INVALID_REQUEST;
15878 case "NO_INDEX_GENERATED":
15879 return NO_INDEX_GENERATED;
15880 case "ORGANIZE_DIRECTIVES_ERROR":
15881 return ORGANIZE_DIRECTIVES_ERROR;
15882 case "REFACTORING_REQUEST_CANCELLED":
15883 return REFACTORING_REQUEST_CANCELLED;
15884 case "SERVER_ALREADY_STARTED":
15885 return SERVER_ALREADY_STARTED;
15886 case "SERVER_ERROR":
15887 return SERVER_ERROR;
15888 case "SORT_MEMBERS_INVALID_FILE":
15889 return SORT_MEMBERS_INVALID_FILE;
15890 case "SORT_MEMBERS_PARSE_ERRORS":
15891 return SORT_MEMBERS_PARSE_ERRORS;
15892 case "UNANALYZED_PRIORITY_FILES":
15893 return UNANALYZED_PRIORITY_FILES;
15894 case "UNKNOWN_REQUEST":
15895 return UNKNOWN_REQUEST;
15896 case "UNKNOWN_SOURCE":
15897 return UNKNOWN_SOURCE;
15898 case "UNSUPPORTED_FEATURE":
15899 return UNSUPPORTED_FEATURE;
15900 }
15901 throw new Exception('Illegal enum value: $name');
15902 }
15903
15904 factory RequestErrorCode.fromJson(
15905 JsonDecoder jsonDecoder, String jsonPath, Object json) {
15906 if (json is String) {
15907 try {
15908 return new RequestErrorCode(json);
15909 } catch (_) {
15910 // Fall through
15911 }
15912 }
15913 throw jsonDecoder.mismatch(jsonPath, "RequestErrorCode", json);
15914 }
15915
15916 @override
15917 String toString() => "RequestErrorCode.$name";
15918
15919 String toJson() => name;
15920 }
15921
15922 /**
15923 * SearchResult
15924 *
15925 * {
15926 * "location": Location
15927 * "kind": SearchResultKind
15928 * "isPotential": bool
15929 * "path": List<Element>
15930 * }
15931 *
15932 * Clients may not extend, implement or mix-in this class.
15933 */
15934 class SearchResult implements HasToJson {
15935 Location _location;
15936
15937 SearchResultKind _kind;
15938
15939 bool _isPotential;
15940
15941 List<Element> _path;
15942
15943 /**
15944 * The location of the code that matched the search criteria.
15945 */
15946 Location get location => _location;
15947
15948 /**
15949 * The location of the code that matched the search criteria.
15950 */
15951 void set location(Location value) {
15952 assert(value != null);
15953 this._location = value;
15954 }
15955
15956 /**
15957 * The kind of element that was found or the kind of reference that was
15958 * found.
15959 */
15960 SearchResultKind get kind => _kind;
15961
15962 /**
15963 * The kind of element that was found or the kind of reference that was
15964 * found.
15965 */
15966 void set kind(SearchResultKind value) {
15967 assert(value != null);
15968 this._kind = value;
15969 }
15970
15971 /**
15972 * True if the result is a potential match but cannot be confirmed to be a
15973 * match. For example, if all references to a method m defined in some class
15974 * were requested, and a reference to a method m from an unknown class were
15975 * found, it would be marked as being a potential match.
15976 */
15977 bool get isPotential => _isPotential;
15978
15979 /**
15980 * True if the result is a potential match but cannot be confirmed to be a
15981 * match. For example, if all references to a method m defined in some class
15982 * were requested, and a reference to a method m from an unknown class were
15983 * found, it would be marked as being a potential match.
15984 */
15985 void set isPotential(bool value) {
15986 assert(value != null);
15987 this._isPotential = value;
15988 }
15989
15990 /**
15991 * The elements that contain the result, starting with the most immediately
15992 * enclosing ancestor and ending with the library.
15993 */
15994 List<Element> get path => _path;
15995
15996 /**
15997 * The elements that contain the result, starting with the most immediately
15998 * enclosing ancestor and ending with the library.
15999 */
16000 void set path(List<Element> value) {
16001 assert(value != null);
16002 this._path = value;
16003 }
16004
16005 SearchResult(Location location, SearchResultKind kind, bool isPotential,
16006 List<Element> path) {
16007 this.location = location;
16008 this.kind = kind;
16009 this.isPotential = isPotential;
16010 this.path = path;
16011 }
16012
16013 factory SearchResult.fromJson(
16014 JsonDecoder jsonDecoder, String jsonPath, Object json) { 16134 JsonDecoder jsonDecoder, String jsonPath, Object json) {
16015 if (json == null) { 16135 if (json == null) {
16016 json = {}; 16136 json = {};
16017 } 16137 }
16018 if (json is Map) { 16138 if (json is Map) {
16019 Location location; 16139 String id;
16020 if (json.containsKey("location")) { 16140 if (json.containsKey("id")) {
16021 location = new Location.fromJson( 16141 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
16022 jsonDecoder, jsonPath + ".location", json["location"]); 16142 }
16023 } else { 16143 Element element;
16024 throw jsonDecoder.missingKey(jsonPath, "location"); 16144 if (json.containsKey("element")) {
16025 } 16145 element = new Element.fromJson(
16026 SearchResultKind kind; 16146 jsonDecoder, jsonPath + ".element", json["element"]);
16027 if (json.containsKey("kind")) { 16147 }
16028 kind = new SearchResultKind.fromJson( 16148 return new SearchFindElementReferencesResult(id: id, element: element);
16029 jsonDecoder, jsonPath + ".kind", json["kind"]);
16030 } else {
16031 throw jsonDecoder.missingKey(jsonPath, "kind");
16032 }
16033 bool isPotential;
16034 if (json.containsKey("isPotential")) {
16035 isPotential = jsonDecoder.decodeBool(
16036 jsonPath + ".isPotential", json["isPotential"]);
16037 } else {
16038 throw jsonDecoder.missingKey(jsonPath, "isPotential");
16039 }
16040 List<Element> path;
16041 if (json.containsKey("path")) {
16042 path = jsonDecoder.decodeList(
16043 jsonPath + ".path",
16044 json["path"],
16045 (String jsonPath, Object json) =>
16046 new Element.fromJson(jsonDecoder, jsonPath, json));
16047 } else {
16048 throw jsonDecoder.missingKey(jsonPath, "path");
16049 }
16050 return new SearchResult(location, kind, isPotential, path);
16051 } else { 16149 } else {
16052 throw jsonDecoder.mismatch(jsonPath, "SearchResult", json); 16150 throw jsonDecoder.mismatch(
16053 } 16151 jsonPath, "search.findElementReferences result", json);
16054 } 16152 }
16055 16153 }
16154
16155 factory SearchFindElementReferencesResult.fromResponse(Response response) {
16156 return new SearchFindElementReferencesResult.fromJson(
16157 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
16158 "result",
16159 response.result);
16160 }
16161
16162 @override
16056 Map<String, dynamic> toJson() { 16163 Map<String, dynamic> toJson() {
16057 Map<String, dynamic> result = {}; 16164 Map<String, dynamic> result = {};
16058 result["location"] = location.toJson(); 16165 if (id != null) {
16059 result["kind"] = kind.toJson(); 16166 result["id"] = id;
16060 result["isPotential"] = isPotential; 16167 }
16061 result["path"] = path.map((Element value) => value.toJson()).toList(); 16168 if (element != null) {
16169 result["element"] = element.toJson();
16170 }
16062 return result; 16171 return result;
16063 } 16172 }
16064 16173
16065 @override 16174 @override
16175 Response toResponse(String id) {
16176 return new Response(id, result: toJson());
16177 }
16178
16179 @override
16066 String toString() => JSON.encode(toJson()); 16180 String toString() => JSON.encode(toJson());
16067 16181
16068 @override 16182 @override
16069 bool operator ==(other) { 16183 bool operator ==(other) {
16070 if (other is SearchResult) { 16184 if (other is SearchFindElementReferencesResult) {
16071 return location == other.location && 16185 return id == other.id && element == other.element;
16072 kind == other.kind &&
16073 isPotential == other.isPotential &&
16074 listEqual(path, other.path, (Element a, Element b) => a == b);
16075 } 16186 }
16076 return false; 16187 return false;
16077 } 16188 }
16189
16190 @override
16191 int get hashCode {
16192 int hash = 0;
16193 hash = JenkinsSmiHash.combine(hash, id.hashCode);
16194 hash = JenkinsSmiHash.combine(hash, element.hashCode);
16195 return JenkinsSmiHash.finish(hash);
16196 }
16197 }
16198
16199 /**
16200 * search.findMemberDeclarations params
16201 *
16202 * {
16203 * "name": String
16204 * }
16205 *
16206 * Clients may not extend, implement or mix-in this class.
16207 */
16208 class SearchFindMemberDeclarationsParams implements RequestParams {
16209 String _name;
16210
16211 /**
16212 * The name of the declarations to be found.
16213 */
16214 String get name => _name;
16215
16216 /**
16217 * The name of the declarations to be found.
16218 */
16219 void set name(String value) {
16220 assert(value != null);
16221 this._name = value;
16222 }
16223
16224 SearchFindMemberDeclarationsParams(String name) {
16225 this.name = name;
16226 }
16227
16228 factory SearchFindMemberDeclarationsParams.fromJson(
16229 JsonDecoder jsonDecoder, String jsonPath, Object json) {
16230 if (json == null) {
16231 json = {};
16232 }
16233 if (json is Map) {
16234 String name;
16235 if (json.containsKey("name")) {
16236 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]);
16237 } else {
16238 throw jsonDecoder.mismatch(jsonPath, "name");
16239 }
16240 return new SearchFindMemberDeclarationsParams(name);
16241 } else {
16242 throw jsonDecoder.mismatch(
16243 jsonPath, "search.findMemberDeclarations params", json);
16244 }
16245 }
16246
16247 factory SearchFindMemberDeclarationsParams.fromRequest(Request request) {
16248 return new SearchFindMemberDeclarationsParams.fromJson(
16249 new RequestDecoder(request), "params", request.params);
16250 }
16251
16252 @override
16253 Map<String, dynamic> toJson() {
16254 Map<String, dynamic> result = {};
16255 result["name"] = name;
16256 return result;
16257 }
16258
16259 @override
16260 Request toRequest(String id) {
16261 return new Request(id, "search.findMemberDeclarations", toJson());
16262 }
16263
16264 @override
16265 String toString() => JSON.encode(toJson());
16266
16267 @override
16268 bool operator ==(other) {
16269 if (other is SearchFindMemberDeclarationsParams) {
16270 return name == other.name;
16271 }
16272 return false;
16273 }
16274
16275 @override
16276 int get hashCode {
16277 int hash = 0;
16278 hash = JenkinsSmiHash.combine(hash, name.hashCode);
16279 return JenkinsSmiHash.finish(hash);
16280 }
16281 }
16282
16283 /**
16284 * search.findMemberDeclarations result
16285 *
16286 * {
16287 * "id": SearchId
16288 * }
16289 *
16290 * Clients may not extend, implement or mix-in this class.
16291 */
16292 class SearchFindMemberDeclarationsResult implements ResponseResult {
16293 String _id;
16294
16295 /**
16296 * The identifier used to associate results with this search request.
16297 */
16298 String get id => _id;
16299
16300 /**
16301 * The identifier used to associate results with this search request.
16302 */
16303 void set id(String value) {
16304 assert(value != null);
16305 this._id = value;
16306 }
16307
16308 SearchFindMemberDeclarationsResult(String id) {
16309 this.id = id;
16310 }
16311
16312 factory SearchFindMemberDeclarationsResult.fromJson(
16313 JsonDecoder jsonDecoder, String jsonPath, Object json) {
16314 if (json == null) {
16315 json = {};
16316 }
16317 if (json is Map) {
16318 String id;
16319 if (json.containsKey("id")) {
16320 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
16321 } else {
16322 throw jsonDecoder.mismatch(jsonPath, "id");
16323 }
16324 return new SearchFindMemberDeclarationsResult(id);
16325 } else {
16326 throw jsonDecoder.mismatch(
16327 jsonPath, "search.findMemberDeclarations result", json);
16328 }
16329 }
16330
16331 factory SearchFindMemberDeclarationsResult.fromResponse(Response response) {
16332 return new SearchFindMemberDeclarationsResult.fromJson(
16333 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
16334 "result",
16335 response.result);
16336 }
16337
16338 @override
16339 Map<String, dynamic> toJson() {
16340 Map<String, dynamic> result = {};
16341 result["id"] = id;
16342 return result;
16343 }
16344
16345 @override
16346 Response toResponse(String id) {
16347 return new Response(id, result: toJson());
16348 }
16349
16350 @override
16351 String toString() => JSON.encode(toJson());
16352
16353 @override
16354 bool operator ==(other) {
16355 if (other is SearchFindMemberDeclarationsResult) {
16356 return id == other.id;
16357 }
16358 return false;
16359 }
16078 16360
16079 @override 16361 @override
16080 int get hashCode { 16362 int get hashCode {
16081 int hash = 0; 16363 int hash = 0;
16082 hash = JenkinsSmiHash.combine(hash, location.hashCode); 16364 hash = JenkinsSmiHash.combine(hash, id.hashCode);
16083 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
16084 hash = JenkinsSmiHash.combine(hash, isPotential.hashCode);
16085 hash = JenkinsSmiHash.combine(hash, path.hashCode);
16086 return JenkinsSmiHash.finish(hash); 16365 return JenkinsSmiHash.finish(hash);
16087 } 16366 }
16088 } 16367 }
16089 16368
16090 /** 16369 /**
16091 * SearchResultKind 16370 * search.findMemberReferences params
16092 * 16371 *
16093 * enum { 16372 * {
16094 * DECLARATION 16373 * "name": String
16095 * INVOCATION
16096 * READ
16097 * READ_WRITE
16098 * REFERENCE
16099 * UNKNOWN
16100 * WRITE
16101 * } 16374 * }
16102 * 16375 *
16103 * Clients may not extend, implement or mix-in this class. 16376 * Clients may not extend, implement or mix-in this class.
16104 */ 16377 */
16105 class SearchResultKind implements Enum { 16378 class SearchFindMemberReferencesParams implements RequestParams {
16106 /** 16379 String _name;
16107 * The declaration of an element. 16380
16108 */ 16381 /**
16109 static const SearchResultKind DECLARATION = 16382 * The name of the references to be found.
16110 const SearchResultKind._("DECLARATION"); 16383 */
16111 16384 String get name => _name;
16112 /** 16385
16113 * The invocation of a function or method. 16386 /**
16114 */ 16387 * The name of the references to be found.
16115 static const SearchResultKind INVOCATION = 16388 */
16116 const SearchResultKind._("INVOCATION"); 16389 void set name(String value) {
16117
16118 /**
16119 * A reference to a field, parameter or variable where it is being read.
16120 */
16121 static const SearchResultKind READ = const SearchResultKind._("READ");
16122
16123 /**
16124 * A reference to a field, parameter or variable where it is being read and
16125 * written.
16126 */
16127 static const SearchResultKind READ_WRITE =
16128 const SearchResultKind._("READ_WRITE");
16129
16130 /**
16131 * A reference to an element.
16132 */
16133 static const SearchResultKind REFERENCE =
16134 const SearchResultKind._("REFERENCE");
16135
16136 /**
16137 * Some other kind of search result.
16138 */
16139 static const SearchResultKind UNKNOWN = const SearchResultKind._("UNKNOWN");
16140
16141 /**
16142 * A reference to a field, parameter or variable where it is being written.
16143 */
16144 static const SearchResultKind WRITE = const SearchResultKind._("WRITE");
16145
16146 /**
16147 * A list containing all of the enum values that are defined.
16148 */
16149 static const List<SearchResultKind> VALUES = const <SearchResultKind>[
16150 DECLARATION,
16151 INVOCATION,
16152 READ,
16153 READ_WRITE,
16154 REFERENCE,
16155 UNKNOWN,
16156 WRITE
16157 ];
16158
16159 final String name;
16160
16161 const SearchResultKind._(this.name);
16162
16163 factory SearchResultKind(String name) {
16164 switch (name) {
16165 case "DECLARATION":
16166 return DECLARATION;
16167 case "INVOCATION":
16168 return INVOCATION;
16169 case "READ":
16170 return READ;
16171 case "READ_WRITE":
16172 return READ_WRITE;
16173 case "REFERENCE":
16174 return REFERENCE;
16175 case "UNKNOWN":
16176 return UNKNOWN;
16177 case "WRITE":
16178 return WRITE;
16179 }
16180 throw new Exception('Illegal enum value: $name');
16181 }
16182
16183 factory SearchResultKind.fromJson(
16184 JsonDecoder jsonDecoder, String jsonPath, Object json) {
16185 if (json is String) {
16186 try {
16187 return new SearchResultKind(json);
16188 } catch (_) {
16189 // Fall through
16190 }
16191 }
16192 throw jsonDecoder.mismatch(jsonPath, "SearchResultKind", json);
16193 }
16194
16195 @override
16196 String toString() => "SearchResultKind.$name";
16197
16198 String toJson() => name;
16199 }
16200
16201 /**
16202 * ServerService
16203 *
16204 * enum {
16205 * STATUS
16206 * }
16207 *
16208 * Clients may not extend, implement or mix-in this class.
16209 */
16210 class ServerService implements Enum {
16211 static const ServerService STATUS = const ServerService._("STATUS");
16212
16213 /**
16214 * A list containing all of the enum values that are defined.
16215 */
16216 static const List<ServerService> VALUES = const <ServerService>[STATUS];
16217
16218 final String name;
16219
16220 const ServerService._(this.name);
16221
16222 factory ServerService(String name) {
16223 switch (name) {
16224 case "STATUS":
16225 return STATUS;
16226 }
16227 throw new Exception('Illegal enum value: $name');
16228 }
16229
16230 factory ServerService.fromJson(
16231 JsonDecoder jsonDecoder, String jsonPath, Object json) {
16232 if (json is String) {
16233 try {
16234 return new ServerService(json);
16235 } catch (_) {
16236 // Fall through
16237 }
16238 }
16239 throw jsonDecoder.mismatch(jsonPath, "ServerService", json);
16240 }
16241
16242 @override
16243 String toString() => "ServerService.$name";
16244
16245 String toJson() => name;
16246 }
16247
16248 /**
16249 * SourceChange
16250 *
16251 * {
16252 * "message": String
16253 * "edits": List<SourceFileEdit>
16254 * "linkedEditGroups": List<LinkedEditGroup>
16255 * "selection": optional Position
16256 * }
16257 *
16258 * Clients may not extend, implement or mix-in this class.
16259 */
16260 class SourceChange implements HasToJson {
16261 String _message;
16262
16263 List<SourceFileEdit> _edits;
16264
16265 List<LinkedEditGroup> _linkedEditGroups;
16266
16267 Position _selection;
16268
16269 /**
16270 * A human-readable description of the change to be applied.
16271 */
16272 String get message => _message;
16273
16274 /**
16275 * A human-readable description of the change to be applied.
16276 */
16277 void set message(String value) {
16278 assert(value != null); 16390 assert(value != null);
16279 this._message = value; 16391 this._name = value;
16280 } 16392 }
16281 16393
16282 /** 16394 SearchFindMemberReferencesParams(String name) {
16283 * A list of the edits used to effect the change, grouped by file. 16395 this.name = name;
16284 */ 16396 }
16285 List<SourceFileEdit> get edits => _edits; 16397
16286 16398 factory SearchFindMemberReferencesParams.fromJson(
16287 /**
16288 * A list of the edits used to effect the change, grouped by file.
16289 */
16290 void set edits(List<SourceFileEdit> value) {
16291 assert(value != null);
16292 this._edits = value;
16293 }
16294
16295 /**
16296 * A list of the linked editing groups used to customize the changes that
16297 * were made.
16298 */
16299 List<LinkedEditGroup> get linkedEditGroups => _linkedEditGroups;
16300
16301 /**
16302 * A list of the linked editing groups used to customize the changes that
16303 * were made.
16304 */
16305 void set linkedEditGroups(List<LinkedEditGroup> value) {
16306 assert(value != null);
16307 this._linkedEditGroups = value;
16308 }
16309
16310 /**
16311 * The position that should be selected after the edits have been applied.
16312 */
16313 Position get selection => _selection;
16314
16315 /**
16316 * The position that should be selected after the edits have been applied.
16317 */
16318 void set selection(Position value) {
16319 this._selection = value;
16320 }
16321
16322 SourceChange(String message,
16323 {List<SourceFileEdit> edits,
16324 List<LinkedEditGroup> linkedEditGroups,
16325 Position selection}) {
16326 this.message = message;
16327 if (edits == null) {
16328 this.edits = <SourceFileEdit>[];
16329 } else {
16330 this.edits = edits;
16331 }
16332 if (linkedEditGroups == null) {
16333 this.linkedEditGroups = <LinkedEditGroup>[];
16334 } else {
16335 this.linkedEditGroups = linkedEditGroups;
16336 }
16337 this.selection = selection;
16338 }
16339
16340 factory SourceChange.fromJson(
16341 JsonDecoder jsonDecoder, String jsonPath, Object json) { 16399 JsonDecoder jsonDecoder, String jsonPath, Object json) {
16342 if (json == null) { 16400 if (json == null) {
16343 json = {}; 16401 json = {};
16344 } 16402 }
16345 if (json is Map) { 16403 if (json is Map) {
16346 String message; 16404 String name;
16347 if (json.containsKey("message")) { 16405 if (json.containsKey("name")) {
16348 message = 16406 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]);
16349 jsonDecoder.decodeString(jsonPath + ".message", json["message"]);
16350 } else { 16407 } else {
16351 throw jsonDecoder.missingKey(jsonPath, "message"); 16408 throw jsonDecoder.mismatch(jsonPath, "name");
16352 } 16409 }
16353 List<SourceFileEdit> edits; 16410 return new SearchFindMemberReferencesParams(name);
16354 if (json.containsKey("edits")) {
16355 edits = jsonDecoder.decodeList(
16356 jsonPath + ".edits",
16357 json["edits"],
16358 (String jsonPath, Object json) =>
16359 new SourceFileEdit.fromJson(jsonDecoder, jsonPath, json));
16360 } else {
16361 throw jsonDecoder.missingKey(jsonPath, "edits");
16362 }
16363 List<LinkedEditGroup> linkedEditGroups;
16364 if (json.containsKey("linkedEditGroups")) {
16365 linkedEditGroups = jsonDecoder.decodeList(
16366 jsonPath + ".linkedEditGroups",
16367 json["linkedEditGroups"],
16368 (String jsonPath, Object json) =>
16369 new LinkedEditGroup.fromJson(jsonDecoder, jsonPath, json));
16370 } else {
16371 throw jsonDecoder.missingKey(jsonPath, "linkedEditGroups");
16372 }
16373 Position selection;
16374 if (json.containsKey("selection")) {
16375 selection = new Position.fromJson(
16376 jsonDecoder, jsonPath + ".selection", json["selection"]);
16377 }
16378 return new SourceChange(message,
16379 edits: edits,
16380 linkedEditGroups: linkedEditGroups,
16381 selection: selection);
16382 } else { 16411 } else {
16383 throw jsonDecoder.mismatch(jsonPath, "SourceChange", json); 16412 throw jsonDecoder.mismatch(
16384 } 16413 jsonPath, "search.findMemberReferences params", json);
16385 } 16414 }
16386 16415 }
16416
16417 factory SearchFindMemberReferencesParams.fromRequest(Request request) {
16418 return new SearchFindMemberReferencesParams.fromJson(
16419 new RequestDecoder(request), "params", request.params);
16420 }
16421
16422 @override
16387 Map<String, dynamic> toJson() { 16423 Map<String, dynamic> toJson() {
16388 Map<String, dynamic> result = {}; 16424 Map<String, dynamic> result = {};
16389 result["message"] = message; 16425 result["name"] = name;
16390 result["edits"] =
16391 edits.map((SourceFileEdit value) => value.toJson()).toList();
16392 result["linkedEditGroups"] = linkedEditGroups
16393 .map((LinkedEditGroup value) => value.toJson())
16394 .toList();
16395 if (selection != null) {
16396 result["selection"] = selection.toJson();
16397 }
16398 return result; 16426 return result;
16399 } 16427 }
16400 16428
16401 /** 16429 @override
16402 * Adds [edit] to the [FileEdit] for the given [file]. 16430 Request toRequest(String id) {
16403 */ 16431 return new Request(id, "search.findMemberReferences", toJson());
16404 void addEdit(String file, int fileStamp, SourceEdit edit) => 16432 }
16405 addEditToSourceChange(this, file, fileStamp, edit);
16406
16407 /**
16408 * Adds the given [FileEdit].
16409 */
16410 void addFileEdit(SourceFileEdit edit) {
16411 edits.add(edit);
16412 }
16413
16414 /**
16415 * Adds the given [LinkedEditGroup].
16416 */
16417 void addLinkedEditGroup(LinkedEditGroup linkedEditGroup) {
16418 linkedEditGroups.add(linkedEditGroup);
16419 }
16420
16421 /**
16422 * Returns the [FileEdit] for the given [file], maybe `null`.
16423 */
16424 SourceFileEdit getFileEdit(String file) => getChangeFileEdit(this, file);
16425 16433
16426 @override 16434 @override
16427 String toString() => JSON.encode(toJson()); 16435 String toString() => JSON.encode(toJson());
16428 16436
16429 @override 16437 @override
16430 bool operator ==(other) { 16438 bool operator ==(other) {
16431 if (other is SourceChange) { 16439 if (other is SearchFindMemberReferencesParams) {
16432 return message == other.message && 16440 return name == other.name;
16433 listEqual(edits, other.edits,
16434 (SourceFileEdit a, SourceFileEdit b) => a == b) &&
16435 listEqual(linkedEditGroups, other.linkedEditGroups,
16436 (LinkedEditGroup a, LinkedEditGroup b) => a == b) &&
16437 selection == other.selection;
16438 } 16441 }
16439 return false; 16442 return false;
16440 } 16443 }
16444
16445 @override
16446 int get hashCode {
16447 int hash = 0;
16448 hash = JenkinsSmiHash.combine(hash, name.hashCode);
16449 return JenkinsSmiHash.finish(hash);
16450 }
16451 }
16452
16453 /**
16454 * search.findMemberReferences result
16455 *
16456 * {
16457 * "id": SearchId
16458 * }
16459 *
16460 * Clients may not extend, implement or mix-in this class.
16461 */
16462 class SearchFindMemberReferencesResult implements ResponseResult {
16463 String _id;
16464
16465 /**
16466 * The identifier used to associate results with this search request.
16467 */
16468 String get id => _id;
16469
16470 /**
16471 * The identifier used to associate results with this search request.
16472 */
16473 void set id(String value) {
16474 assert(value != null);
16475 this._id = value;
16476 }
16477
16478 SearchFindMemberReferencesResult(String id) {
16479 this.id = id;
16480 }
16481
16482 factory SearchFindMemberReferencesResult.fromJson(
16483 JsonDecoder jsonDecoder, String jsonPath, Object json) {
16484 if (json == null) {
16485 json = {};
16486 }
16487 if (json is Map) {
16488 String id;
16489 if (json.containsKey("id")) {
16490 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
16491 } else {
16492 throw jsonDecoder.mismatch(jsonPath, "id");
16493 }
16494 return new SearchFindMemberReferencesResult(id);
16495 } else {
16496 throw jsonDecoder.mismatch(
16497 jsonPath, "search.findMemberReferences result", json);
16498 }
16499 }
16500
16501 factory SearchFindMemberReferencesResult.fromResponse(Response response) {
16502 return new SearchFindMemberReferencesResult.fromJson(
16503 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
16504 "result",
16505 response.result);
16506 }
16507
16508 @override
16509 Map<String, dynamic> toJson() {
16510 Map<String, dynamic> result = {};
16511 result["id"] = id;
16512 return result;
16513 }
16514
16515 @override
16516 Response toResponse(String id) {
16517 return new Response(id, result: toJson());
16518 }
16519
16520 @override
16521 String toString() => JSON.encode(toJson());
16522
16523 @override
16524 bool operator ==(other) {
16525 if (other is SearchFindMemberReferencesResult) {
16526 return id == other.id;
16527 }
16528 return false;
16529 }
16530
16531 @override
16532 int get hashCode {
16533 int hash = 0;
16534 hash = JenkinsSmiHash.combine(hash, id.hashCode);
16535 return JenkinsSmiHash.finish(hash);
16536 }
16537 }
16538
16539 /**
16540 * search.findTopLevelDeclarations params
16541 *
16542 * {
16543 * "pattern": String
16544 * }
16545 *
16546 * Clients may not extend, implement or mix-in this class.
16547 */
16548 class SearchFindTopLevelDeclarationsParams implements RequestParams {
16549 String _pattern;
16550
16551 /**
16552 * The regular expression used to match the names of the declarations to be
16553 * found.
16554 */
16555 String get pattern => _pattern;
16556
16557 /**
16558 * The regular expression used to match the names of the declarations to be
16559 * found.
16560 */
16561 void set pattern(String value) {
16562 assert(value != null);
16563 this._pattern = value;
16564 }
16565
16566 SearchFindTopLevelDeclarationsParams(String pattern) {
16567 this.pattern = pattern;
16568 }
16569
16570 factory SearchFindTopLevelDeclarationsParams.fromJson(
16571 JsonDecoder jsonDecoder, String jsonPath, Object json) {
16572 if (json == null) {
16573 json = {};
16574 }
16575 if (json is Map) {
16576 String pattern;
16577 if (json.containsKey("pattern")) {
16578 pattern =
16579 jsonDecoder.decodeString(jsonPath + ".pattern", json["pattern"]);
16580 } else {
16581 throw jsonDecoder.mismatch(jsonPath, "pattern");
16582 }
16583 return new SearchFindTopLevelDeclarationsParams(pattern);
16584 } else {
16585 throw jsonDecoder.mismatch(
16586 jsonPath, "search.findTopLevelDeclarations params", json);
16587 }
16588 }
16589
16590 factory SearchFindTopLevelDeclarationsParams.fromRequest(Request request) {
16591 return new SearchFindTopLevelDeclarationsParams.fromJson(
16592 new RequestDecoder(request), "params", request.params);
16593 }
16594
16595 @override
16596 Map<String, dynamic> toJson() {
16597 Map<String, dynamic> result = {};
16598 result["pattern"] = pattern;
16599 return result;
16600 }
16601
16602 @override
16603 Request toRequest(String id) {
16604 return new Request(id, "search.findTopLevelDeclarations", toJson());
16605 }
16606
16607 @override
16608 String toString() => JSON.encode(toJson());
16609
16610 @override
16611 bool operator ==(other) {
16612 if (other is SearchFindTopLevelDeclarationsParams) {
16613 return pattern == other.pattern;
16614 }
16615 return false;
16616 }
16617
16618 @override
16619 int get hashCode {
16620 int hash = 0;
16621 hash = JenkinsSmiHash.combine(hash, pattern.hashCode);
16622 return JenkinsSmiHash.finish(hash);
16623 }
16624 }
16625
16626 /**
16627 * search.findTopLevelDeclarations result
16628 *
16629 * {
16630 * "id": SearchId
16631 * }
16632 *
16633 * Clients may not extend, implement or mix-in this class.
16634 */
16635 class SearchFindTopLevelDeclarationsResult implements ResponseResult {
16636 String _id;
16637
16638 /**
16639 * The identifier used to associate results with this search request.
16640 */
16641 String get id => _id;
16642
16643 /**
16644 * The identifier used to associate results with this search request.
16645 */
16646 void set id(String value) {
16647 assert(value != null);
16648 this._id = value;
16649 }
16650
16651 SearchFindTopLevelDeclarationsResult(String id) {
16652 this.id = id;
16653 }
16654
16655 factory SearchFindTopLevelDeclarationsResult.fromJson(
16656 JsonDecoder jsonDecoder, String jsonPath, Object json) {
16657 if (json == null) {
16658 json = {};
16659 }
16660 if (json is Map) {
16661 String id;
16662 if (json.containsKey("id")) {
16663 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
16664 } else {
16665 throw jsonDecoder.mismatch(jsonPath, "id");
16666 }
16667 return new SearchFindTopLevelDeclarationsResult(id);
16668 } else {
16669 throw jsonDecoder.mismatch(
16670 jsonPath, "search.findTopLevelDeclarations result", json);
16671 }
16672 }
16673
16674 factory SearchFindTopLevelDeclarationsResult.fromResponse(Response response) {
16675 return new SearchFindTopLevelDeclarationsResult.fromJson(
16676 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
16677 "result",
16678 response.result);
16679 }
16680
16681 @override
16682 Map<String, dynamic> toJson() {
16683 Map<String, dynamic> result = {};
16684 result["id"] = id;
16685 return result;
16686 }
16687
16688 @override
16689 Response toResponse(String id) {
16690 return new Response(id, result: toJson());
16691 }
16692
16693 @override
16694 String toString() => JSON.encode(toJson());
16695
16696 @override
16697 bool operator ==(other) {
16698 if (other is SearchFindTopLevelDeclarationsResult) {
16699 return id == other.id;
16700 }
16701 return false;
16702 }
16441 16703
16442 @override 16704 @override
16443 int get hashCode { 16705 int get hashCode {
16444 int hash = 0; 16706 int hash = 0;
16445 hash = JenkinsSmiHash.combine(hash, message.hashCode); 16707 hash = JenkinsSmiHash.combine(hash, id.hashCode);
16446 hash = JenkinsSmiHash.combine(hash, edits.hashCode);
16447 hash = JenkinsSmiHash.combine(hash, linkedEditGroups.hashCode);
16448 hash = JenkinsSmiHash.combine(hash, selection.hashCode);
16449 return JenkinsSmiHash.finish(hash); 16708 return JenkinsSmiHash.finish(hash);
16450 } 16709 }
16451 } 16710 }
16452 16711
16453 /** 16712 /**
16454 * SourceEdit 16713 * search.getTypeHierarchy params
16455 * 16714 *
16456 * { 16715 * {
16716 * "file": FilePath
16457 * "offset": int 16717 * "offset": int
16458 * "length": int 16718 * "superOnly": optional bool
16459 * "replacement": String
16460 * "id": optional String
16461 * } 16719 * }
16462 * 16720 *
16463 * Clients may not extend, implement or mix-in this class. 16721 * Clients may not extend, implement or mix-in this class.
16464 */ 16722 */
16465 class SourceEdit implements HasToJson { 16723 class SearchGetTypeHierarchyParams implements RequestParams {
16466 /** 16724 String _file;
16467 * Get the result of applying a set of [edits] to the given [code]. Edits are
16468 * applied in the order they appear in [edits].
16469 */
16470 static String applySequence(String code, Iterable<SourceEdit> edits) =>
16471 applySequenceOfEdits(code, edits);
16472 16725
16473 int _offset; 16726 int _offset;
16474 16727
16475 int _length; 16728 bool _superOnly;
16476
16477 String _replacement;
16478
16479 String _id;
16480 16729
16481 /** 16730 /**
16482 * The offset of the region to be modified. 16731 * The file containing the declaration or reference to the type for which a
16732 * hierarchy is being requested.
16733 */
16734 String get file => _file;
16735
16736 /**
16737 * The file containing the declaration or reference to the type for which a
16738 * hierarchy is being requested.
16739 */
16740 void set file(String value) {
16741 assert(value != null);
16742 this._file = value;
16743 }
16744
16745 /**
16746 * The offset of the name of the type within the file.
16483 */ 16747 */
16484 int get offset => _offset; 16748 int get offset => _offset;
16485 16749
16486 /** 16750 /**
16487 * The offset of the region to be modified. 16751 * The offset of the name of the type within the file.
16488 */ 16752 */
16489 void set offset(int value) { 16753 void set offset(int value) {
16490 assert(value != null); 16754 assert(value != null);
16491 this._offset = value; 16755 this._offset = value;
16492 } 16756 }
16493 16757
16494 /** 16758 /**
16495 * The length of the region to be modified. 16759 * True if the client is only requesting superclasses and interfaces
16760 * hierarchy.
16496 */ 16761 */
16497 int get length => _length; 16762 bool get superOnly => _superOnly;
16498 16763
16499 /** 16764 /**
16500 * The length of the region to be modified. 16765 * True if the client is only requesting superclasses and interfaces
16766 * hierarchy.
16501 */ 16767 */
16502 void set length(int value) { 16768 void set superOnly(bool value) {
16503 assert(value != null); 16769 this._superOnly = value;
16504 this._length = value;
16505 } 16770 }
16506 16771
16507 /** 16772 SearchGetTypeHierarchyParams(String file, int offset, {bool superOnly}) {
16508 * The code that is to replace the specified region in the original code. 16773 this.file = file;
16509 */ 16774 this.offset = offset;
16510 String get replacement => _replacement; 16775 this.superOnly = superOnly;
16511
16512 /**
16513 * The code that is to replace the specified region in the original code.
16514 */
16515 void set replacement(String value) {
16516 assert(value != null);
16517 this._replacement = value;
16518 } 16776 }
16519 16777
16520 /** 16778 factory SearchGetTypeHierarchyParams.fromJson(
16521 * An identifier that uniquely identifies this source edit from other edits
16522 * in the same response. This field is omitted unless a containing structure
16523 * needs to be able to identify the edit for some reason.
16524 *
16525 * For example, some refactoring operations can produce edits that might not
16526 * be appropriate (referred to as potential edits). Such edits will have an
16527 * id so that they can be referenced. Edits in the same response that do not
16528 * need to be referenced will not have an id.
16529 */
16530 String get id => _id;
16531
16532 /**
16533 * An identifier that uniquely identifies this source edit from other edits
16534 * in the same response. This field is omitted unless a containing structure
16535 * needs to be able to identify the edit for some reason.
16536 *
16537 * For example, some refactoring operations can produce edits that might not
16538 * be appropriate (referred to as potential edits). Such edits will have an
16539 * id so that they can be referenced. Edits in the same response that do not
16540 * need to be referenced will not have an id.
16541 */
16542 void set id(String value) {
16543 this._id = value;
16544 }
16545
16546 SourceEdit(int offset, int length, String replacement, {String id}) {
16547 this.offset = offset;
16548 this.length = length;
16549 this.replacement = replacement;
16550 this.id = id;
16551 }
16552
16553 factory SourceEdit.fromJson(
16554 JsonDecoder jsonDecoder, String jsonPath, Object json) { 16779 JsonDecoder jsonDecoder, String jsonPath, Object json) {
16555 if (json == null) { 16780 if (json == null) {
16556 json = {}; 16781 json = {};
16557 } 16782 }
16558 if (json is Map) { 16783 if (json is Map) {
16784 String file;
16785 if (json.containsKey("file")) {
16786 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
16787 } else {
16788 throw jsonDecoder.mismatch(jsonPath, "file");
16789 }
16559 int offset; 16790 int offset;
16560 if (json.containsKey("offset")) { 16791 if (json.containsKey("offset")) {
16561 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 16792 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
16562 } else { 16793 } else {
16563 throw jsonDecoder.missingKey(jsonPath, "offset"); 16794 throw jsonDecoder.mismatch(jsonPath, "offset");
16564 } 16795 }
16565 int length; 16796 bool superOnly;
16566 if (json.containsKey("length")) { 16797 if (json.containsKey("superOnly")) {
16567 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); 16798 superOnly =
16568 } else { 16799 jsonDecoder.decodeBool(jsonPath + ".superOnly", json["superOnly"]);
16569 throw jsonDecoder.missingKey(jsonPath, "length");
16570 } 16800 }
16571 String replacement; 16801 return new SearchGetTypeHierarchyParams(file, offset,
16572 if (json.containsKey("replacement")) { 16802 superOnly: superOnly);
16573 replacement = jsonDecoder.decodeString(
16574 jsonPath + ".replacement", json["replacement"]);
16575 } else {
16576 throw jsonDecoder.missingKey(jsonPath, "replacement");
16577 }
16578 String id;
16579 if (json.containsKey("id")) {
16580 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
16581 }
16582 return new SourceEdit(offset, length, replacement, id: id);
16583 } else { 16803 } else {
16584 throw jsonDecoder.mismatch(jsonPath, "SourceEdit", json); 16804 throw jsonDecoder.mismatch(
16805 jsonPath, "search.getTypeHierarchy params", json);
16585 } 16806 }
16586 } 16807 }
16587 16808
16588 /** 16809 factory SearchGetTypeHierarchyParams.fromRequest(Request request) {
16589 * The end of the region to be modified. 16810 return new SearchGetTypeHierarchyParams.fromJson(
16590 */ 16811 new RequestDecoder(request), "params", request.params);
16591 int get end => offset + length; 16812 }
16592 16813
16814 @override
16593 Map<String, dynamic> toJson() { 16815 Map<String, dynamic> toJson() {
16594 Map<String, dynamic> result = {}; 16816 Map<String, dynamic> result = {};
16817 result["file"] = file;
16595 result["offset"] = offset; 16818 result["offset"] = offset;
16596 result["length"] = length; 16819 if (superOnly != null) {
16597 result["replacement"] = replacement; 16820 result["superOnly"] = superOnly;
16598 if (id != null) {
16599 result["id"] = id;
16600 } 16821 }
16601 return result; 16822 return result;
16602 } 16823 }
16603 16824
16604 /** 16825 @override
16605 * Get the result of applying the edit to the given [code]. 16826 Request toRequest(String id) {
16606 */ 16827 return new Request(id, "search.getTypeHierarchy", toJson());
16607 String apply(String code) => applyEdit(code, this); 16828 }
16608 16829
16609 @override 16830 @override
16610 String toString() => JSON.encode(toJson()); 16831 String toString() => JSON.encode(toJson());
16611 16832
16612 @override 16833 @override
16613 bool operator ==(other) { 16834 bool operator ==(other) {
16614 if (other is SourceEdit) { 16835 if (other is SearchGetTypeHierarchyParams) {
16615 return offset == other.offset && 16836 return file == other.file &&
16616 length == other.length && 16837 offset == other.offset &&
16617 replacement == other.replacement && 16838 superOnly == other.superOnly;
16618 id == other.id;
16619 } 16839 }
16620 return false; 16840 return false;
16621 } 16841 }
16622 16842
16623 @override 16843 @override
16624 int get hashCode { 16844 int get hashCode {
16625 int hash = 0; 16845 int hash = 0;
16846 hash = JenkinsSmiHash.combine(hash, file.hashCode);
16626 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 16847 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
16627 hash = JenkinsSmiHash.combine(hash, length.hashCode); 16848 hash = JenkinsSmiHash.combine(hash, superOnly.hashCode);
16628 hash = JenkinsSmiHash.combine(hash, replacement.hashCode);
16629 hash = JenkinsSmiHash.combine(hash, id.hashCode);
16630 return JenkinsSmiHash.finish(hash); 16849 return JenkinsSmiHash.finish(hash);
16631 } 16850 }
16632 } 16851 }
16633 16852
16634 /** 16853 /**
16635 * SourceFileEdit 16854 * search.getTypeHierarchy result
16636 * 16855 *
16637 * { 16856 * {
16638 * "file": FilePath 16857 * "hierarchyItems": optional List<TypeHierarchyItem>
16639 * "fileStamp": long
16640 * "edits": List<SourceEdit>
16641 * } 16858 * }
16642 * 16859 *
16643 * Clients may not extend, implement or mix-in this class. 16860 * Clients may not extend, implement or mix-in this class.
16644 */ 16861 */
16645 class SourceFileEdit implements HasToJson { 16862 class SearchGetTypeHierarchyResult implements ResponseResult {
16646 String _file; 16863 List<TypeHierarchyItem> _hierarchyItems;
16647
16648 int _fileStamp;
16649
16650 List<SourceEdit> _edits;
16651 16864
16652 /** 16865 /**
16653 * The file containing the code to be modified. 16866 * A list of the types in the requested hierarchy. The first element of the
16867 * list is the item representing the type for which the hierarchy was
16868 * requested. The index of other elements of the list is unspecified, but
16869 * correspond to the integers used to reference supertype and subtype items
16870 * within the items.
16871 *
16872 * This field will be absent if the code at the given file and offset does
16873 * not represent a type, or if the file has not been sufficiently analyzed to
16874 * allow a type hierarchy to be produced.
16654 */ 16875 */
16655 String get file => _file; 16876 List<TypeHierarchyItem> get hierarchyItems => _hierarchyItems;
16656 16877
16657 /** 16878 /**
16658 * The file containing the code to be modified. 16879 * A list of the types in the requested hierarchy. The first element of the
16880 * list is the item representing the type for which the hierarchy was
16881 * requested. The index of other elements of the list is unspecified, but
16882 * correspond to the integers used to reference supertype and subtype items
16883 * within the items.
16884 *
16885 * This field will be absent if the code at the given file and offset does
16886 * not represent a type, or if the file has not been sufficiently analyzed to
16887 * allow a type hierarchy to be produced.
16659 */ 16888 */
16660 void set file(String value) { 16889 void set hierarchyItems(List<TypeHierarchyItem> value) {
16661 assert(value != null); 16890 this._hierarchyItems = value;
16662 this._file = value;
16663 } 16891 }
16664 16892
16665 /** 16893 SearchGetTypeHierarchyResult({List<TypeHierarchyItem> hierarchyItems}) {
16666 * The modification stamp of the file at the moment when the change was 16894 this.hierarchyItems = hierarchyItems;
16667 * created, in milliseconds since the "Unix epoch". Will be -1 if the file
16668 * did not exist and should be created. The client may use this field to make
16669 * sure that the file was not changed since then, so it is safe to apply the
16670 * change.
16671 */
16672 int get fileStamp => _fileStamp;
16673
16674 /**
16675 * The modification stamp of the file at the moment when the change was
16676 * created, in milliseconds since the "Unix epoch". Will be -1 if the file
16677 * did not exist and should be created. The client may use this field to make
16678 * sure that the file was not changed since then, so it is safe to apply the
16679 * change.
16680 */
16681 void set fileStamp(int value) {
16682 assert(value != null);
16683 this._fileStamp = value;
16684 } 16895 }
16685 16896
16686 /** 16897 factory SearchGetTypeHierarchyResult.fromJson(
16687 * A list of the edits used to effect the change.
16688 */
16689 List<SourceEdit> get edits => _edits;
16690
16691 /**
16692 * A list of the edits used to effect the change.
16693 */
16694 void set edits(List<SourceEdit> value) {
16695 assert(value != null);
16696 this._edits = value;
16697 }
16698
16699 SourceFileEdit(String file, int fileStamp, {List<SourceEdit> edits}) {
16700 this.file = file;
16701 this.fileStamp = fileStamp;
16702 if (edits == null) {
16703 this.edits = <SourceEdit>[];
16704 } else {
16705 this.edits = edits;
16706 }
16707 }
16708
16709 factory SourceFileEdit.fromJson(
16710 JsonDecoder jsonDecoder, String jsonPath, Object json) { 16898 JsonDecoder jsonDecoder, String jsonPath, Object json) {
16711 if (json == null) { 16899 if (json == null) {
16712 json = {}; 16900 json = {};
16713 } 16901 }
16714 if (json is Map) { 16902 if (json is Map) {
16715 String file; 16903 List<TypeHierarchyItem> hierarchyItems;
16716 if (json.containsKey("file")) { 16904 if (json.containsKey("hierarchyItems")) {
16717 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); 16905 hierarchyItems = jsonDecoder.decodeList(
16718 } else { 16906 jsonPath + ".hierarchyItems",
16719 throw jsonDecoder.missingKey(jsonPath, "file"); 16907 json["hierarchyItems"],
16908 (String jsonPath, Object json) =>
16909 new TypeHierarchyItem.fromJson(jsonDecoder, jsonPath, json));
16720 } 16910 }
16721 int fileStamp; 16911 return new SearchGetTypeHierarchyResult(hierarchyItems: hierarchyItems);
16722 if (json.containsKey("fileStamp")) {
16723 fileStamp =
16724 jsonDecoder.decodeInt(jsonPath + ".fileStamp", json["fileStamp"]);
16725 } else {
16726 throw jsonDecoder.missingKey(jsonPath, "fileStamp");
16727 }
16728 List<SourceEdit> edits;
16729 if (json.containsKey("edits")) {
16730 edits = jsonDecoder.decodeList(
16731 jsonPath + ".edits",
16732 json["edits"],
16733 (String jsonPath, Object json) =>
16734 new SourceEdit.fromJson(jsonDecoder, jsonPath, json));
16735 } else {
16736 throw jsonDecoder.missingKey(jsonPath, "edits");
16737 }
16738 return new SourceFileEdit(file, fileStamp, edits: edits);
16739 } else { 16912 } else {
16740 throw jsonDecoder.mismatch(jsonPath, "SourceFileEdit", json); 16913 throw jsonDecoder.mismatch(
16914 jsonPath, "search.getTypeHierarchy result", json);
16741 } 16915 }
16742 } 16916 }
16743 16917
16918 factory SearchGetTypeHierarchyResult.fromResponse(Response response) {
16919 return new SearchGetTypeHierarchyResult.fromJson(
16920 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
16921 "result",
16922 response.result);
16923 }
16924
16925 @override
16744 Map<String, dynamic> toJson() { 16926 Map<String, dynamic> toJson() {
16745 Map<String, dynamic> result = {}; 16927 Map<String, dynamic> result = {};
16746 result["file"] = file; 16928 if (hierarchyItems != null) {
16747 result["fileStamp"] = fileStamp; 16929 result["hierarchyItems"] = hierarchyItems
16748 result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList(); 16930 .map((TypeHierarchyItem value) => value.toJson())
16931 .toList();
16932 }
16749 return result; 16933 return result;
16750 } 16934 }
16751 16935
16752 /** 16936 @override
16753 * Adds the given [Edit] to the list. 16937 Response toResponse(String id) {
16754 */ 16938 return new Response(id, result: toJson());
16755 void add(SourceEdit edit) => addEditForSource(this, edit); 16939 }
16756
16757 /**
16758 * Adds the given [Edit]s.
16759 */
16760 void addAll(Iterable<SourceEdit> edits) => addAllEditsForSource(this, edits);
16761 16940
16762 @override 16941 @override
16763 String toString() => JSON.encode(toJson()); 16942 String toString() => JSON.encode(toJson());
16764 16943
16765 @override 16944 @override
16766 bool operator ==(other) { 16945 bool operator ==(other) {
16767 if (other is SourceFileEdit) { 16946 if (other is SearchGetTypeHierarchyResult) {
16768 return file == other.file && 16947 return listEqual(hierarchyItems, other.hierarchyItems,
16769 fileStamp == other.fileStamp && 16948 (TypeHierarchyItem a, TypeHierarchyItem b) => a == b);
16770 listEqual(edits, other.edits, (SourceEdit a, SourceEdit b) => a == b);
16771 } 16949 }
16772 return false; 16950 return false;
16773 } 16951 }
16774 16952
16775 @override 16953 @override
16776 int get hashCode { 16954 int get hashCode {
16777 int hash = 0; 16955 int hash = 0;
16778 hash = JenkinsSmiHash.combine(hash, file.hashCode); 16956 hash = JenkinsSmiHash.combine(hash, hierarchyItems.hashCode);
16779 hash = JenkinsSmiHash.combine(hash, fileStamp.hashCode);
16780 hash = JenkinsSmiHash.combine(hash, edits.hashCode);
16781 return JenkinsSmiHash.finish(hash); 16957 return JenkinsSmiHash.finish(hash);
16782 } 16958 }
16783 } 16959 }
16784 16960
16785 /** 16961 /**
16786 * TypeHierarchyItem 16962 * SearchResult
16787 * 16963 *
16788 * { 16964 * {
16789 * "classElement": Element 16965 * "location": Location
16790 * "displayName": optional String 16966 * "kind": SearchResultKind
16791 * "memberElement": optional Element 16967 * "isPotential": bool
16792 * "superclass": optional int 16968 * "path": List<Element>
16793 * "interfaces": List<int>
16794 * "mixins": List<int>
16795 * "subclasses": List<int>
16796 * } 16969 * }
16797 * 16970 *
16798 * Clients may not extend, implement or mix-in this class. 16971 * Clients may not extend, implement or mix-in this class.
16799 */ 16972 */
16800 class TypeHierarchyItem implements HasToJson { 16973 class SearchResult implements HasToJson {
16801 Element _classElement; 16974 Location _location;
16802 16975
16803 String _displayName; 16976 SearchResultKind _kind;
16804 16977
16805 Element _memberElement; 16978 bool _isPotential;
16806 16979
16807 int _superclass; 16980 List<Element> _path;
16808
16809 List<int> _interfaces;
16810
16811 List<int> _mixins;
16812
16813 List<int> _subclasses;
16814 16981
16815 /** 16982 /**
16816 * The class element represented by this item. 16983 * The location of the code that matched the search criteria.
16817 */ 16984 */
16818 Element get classElement => _classElement; 16985 Location get location => _location;
16819 16986
16820 /** 16987 /**
16821 * The class element represented by this item. 16988 * The location of the code that matched the search criteria.
16822 */ 16989 */
16823 void set classElement(Element value) { 16990 void set location(Location value) {
16824 assert(value != null); 16991 assert(value != null);
16825 this._classElement = value; 16992 this._location = value;
16826 } 16993 }
16827 16994
16828 /** 16995 /**
16829 * The name to be displayed for the class. This field will be omitted if the 16996 * The kind of element that was found or the kind of reference that was
16830 * display name is the same as the name of the element. The display name is 16997 * found.
16831 * different if there is additional type information to be displayed, such as
16832 * type arguments.
16833 */ 16998 */
16834 String get displayName => _displayName; 16999 SearchResultKind get kind => _kind;
16835 17000
16836 /** 17001 /**
16837 * The name to be displayed for the class. This field will be omitted if the 17002 * The kind of element that was found or the kind of reference that was
16838 * display name is the same as the name of the element. The display name is 17003 * found.
16839 * different if there is additional type information to be displayed, such as
16840 * type arguments.
16841 */ 17004 */
16842 void set displayName(String value) { 17005 void set kind(SearchResultKind value) {
16843 this._displayName = value; 17006 assert(value != null);
17007 this._kind = value;
16844 } 17008 }
16845 17009
16846 /** 17010 /**
16847 * The member in the class corresponding to the member on which the hierarchy 17011 * True if the result is a potential match but cannot be confirmed to be a
16848 * was requested. This field will be omitted if the hierarchy was not 17012 * match. For example, if all references to a method m defined in some class
16849 * requested for a member or if the class does not have a corresponding 17013 * were requested, and a reference to a method m from an unknown class were
16850 * member. 17014 * found, it would be marked as being a potential match.
16851 */ 17015 */
16852 Element get memberElement => _memberElement; 17016 bool get isPotential => _isPotential;
16853 17017
16854 /** 17018 /**
16855 * The member in the class corresponding to the member on which the hierarchy 17019 * True if the result is a potential match but cannot be confirmed to be a
16856 * was requested. This field will be omitted if the hierarchy was not 17020 * match. For example, if all references to a method m defined in some class
16857 * requested for a member or if the class does not have a corresponding 17021 * were requested, and a reference to a method m from an unknown class were
16858 * member. 17022 * found, it would be marked as being a potential match.
16859 */ 17023 */
16860 void set memberElement(Element value) { 17024 void set isPotential(bool value) {
16861 this._memberElement = value; 17025 assert(value != null);
17026 this._isPotential = value;
16862 } 17027 }
16863 17028
16864 /** 17029 /**
16865 * The index of the item representing the superclass of this class. This 17030 * The elements that contain the result, starting with the most immediately
16866 * field will be omitted if this item represents the class Object. 17031 * enclosing ancestor and ending with the library.
16867 */ 17032 */
16868 int get superclass => _superclass; 17033 List<Element> get path => _path;
16869 17034
16870 /** 17035 /**
16871 * The index of the item representing the superclass of this class. This 17036 * The elements that contain the result, starting with the most immediately
16872 * field will be omitted if this item represents the class Object. 17037 * enclosing ancestor and ending with the library.
16873 */ 17038 */
16874 void set superclass(int value) { 17039 void set path(List<Element> value) {
16875 this._superclass = value; 17040 assert(value != null);
17041 this._path = value;
16876 } 17042 }
16877 17043
16878 /** 17044 SearchResult(Location location, SearchResultKind kind, bool isPotential,
16879 * The indexes of the items representing the interfaces implemented by this 17045 List<Element> path) {
16880 * class. The list will be empty if there are no implemented interfaces. 17046 this.location = location;
16881 */ 17047 this.kind = kind;
16882 List<int> get interfaces => _interfaces; 17048 this.isPotential = isPotential;
16883 17049 this.path = path;
16884 /**
16885 * The indexes of the items representing the interfaces implemented by this
16886 * class. The list will be empty if there are no implemented interfaces.
16887 */
16888 void set interfaces(List<int> value) {
16889 assert(value != null);
16890 this._interfaces = value;
16891 } 17050 }
16892 17051
16893 /** 17052 factory SearchResult.fromJson(
16894 * The indexes of the items representing the mixins referenced by this class.
16895 * The list will be empty if there are no classes mixed in to this class.
16896 */
16897 List<int> get mixins => _mixins;
16898
16899 /**
16900 * The indexes of the items representing the mixins referenced by this class.
16901 * The list will be empty if there are no classes mixed in to this class.
16902 */
16903 void set mixins(List<int> value) {
16904 assert(value != null);
16905 this._mixins = value;
16906 }
16907
16908 /**
16909 * The indexes of the items representing the subtypes of this class. The list
16910 * will be empty if there are no subtypes or if this item represents a
16911 * supertype of the pivot type.
16912 */
16913 List<int> get subclasses => _subclasses;
16914
16915 /**
16916 * The indexes of the items representing the subtypes of this class. The list
16917 * will be empty if there are no subtypes or if this item represents a
16918 * supertype of the pivot type.
16919 */
16920 void set subclasses(List<int> value) {
16921 assert(value != null);
16922 this._subclasses = value;
16923 }
16924
16925 TypeHierarchyItem(Element classElement,
16926 {String displayName,
16927 Element memberElement,
16928 int superclass,
16929 List<int> interfaces,
16930 List<int> mixins,
16931 List<int> subclasses}) {
16932 this.classElement = classElement;
16933 this.displayName = displayName;
16934 this.memberElement = memberElement;
16935 this.superclass = superclass;
16936 if (interfaces == null) {
16937 this.interfaces = <int>[];
16938 } else {
16939 this.interfaces = interfaces;
16940 }
16941 if (mixins == null) {
16942 this.mixins = <int>[];
16943 } else {
16944 this.mixins = mixins;
16945 }
16946 if (subclasses == null) {
16947 this.subclasses = <int>[];
16948 } else {
16949 this.subclasses = subclasses;
16950 }
16951 }
16952
16953 factory TypeHierarchyItem.fromJson(
16954 JsonDecoder jsonDecoder, String jsonPath, Object json) { 17053 JsonDecoder jsonDecoder, String jsonPath, Object json) {
16955 if (json == null) { 17054 if (json == null) {
16956 json = {}; 17055 json = {};
16957 } 17056 }
16958 if (json is Map) { 17057 if (json is Map) {
16959 Element classElement; 17058 Location location;
16960 if (json.containsKey("classElement")) { 17059 if (json.containsKey("location")) {
16961 classElement = new Element.fromJson( 17060 location = new Location.fromJson(
16962 jsonDecoder, jsonPath + ".classElement", json["classElement"]); 17061 jsonDecoder, jsonPath + ".location", json["location"]);
16963 } else { 17062 } else {
16964 throw jsonDecoder.missingKey(jsonPath, "classElement"); 17063 throw jsonDecoder.mismatch(jsonPath, "location");
16965 } 17064 }
16966 String displayName; 17065 SearchResultKind kind;
16967 if (json.containsKey("displayName")) { 17066 if (json.containsKey("kind")) {
16968 displayName = jsonDecoder.decodeString( 17067 kind = new SearchResultKind.fromJson(
16969 jsonPath + ".displayName", json["displayName"]); 17068 jsonDecoder, jsonPath + ".kind", json["kind"]);
17069 } else {
17070 throw jsonDecoder.mismatch(jsonPath, "kind");
16970 } 17071 }
16971 Element memberElement; 17072 bool isPotential;
16972 if (json.containsKey("memberElement")) { 17073 if (json.containsKey("isPotential")) {
16973 memberElement = new Element.fromJson( 17074 isPotential = jsonDecoder.decodeBool(
16974 jsonDecoder, jsonPath + ".memberElement", json["memberElement"]); 17075 jsonPath + ".isPotential", json["isPotential"]);
17076 } else {
17077 throw jsonDecoder.mismatch(jsonPath, "isPotential");
16975 } 17078 }
16976 int superclass; 17079 List<Element> path;
16977 if (json.containsKey("superclass")) { 17080 if (json.containsKey("path")) {
16978 superclass = 17081 path = jsonDecoder.decodeList(
16979 jsonDecoder.decodeInt(jsonPath + ".superclass", json["superclass"]); 17082 jsonPath + ".path",
17083 json["path"],
17084 (String jsonPath, Object json) =>
17085 new Element.fromJson(jsonDecoder, jsonPath, json));
17086 } else {
17087 throw jsonDecoder.mismatch(jsonPath, "path");
16980 } 17088 }
16981 List<int> interfaces; 17089 return new SearchResult(location, kind, isPotential, path);
16982 if (json.containsKey("interfaces")) {
16983 interfaces = jsonDecoder.decodeList(jsonPath + ".interfaces",
16984 json["interfaces"], jsonDecoder.decodeInt);
16985 } else {
16986 throw jsonDecoder.missingKey(jsonPath, "interfaces");
16987 }
16988 List<int> mixins;
16989 if (json.containsKey("mixins")) {
16990 mixins = jsonDecoder.decodeList(
16991 jsonPath + ".mixins", json["mixins"], jsonDecoder.decodeInt);
16992 } else {
16993 throw jsonDecoder.missingKey(jsonPath, "mixins");
16994 }
16995 List<int> subclasses;
16996 if (json.containsKey("subclasses")) {
16997 subclasses = jsonDecoder.decodeList(jsonPath + ".subclasses",
16998 json["subclasses"], jsonDecoder.decodeInt);
16999 } else {
17000 throw jsonDecoder.missingKey(jsonPath, "subclasses");
17001 }
17002 return new TypeHierarchyItem(classElement,
17003 displayName: displayName,
17004 memberElement: memberElement,
17005 superclass: superclass,
17006 interfaces: interfaces,
17007 mixins: mixins,
17008 subclasses: subclasses);
17009 } else { 17090 } else {
17010 throw jsonDecoder.mismatch(jsonPath, "TypeHierarchyItem", json); 17091 throw jsonDecoder.mismatch(jsonPath, "SearchResult", json);
17011 } 17092 }
17012 } 17093 }
17013 17094
17095 @override
17014 Map<String, dynamic> toJson() { 17096 Map<String, dynamic> toJson() {
17015 Map<String, dynamic> result = {}; 17097 Map<String, dynamic> result = {};
17016 result["classElement"] = classElement.toJson(); 17098 result["location"] = location.toJson();
17017 if (displayName != null) { 17099 result["kind"] = kind.toJson();
17018 result["displayName"] = displayName; 17100 result["isPotential"] = isPotential;
17019 } 17101 result["path"] = path.map((Element value) => value.toJson()).toList();
17020 if (memberElement != null) {
17021 result["memberElement"] = memberElement.toJson();
17022 }
17023 if (superclass != null) {
17024 result["superclass"] = superclass;
17025 }
17026 result["interfaces"] = interfaces;
17027 result["mixins"] = mixins;
17028 result["subclasses"] = subclasses;
17029 return result; 17102 return result;
17030 } 17103 }
17031 17104
17032 @override 17105 @override
17033 String toString() => JSON.encode(toJson()); 17106 String toString() => JSON.encode(toJson());
17034 17107
17035 @override 17108 @override
17036 bool operator ==(other) { 17109 bool operator ==(other) {
17037 if (other is TypeHierarchyItem) { 17110 if (other is SearchResult) {
17038 return classElement == other.classElement && 17111 return location == other.location &&
17039 displayName == other.displayName && 17112 kind == other.kind &&
17040 memberElement == other.memberElement && 17113 isPotential == other.isPotential &&
17041 superclass == other.superclass && 17114 listEqual(path, other.path, (Element a, Element b) => a == b);
17042 listEqual(interfaces, other.interfaces, (int a, int b) => a == b) &&
17043 listEqual(mixins, other.mixins, (int a, int b) => a == b) &&
17044 listEqual(subclasses, other.subclasses, (int a, int b) => a == b);
17045 } 17115 }
17046 return false; 17116 return false;
17047 } 17117 }
17048 17118
17049 @override 17119 @override
17050 int get hashCode { 17120 int get hashCode {
17051 int hash = 0; 17121 int hash = 0;
17052 hash = JenkinsSmiHash.combine(hash, classElement.hashCode); 17122 hash = JenkinsSmiHash.combine(hash, location.hashCode);
17053 hash = JenkinsSmiHash.combine(hash, displayName.hashCode); 17123 hash = JenkinsSmiHash.combine(hash, kind.hashCode);
17054 hash = JenkinsSmiHash.combine(hash, memberElement.hashCode); 17124 hash = JenkinsSmiHash.combine(hash, isPotential.hashCode);
17055 hash = JenkinsSmiHash.combine(hash, superclass.hashCode); 17125 hash = JenkinsSmiHash.combine(hash, path.hashCode);
17056 hash = JenkinsSmiHash.combine(hash, interfaces.hashCode);
17057 hash = JenkinsSmiHash.combine(hash, mixins.hashCode);
17058 hash = JenkinsSmiHash.combine(hash, subclasses.hashCode);
17059 return JenkinsSmiHash.finish(hash); 17126 return JenkinsSmiHash.finish(hash);
17060 } 17127 }
17061 } 17128 }
17062 17129
17063 /** 17130 /**
17064 * convertGetterToMethod feedback 17131 * SearchResultKind
17132 *
17133 * enum {
17134 * DECLARATION
17135 * INVOCATION
17136 * READ
17137 * READ_WRITE
17138 * REFERENCE
17139 * UNKNOWN
17140 * WRITE
17141 * }
17065 * 17142 *
17066 * Clients may not extend, implement or mix-in this class. 17143 * Clients may not extend, implement or mix-in this class.
17067 */ 17144 */
17068 class ConvertGetterToMethodFeedback extends RefactoringFeedback { 17145 class SearchResultKind implements Enum {
17069 @override 17146 /**
17070 bool operator ==(other) { 17147 * The declaration of an element.
17071 if (other is ConvertGetterToMethodFeedback) { 17148 */
17072 return true; 17149 static const SearchResultKind DECLARATION =
17073 } 17150 const SearchResultKind._("DECLARATION");
17074 return false; 17151
17075 } 17152 /**
17076 17153 * The invocation of a function or method.
17077 @override 17154 */
17078 int get hashCode { 17155 static const SearchResultKind INVOCATION =
17079 return 616032599; 17156 const SearchResultKind._("INVOCATION");
17080 } 17157
17158 /**
17159 * A reference to a field, parameter or variable where it is being read.
17160 */
17161 static const SearchResultKind READ = const SearchResultKind._("READ");
17162
17163 /**
17164 * A reference to a field, parameter or variable where it is being read and
17165 * written.
17166 */
17167 static const SearchResultKind READ_WRITE =
17168 const SearchResultKind._("READ_WRITE");
17169
17170 /**
17171 * A reference to an element.
17172 */
17173 static const SearchResultKind REFERENCE =
17174 const SearchResultKind._("REFERENCE");
17175
17176 /**
17177 * Some other kind of search result.
17178 */
17179 static const SearchResultKind UNKNOWN = const SearchResultKind._("UNKNOWN");
17180
17181 /**
17182 * A reference to a field, parameter or variable where it is being written.
17183 */
17184 static const SearchResultKind WRITE = const SearchResultKind._("WRITE");
17185
17186 /**
17187 * A list containing all of the enum values that are defined.
17188 */
17189 static const List<SearchResultKind> VALUES = const <SearchResultKind>[
17190 DECLARATION,
17191 INVOCATION,
17192 READ,
17193 READ_WRITE,
17194 REFERENCE,
17195 UNKNOWN,
17196 WRITE
17197 ];
17198
17199 @override
17200 final String name;
17201
17202 const SearchResultKind._(this.name);
17203
17204 factory SearchResultKind(String name) {
17205 switch (name) {
17206 case "DECLARATION":
17207 return DECLARATION;
17208 case "INVOCATION":
17209 return INVOCATION;
17210 case "READ":
17211 return READ;
17212 case "READ_WRITE":
17213 return READ_WRITE;
17214 case "REFERENCE":
17215 return REFERENCE;
17216 case "UNKNOWN":
17217 return UNKNOWN;
17218 case "WRITE":
17219 return WRITE;
17220 }
17221 throw new Exception('Illegal enum value: $name');
17222 }
17223
17224 factory SearchResultKind.fromJson(
17225 JsonDecoder jsonDecoder, String jsonPath, Object json) {
17226 if (json is String) {
17227 try {
17228 return new SearchResultKind(json);
17229 } catch (_) {
17230 // Fall through
17231 }
17232 }
17233 throw jsonDecoder.mismatch(jsonPath, "SearchResultKind", json);
17234 }
17235
17236 @override
17237 String toString() => "SearchResultKind.$name";
17238
17239 String toJson() => name;
17081 } 17240 }
17082 17241
17083 /** 17242 /**
17084 * convertGetterToMethod options 17243 * search.results params
17244 *
17245 * {
17246 * "id": SearchId
17247 * "results": List<SearchResult>
17248 * "isLast": bool
17249 * }
17085 * 17250 *
17086 * Clients may not extend, implement or mix-in this class. 17251 * Clients may not extend, implement or mix-in this class.
17087 */ 17252 */
17088 class ConvertGetterToMethodOptions extends RefactoringOptions { 17253 class SearchResultsParams implements HasToJson {
17089 @override 17254 String _id;
17090 bool operator ==(other) { 17255
17091 if (other is ConvertGetterToMethodOptions) { 17256 List<SearchResult> _results;
17092 return true; 17257
17093 } 17258 bool _isLast;
17094 return false; 17259
17095 } 17260 /**
17096 17261 * The id associated with the search.
17097 @override 17262 */
17098 int get hashCode { 17263 String get id => _id;
17099 return 488848400; 17264
17100 } 17265 /**
17101 } 17266 * The id associated with the search.
17102 17267 */
17103 /** 17268 void set id(String value) {
17104 * convertMethodToGetter feedback
17105 *
17106 * Clients may not extend, implement or mix-in this class.
17107 */
17108 class ConvertMethodToGetterFeedback extends RefactoringFeedback {
17109 @override
17110 bool operator ==(other) {
17111 if (other is ConvertMethodToGetterFeedback) {
17112 return true;
17113 }
17114 return false;
17115 }
17116
17117 @override
17118 int get hashCode {
17119 return 165291526;
17120 }
17121 }
17122
17123 /**
17124 * convertMethodToGetter options
17125 *
17126 * Clients may not extend, implement or mix-in this class.
17127 */
17128 class ConvertMethodToGetterOptions extends RefactoringOptions {
17129 @override
17130 bool operator ==(other) {
17131 if (other is ConvertMethodToGetterOptions) {
17132 return true;
17133 }
17134 return false;
17135 }
17136
17137 @override
17138 int get hashCode {
17139 return 27952290;
17140 }
17141 }
17142
17143 /**
17144 * extractLocalVariable feedback
17145 *
17146 * {
17147 * "coveringExpressionOffsets": optional List<int>
17148 * "coveringExpressionLengths": optional List<int>
17149 * "names": List<String>
17150 * "offsets": List<int>
17151 * "lengths": List<int>
17152 * }
17153 *
17154 * Clients may not extend, implement or mix-in this class.
17155 */
17156 class ExtractLocalVariableFeedback extends RefactoringFeedback {
17157 List<int> _coveringExpressionOffsets;
17158
17159 List<int> _coveringExpressionLengths;
17160
17161 List<String> _names;
17162
17163 List<int> _offsets;
17164
17165 List<int> _lengths;
17166
17167 /**
17168 * The offsets of the expressions that cover the specified selection, from
17169 * the down most to the up most.
17170 */
17171 List<int> get coveringExpressionOffsets => _coveringExpressionOffsets;
17172
17173 /**
17174 * The offsets of the expressions that cover the specified selection, from
17175 * the down most to the up most.
17176 */
17177 void set coveringExpressionOffsets(List<int> value) {
17178 this._coveringExpressionOffsets = value;
17179 }
17180
17181 /**
17182 * The lengths of the expressions that cover the specified selection, from
17183 * the down most to the up most.
17184 */
17185 List<int> get coveringExpressionLengths => _coveringExpressionLengths;
17186
17187 /**
17188 * The lengths of the expressions that cover the specified selection, from
17189 * the down most to the up most.
17190 */
17191 void set coveringExpressionLengths(List<int> value) {
17192 this._coveringExpressionLengths = value;
17193 }
17194
17195 /**
17196 * The proposed names for the local variable.
17197 */
17198 List<String> get names => _names;
17199
17200 /**
17201 * The proposed names for the local variable.
17202 */
17203 void set names(List<String> value) {
17204 assert(value != null); 17269 assert(value != null);
17205 this._names = value; 17270 this._id = value;
17206 } 17271 }
17207 17272
17208 /** 17273 /**
17209 * The offsets of the expressions that would be replaced by a reference to 17274 * The search results being reported.
17210 * the variable. 17275 */
17211 */ 17276 List<SearchResult> get results => _results;
17212 List<int> get offsets => _offsets; 17277
17213 17278 /**
17214 /** 17279 * The search results being reported.
17215 * The offsets of the expressions that would be replaced by a reference to 17280 */
17216 * the variable. 17281 void set results(List<SearchResult> value) {
17217 */
17218 void set offsets(List<int> value) {
17219 assert(value != null); 17282 assert(value != null);
17220 this._offsets = value; 17283 this._results = value;
17221 } 17284 }
17222 17285
17223 /** 17286 /**
17224 * The lengths of the expressions that would be replaced by a reference to 17287 * True if this is that last set of results that will be returned for the
17225 * the variable. The lengths correspond to the offsets. In other words, for a 17288 * indicated search.
17226 * given expression, if the offset of that expression is offsets[i], then the 17289 */
17227 * length of that expression is lengths[i]. 17290 bool get isLast => _isLast;
17228 */ 17291
17229 List<int> get lengths => _lengths; 17292 /**
17230 17293 * True if this is that last set of results that will be returned for the
17231 /** 17294 * indicated search.
17232 * The lengths of the expressions that would be replaced by a reference to 17295 */
17233 * the variable. The lengths correspond to the offsets. In other words, for a 17296 void set isLast(bool value) {
17234 * given expression, if the offset of that expression is offsets[i], then the
17235 * length of that expression is lengths[i].
17236 */
17237 void set lengths(List<int> value) {
17238 assert(value != null); 17297 assert(value != null);
17239 this._lengths = value; 17298 this._isLast = value;
17240 } 17299 }
17241 17300
17242 ExtractLocalVariableFeedback( 17301 SearchResultsParams(String id, List<SearchResult> results, bool isLast) {
17243 List<String> names, List<int> offsets, List<int> lengths, 17302 this.id = id;
17244 {List<int> coveringExpressionOffsets, 17303 this.results = results;
17245 List<int> coveringExpressionLengths}) { 17304 this.isLast = isLast;
17246 this.coveringExpressionOffsets = coveringExpressionOffsets; 17305 }
17247 this.coveringExpressionLengths = coveringExpressionLengths; 17306
17248 this.names = names; 17307 factory SearchResultsParams.fromJson(
17249 this.offsets = offsets;
17250 this.lengths = lengths;
17251 }
17252
17253 factory ExtractLocalVariableFeedback.fromJson(
17254 JsonDecoder jsonDecoder, String jsonPath, Object json) { 17308 JsonDecoder jsonDecoder, String jsonPath, Object json) {
17255 if (json == null) { 17309 if (json == null) {
17256 json = {}; 17310 json = {};
17257 } 17311 }
17258 if (json is Map) { 17312 if (json is Map) {
17259 List<int> coveringExpressionOffsets; 17313 String id;
17260 if (json.containsKey("coveringExpressionOffsets")) { 17314 if (json.containsKey("id")) {
17261 coveringExpressionOffsets = jsonDecoder.decodeList( 17315 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
17262 jsonPath + ".coveringExpressionOffsets",
17263 json["coveringExpressionOffsets"],
17264 jsonDecoder.decodeInt);
17265 }
17266 List<int> coveringExpressionLengths;
17267 if (json.containsKey("coveringExpressionLengths")) {
17268 coveringExpressionLengths = jsonDecoder.decodeList(
17269 jsonPath + ".coveringExpressionLengths",
17270 json["coveringExpressionLengths"],
17271 jsonDecoder.decodeInt);
17272 }
17273 List<String> names;
17274 if (json.containsKey("names")) {
17275 names = jsonDecoder.decodeList(
17276 jsonPath + ".names", json["names"], jsonDecoder.decodeString);
17277 } else { 17316 } else {
17278 throw jsonDecoder.missingKey(jsonPath, "names"); 17317 throw jsonDecoder.mismatch(jsonPath, "id");
17279 } 17318 }
17280 List<int> offsets; 17319 List<SearchResult> results;
17281 if (json.containsKey("offsets")) { 17320 if (json.containsKey("results")) {
17282 offsets = jsonDecoder.decodeList( 17321 results = jsonDecoder.decodeList(
17283 jsonPath + ".offsets", json["offsets"], jsonDecoder.decodeInt); 17322 jsonPath + ".results",
17323 json["results"],
17324 (String jsonPath, Object json) =>
17325 new SearchResult.fromJson(jsonDecoder, jsonPath, json));
17284 } else { 17326 } else {
17285 throw jsonDecoder.missingKey(jsonPath, "offsets"); 17327 throw jsonDecoder.mismatch(jsonPath, "results");
17286 } 17328 }
17287 List<int> lengths; 17329 bool isLast;
17288 if (json.containsKey("lengths")) { 17330 if (json.containsKey("isLast")) {
17289 lengths = jsonDecoder.decodeList( 17331 isLast = jsonDecoder.decodeBool(jsonPath + ".isLast", json["isLast"]);
17290 jsonPath + ".lengths", json["lengths"], jsonDecoder.decodeInt);
17291 } else { 17332 } else {
17292 throw jsonDecoder.missingKey(jsonPath, "lengths"); 17333 throw jsonDecoder.mismatch(jsonPath, "isLast");
17293 } 17334 }
17294 return new ExtractLocalVariableFeedback(names, offsets, lengths, 17335 return new SearchResultsParams(id, results, isLast);
17295 coveringExpressionOffsets: coveringExpressionOffsets,
17296 coveringExpressionLengths: coveringExpressionLengths);
17297 } else { 17336 } else {
17298 throw jsonDecoder.mismatch( 17337 throw jsonDecoder.mismatch(jsonPath, "search.results params", json);
17299 jsonPath, "extractLocalVariable feedback", json); 17338 }
17300 } 17339 }
17301 } 17340
17302 17341 factory SearchResultsParams.fromNotification(Notification notification) {
17342 return new SearchResultsParams.fromJson(
17343 new ResponseDecoder(null), "params", notification.params);
17344 }
17345
17346 @override
17303 Map<String, dynamic> toJson() { 17347 Map<String, dynamic> toJson() {
17304 Map<String, dynamic> result = {}; 17348 Map<String, dynamic> result = {};
17305 if (coveringExpressionOffsets != null) { 17349 result["id"] = id;
17306 result["coveringExpressionOffsets"] = coveringExpressionOffsets; 17350 result["results"] =
17307 } 17351 results.map((SearchResult value) => value.toJson()).toList();
17308 if (coveringExpressionLengths != null) { 17352 result["isLast"] = isLast;
17309 result["coveringExpressionLengths"] = coveringExpressionLengths;
17310 }
17311 result["names"] = names;
17312 result["offsets"] = offsets;
17313 result["lengths"] = lengths;
17314 return result; 17353 return result;
17315 } 17354 }
17316 17355
17317 @override 17356 Notification toNotification() {
17357 return new Notification("search.results", toJson());
17358 }
17359
17360 @override
17318 String toString() => JSON.encode(toJson()); 17361 String toString() => JSON.encode(toJson());
17319 17362
17320 @override 17363 @override
17321 bool operator ==(other) { 17364 bool operator ==(other) {
17322 if (other is ExtractLocalVariableFeedback) { 17365 if (other is SearchResultsParams) {
17323 return listEqual(coveringExpressionOffsets, 17366 return id == other.id &&
17324 other.coveringExpressionOffsets, (int a, int b) => a == b) && 17367 listEqual(results, other.results,
17325 listEqual(coveringExpressionLengths, other.coveringExpressionLengths, 17368 (SearchResult a, SearchResult b) => a == b) &&
17326 (int a, int b) => a == b) && 17369 isLast == other.isLast;
17327 listEqual(names, other.names, (String a, String b) => a == b) &&
17328 listEqual(offsets, other.offsets, (int a, int b) => a == b) &&
17329 listEqual(lengths, other.lengths, (int a, int b) => a == b);
17330 } 17370 }
17331 return false; 17371 return false;
17332 } 17372 }
17333 17373
17334 @override 17374 @override
17335 int get hashCode { 17375 int get hashCode {
17336 int hash = 0; 17376 int hash = 0;
17337 hash = JenkinsSmiHash.combine(hash, coveringExpressionOffsets.hashCode); 17377 hash = JenkinsSmiHash.combine(hash, id.hashCode);
17338 hash = JenkinsSmiHash.combine(hash, coveringExpressionLengths.hashCode); 17378 hash = JenkinsSmiHash.combine(hash, results.hashCode);
17339 hash = JenkinsSmiHash.combine(hash, names.hashCode); 17379 hash = JenkinsSmiHash.combine(hash, isLast.hashCode);
17340 hash = JenkinsSmiHash.combine(hash, offsets.hashCode);
17341 hash = JenkinsSmiHash.combine(hash, lengths.hashCode);
17342 return JenkinsSmiHash.finish(hash); 17380 return JenkinsSmiHash.finish(hash);
17343 } 17381 }
17344 } 17382 }
17345 17383
17346 /** 17384 /**
17347 * extractLocalVariable options 17385 * server.connected params
17348 * 17386 *
17349 * { 17387 * {
17350 * "name": String 17388 * "version": String
17351 * "extractAll": bool 17389 * "pid": int
17390 * "sessionId": optional String
17352 * } 17391 * }
17353 * 17392 *
17354 * Clients may not extend, implement or mix-in this class. 17393 * Clients may not extend, implement or mix-in this class.
17355 */ 17394 */
17356 class ExtractLocalVariableOptions extends RefactoringOptions { 17395 class ServerConnectedParams implements HasToJson {
17357 String _name; 17396 String _version;
17358 17397
17359 bool _extractAll; 17398 int _pid;
17399
17400 String _sessionId;
17360 17401
17361 /** 17402 /**
17362 * The name that the local variable should be given. 17403 * The version number of the analysis server.
17363 */ 17404 */
17364 String get name => _name; 17405 String get version => _version;
17365 17406
17366 /** 17407 /**
17367 * The name that the local variable should be given. 17408 * The version number of the analysis server.
17368 */ 17409 */
17369 void set name(String value) { 17410 void set version(String value) {
17370 assert(value != null); 17411 assert(value != null);
17371 this._name = value; 17412 this._version = value;
17372 } 17413 }
17373 17414
17374 /** 17415 /**
17375 * True if all occurrences of the expression within the scope in which the 17416 * The process id of the analysis server process.
17376 * variable will be defined should be replaced by a reference to the local
17377 * variable. The expression used to initiate the refactoring will always be
17378 * replaced.
17379 */ 17417 */
17380 bool get extractAll => _extractAll; 17418 int get pid => _pid;
17381 17419
17382 /** 17420 /**
17383 * True if all occurrences of the expression within the scope in which the 17421 * The process id of the analysis server process.
17384 * variable will be defined should be replaced by a reference to the local
17385 * variable. The expression used to initiate the refactoring will always be
17386 * replaced.
17387 */ 17422 */
17388 void set extractAll(bool value) { 17423 void set pid(int value) {
17389 assert(value != null); 17424 assert(value != null);
17390 this._extractAll = value; 17425 this._pid = value;
17391 } 17426 }
17392 17427
17393 ExtractLocalVariableOptions(String name, bool extractAll) { 17428 /**
17394 this.name = name; 17429 * The session id for this session.
17395 this.extractAll = extractAll; 17430 */
17431 String get sessionId => _sessionId;
17432
17433 /**
17434 * The session id for this session.
17435 */
17436 void set sessionId(String value) {
17437 this._sessionId = value;
17396 } 17438 }
17397 17439
17398 factory ExtractLocalVariableOptions.fromJson( 17440 ServerConnectedParams(String version, int pid, {String sessionId}) {
17441 this.version = version;
17442 this.pid = pid;
17443 this.sessionId = sessionId;
17444 }
17445
17446 factory ServerConnectedParams.fromJson(
17399 JsonDecoder jsonDecoder, String jsonPath, Object json) { 17447 JsonDecoder jsonDecoder, String jsonPath, Object json) {
17400 if (json == null) { 17448 if (json == null) {
17401 json = {}; 17449 json = {};
17402 } 17450 }
17403 if (json is Map) { 17451 if (json is Map) {
17404 String name; 17452 String version;
17405 if (json.containsKey("name")) { 17453 if (json.containsKey("version")) {
17406 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]); 17454 version =
17455 jsonDecoder.decodeString(jsonPath + ".version", json["version"]);
17407 } else { 17456 } else {
17408 throw jsonDecoder.missingKey(jsonPath, "name"); 17457 throw jsonDecoder.mismatch(jsonPath, "version");
17409 } 17458 }
17410 bool extractAll; 17459 int pid;
17411 if (json.containsKey("extractAll")) { 17460 if (json.containsKey("pid")) {
17412 extractAll = jsonDecoder.decodeBool( 17461 pid = jsonDecoder.decodeInt(jsonPath + ".pid", json["pid"]);
17413 jsonPath + ".extractAll", json["extractAll"]);
17414 } else { 17462 } else {
17415 throw jsonDecoder.missingKey(jsonPath, "extractAll"); 17463 throw jsonDecoder.mismatch(jsonPath, "pid");
17416 } 17464 }
17417 return new ExtractLocalVariableOptions(name, extractAll); 17465 String sessionId;
17466 if (json.containsKey("sessionId")) {
17467 sessionId = jsonDecoder.decodeString(
17468 jsonPath + ".sessionId", json["sessionId"]);
17469 }
17470 return new ServerConnectedParams(version, pid, sessionId: sessionId);
17418 } else { 17471 } else {
17419 throw jsonDecoder.mismatch( 17472 throw jsonDecoder.mismatch(jsonPath, "server.connected params", json);
17420 jsonPath, "extractLocalVariable options", json);
17421 } 17473 }
17422 } 17474 }
17423 17475
17424 factory ExtractLocalVariableOptions.fromRefactoringParams( 17476 factory ServerConnectedParams.fromNotification(Notification notification) {
17425 EditGetRefactoringParams refactoringParams, Request request) { 17477 return new ServerConnectedParams.fromJson(
17426 return new ExtractLocalVariableOptions.fromJson( 17478 new ResponseDecoder(null), "params", notification.params);
17427 new RequestDecoder(request), "options", refactoringParams.options);
17428 } 17479 }
17429 17480
17481 @override
17430 Map<String, dynamic> toJson() { 17482 Map<String, dynamic> toJson() {
17431 Map<String, dynamic> result = {}; 17483 Map<String, dynamic> result = {};
17432 result["name"] = name; 17484 result["version"] = version;
17433 result["extractAll"] = extractAll; 17485 result["pid"] = pid;
17486 if (sessionId != null) {
17487 result["sessionId"] = sessionId;
17488 }
17434 return result; 17489 return result;
17435 } 17490 }
17436 17491
17492 Notification toNotification() {
17493 return new Notification("server.connected", toJson());
17494 }
17495
17437 @override 17496 @override
17438 String toString() => JSON.encode(toJson()); 17497 String toString() => JSON.encode(toJson());
17439 17498
17440 @override 17499 @override
17441 bool operator ==(other) { 17500 bool operator ==(other) {
17442 if (other is ExtractLocalVariableOptions) { 17501 if (other is ServerConnectedParams) {
17443 return name == other.name && extractAll == other.extractAll; 17502 return version == other.version &&
17503 pid == other.pid &&
17504 sessionId == other.sessionId;
17444 } 17505 }
17445 return false; 17506 return false;
17446 } 17507 }
17447 17508
17448 @override 17509 @override
17449 int get hashCode { 17510 int get hashCode {
17450 int hash = 0; 17511 int hash = 0;
17451 hash = JenkinsSmiHash.combine(hash, name.hashCode); 17512 hash = JenkinsSmiHash.combine(hash, version.hashCode);
17452 hash = JenkinsSmiHash.combine(hash, extractAll.hashCode); 17513 hash = JenkinsSmiHash.combine(hash, pid.hashCode);
17514 hash = JenkinsSmiHash.combine(hash, sessionId.hashCode);
17453 return JenkinsSmiHash.finish(hash); 17515 return JenkinsSmiHash.finish(hash);
17454 } 17516 }
17455 } 17517 }
17456 17518
17457 /** 17519 /**
17458 * extractMethod feedback 17520 * server.error params
17459 * 17521 *
17460 * { 17522 * {
17461 * "offset": int 17523 * "isFatal": bool
17462 * "length": int 17524 * "message": String
17463 * "returnType": String 17525 * "stackTrace": String
17464 * "names": List<String>
17465 * "canCreateGetter": bool
17466 * "parameters": List<RefactoringMethodParameter>
17467 * "offsets": List<int>
17468 * "lengths": List<int>
17469 * } 17526 * }
17470 * 17527 *
17471 * Clients may not extend, implement or mix-in this class. 17528 * Clients may not extend, implement or mix-in this class.
17472 */ 17529 */
17473 class ExtractMethodFeedback extends RefactoringFeedback { 17530 class ServerErrorParams implements HasToJson {
17474 int _offset; 17531 bool _isFatal;
17475 17532
17476 int _length; 17533 String _message;
17477 17534
17478 String _returnType; 17535 String _stackTrace;
17479 17536
17480 List<String> _names; 17537 /**
17481 17538 * True if the error is a fatal error, meaning that the server will shutdown
17482 bool _canCreateGetter; 17539 * automatically after sending this notification.
17483 17540 */
17484 List<RefactoringMethodParameter> _parameters; 17541 bool get isFatal => _isFatal;
17485 17542
17486 List<int> _offsets; 17543 /**
17487 17544 * True if the error is a fatal error, meaning that the server will shutdown
17488 List<int> _lengths; 17545 * automatically after sending this notification.
17489 17546 */
17490 /** 17547 void set isFatal(bool value) {
17491 * The offset to the beginning of the expression or statements that will be 17548 assert(value != null);
17492 * extracted. 17549 this._isFatal = value;
17493 */ 17550 }
17494 int get offset => _offset; 17551
17495 17552 /**
17496 /** 17553 * The error message indicating what kind of error was encountered.
17497 * The offset to the beginning of the expression or statements that will be 17554 */
17498 * extracted. 17555 String get message => _message;
17499 */ 17556
17500 void set offset(int value) { 17557 /**
17501 assert(value != null); 17558 * The error message indicating what kind of error was encountered.
17502 this._offset = value; 17559 */
17503 } 17560 void set message(String value) {
17504 17561 assert(value != null);
17505 /** 17562 this._message = value;
17506 * The length of the expression or statements that will be extracted. 17563 }
17507 */ 17564
17508 int get length => _length; 17565 /**
17509 17566 * The stack trace associated with the generation of the error, used for
17510 /** 17567 * debugging the server.
17511 * The length of the expression or statements that will be extracted. 17568 */
17512 */ 17569 String get stackTrace => _stackTrace;
17513 void set length(int value) { 17570
17514 assert(value != null); 17571 /**
17515 this._length = value; 17572 * The stack trace associated with the generation of the error, used for
17516 } 17573 * debugging the server.
17517 17574 */
17518 /** 17575 void set stackTrace(String value) {
17519 * The proposed return type for the method. If the returned element does not 17576 assert(value != null);
17520 * have a declared return type, this field will contain an empty string. 17577 this._stackTrace = value;
17521 */ 17578 }
17522 String get returnType => _returnType; 17579
17523 17580 ServerErrorParams(bool isFatal, String message, String stackTrace) {
17524 /** 17581 this.isFatal = isFatal;
17525 * The proposed return type for the method. If the returned element does not 17582 this.message = message;
17526 * have a declared return type, this field will contain an empty string. 17583 this.stackTrace = stackTrace;
17527 */ 17584 }
17528 void set returnType(String value) { 17585
17529 assert(value != null); 17586 factory ServerErrorParams.fromJson(
17530 this._returnType = value;
17531 }
17532
17533 /**
17534 * The proposed names for the method.
17535 */
17536 List<String> get names => _names;
17537
17538 /**
17539 * The proposed names for the method.
17540 */
17541 void set names(List<String> value) {
17542 assert(value != null);
17543 this._names = value;
17544 }
17545
17546 /**
17547 * True if a getter could be created rather than a method.
17548 */
17549 bool get canCreateGetter => _canCreateGetter;
17550
17551 /**
17552 * True if a getter could be created rather than a method.
17553 */
17554 void set canCreateGetter(bool value) {
17555 assert(value != null);
17556 this._canCreateGetter = value;
17557 }
17558
17559 /**
17560 * The proposed parameters for the method.
17561 */
17562 List<RefactoringMethodParameter> get parameters => _parameters;
17563
17564 /**
17565 * The proposed parameters for the method.
17566 */
17567 void set parameters(List<RefactoringMethodParameter> value) {
17568 assert(value != null);
17569 this._parameters = value;
17570 }
17571
17572 /**
17573 * The offsets of the expressions or statements that would be replaced by an
17574 * invocation of the method.
17575 */
17576 List<int> get offsets => _offsets;
17577
17578 /**
17579 * The offsets of the expressions or statements that would be replaced by an
17580 * invocation of the method.
17581 */
17582 void set offsets(List<int> value) {
17583 assert(value != null);
17584 this._offsets = value;
17585 }
17586
17587 /**
17588 * The lengths of the expressions or statements that would be replaced by an
17589 * invocation of the method. The lengths correspond to the offsets. In other
17590 * words, for a given expression (or block of statements), if the offset of
17591 * that expression is offsets[i], then the length of that expression is
17592 * lengths[i].
17593 */
17594 List<int> get lengths => _lengths;
17595
17596 /**
17597 * The lengths of the expressions or statements that would be replaced by an
17598 * invocation of the method. The lengths correspond to the offsets. In other
17599 * words, for a given expression (or block of statements), if the offset of
17600 * that expression is offsets[i], then the length of that expression is
17601 * lengths[i].
17602 */
17603 void set lengths(List<int> value) {
17604 assert(value != null);
17605 this._lengths = value;
17606 }
17607
17608 ExtractMethodFeedback(
17609 int offset,
17610 int length,
17611 String returnType,
17612 List<String> names,
17613 bool canCreateGetter,
17614 List<RefactoringMethodParameter> parameters,
17615 List<int> offsets,
17616 List<int> lengths) {
17617 this.offset = offset;
17618 this.length = length;
17619 this.returnType = returnType;
17620 this.names = names;
17621 this.canCreateGetter = canCreateGetter;
17622 this.parameters = parameters;
17623 this.offsets = offsets;
17624 this.lengths = lengths;
17625 }
17626
17627 factory ExtractMethodFeedback.fromJson(
17628 JsonDecoder jsonDecoder, String jsonPath, Object json) { 17587 JsonDecoder jsonDecoder, String jsonPath, Object json) {
17629 if (json == null) { 17588 if (json == null) {
17630 json = {}; 17589 json = {};
17631 } 17590 }
17632 if (json is Map) { 17591 if (json is Map) {
17633 int offset; 17592 bool isFatal;
17634 if (json.containsKey("offset")) { 17593 if (json.containsKey("isFatal")) {
17635 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 17594 isFatal =
17636 } else { 17595 jsonDecoder.decodeBool(jsonPath + ".isFatal", json["isFatal"]);
17637 throw jsonDecoder.missingKey(jsonPath, "offset"); 17596 } else {
17638 } 17597 throw jsonDecoder.mismatch(jsonPath, "isFatal");
17639 int length; 17598 }
17640 if (json.containsKey("length")) { 17599 String message;
17641 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); 17600 if (json.containsKey("message")) {
17642 } else { 17601 message =
17643 throw jsonDecoder.missingKey(jsonPath, "length"); 17602 jsonDecoder.decodeString(jsonPath + ".message", json["message"]);
17644 } 17603 } else {
17645 String returnType; 17604 throw jsonDecoder.mismatch(jsonPath, "message");
17646 if (json.containsKey("returnType")) { 17605 }
17647 returnType = jsonDecoder.decodeString( 17606 String stackTrace;
17648 jsonPath + ".returnType", json["returnType"]); 17607 if (json.containsKey("stackTrace")) {
17649 } else { 17608 stackTrace = jsonDecoder.decodeString(
17650 throw jsonDecoder.missingKey(jsonPath, "returnType"); 17609 jsonPath + ".stackTrace", json["stackTrace"]);
17651 } 17610 } else {
17652 List<String> names; 17611 throw jsonDecoder.mismatch(jsonPath, "stackTrace");
17653 if (json.containsKey("names")) { 17612 }
17654 names = jsonDecoder.decodeList( 17613 return new ServerErrorParams(isFatal, message, stackTrace);
17655 jsonPath + ".names", json["names"], jsonDecoder.decodeString);
17656 } else {
17657 throw jsonDecoder.missingKey(jsonPath, "names");
17658 }
17659 bool canCreateGetter;
17660 if (json.containsKey("canCreateGetter")) {
17661 canCreateGetter = jsonDecoder.decodeBool(
17662 jsonPath + ".canCreateGetter", json["canCreateGetter"]);
17663 } else {
17664 throw jsonDecoder.missingKey(jsonPath, "canCreateGetter");
17665 }
17666 List<RefactoringMethodParameter> parameters;
17667 if (json.containsKey("parameters")) {
17668 parameters = jsonDecoder.decodeList(
17669 jsonPath + ".parameters",
17670 json["parameters"],
17671 (String jsonPath, Object json) =>
17672 new RefactoringMethodParameter.fromJson(
17673 jsonDecoder, jsonPath, json));
17674 } else {
17675 throw jsonDecoder.missingKey(jsonPath, "parameters");
17676 }
17677 List<int> offsets;
17678 if (json.containsKey("offsets")) {
17679 offsets = jsonDecoder.decodeList(
17680 jsonPath + ".offsets", json["offsets"], jsonDecoder.decodeInt);
17681 } else {
17682 throw jsonDecoder.missingKey(jsonPath, "offsets");
17683 }
17684 List<int> lengths;
17685 if (json.containsKey("lengths")) {
17686 lengths = jsonDecoder.decodeList(
17687 jsonPath + ".lengths", json["lengths"], jsonDecoder.decodeInt);
17688 } else {
17689 throw jsonDecoder.missingKey(jsonPath, "lengths");
17690 }
17691 return new ExtractMethodFeedback(offset, length, returnType, names,
17692 canCreateGetter, parameters, offsets, lengths);
17693 } else { 17614 } else {
17694 throw jsonDecoder.mismatch(jsonPath, "extractMethod feedback", json); 17615 throw jsonDecoder.mismatch(jsonPath, "server.error params", json);
17695 } 17616 }
17696 } 17617 }
17697 17618
17619 factory ServerErrorParams.fromNotification(Notification notification) {
17620 return new ServerErrorParams.fromJson(
17621 new ResponseDecoder(null), "params", notification.params);
17622 }
17623
17624 @override
17698 Map<String, dynamic> toJson() { 17625 Map<String, dynamic> toJson() {
17699 Map<String, dynamic> result = {}; 17626 Map<String, dynamic> result = {};
17700 result["offset"] = offset; 17627 result["isFatal"] = isFatal;
17701 result["length"] = length; 17628 result["message"] = message;
17702 result["returnType"] = returnType; 17629 result["stackTrace"] = stackTrace;
17703 result["names"] = names;
17704 result["canCreateGetter"] = canCreateGetter;
17705 result["parameters"] = parameters
17706 .map((RefactoringMethodParameter value) => value.toJson())
17707 .toList();
17708 result["offsets"] = offsets;
17709 result["lengths"] = lengths;
17710 return result; 17630 return result;
17711 } 17631 }
17712 17632
17633 Notification toNotification() {
17634 return new Notification("server.error", toJson());
17635 }
17636
17713 @override 17637 @override
17714 String toString() => JSON.encode(toJson()); 17638 String toString() => JSON.encode(toJson());
17715 17639
17716 @override 17640 @override
17717 bool operator ==(other) { 17641 bool operator ==(other) {
17718 if (other is ExtractMethodFeedback) { 17642 if (other is ServerErrorParams) {
17719 return offset == other.offset && 17643 return isFatal == other.isFatal &&
17720 length == other.length && 17644 message == other.message &&
17721 returnType == other.returnType && 17645 stackTrace == other.stackTrace;
17722 listEqual(names, other.names, (String a, String b) => a == b) &&
17723 canCreateGetter == other.canCreateGetter &&
17724 listEqual(
17725 parameters,
17726 other.parameters,
17727 (RefactoringMethodParameter a, RefactoringMethodParameter b) =>
17728 a == b) &&
17729 listEqual(offsets, other.offsets, (int a, int b) => a == b) &&
17730 listEqual(lengths, other.lengths, (int a, int b) => a == b);
17731 } 17646 }
17732 return false; 17647 return false;
17733 } 17648 }
17649
17650 @override
17651 int get hashCode {
17652 int hash = 0;
17653 hash = JenkinsSmiHash.combine(hash, isFatal.hashCode);
17654 hash = JenkinsSmiHash.combine(hash, message.hashCode);
17655 hash = JenkinsSmiHash.combine(hash, stackTrace.hashCode);
17656 return JenkinsSmiHash.finish(hash);
17657 }
17658 }
17659
17660 /**
17661 * server.getVersion params
17662 *
17663 * Clients may not extend, implement or mix-in this class.
17664 */
17665 class ServerGetVersionParams implements RequestParams {
17666 @override
17667 Map<String, dynamic> toJson() => <String, dynamic>{};
17668
17669 @override
17670 Request toRequest(String id) {
17671 return new Request(id, "server.getVersion", null);
17672 }
17673
17674 @override
17675 bool operator ==(other) {
17676 if (other is ServerGetVersionParams) {
17677 return true;
17678 }
17679 return false;
17680 }
17681
17682 @override
17683 int get hashCode {
17684 return 55877452;
17685 }
17686 }
17687
17688 /**
17689 * server.getVersion result
17690 *
17691 * {
17692 * "version": String
17693 * }
17694 *
17695 * Clients may not extend, implement or mix-in this class.
17696 */
17697 class ServerGetVersionResult implements ResponseResult {
17698 String _version;
17699
17700 /**
17701 * The version number of the analysis server.
17702 */
17703 String get version => _version;
17704
17705 /**
17706 * The version number of the analysis server.
17707 */
17708 void set version(String value) {
17709 assert(value != null);
17710 this._version = value;
17711 }
17712
17713 ServerGetVersionResult(String version) {
17714 this.version = version;
17715 }
17716
17717 factory ServerGetVersionResult.fromJson(
17718 JsonDecoder jsonDecoder, String jsonPath, Object json) {
17719 if (json == null) {
17720 json = {};
17721 }
17722 if (json is Map) {
17723 String version;
17724 if (json.containsKey("version")) {
17725 version =
17726 jsonDecoder.decodeString(jsonPath + ".version", json["version"]);
17727 } else {
17728 throw jsonDecoder.mismatch(jsonPath, "version");
17729 }
17730 return new ServerGetVersionResult(version);
17731 } else {
17732 throw jsonDecoder.mismatch(jsonPath, "server.getVersion result", json);
17733 }
17734 }
17735
17736 factory ServerGetVersionResult.fromResponse(Response response) {
17737 return new ServerGetVersionResult.fromJson(
17738 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)),
17739 "result",
17740 response.result);
17741 }
17742
17743 @override
17744 Map<String, dynamic> toJson() {
17745 Map<String, dynamic> result = {};
17746 result["version"] = version;
17747 return result;
17748 }
17749
17750 @override
17751 Response toResponse(String id) {
17752 return new Response(id, result: toJson());
17753 }
17754
17755 @override
17756 String toString() => JSON.encode(toJson());
17757
17758 @override
17759 bool operator ==(other) {
17760 if (other is ServerGetVersionResult) {
17761 return version == other.version;
17762 }
17763 return false;
17764 }
17734 17765
17735 @override 17766 @override
17736 int get hashCode { 17767 int get hashCode {
17737 int hash = 0; 17768 int hash = 0;
17738 hash = JenkinsSmiHash.combine(hash, offset.hashCode); 17769 hash = JenkinsSmiHash.combine(hash, version.hashCode);
17739 hash = JenkinsSmiHash.combine(hash, length.hashCode);
17740 hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
17741 hash = JenkinsSmiHash.combine(hash, names.hashCode);
17742 hash = JenkinsSmiHash.combine(hash, canCreateGetter.hashCode);
17743 hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
17744 hash = JenkinsSmiHash.combine(hash, offsets.hashCode);
17745 hash = JenkinsSmiHash.combine(hash, lengths.hashCode);
17746 return JenkinsSmiHash.finish(hash); 17770 return JenkinsSmiHash.finish(hash);
17747 } 17771 }
17748 } 17772 }
17749 17773
17750 /** 17774 /**
17751 * extractMethod options 17775 * ServerService
17776 *
17777 * enum {
17778 * STATUS
17779 * }
17780 *
17781 * Clients may not extend, implement or mix-in this class.
17782 */
17783 class ServerService implements Enum {
17784 static const ServerService STATUS = const ServerService._("STATUS");
17785
17786 /**
17787 * A list containing all of the enum values that are defined.
17788 */
17789 static const List<ServerService> VALUES = const <ServerService>[STATUS];
17790
17791 @override
17792 final String name;
17793
17794 const ServerService._(this.name);
17795
17796 factory ServerService(String name) {
17797 switch (name) {
17798 case "STATUS":
17799 return STATUS;
17800 }
17801 throw new Exception('Illegal enum value: $name');
17802 }
17803
17804 factory ServerService.fromJson(
17805 JsonDecoder jsonDecoder, String jsonPath, Object json) {
17806 if (json is String) {
17807 try {
17808 return new ServerService(json);
17809 } catch (_) {
17810 // Fall through
17811 }
17812 }
17813 throw jsonDecoder.mismatch(jsonPath, "ServerService", json);
17814 }
17815
17816 @override
17817 String toString() => "ServerService.$name";
17818
17819 String toJson() => name;
17820 }
17821
17822 /**
17823 * server.setSubscriptions params
17752 * 17824 *
17753 * { 17825 * {
17754 * "returnType": String 17826 * "subscriptions": List<ServerService>
17755 * "createGetter": bool
17756 * "name": String
17757 * "parameters": List<RefactoringMethodParameter>
17758 * "extractAll": bool
17759 * } 17827 * }
17760 * 17828 *
17761 * Clients may not extend, implement or mix-in this class. 17829 * Clients may not extend, implement or mix-in this class.
17762 */ 17830 */
17763 class ExtractMethodOptions extends RefactoringOptions { 17831 class ServerSetSubscriptionsParams implements RequestParams {
17764 String _returnType; 17832 List<ServerService> _subscriptions;
17765 17833
17766 bool _createGetter; 17834 /**
17767 17835 * A list of the services being subscribed to.
17768 String _name; 17836 */
17769 17837 List<ServerService> get subscriptions => _subscriptions;
17770 List<RefactoringMethodParameter> _parameters; 17838
17771 17839 /**
17772 bool _extractAll; 17840 * A list of the services being subscribed to.
17773 17841 */
17774 /** 17842 void set subscriptions(List<ServerService> value) {
17775 * The return type that should be defined for the method.
17776 */
17777 String get returnType => _returnType;
17778
17779 /**
17780 * The return type that should be defined for the method.
17781 */
17782 void set returnType(String value) {
17783 assert(value != null); 17843 assert(value != null);
17784 this._returnType = value; 17844 this._subscriptions = value;
17785 } 17845 }
17786 17846
17787 /** 17847 ServerSetSubscriptionsParams(List<ServerService> subscriptions) {
17788 * True if a getter should be created rather than a method. It is an error if 17848 this.subscriptions = subscriptions;
17789 * this field is true and the list of parameters is non-empty. 17849 }
17790 */ 17850
17791 bool get createGetter => _createGetter; 17851 factory ServerSetSubscriptionsParams.fromJson(
17792
17793 /**
17794 * True if a getter should be created rather than a method. It is an error if
17795 * this field is true and the list of parameters is non-empty.
17796 */
17797 void set createGetter(bool value) {
17798 assert(value != null);
17799 this._createGetter = value;
17800 }
17801
17802 /**
17803 * The name that the method should be given.
17804 */
17805 String get name => _name;
17806
17807 /**
17808 * The name that the method should be given.
17809 */
17810 void set name(String value) {
17811 assert(value != null);
17812 this._name = value;
17813 }
17814
17815 /**
17816 * The parameters that should be defined for the method.
17817 *
17818 * It is an error if a REQUIRED or NAMED parameter follows a POSITIONAL
17819 * parameter. It is an error if a REQUIRED or POSITIONAL parameter follows a
17820 * NAMED parameter.
17821 *
17822 * - To change the order and/or update proposed parameters, add parameters
17823 * with the same identifiers as proposed.
17824 * - To add new parameters, omit their identifier.
17825 * - To remove some parameters, omit them in this list.
17826 */
17827 List<RefactoringMethodParameter> get parameters => _parameters;
17828
17829 /**
17830 * The parameters that should be defined for the method.
17831 *
17832 * It is an error if a REQUIRED or NAMED parameter follows a POSITIONAL
17833 * parameter. It is an error if a REQUIRED or POSITIONAL parameter follows a
17834 * NAMED parameter.
17835 *
17836 * - To change the order and/or update proposed parameters, add parameters
17837 * with the same identifiers as proposed.
17838 * - To add new parameters, omit their identifier.
17839 * - To remove some parameters, omit them in this list.
17840 */
17841 void set parameters(List<RefactoringMethodParameter> value) {
17842 assert(value != null);
17843 this._parameters = value;
17844 }
17845
17846 /**
17847 * True if all occurrences of the expression or statements should be replaced
17848 * by an invocation of the method. The expression or statements used to
17849 * initiate the refactoring will always be replaced.
17850 */
17851 bool get extractAll => _extractAll;
17852
17853 /**
17854 * True if all occurrences of the expression or statements should be replaced
17855 * by an invocation of the method. The expression or statements used to
17856 * initiate the refactoring will always be replaced.
17857 */
17858 void set extractAll(bool value) {
17859 assert(value != null);
17860 this._extractAll = value;
17861 }
17862
17863 ExtractMethodOptions(String returnType, bool createGetter, String name,
17864 List<RefactoringMethodParameter> parameters, bool extractAll) {
17865 this.returnType = returnType;
17866 this.createGetter = createGetter;
17867 this.name = name;
17868 this.parameters = parameters;
17869 this.extractAll = extractAll;
17870 }
17871
17872 factory ExtractMethodOptions.fromJson(
17873 JsonDecoder jsonDecoder, String jsonPath, Object json) { 17852 JsonDecoder jsonDecoder, String jsonPath, Object json) {
17874 if (json == null) { 17853 if (json == null) {
17875 json = {}; 17854 json = {};
17876 } 17855 }
17877 if (json is Map) { 17856 if (json is Map) {
17878 String returnType; 17857 List<ServerService> subscriptions;
17879 if (json.containsKey("returnType")) { 17858 if (json.containsKey("subscriptions")) {
17880 returnType = jsonDecoder.decodeString( 17859 subscriptions = jsonDecoder.decodeList(
17881 jsonPath + ".returnType", json["returnType"]); 17860 jsonPath + ".subscriptions",
17861 json["subscriptions"],
17862 (String jsonPath, Object json) =>
17863 new ServerService.fromJson(jsonDecoder, jsonPath, json));
17882 } else { 17864 } else {
17883 throw jsonDecoder.missingKey(jsonPath, "returnType"); 17865 throw jsonDecoder.mismatch(jsonPath, "subscriptions");
17884 } 17866 }
17885 bool createGetter; 17867 return new ServerSetSubscriptionsParams(subscriptions);
17886 if (json.containsKey("createGetter")) {
17887 createGetter = jsonDecoder.decodeBool(
17888 jsonPath + ".createGetter", json["createGetter"]);
17889 } else {
17890 throw jsonDecoder.missingKey(jsonPath, "createGetter");
17891 }
17892 String name;
17893 if (json.containsKey("name")) {
17894 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]);
17895 } else {
17896 throw jsonDecoder.missingKey(jsonPath, "name");
17897 }
17898 List<RefactoringMethodParameter> parameters;
17899 if (json.containsKey("parameters")) {
17900 parameters = jsonDecoder.decodeList(
17901 jsonPath + ".parameters",
17902 json["parameters"],
17903 (String jsonPath, Object json) =>
17904 new RefactoringMethodParameter.fromJson(
17905 jsonDecoder, jsonPath, json));
17906 } else {
17907 throw jsonDecoder.missingKey(jsonPath, "parameters");
17908 }
17909 bool extractAll;
17910 if (json.containsKey("extractAll")) {
17911 extractAll = jsonDecoder.decodeBool(
17912 jsonPath + ".extractAll", json["extractAll"]);
17913 } else {
17914 throw jsonDecoder.missingKey(jsonPath, "extractAll");
17915 }
17916 return new ExtractMethodOptions(
17917 returnType, createGetter, name, parameters, extractAll);
17918 } else { 17868 } else {
17919 throw jsonDecoder.mismatch(jsonPath, "extractMethod options", json); 17869 throw jsonDecoder.mismatch(
17920 } 17870 jsonPath, "server.setSubscriptions params", json);
17921 } 17871 }
17922 17872 }
17923 factory ExtractMethodOptions.fromRefactoringParams( 17873
17924 EditGetRefactoringParams refactoringParams, Request request) { 17874 factory ServerSetSubscriptionsParams.fromRequest(Request request) {
17925 return new ExtractMethodOptions.fromJson( 17875 return new ServerSetSubscriptionsParams.fromJson(
17926 new RequestDecoder(request), "options", refactoringParams.options); 17876 new RequestDecoder(request), "params", request.params);
17927 } 17877 }
17928 17878
17879 @override
17929 Map<String, dynamic> toJson() { 17880 Map<String, dynamic> toJson() {
17930 Map<String, dynamic> result = {}; 17881 Map<String, dynamic> result = {};
17931 result["returnType"] = returnType; 17882 result["subscriptions"] =
17932 result["createGetter"] = createGetter; 17883 subscriptions.map((ServerService value) => value.toJson()).toList();
17933 result["name"] = name;
17934 result["parameters"] = parameters
17935 .map((RefactoringMethodParameter value) => value.toJson())
17936 .toList();
17937 result["extractAll"] = extractAll;
17938 return result; 17884 return result;
17939 } 17885 }
17940 17886
17941 @override 17887 @override
17888 Request toRequest(String id) {
17889 return new Request(id, "server.setSubscriptions", toJson());
17890 }
17891
17892 @override
17942 String toString() => JSON.encode(toJson()); 17893 String toString() => JSON.encode(toJson());
17943 17894
17944 @override 17895 @override
17945 bool operator ==(other) { 17896 bool operator ==(other) {
17946 if (other is ExtractMethodOptions) { 17897 if (other is ServerSetSubscriptionsParams) {
17947 return returnType == other.returnType && 17898 return listEqual(subscriptions, other.subscriptions,
17948 createGetter == other.createGetter && 17899 (ServerService a, ServerService b) => a == b);
17949 name == other.name &&
17950 listEqual(
17951 parameters,
17952 other.parameters,
17953 (RefactoringMethodParameter a, RefactoringMethodParameter b) =>
17954 a == b) &&
17955 extractAll == other.extractAll;
17956 } 17900 }
17957 return false; 17901 return false;
17958 } 17902 }
17959 17903
17960 @override 17904 @override
17961 int get hashCode { 17905 int get hashCode {
17962 int hash = 0; 17906 int hash = 0;
17963 hash = JenkinsSmiHash.combine(hash, returnType.hashCode); 17907 hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
17964 hash = JenkinsSmiHash.combine(hash, createGetter.hashCode);
17965 hash = JenkinsSmiHash.combine(hash, name.hashCode);
17966 hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
17967 hash = JenkinsSmiHash.combine(hash, extractAll.hashCode);
17968 return JenkinsSmiHash.finish(hash); 17908 return JenkinsSmiHash.finish(hash);
17969 } 17909 }
17970 } 17910 }
17971 17911
17972 /** 17912 /**
17973 * inlineLocalVariable feedback 17913 * server.setSubscriptions result
17914 *
17915 * Clients may not extend, implement or mix-in this class.
17916 */
17917 class ServerSetSubscriptionsResult implements ResponseResult {
17918 @override
17919 Map<String, dynamic> toJson() => <String, dynamic>{};
17920
17921 @override
17922 Response toResponse(String id) {
17923 return new Response(id, result: null);
17924 }
17925
17926 @override
17927 bool operator ==(other) {
17928 if (other is ServerSetSubscriptionsResult) {
17929 return true;
17930 }
17931 return false;
17932 }
17933
17934 @override
17935 int get hashCode {
17936 return 748820900;
17937 }
17938 }
17939
17940 /**
17941 * server.shutdown params
17942 *
17943 * Clients may not extend, implement or mix-in this class.
17944 */
17945 class ServerShutdownParams implements RequestParams {
17946 @override
17947 Map<String, dynamic> toJson() => <String, dynamic>{};
17948
17949 @override
17950 Request toRequest(String id) {
17951 return new Request(id, "server.shutdown", null);
17952 }
17953
17954 @override
17955 bool operator ==(other) {
17956 if (other is ServerShutdownParams) {
17957 return true;
17958 }
17959 return false;
17960 }
17961
17962 @override
17963 int get hashCode {
17964 return 366630911;
17965 }
17966 }
17967
17968 /**
17969 * server.shutdown result
17970 *
17971 * Clients may not extend, implement or mix-in this class.
17972 */
17973 class ServerShutdownResult implements ResponseResult {
17974 @override
17975 Map<String, dynamic> toJson() => <String, dynamic>{};
17976
17977 @override
17978 Response toResponse(String id) {
17979 return new Response(id, result: null);
17980 }
17981
17982 @override
17983 bool operator ==(other) {
17984 if (other is ServerShutdownResult) {
17985 return true;
17986 }
17987 return false;
17988 }
17989
17990 @override
17991 int get hashCode {
17992 return 193626532;
17993 }
17994 }
17995
17996 /**
17997 * server.status params
17974 * 17998 *
17975 * { 17999 * {
17976 * "name": String 18000 * "analysis": optional AnalysisStatus
17977 * "occurrences": int 18001 * "pub": optional PubStatus
17978 * } 18002 * }
17979 * 18003 *
17980 * Clients may not extend, implement or mix-in this class. 18004 * Clients may not extend, implement or mix-in this class.
17981 */ 18005 */
17982 class InlineLocalVariableFeedback extends RefactoringFeedback { 18006 class ServerStatusParams implements HasToJson {
17983 String _name; 18007 AnalysisStatus _analysis;
17984 18008
17985 int _occurrences; 18009 PubStatus _pub;
17986 18010
17987 /** 18011 /**
17988 * The name of the variable being inlined. 18012 * The current status of analysis, including whether analysis is being
17989 */ 18013 * performed and if so what is being analyzed.
17990 String get name => _name; 18014 */
17991 18015 AnalysisStatus get analysis => _analysis;
17992 /** 18016
17993 * The name of the variable being inlined. 18017 /**
17994 */ 18018 * The current status of analysis, including whether analysis is being
17995 void set name(String value) { 18019 * performed and if so what is being analyzed.
17996 assert(value != null); 18020 */
17997 this._name = value; 18021 void set analysis(AnalysisStatus value) {
17998 } 18022 this._analysis = value;
17999 18023 }
18000 /** 18024
18001 * The number of times the variable occurs. 18025 /**
18002 */ 18026 * The current status of pub execution, indicating whether we are currently
18003 int get occurrences => _occurrences; 18027 * running pub.
18004 18028 */
18005 /** 18029 PubStatus get pub => _pub;
18006 * The number of times the variable occurs. 18030
18007 */ 18031 /**
18008 void set occurrences(int value) { 18032 * The current status of pub execution, indicating whether we are currently
18009 assert(value != null); 18033 * running pub.
18010 this._occurrences = value; 18034 */
18011 } 18035 void set pub(PubStatus value) {
18012 18036 this._pub = value;
18013 InlineLocalVariableFeedback(String name, int occurrences) { 18037 }
18014 this.name = name; 18038
18015 this.occurrences = occurrences; 18039 ServerStatusParams({AnalysisStatus analysis, PubStatus pub}) {
18016 } 18040 this.analysis = analysis;
18017 18041 this.pub = pub;
18018 factory InlineLocalVariableFeedback.fromJson( 18042 }
18043
18044 factory ServerStatusParams.fromJson(
18019 JsonDecoder jsonDecoder, String jsonPath, Object json) { 18045 JsonDecoder jsonDecoder, String jsonPath, Object json) {
18020 if (json == null) { 18046 if (json == null) {
18021 json = {}; 18047 json = {};
18022 } 18048 }
18023 if (json is Map) { 18049 if (json is Map) {
18024 String name; 18050 AnalysisStatus analysis;
18025 if (json.containsKey("name")) { 18051 if (json.containsKey("analysis")) {
18026 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]); 18052 analysis = new AnalysisStatus.fromJson(
18027 } else { 18053 jsonDecoder, jsonPath + ".analysis", json["analysis"]);
18028 throw jsonDecoder.missingKey(jsonPath, "name");
18029 } 18054 }
18030 int occurrences; 18055 PubStatus pub;
18031 if (json.containsKey("occurrences")) { 18056 if (json.containsKey("pub")) {
18032 occurrences = jsonDecoder.decodeInt( 18057 pub =
18033 jsonPath + ".occurrences", json["occurrences"]); 18058 new PubStatus.fromJson(jsonDecoder, jsonPath + ".pub", json["pub"]);
18034 } else {
18035 throw jsonDecoder.missingKey(jsonPath, "occurrences");
18036 } 18059 }
18037 return new InlineLocalVariableFeedback(name, occurrences); 18060 return new ServerStatusParams(analysis: analysis, pub: pub);
18038 } else { 18061 } else {
18039 throw jsonDecoder.mismatch( 18062 throw jsonDecoder.mismatch(jsonPath, "server.status params", json);
18040 jsonPath, "inlineLocalVariable feedback", json); 18063 }
18041 } 18064 }
18042 } 18065
18043 18066 factory ServerStatusParams.fromNotification(Notification notification) {
18067 return new ServerStatusParams.fromJson(
18068 new ResponseDecoder(null), "params", notification.params);
18069 }
18070
18071 @override
18044 Map<String, dynamic> toJson() { 18072 Map<String, dynamic> toJson() {
18045 Map<String, dynamic> result = {}; 18073 Map<String, dynamic> result = {};
18046 result["name"] = name; 18074 if (analysis != null) {
18047 result["occurrences"] = occurrences; 18075 result["analysis"] = analysis.toJson();
18076 }
18077 if (pub != null) {
18078 result["pub"] = pub.toJson();
18079 }
18048 return result; 18080 return result;
18049 } 18081 }
18050 18082
18083 Notification toNotification() {
18084 return new Notification("server.status", toJson());
18085 }
18086
18051 @override 18087 @override
18052 String toString() => JSON.encode(toJson()); 18088 String toString() => JSON.encode(toJson());
18053 18089
18054 @override 18090 @override
18055 bool operator ==(other) { 18091 bool operator ==(other) {
18056 if (other is InlineLocalVariableFeedback) { 18092 if (other is ServerStatusParams) {
18057 return name == other.name && occurrences == other.occurrences; 18093 return analysis == other.analysis && pub == other.pub;
18058 } 18094 }
18059 return false; 18095 return false;
18060 } 18096 }
18061 18097
18062 @override 18098 @override
18063 int get hashCode { 18099 int get hashCode {
18064 int hash = 0; 18100 int hash = 0;
18065 hash = JenkinsSmiHash.combine(hash, name.hashCode); 18101 hash = JenkinsSmiHash.combine(hash, analysis.hashCode);
18066 hash = JenkinsSmiHash.combine(hash, occurrences.hashCode); 18102 hash = JenkinsSmiHash.combine(hash, pub.hashCode);
18067 return JenkinsSmiHash.finish(hash); 18103 return JenkinsSmiHash.finish(hash);
18068 } 18104 }
18069 } 18105 }
18070 18106
18071 /** 18107 /**
18072 * inlineLocalVariable options 18108 * SourceChange
18073 *
18074 * Clients may not extend, implement or mix-in this class.
18075 */
18076 class InlineLocalVariableOptions extends RefactoringOptions {
18077 @override
18078 bool operator ==(other) {
18079 if (other is InlineLocalVariableOptions) {
18080 return true;
18081 }
18082 return false;
18083 }
18084
18085 @override
18086 int get hashCode {
18087 return 540364977;
18088 }
18089 }
18090
18091 /**
18092 * inlineMethod feedback
18093 * 18109 *
18094 * { 18110 * {
18095 * "className": optional String 18111 * "message": String
18096 * "methodName": String 18112 * "edits": List<SourceFileEdit>
18097 * "isDeclaration": bool 18113 * "linkedEditGroups": List<LinkedEditGroup>
18114 * "selection": optional Position
18098 * } 18115 * }
18099 * 18116 *
18100 * Clients may not extend, implement or mix-in this class. 18117 * Clients may not extend, implement or mix-in this class.
18101 */ 18118 */
18102 class InlineMethodFeedback extends RefactoringFeedback { 18119 class SourceChange implements HasToJson {
18103 String _className; 18120 String _message;
18104 18121
18105 String _methodName; 18122 List<SourceFileEdit> _edits;
18106 18123
18107 bool _isDeclaration; 18124 List<LinkedEditGroup> _linkedEditGroups;
18108 18125
18109 /** 18126 Position _selection;
18110 * The name of the class enclosing the method being inlined. If not a class 18127
18111 * member is being inlined, this field will be absent. 18128 /**
18112 */ 18129 * A human-readable description of the change to be applied.
18113 String get className => _className; 18130 */
18114 18131 String get message => _message;
18115 /** 18132
18116 * The name of the class enclosing the method being inlined. If not a class 18133 /**
18117 * member is being inlined, this field will be absent. 18134 * A human-readable description of the change to be applied.
18118 */ 18135 */
18119 void set className(String value) { 18136 void set message(String value) {
18120 this._className = value;
18121 }
18122
18123 /**
18124 * The name of the method (or function) being inlined.
18125 */
18126 String get methodName => _methodName;
18127
18128 /**
18129 * The name of the method (or function) being inlined.
18130 */
18131 void set methodName(String value) {
18132 assert(value != null); 18137 assert(value != null);
18133 this._methodName = value; 18138 this._message = value;
18134 } 18139 }
18135 18140
18136 /** 18141 /**
18137 * True if the declaration of the method is selected. So all references 18142 * A list of the edits used to effect the change, grouped by file.
18138 * should be inlined. 18143 */
18139 */ 18144 List<SourceFileEdit> get edits => _edits;
18140 bool get isDeclaration => _isDeclaration; 18145
18141 18146 /**
18142 /** 18147 * A list of the edits used to effect the change, grouped by file.
18143 * True if the declaration of the method is selected. So all references 18148 */
18144 * should be inlined. 18149 void set edits(List<SourceFileEdit> value) {
18145 */
18146 void set isDeclaration(bool value) {
18147 assert(value != null); 18150 assert(value != null);
18148 this._isDeclaration = value; 18151 this._edits = value;
18149 } 18152 }
18150 18153
18151 InlineMethodFeedback(String methodName, bool isDeclaration, 18154 /**
18152 {String className}) { 18155 * A list of the linked editing groups used to customize the changes that
18153 this.className = className; 18156 * were made.
18154 this.methodName = methodName; 18157 */
18155 this.isDeclaration = isDeclaration; 18158 List<LinkedEditGroup> get linkedEditGroups => _linkedEditGroups;
18156 } 18159
18157 18160 /**
18158 factory InlineMethodFeedback.fromJson( 18161 * A list of the linked editing groups used to customize the changes that
18162 * were made.
18163 */
18164 void set linkedEditGroups(List<LinkedEditGroup> value) {
18165 assert(value != null);
18166 this._linkedEditGroups = value;
18167 }
18168
18169 /**
18170 * The position that should be selected after the edits have been applied.
18171 */
18172 Position get selection => _selection;
18173
18174 /**
18175 * The position that should be selected after the edits have been applied.
18176 */
18177 void set selection(Position value) {
18178 this._selection = value;
18179 }
18180
18181 SourceChange(String message,
18182 {List<SourceFileEdit> edits,
18183 List<LinkedEditGroup> linkedEditGroups,
18184 Position selection}) {
18185 this.message = message;
18186 if (edits == null) {
18187 this.edits = <SourceFileEdit>[];
18188 } else {
18189 this.edits = edits;
18190 }
18191 if (linkedEditGroups == null) {
18192 this.linkedEditGroups = <LinkedEditGroup>[];
18193 } else {
18194 this.linkedEditGroups = linkedEditGroups;
18195 }
18196 this.selection = selection;
18197 }
18198
18199 factory SourceChange.fromJson(
18159 JsonDecoder jsonDecoder, String jsonPath, Object json) { 18200 JsonDecoder jsonDecoder, String jsonPath, Object json) {
18160 if (json == null) { 18201 if (json == null) {
18161 json = {}; 18202 json = {};
18162 } 18203 }
18163 if (json is Map) { 18204 if (json is Map) {
18164 String className; 18205 String message;
18165 if (json.containsKey("className")) { 18206 if (json.containsKey("message")) {
18166 className = jsonDecoder.decodeString( 18207 message =
18167 jsonPath + ".className", json["className"]); 18208 jsonDecoder.decodeString(jsonPath + ".message", json["message"]);
18168 }
18169 String methodName;
18170 if (json.containsKey("methodName")) {
18171 methodName = jsonDecoder.decodeString(
18172 jsonPath + ".methodName", json["methodName"]);
18173 } else { 18209 } else {
18174 throw jsonDecoder.missingKey(jsonPath, "methodName"); 18210 throw jsonDecoder.mismatch(jsonPath, "message");
18175 } 18211 }
18176 bool isDeclaration; 18212 List<SourceFileEdit> edits;
18177 if (json.containsKey("isDeclaration")) { 18213 if (json.containsKey("edits")) {
18178 isDeclaration = jsonDecoder.decodeBool( 18214 edits = jsonDecoder.decodeList(
18179 jsonPath + ".isDeclaration", json["isDeclaration"]); 18215 jsonPath + ".edits",
18216 json["edits"],
18217 (String jsonPath, Object json) =>
18218 new SourceFileEdit.fromJson(jsonDecoder, jsonPath, json));
18180 } else { 18219 } else {
18181 throw jsonDecoder.missingKey(jsonPath, "isDeclaration"); 18220 throw jsonDecoder.mismatch(jsonPath, "edits");
18182 } 18221 }
18183 return new InlineMethodFeedback(methodName, isDeclaration, 18222 List<LinkedEditGroup> linkedEditGroups;
18184 className: className); 18223 if (json.containsKey("linkedEditGroups")) {
18224 linkedEditGroups = jsonDecoder.decodeList(
18225 jsonPath + ".linkedEditGroups",
18226 json["linkedEditGroups"],
18227 (String jsonPath, Object json) =>
18228 new LinkedEditGroup.fromJson(jsonDecoder, jsonPath, json));
18229 } else {
18230 throw jsonDecoder.mismatch(jsonPath, "linkedEditGroups");
18231 }
18232 Position selection;
18233 if (json.containsKey("selection")) {
18234 selection = new Position.fromJson(
18235 jsonDecoder, jsonPath + ".selection", json["selection"]);
18236 }
18237 return new SourceChange(message,
18238 edits: edits,
18239 linkedEditGroups: linkedEditGroups,
18240 selection: selection);
18185 } else { 18241 } else {
18186 throw jsonDecoder.mismatch(jsonPath, "inlineMethod feedback", json); 18242 throw jsonDecoder.mismatch(jsonPath, "SourceChange", json);
18187 } 18243 }
18188 } 18244 }
18189 18245
18246 @override
18190 Map<String, dynamic> toJson() { 18247 Map<String, dynamic> toJson() {
18191 Map<String, dynamic> result = {}; 18248 Map<String, dynamic> result = {};
18192 if (className != null) { 18249 result["message"] = message;
18193 result["className"] = className; 18250 result["edits"] =
18194 } 18251 edits.map((SourceFileEdit value) => value.toJson()).toList();
18195 result["methodName"] = methodName; 18252 result["linkedEditGroups"] = linkedEditGroups
18196 result["isDeclaration"] = isDeclaration; 18253 .map((LinkedEditGroup value) => value.toJson())
18254 .toList();
18255 if (selection != null) {
18256 result["selection"] = selection.toJson();
18257 }
18197 return result; 18258 return result;
18198 } 18259 }
18199 18260
18261 /**
18262 * Adds [edit] to the [FileEdit] for the given [file].
18263 */
18264 void addEdit(String file, int fileStamp, SourceEdit edit) =>
18265 addEditToSourceChange(this, file, fileStamp, edit);
18266
18267 /**
18268 * Adds the given [FileEdit].
18269 */
18270 void addFileEdit(SourceFileEdit edit) {
18271 edits.add(edit);
18272 }
18273
18274 /**
18275 * Adds the given [LinkedEditGroup].
18276 */
18277 void addLinkedEditGroup(LinkedEditGroup linkedEditGroup) {
18278 linkedEditGroups.add(linkedEditGroup);
18279 }
18280
18281 /**
18282 * Returns the [FileEdit] for the given [file], maybe `null`.
18283 */
18284 SourceFileEdit getFileEdit(String file) => getChangeFileEdit(this, file);
18285
18200 @override 18286 @override
18201 String toString() => JSON.encode(toJson()); 18287 String toString() => JSON.encode(toJson());
18202 18288
18203 @override 18289 @override
18204 bool operator ==(other) { 18290 bool operator ==(other) {
18205 if (other is InlineMethodFeedback) { 18291 if (other is SourceChange) {
18206 return className == other.className && 18292 return message == other.message &&
18207 methodName == other.methodName && 18293 listEqual(edits, other.edits,
18208 isDeclaration == other.isDeclaration; 18294 (SourceFileEdit a, SourceFileEdit b) => a == b) &&
18295 listEqual(linkedEditGroups, other.linkedEditGroups,
18296 (LinkedEditGroup a, LinkedEditGroup b) => a == b) &&
18297 selection == other.selection;
18209 } 18298 }
18210 return false; 18299 return false;
18211 } 18300 }
18212 18301
18213 @override 18302 @override
18214 int get hashCode { 18303 int get hashCode {
18215 int hash = 0; 18304 int hash = 0;
18216 hash = JenkinsSmiHash.combine(hash, className.hashCode); 18305 hash = JenkinsSmiHash.combine(hash, message.hashCode);
18217 hash = JenkinsSmiHash.combine(hash, methodName.hashCode); 18306 hash = JenkinsSmiHash.combine(hash, edits.hashCode);
18218 hash = JenkinsSmiHash.combine(hash, isDeclaration.hashCode); 18307 hash = JenkinsSmiHash.combine(hash, linkedEditGroups.hashCode);
18308 hash = JenkinsSmiHash.combine(hash, selection.hashCode);
18219 return JenkinsSmiHash.finish(hash); 18309 return JenkinsSmiHash.finish(hash);
18220 } 18310 }
18221 } 18311 }
18222 18312
18223 /** 18313 /**
18224 * inlineMethod options 18314 * SourceEdit
18225 * 18315 *
18226 * { 18316 * {
18227 * "deleteSource": bool 18317 * "offset": int
18228 * "inlineAll": bool 18318 * "length": int
18319 * "replacement": String
18320 * "id": optional String
18229 * } 18321 * }
18230 * 18322 *
18231 * Clients may not extend, implement or mix-in this class. 18323 * Clients may not extend, implement or mix-in this class.
18232 */ 18324 */
18233 class InlineMethodOptions extends RefactoringOptions { 18325 class SourceEdit implements HasToJson {
18234 bool _deleteSource; 18326 /**
18327 * Get the result of applying a set of [edits] to the given [code]. Edits are
18328 * applied in the order they appear in [edits].
18329 */
18330 static String applySequence(String code, Iterable<SourceEdit> edits) =>
18331 applySequenceOfEdits(code, edits);
18235 18332
18236 bool _inlineAll; 18333 int _offset;
18334
18335 int _length;
18336
18337 String _replacement;
18338
18339 String _id;
18237 18340
18238 /** 18341 /**
18239 * True if the method being inlined should be removed. It is an error if this 18342 * The offset of the region to be modified.
18240 * field is true and inlineAll is false.
18241 */ 18343 */
18242 bool get deleteSource => _deleteSource; 18344 int get offset => _offset;
18243 18345
18244 /** 18346 /**
18245 * True if the method being inlined should be removed. It is an error if this 18347 * The offset of the region to be modified.
18246 * field is true and inlineAll is false.
18247 */ 18348 */
18248 void set deleteSource(bool value) { 18349 void set offset(int value) {
18249 assert(value != null); 18350 assert(value != null);
18250 this._deleteSource = value; 18351 this._offset = value;
18251 } 18352 }
18252 18353
18253 /** 18354 /**
18254 * True if all invocations of the method should be inlined, or false if only 18355 * The length of the region to be modified.
18255 * the invocation site used to create this refactoring should be inlined.
18256 */ 18356 */
18257 bool get inlineAll => _inlineAll; 18357 int get length => _length;
18258 18358
18259 /** 18359 /**
18260 * True if all invocations of the method should be inlined, or false if only 18360 * The length of the region to be modified.
18261 * the invocation site used to create this refactoring should be inlined.
18262 */ 18361 */
18263 void set inlineAll(bool value) { 18362 void set length(int value) {
18264 assert(value != null); 18363 assert(value != null);
18265 this._inlineAll = value; 18364 this._length = value;
18266 } 18365 }
18267 18366
18268 InlineMethodOptions(bool deleteSource, bool inlineAll) { 18367 /**
18269 this.deleteSource = deleteSource; 18368 * The code that is to replace the specified region in the original code.
18270 this.inlineAll = inlineAll; 18369 */
18370 String get replacement => _replacement;
18371
18372 /**
18373 * The code that is to replace the specified region in the original code.
18374 */
18375 void set replacement(String value) {
18376 assert(value != null);
18377 this._replacement = value;
18271 } 18378 }
18272 18379
18273 factory InlineMethodOptions.fromJson( 18380 /**
18381 * An identifier that uniquely identifies this source edit from other edits
18382 * in the same response. This field is omitted unless a containing structure
18383 * needs to be able to identify the edit for some reason.
18384 *
18385 * For example, some refactoring operations can produce edits that might not
18386 * be appropriate (referred to as potential edits). Such edits will have an
18387 * id so that they can be referenced. Edits in the same response that do not
18388 * need to be referenced will not have an id.
18389 */
18390 String get id => _id;
18391
18392 /**
18393 * An identifier that uniquely identifies this source edit from other edits
18394 * in the same response. This field is omitted unless a containing structure
18395 * needs to be able to identify the edit for some reason.
18396 *
18397 * For example, some refactoring operations can produce edits that might not
18398 * be appropriate (referred to as potential edits). Such edits will have an
18399 * id so that they can be referenced. Edits in the same response that do not
18400 * need to be referenced will not have an id.
18401 */
18402 void set id(String value) {
18403 this._id = value;
18404 }
18405
18406 SourceEdit(int offset, int length, String replacement, {String id}) {
18407 this.offset = offset;
18408 this.length = length;
18409 this.replacement = replacement;
18410 this.id = id;
18411 }
18412
18413 factory SourceEdit.fromJson(
18274 JsonDecoder jsonDecoder, String jsonPath, Object json) { 18414 JsonDecoder jsonDecoder, String jsonPath, Object json) {
18275 if (json == null) { 18415 if (json == null) {
18276 json = {}; 18416 json = {};
18277 } 18417 }
18278 if (json is Map) { 18418 if (json is Map) {
18279 bool deleteSource; 18419 int offset;
18280 if (json.containsKey("deleteSource")) { 18420 if (json.containsKey("offset")) {
18281 deleteSource = jsonDecoder.decodeBool( 18421 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]);
18282 jsonPath + ".deleteSource", json["deleteSource"]);
18283 } else { 18422 } else {
18284 throw jsonDecoder.missingKey(jsonPath, "deleteSource"); 18423 throw jsonDecoder.mismatch(jsonPath, "offset");
18285 } 18424 }
18286 bool inlineAll; 18425 int length;
18287 if (json.containsKey("inlineAll")) { 18426 if (json.containsKey("length")) {
18288 inlineAll = 18427 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]);
18289 jsonDecoder.decodeBool(jsonPath + ".inlineAll", json["inlineAll"]);
18290 } else { 18428 } else {
18291 throw jsonDecoder.missingKey(jsonPath, "inlineAll"); 18429 throw jsonDecoder.mismatch(jsonPath, "length");
18292 } 18430 }
18293 return new InlineMethodOptions(deleteSource, inlineAll); 18431 String replacement;
18432 if (json.containsKey("replacement")) {
18433 replacement = jsonDecoder.decodeString(
18434 jsonPath + ".replacement", json["replacement"]);
18435 } else {
18436 throw jsonDecoder.mismatch(jsonPath, "replacement");
18437 }
18438 String id;
18439 if (json.containsKey("id")) {
18440 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]);
18441 }
18442 return new SourceEdit(offset, length, replacement, id: id);
18294 } else { 18443 } else {
18295 throw jsonDecoder.mismatch(jsonPath, "inlineMethod options", json); 18444 throw jsonDecoder.mismatch(jsonPath, "SourceEdit", json);
18296 } 18445 }
18297 } 18446 }
18298 18447
18299 factory InlineMethodOptions.fromRefactoringParams( 18448 /**
18300 EditGetRefactoringParams refactoringParams, Request request) { 18449 * The end of the region to be modified.
18301 return new InlineMethodOptions.fromJson( 18450 */
18302 new RequestDecoder(request), "options", refactoringParams.options); 18451 int get end => offset + length;
18452
18453 @override
18454 Map<String, dynamic> toJson() {
18455 Map<String, dynamic> result = {};
18456 result["offset"] = offset;
18457 result["length"] = length;
18458 result["replacement"] = replacement;
18459 if (id != null) {
18460 result["id"] = id;
18461 }
18462 return result;
18303 } 18463 }
18304 18464
18305 Map<String, dynamic> toJson() { 18465 /**
18306 Map<String, dynamic> result = {}; 18466 * Get the result of applying the edit to the given [code].
18307 result["deleteSource"] = deleteSource; 18467 */
18308 result["inlineAll"] = inlineAll; 18468 String apply(String code) => applyEdit(code, this);
18309 return result;
18310 }
18311 18469
18312 @override 18470 @override
18313 String toString() => JSON.encode(toJson()); 18471 String toString() => JSON.encode(toJson());
18314 18472
18315 @override 18473 @override
18316 bool operator ==(other) { 18474 bool operator ==(other) {
18317 if (other is InlineMethodOptions) { 18475 if (other is SourceEdit) {
18318 return deleteSource == other.deleteSource && inlineAll == other.inlineAll; 18476 return offset == other.offset &&
18477 length == other.length &&
18478 replacement == other.replacement &&
18479 id == other.id;
18319 } 18480 }
18320 return false; 18481 return false;
18321 } 18482 }
18322 18483
18323 @override 18484 @override
18324 int get hashCode { 18485 int get hashCode {
18325 int hash = 0; 18486 int hash = 0;
18326 hash = JenkinsSmiHash.combine(hash, deleteSource.hashCode); 18487 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
18327 hash = JenkinsSmiHash.combine(hash, inlineAll.hashCode); 18488 hash = JenkinsSmiHash.combine(hash, length.hashCode);
18489 hash = JenkinsSmiHash.combine(hash, replacement.hashCode);
18490 hash = JenkinsSmiHash.combine(hash, id.hashCode);
18328 return JenkinsSmiHash.finish(hash); 18491 return JenkinsSmiHash.finish(hash);
18329 } 18492 }
18330 } 18493 }
18331 18494
18332 /** 18495 /**
18333 * moveFile feedback 18496 * SourceFileEdit
18334 *
18335 * Clients may not extend, implement or mix-in this class.
18336 */
18337 class MoveFileFeedback extends RefactoringFeedback {
18338 @override
18339 bool operator ==(other) {
18340 if (other is MoveFileFeedback) {
18341 return true;
18342 }
18343 return false;
18344 }
18345
18346 @override
18347 int get hashCode {
18348 return 438975893;
18349 }
18350 }
18351
18352 /**
18353 * moveFile options
18354 * 18497 *
18355 * { 18498 * {
18356 * "newFile": FilePath 18499 * "file": FilePath
18500 * "fileStamp": long
18501 * "edits": List<SourceEdit>
18357 * } 18502 * }
18358 * 18503 *
18359 * Clients may not extend, implement or mix-in this class. 18504 * Clients may not extend, implement or mix-in this class.
18360 */ 18505 */
18361 class MoveFileOptions extends RefactoringOptions { 18506 class SourceFileEdit implements HasToJson {
18362 String _newFile; 18507 String _file;
18508
18509 int _fileStamp;
18510
18511 List<SourceEdit> _edits;
18363 18512
18364 /** 18513 /**
18365 * The new file path to which the given file is being moved. 18514 * The file containing the code to be modified.
18366 */ 18515 */
18367 String get newFile => _newFile; 18516 String get file => _file;
18368 18517
18369 /** 18518 /**
18370 * The new file path to which the given file is being moved. 18519 * The file containing the code to be modified.
18371 */ 18520 */
18372 void set newFile(String value) { 18521 void set file(String value) {
18373 assert(value != null); 18522 assert(value != null);
18374 this._newFile = value; 18523 this._file = value;
18375 } 18524 }
18376 18525
18377 MoveFileOptions(String newFile) { 18526 /**
18378 this.newFile = newFile; 18527 * The modification stamp of the file at the moment when the change was
18528 * created, in milliseconds since the "Unix epoch". Will be -1 if the file
18529 * did not exist and should be created. The client may use this field to make
18530 * sure that the file was not changed since then, so it is safe to apply the
18531 * change.
18532 */
18533 int get fileStamp => _fileStamp;
18534
18535 /**
18536 * The modification stamp of the file at the moment when the change was
18537 * created, in milliseconds since the "Unix epoch". Will be -1 if the file
18538 * did not exist and should be created. The client may use this field to make
18539 * sure that the file was not changed since then, so it is safe to apply the
18540 * change.
18541 */
18542 void set fileStamp(int value) {
18543 assert(value != null);
18544 this._fileStamp = value;
18379 } 18545 }
18380 18546
18381 factory MoveFileOptions.fromJson( 18547 /**
18548 * A list of the edits used to effect the change.
18549 */
18550 List<SourceEdit> get edits => _edits;
18551
18552 /**
18553 * A list of the edits used to effect the change.
18554 */
18555 void set edits(List<SourceEdit> value) {
18556 assert(value != null);
18557 this._edits = value;
18558 }
18559
18560 SourceFileEdit(String file, int fileStamp, {List<SourceEdit> edits}) {
18561 this.file = file;
18562 this.fileStamp = fileStamp;
18563 if (edits == null) {
18564 this.edits = <SourceEdit>[];
18565 } else {
18566 this.edits = edits;
18567 }
18568 }
18569
18570 factory SourceFileEdit.fromJson(
18382 JsonDecoder jsonDecoder, String jsonPath, Object json) { 18571 JsonDecoder jsonDecoder, String jsonPath, Object json) {
18383 if (json == null) { 18572 if (json == null) {
18384 json = {}; 18573 json = {};
18385 } 18574 }
18386 if (json is Map) { 18575 if (json is Map) {
18387 String newFile; 18576 String file;
18388 if (json.containsKey("newFile")) { 18577 if (json.containsKey("file")) {
18389 newFile = 18578 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]);
18390 jsonDecoder.decodeString(jsonPath + ".newFile", json["newFile"]);
18391 } else { 18579 } else {
18392 throw jsonDecoder.missingKey(jsonPath, "newFile"); 18580 throw jsonDecoder.mismatch(jsonPath, "file");
18393 } 18581 }
18394 return new MoveFileOptions(newFile); 18582 int fileStamp;
18583 if (json.containsKey("fileStamp")) {
18584 fileStamp =
18585 jsonDecoder.decodeInt(jsonPath + ".fileStamp", json["fileStamp"]);
18586 } else {
18587 throw jsonDecoder.mismatch(jsonPath, "fileStamp");
18588 }
18589 List<SourceEdit> edits;
18590 if (json.containsKey("edits")) {
18591 edits = jsonDecoder.decodeList(
18592 jsonPath + ".edits",
18593 json["edits"],
18594 (String jsonPath, Object json) =>
18595 new SourceEdit.fromJson(jsonDecoder, jsonPath, json));
18596 } else {
18597 throw jsonDecoder.mismatch(jsonPath, "edits");
18598 }
18599 return new SourceFileEdit(file, fileStamp, edits: edits);
18395 } else { 18600 } else {
18396 throw jsonDecoder.mismatch(jsonPath, "moveFile options", json); 18601 throw jsonDecoder.mismatch(jsonPath, "SourceFileEdit", json);
18397 } 18602 }
18398 } 18603 }
18399 18604
18400 factory MoveFileOptions.fromRefactoringParams( 18605 @override
18401 EditGetRefactoringParams refactoringParams, Request request) { 18606 Map<String, dynamic> toJson() {
18402 return new MoveFileOptions.fromJson( 18607 Map<String, dynamic> result = {};
18403 new RequestDecoder(request), "options", refactoringParams.options); 18608 result["file"] = file;
18609 result["fileStamp"] = fileStamp;
18610 result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList();
18611 return result;
18404 } 18612 }
18405 18613
18406 Map<String, dynamic> toJson() { 18614 /**
18407 Map<String, dynamic> result = {}; 18615 * Adds the given [Edit] to the list.
18408 result["newFile"] = newFile; 18616 */
18409 return result; 18617 void add(SourceEdit edit) => addEditForSource(this, edit);
18410 } 18618
18619 /**
18620 * Adds the given [Edit]s.
18621 */
18622 void addAll(Iterable<SourceEdit> edits) => addAllEditsForSource(this, edits);
18411 18623
18412 @override 18624 @override
18413 String toString() => JSON.encode(toJson()); 18625 String toString() => JSON.encode(toJson());
18414 18626
18415 @override 18627 @override
18416 bool operator ==(other) { 18628 bool operator ==(other) {
18417 if (other is MoveFileOptions) { 18629 if (other is SourceFileEdit) {
18418 return newFile == other.newFile; 18630 return file == other.file &&
18631 fileStamp == other.fileStamp &&
18632 listEqual(edits, other.edits, (SourceEdit a, SourceEdit b) => a == b);
18419 } 18633 }
18420 return false; 18634 return false;
18421 } 18635 }
18422 18636
18423 @override 18637 @override
18424 int get hashCode { 18638 int get hashCode {
18425 int hash = 0; 18639 int hash = 0;
18426 hash = JenkinsSmiHash.combine(hash, newFile.hashCode); 18640 hash = JenkinsSmiHash.combine(hash, file.hashCode);
18641 hash = JenkinsSmiHash.combine(hash, fileStamp.hashCode);
18642 hash = JenkinsSmiHash.combine(hash, edits.hashCode);
18427 return JenkinsSmiHash.finish(hash); 18643 return JenkinsSmiHash.finish(hash);
18428 } 18644 }
18429 } 18645 }
18430 18646
18431 /** 18647 /**
18432 * rename feedback 18648 * TypeHierarchyItem
18433 * 18649 *
18434 * { 18650 * {
18435 * "offset": int 18651 * "classElement": Element
18436 * "length": int 18652 * "displayName": optional String
18437 * "elementKindName": String 18653 * "memberElement": optional Element
18438 * "oldName": String 18654 * "superclass": optional int
18655 * "interfaces": List<int>
18656 * "mixins": List<int>
18657 * "subclasses": List<int>
18439 * } 18658 * }
18440 * 18659 *
18441 * Clients may not extend, implement or mix-in this class. 18660 * Clients may not extend, implement or mix-in this class.
18442 */ 18661 */
18443 class RenameFeedback extends RefactoringFeedback { 18662 class TypeHierarchyItem implements HasToJson {
18444 int _offset; 18663 Element _classElement;
18445 18664
18446 int _length; 18665 String _displayName;
18447 18666
18448 String _elementKindName; 18667 Element _memberElement;
18449 18668
18450 String _oldName; 18669 int _superclass;
18451 18670
18452 /** 18671 List<int> _interfaces;
18453 * The offset to the beginning of the name selected to be renamed. 18672
18454 */ 18673 List<int> _mixins;
18455 int get offset => _offset; 18674
18456 18675 List<int> _subclasses;
18457 /** 18676
18458 * The offset to the beginning of the name selected to be renamed. 18677 /**
18459 */ 18678 * The class element represented by this item.
18460 void set offset(int value) { 18679 */
18461 assert(value != null); 18680 Element get classElement => _classElement;
18462 this._offset = value; 18681
18463 } 18682 /**
18464 18683 * The class element represented by this item.
18465 /** 18684 */
18466 * The length of the name selected to be renamed. 18685 void set classElement(Element value) {
18467 */ 18686 assert(value != null);
18468 int get length => _length; 18687 this._classElement = value;
18469 18688 }
18470 /** 18689
18471 * The length of the name selected to be renamed. 18690 /**
18472 */ 18691 * The name to be displayed for the class. This field will be omitted if the
18473 void set length(int value) { 18692 * display name is the same as the name of the element. The display name is
18474 assert(value != null); 18693 * different if there is additional type information to be displayed, such as
18475 this._length = value; 18694 * type arguments.
18476 } 18695 */
18477 18696 String get displayName => _displayName;
18478 /** 18697
18479 * The human-readable description of the kind of element being renamed (such 18698 /**
18480 * as "class" or "function type alias"). 18699 * The name to be displayed for the class. This field will be omitted if the
18481 */ 18700 * display name is the same as the name of the element. The display name is
18482 String get elementKindName => _elementKindName; 18701 * different if there is additional type information to be displayed, such as
18483 18702 * type arguments.
18484 /** 18703 */
18485 * The human-readable description of the kind of element being renamed (such 18704 void set displayName(String value) {
18486 * as "class" or "function type alias"). 18705 this._displayName = value;
18487 */ 18706 }
18488 void set elementKindName(String value) { 18707
18489 assert(value != null); 18708 /**
18490 this._elementKindName = value; 18709 * The member in the class corresponding to the member on which the hierarchy
18491 } 18710 * was requested. This field will be omitted if the hierarchy was not
18492 18711 * requested for a member or if the class does not have a corresponding
18493 /** 18712 * member.
18494 * The old name of the element before the refactoring. 18713 */
18495 */ 18714 Element get memberElement => _memberElement;
18496 String get oldName => _oldName; 18715
18497 18716 /**
18498 /** 18717 * The member in the class corresponding to the member on which the hierarchy
18499 * The old name of the element before the refactoring. 18718 * was requested. This field will be omitted if the hierarchy was not
18500 */ 18719 * requested for a member or if the class does not have a corresponding
18501 void set oldName(String value) { 18720 * member.
18502 assert(value != null); 18721 */
18503 this._oldName = value; 18722 void set memberElement(Element value) {
18504 } 18723 this._memberElement = value;
18505 18724 }
18506 RenameFeedback( 18725
18507 int offset, int length, String elementKindName, String oldName) { 18726 /**
18508 this.offset = offset; 18727 * The index of the item representing the superclass of this class. This
18509 this.length = length; 18728 * field will be omitted if this item represents the class Object.
18510 this.elementKindName = elementKindName; 18729 */
18511 this.oldName = oldName; 18730 int get superclass => _superclass;
18512 } 18731
18513 18732 /**
18514 factory RenameFeedback.fromJson( 18733 * The index of the item representing the superclass of this class. This
18734 * field will be omitted if this item represents the class Object.
18735 */
18736 void set superclass(int value) {
18737 this._superclass = value;
18738 }
18739
18740 /**
18741 * The indexes of the items representing the interfaces implemented by this
18742 * class. The list will be empty if there are no implemented interfaces.
18743 */
18744 List<int> get interfaces => _interfaces;
18745
18746 /**
18747 * The indexes of the items representing the interfaces implemented by this
18748 * class. The list will be empty if there are no implemented interfaces.
18749 */
18750 void set interfaces(List<int> value) {
18751 assert(value != null);
18752 this._interfaces = value;
18753 }
18754
18755 /**
18756 * The indexes of the items representing the mixins referenced by this class.
18757 * The list will be empty if there are no classes mixed in to this class.
18758 */
18759 List<int> get mixins => _mixins;
18760
18761 /**
18762 * The indexes of the items representing the mixins referenced by this class.
18763 * The list will be empty if there are no classes mixed in to this class.
18764 */
18765 void set mixins(List<int> value) {
18766 assert(value != null);
18767 this._mixins = value;
18768 }
18769
18770 /**
18771 * The indexes of the items representing the subtypes of this class. The list
18772 * will be empty if there are no subtypes or if this item represents a
18773 * supertype of the pivot type.
18774 */
18775 List<int> get subclasses => _subclasses;
18776
18777 /**
18778 * The indexes of the items representing the subtypes of this class. The list
18779 * will be empty if there are no subtypes or if this item represents a
18780 * supertype of the pivot type.
18781 */
18782 void set subclasses(List<int> value) {
18783 assert(value != null);
18784 this._subclasses = value;
18785 }
18786
18787 TypeHierarchyItem(Element classElement,
18788 {String displayName,
18789 Element memberElement,
18790 int superclass,
18791 List<int> interfaces,
18792 List<int> mixins,
18793 List<int> subclasses}) {
18794 this.classElement = classElement;
18795 this.displayName = displayName;
18796 this.memberElement = memberElement;
18797 this.superclass = superclass;
18798 if (interfaces == null) {
18799 this.interfaces = <int>[];
18800 } else {
18801 this.interfaces = interfaces;
18802 }
18803 if (mixins == null) {
18804 this.mixins = <int>[];
18805 } else {
18806 this.mixins = mixins;
18807 }
18808 if (subclasses == null) {
18809 this.subclasses = <int>[];
18810 } else {
18811 this.subclasses = subclasses;
18812 }
18813 }
18814
18815 factory TypeHierarchyItem.fromJson(
18515 JsonDecoder jsonDecoder, String jsonPath, Object json) { 18816 JsonDecoder jsonDecoder, String jsonPath, Object json) {
18516 if (json == null) { 18817 if (json == null) {
18517 json = {}; 18818 json = {};
18518 } 18819 }
18519 if (json is Map) { 18820 if (json is Map) {
18520 int offset; 18821 Element classElement;
18521 if (json.containsKey("offset")) { 18822 if (json.containsKey("classElement")) {
18522 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); 18823 classElement = new Element.fromJson(
18523 } else { 18824 jsonDecoder, jsonPath + ".classElement", json["classElement"]);
18524 throw jsonDecoder.missingKey(jsonPath, "offset"); 18825 } else {
18525 } 18826 throw jsonDecoder.mismatch(jsonPath, "classElement");
18526 int length; 18827 }
18527 if (json.containsKey("length")) { 18828 String displayName;
18528 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); 18829 if (json.containsKey("displayName")) {
18529 } else { 18830 displayName = jsonDecoder.decodeString(
18530 throw jsonDecoder.missingKey(jsonPath, "length"); 18831 jsonPath + ".displayName", json["displayName"]);
18531 } 18832 }
18532 String elementKindName; 18833 Element memberElement;
18533 if (json.containsKey("elementKindName")) { 18834 if (json.containsKey("memberElement")) {
18534 elementKindName = jsonDecoder.decodeString( 18835 memberElement = new Element.fromJson(
18535 jsonPath + ".elementKindName", json["elementKindName"]); 18836 jsonDecoder, jsonPath + ".memberElement", json["memberElement"]);
18536 } else { 18837 }
18537 throw jsonDecoder.missingKey(jsonPath, "elementKindName"); 18838 int superclass;
18538 } 18839 if (json.containsKey("superclass")) {
18539 String oldName; 18840 superclass =
18540 if (json.containsKey("oldName")) { 18841 jsonDecoder.decodeInt(jsonPath + ".superclass", json["superclass"]);
18541 oldName = 18842 }
18542 jsonDecoder.decodeString(jsonPath + ".oldName", json["oldName"]); 18843 List<int> interfaces;
18543 } else { 18844 if (json.containsKey("interfaces")) {
18544 throw jsonDecoder.missingKey(jsonPath, "oldName"); 18845 interfaces = jsonDecoder.decodeList(jsonPath + ".interfaces",
18545 } 18846 json["interfaces"], jsonDecoder.decodeInt);
18546 return new RenameFeedback(offset, length, elementKindName, oldName); 18847 } else {
18547 } else { 18848 throw jsonDecoder.mismatch(jsonPath, "interfaces");
18548 throw jsonDecoder.mismatch(jsonPath, "rename feedback", json); 18849 }
18549 } 18850 List<int> mixins;
18550 } 18851 if (json.containsKey("mixins")) {
18551 18852 mixins = jsonDecoder.decodeList(
18853 jsonPath + ".mixins", json["mixins"], jsonDecoder.decodeInt);
18854 } else {
18855 throw jsonDecoder.mismatch(jsonPath, "mixins");
18856 }
18857 List<int> subclasses;
18858 if (json.containsKey("subclasses")) {
18859 subclasses = jsonDecoder.decodeList(jsonPath + ".subclasses",
18860 json["subclasses"], jsonDecoder.decodeInt);
18861 } else {
18862 throw jsonDecoder.mismatch(jsonPath, "subclasses");
18863 }
18864 return new TypeHierarchyItem(classElement,
18865 displayName: displayName,
18866 memberElement: memberElement,
18867 superclass: superclass,
18868 interfaces: interfaces,
18869 mixins: mixins,
18870 subclasses: subclasses);
18871 } else {
18872 throw jsonDecoder.mismatch(jsonPath, "TypeHierarchyItem", json);
18873 }
18874 }
18875
18876 @override
18552 Map<String, dynamic> toJson() { 18877 Map<String, dynamic> toJson() {
18553 Map<String, dynamic> result = {}; 18878 Map<String, dynamic> result = {};
18554 result["offset"] = offset; 18879 result["classElement"] = classElement.toJson();
18555 result["length"] = length; 18880 if (displayName != null) {
18556 result["elementKindName"] = elementKindName; 18881 result["displayName"] = displayName;
18557 result["oldName"] = oldName; 18882 }
18883 if (memberElement != null) {
18884 result["memberElement"] = memberElement.toJson();
18885 }
18886 if (superclass != null) {
18887 result["superclass"] = superclass;
18888 }
18889 result["interfaces"] = interfaces;
18890 result["mixins"] = mixins;
18891 result["subclasses"] = subclasses;
18558 return result; 18892 return result;
18559 } 18893 }
18560 18894
18561 @override
18562 String toString() => JSON.encode(toJson());
18563
18564 @override
18565 bool operator ==(other) {
18566 if (other is RenameFeedback) {
18567 return offset == other.offset &&
18568 length == other.length &&
18569 elementKindName == other.elementKindName &&
18570 oldName == other.oldName;
18571 }
18572 return false;
18573 }
18574
18575 @override
18576 int get hashCode {
18577 int hash = 0;
18578 hash = JenkinsSmiHash.combine(hash, offset.hashCode);
18579 hash = JenkinsSmiHash.combine(hash, length.hashCode);
18580 hash = JenkinsSmiHash.combine(hash, elementKindName.hashCode);
18581 hash = JenkinsSmiHash.combine(hash, oldName.hashCode);
18582 return JenkinsSmiHash.finish(hash);
18583 }
18584 }
18585
18586 /**
18587 * rename options
18588 *
18589 * {
18590 * "newName": String
18591 * }
18592 *
18593 * Clients may not extend, implement or mix-in this class.
18594 */
18595 class RenameOptions extends RefactoringOptions {
18596 String _newName;
18597
18598 /**
18599 * The name that the element should have after the refactoring.
18600 */
18601 String get newName => _newName;
18602
18603 /**
18604 * The name that the element should have after the refactoring.
18605 */
18606 void set newName(String value) {
18607 assert(value != null);
18608 this._newName = value;
18609 }
18610
18611 RenameOptions(String newName) {
18612 this.newName = newName;
18613 }
18614
18615 factory RenameOptions.fromJson(
18616 JsonDecoder jsonDecoder, String jsonPath, Object json) {
18617 if (json == null) {
18618 json = {};
18619 }
18620 if (json is Map) {
18621 String newName;
18622 if (json.containsKey("newName")) {
18623 newName =
18624 jsonDecoder.decodeString(jsonPath + ".newName", json["newName"]);
18625 } else {
18626 throw jsonDecoder.missingKey(jsonPath, "newName");
18627 }
18628 return new RenameOptions(newName);
18629 } else {
18630 throw jsonDecoder.mismatch(jsonPath, "rename options", json);
18631 }
18632 }
18633
18634 factory RenameOptions.fromRefactoringParams(
18635 EditGetRefactoringParams refactoringParams, Request request) {
18636 return new RenameOptions.fromJson(
18637 new RequestDecoder(request), "options", refactoringParams.options);
18638 }
18639
18640 Map<String, dynamic> toJson() {
18641 Map<String, dynamic> result = {};
18642 result["newName"] = newName;
18643 return result;
18644 }
18645
18646 @override 18895 @override
18647 String toString() => JSON.encode(toJson()); 18896 String toString() => JSON.encode(toJson());
18648 18897
18649 @override 18898 @override
18650 bool operator ==(other) { 18899 bool operator ==(other) {
18651 if (other is RenameOptions) { 18900 if (other is TypeHierarchyItem) {
18652 return newName == other.newName; 18901 return classElement == other.classElement &&
18902 displayName == other.displayName &&
18903 memberElement == other.memberElement &&
18904 superclass == other.superclass &&
18905 listEqual(interfaces, other.interfaces, (int a, int b) => a == b) &&
18906 listEqual(mixins, other.mixins, (int a, int b) => a == b) &&
18907 listEqual(subclasses, other.subclasses, (int a, int b) => a == b);
18653 } 18908 }
18654 return false; 18909 return false;
18655 } 18910 }
18656 18911
18657 @override 18912 @override
18658 int get hashCode { 18913 int get hashCode {
18659 int hash = 0; 18914 int hash = 0;
18660 hash = JenkinsSmiHash.combine(hash, newName.hashCode); 18915 hash = JenkinsSmiHash.combine(hash, classElement.hashCode);
18916 hash = JenkinsSmiHash.combine(hash, displayName.hashCode);
18917 hash = JenkinsSmiHash.combine(hash, memberElement.hashCode);
18918 hash = JenkinsSmiHash.combine(hash, superclass.hashCode);
18919 hash = JenkinsSmiHash.combine(hash, interfaces.hashCode);
18920 hash = JenkinsSmiHash.combine(hash, mixins.hashCode);
18921 hash = JenkinsSmiHash.combine(hash, subclasses.hashCode);
18661 return JenkinsSmiHash.finish(hash); 18922 return JenkinsSmiHash.finish(hash);
18662 } 18923 }
18663 } 18924 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/protocol/protocol.dart ('k') | pkg/analysis_server/lib/src/analysis_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698