| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 // | |
| 5 // This file has been automatically generated. Please do not edit it manually. | |
| 6 // To regenerate the file, use the script | |
| 7 // "pkg/analysis_server/tool/spec/generate_files". | |
| 8 | |
| 9 import 'dart:convert' hide JsonDecoder; | |
| 10 | |
| 11 import 'package:analyzer/src/generated/utilities_general.dart'; | |
| 12 import 'package:analyzer_plugin/protocol/protocol.dart'; | |
| 13 import 'package:analyzer_plugin/src/protocol/protocol_internal.dart'; | |
| 14 | |
| 15 /** | |
| 16 * AddContentOverlay | |
| 17 * | |
| 18 * { | |
| 19 * "type": "add" | |
| 20 * "content": String | |
| 21 * } | |
| 22 * | |
| 23 * Clients may not extend, implement or mix-in this class. | |
| 24 */ | |
| 25 class AddContentOverlay implements HasToJson { | |
| 26 String _content; | |
| 27 | |
| 28 /** | |
| 29 * The new content of the file. | |
| 30 */ | |
| 31 String get content => _content; | |
| 32 | |
| 33 /** | |
| 34 * The new content of the file. | |
| 35 */ | |
| 36 void set content(String value) { | |
| 37 assert(value != null); | |
| 38 this._content = value; | |
| 39 } | |
| 40 | |
| 41 AddContentOverlay(String content) { | |
| 42 this.content = content; | |
| 43 } | |
| 44 | |
| 45 factory AddContentOverlay.fromJson(JsonDecoder jsonDecoder, String jsonPath, O
bject json) { | |
| 46 if (json == null) { | |
| 47 json = {}; | |
| 48 } | |
| 49 if (json is Map) { | |
| 50 if (json["type"] != "add") { | |
| 51 throw jsonDecoder.mismatch(jsonPath, "equal " + "add", json); | |
| 52 } | |
| 53 String content; | |
| 54 if (json.containsKey("content")) { | |
| 55 content = jsonDecoder.decodeString(jsonPath + ".content", json["content"
]); | |
| 56 } else { | |
| 57 throw jsonDecoder.mismatch(jsonPath, "content"); | |
| 58 } | |
| 59 return new AddContentOverlay(content); | |
| 60 } else { | |
| 61 throw jsonDecoder.mismatch(jsonPath, "AddContentOverlay", json); | |
| 62 } | |
| 63 } | |
| 64 | |
| 65 @override | |
| 66 Map<String, dynamic> toJson() { | |
| 67 Map<String, dynamic> result = {}; | |
| 68 result["type"] = "add"; | |
| 69 result["content"] = content; | |
| 70 return result; | |
| 71 } | |
| 72 | |
| 73 @override | |
| 74 String toString() => JSON.encode(toJson()); | |
| 75 | |
| 76 @override | |
| 77 bool operator==(other) { | |
| 78 if (other is AddContentOverlay) { | |
| 79 return content == other.content; | |
| 80 } | |
| 81 return false; | |
| 82 } | |
| 83 | |
| 84 @override | |
| 85 int get hashCode { | |
| 86 int hash = 0; | |
| 87 hash = JenkinsSmiHash.combine(hash, 704418402); | |
| 88 hash = JenkinsSmiHash.combine(hash, content.hashCode); | |
| 89 return JenkinsSmiHash.finish(hash); | |
| 90 } | |
| 91 } | |
| 92 | |
| 93 /** | |
| 94 * AnalysisError | |
| 95 * | |
| 96 * { | |
| 97 * "severity": AnalysisErrorSeverity | |
| 98 * "type": AnalysisErrorType | |
| 99 * "location": Location | |
| 100 * "message": String | |
| 101 * "correction": optional String | |
| 102 * "code": String | |
| 103 * "hasFix": optional bool | |
| 104 * } | |
| 105 * | |
| 106 * Clients may not extend, implement or mix-in this class. | |
| 107 */ | |
| 108 class AnalysisError implements HasToJson { | |
| 109 AnalysisErrorSeverity _severity; | |
| 110 | |
| 111 AnalysisErrorType _type; | |
| 112 | |
| 113 Location _location; | |
| 114 | |
| 115 String _message; | |
| 116 | |
| 117 String _correction; | |
| 118 | |
| 119 String _code; | |
| 120 | |
| 121 bool _hasFix; | |
| 122 | |
| 123 /** | |
| 124 * The severity of the error. | |
| 125 */ | |
| 126 AnalysisErrorSeverity get severity => _severity; | |
| 127 | |
| 128 /** | |
| 129 * The severity of the error. | |
| 130 */ | |
| 131 void set severity(AnalysisErrorSeverity value) { | |
| 132 assert(value != null); | |
| 133 this._severity = value; | |
| 134 } | |
| 135 | |
| 136 /** | |
| 137 * The type of the error. | |
| 138 */ | |
| 139 AnalysisErrorType get type => _type; | |
| 140 | |
| 141 /** | |
| 142 * The type of the error. | |
| 143 */ | |
| 144 void set type(AnalysisErrorType value) { | |
| 145 assert(value != null); | |
| 146 this._type = value; | |
| 147 } | |
| 148 | |
| 149 /** | |
| 150 * The location associated with the error. | |
| 151 */ | |
| 152 Location get location => _location; | |
| 153 | |
| 154 /** | |
| 155 * The location associated with the error. | |
| 156 */ | |
| 157 void set location(Location value) { | |
| 158 assert(value != null); | |
| 159 this._location = value; | |
| 160 } | |
| 161 | |
| 162 /** | |
| 163 * The message to be displayed for this error. The message should indicate | |
| 164 * what is wrong with the code and why it is wrong. | |
| 165 */ | |
| 166 String get message => _message; | |
| 167 | |
| 168 /** | |
| 169 * The message to be displayed for this error. The message should indicate | |
| 170 * what is wrong with the code and why it is wrong. | |
| 171 */ | |
| 172 void set message(String value) { | |
| 173 assert(value != null); | |
| 174 this._message = value; | |
| 175 } | |
| 176 | |
| 177 /** | |
| 178 * The correction message to be displayed for this error. The correction | |
| 179 * message should indicate how the user can fix the error. The field is | |
| 180 * omitted if there is no correction message associated with the error code. | |
| 181 */ | |
| 182 String get correction => _correction; | |
| 183 | |
| 184 /** | |
| 185 * The correction message to be displayed for this error. The correction | |
| 186 * message should indicate how the user can fix the error. The field is | |
| 187 * omitted if there is no correction message associated with the error code. | |
| 188 */ | |
| 189 void set correction(String value) { | |
| 190 this._correction = value; | |
| 191 } | |
| 192 | |
| 193 /** | |
| 194 * The name, as a string, of the error code associated with this error. | |
| 195 */ | |
| 196 String get code => _code; | |
| 197 | |
| 198 /** | |
| 199 * The name, as a string, of the error code associated with this error. | |
| 200 */ | |
| 201 void set code(String value) { | |
| 202 assert(value != null); | |
| 203 this._code = value; | |
| 204 } | |
| 205 | |
| 206 /** | |
| 207 * A hint to indicate to interested clients that this error has an associated | |
| 208 * fix (or fixes). The absence of this field implies there are not known to | |
| 209 * be fixes. Note that since the operation to calculate whether fixes apply | |
| 210 * needs to be performant it is possible that complicated tests will be | |
| 211 * skipped and a false negative returned. For this reason, this attribute | |
| 212 * should be treated as a "hint". Despite the possibility of false negatives, | |
| 213 * no false positives should be returned. If a client sees this flag set they | |
| 214 * can proceed with the confidence that there are in fact associated fixes. | |
| 215 */ | |
| 216 bool get hasFix => _hasFix; | |
| 217 | |
| 218 /** | |
| 219 * A hint to indicate to interested clients that this error has an associated | |
| 220 * fix (or fixes). The absence of this field implies there are not known to | |
| 221 * be fixes. Note that since the operation to calculate whether fixes apply | |
| 222 * needs to be performant it is possible that complicated tests will be | |
| 223 * skipped and a false negative returned. For this reason, this attribute | |
| 224 * should be treated as a "hint". Despite the possibility of false negatives, | |
| 225 * no false positives should be returned. If a client sees this flag set they | |
| 226 * can proceed with the confidence that there are in fact associated fixes. | |
| 227 */ | |
| 228 void set hasFix(bool value) { | |
| 229 this._hasFix = value; | |
| 230 } | |
| 231 | |
| 232 AnalysisError(AnalysisErrorSeverity severity, AnalysisErrorType type, Location
location, String message, String code, {String correction, bool hasFix}) { | |
| 233 this.severity = severity; | |
| 234 this.type = type; | |
| 235 this.location = location; | |
| 236 this.message = message; | |
| 237 this.correction = correction; | |
| 238 this.code = code; | |
| 239 this.hasFix = hasFix; | |
| 240 } | |
| 241 | |
| 242 factory AnalysisError.fromJson(JsonDecoder jsonDecoder, String jsonPath, Objec
t json) { | |
| 243 if (json == null) { | |
| 244 json = {}; | |
| 245 } | |
| 246 if (json is Map) { | |
| 247 AnalysisErrorSeverity severity; | |
| 248 if (json.containsKey("severity")) { | |
| 249 severity = new AnalysisErrorSeverity.fromJson(jsonDecoder, jsonPath + ".
severity", json["severity"]); | |
| 250 } else { | |
| 251 throw jsonDecoder.mismatch(jsonPath, "severity"); | |
| 252 } | |
| 253 AnalysisErrorType type; | |
| 254 if (json.containsKey("type")) { | |
| 255 type = new AnalysisErrorType.fromJson(jsonDecoder, jsonPath + ".type", j
son["type"]); | |
| 256 } else { | |
| 257 throw jsonDecoder.mismatch(jsonPath, "type"); | |
| 258 } | |
| 259 Location location; | |
| 260 if (json.containsKey("location")) { | |
| 261 location = new Location.fromJson(jsonDecoder, jsonPath + ".location", js
on["location"]); | |
| 262 } else { | |
| 263 throw jsonDecoder.mismatch(jsonPath, "location"); | |
| 264 } | |
| 265 String message; | |
| 266 if (json.containsKey("message")) { | |
| 267 message = jsonDecoder.decodeString(jsonPath + ".message", json["message"
]); | |
| 268 } else { | |
| 269 throw jsonDecoder.mismatch(jsonPath, "message"); | |
| 270 } | |
| 271 String correction; | |
| 272 if (json.containsKey("correction")) { | |
| 273 correction = jsonDecoder.decodeString(jsonPath + ".correction", json["co
rrection"]); | |
| 274 } | |
| 275 String code; | |
| 276 if (json.containsKey("code")) { | |
| 277 code = jsonDecoder.decodeString(jsonPath + ".code", json["code"]); | |
| 278 } else { | |
| 279 throw jsonDecoder.mismatch(jsonPath, "code"); | |
| 280 } | |
| 281 bool hasFix; | |
| 282 if (json.containsKey("hasFix")) { | |
| 283 hasFix = jsonDecoder.decodeBool(jsonPath + ".hasFix", json["hasFix"]); | |
| 284 } | |
| 285 return new AnalysisError(severity, type, location, message, code, correcti
on: correction, hasFix: hasFix); | |
| 286 } else { | |
| 287 throw jsonDecoder.mismatch(jsonPath, "AnalysisError", json); | |
| 288 } | |
| 289 } | |
| 290 | |
| 291 @override | |
| 292 Map<String, dynamic> toJson() { | |
| 293 Map<String, dynamic> result = {}; | |
| 294 result["severity"] = severity.toJson(); | |
| 295 result["type"] = type.toJson(); | |
| 296 result["location"] = location.toJson(); | |
| 297 result["message"] = message; | |
| 298 if (correction != null) { | |
| 299 result["correction"] = correction; | |
| 300 } | |
| 301 result["code"] = code; | |
| 302 if (hasFix != null) { | |
| 303 result["hasFix"] = hasFix; | |
| 304 } | |
| 305 return result; | |
| 306 } | |
| 307 | |
| 308 @override | |
| 309 String toString() => JSON.encode(toJson()); | |
| 310 | |
| 311 @override | |
| 312 bool operator==(other) { | |
| 313 if (other is AnalysisError) { | |
| 314 return severity == other.severity && | |
| 315 type == other.type && | |
| 316 location == other.location && | |
| 317 message == other.message && | |
| 318 correction == other.correction && | |
| 319 code == other.code && | |
| 320 hasFix == other.hasFix; | |
| 321 } | |
| 322 return false; | |
| 323 } | |
| 324 | |
| 325 @override | |
| 326 int get hashCode { | |
| 327 int hash = 0; | |
| 328 hash = JenkinsSmiHash.combine(hash, severity.hashCode); | |
| 329 hash = JenkinsSmiHash.combine(hash, type.hashCode); | |
| 330 hash = JenkinsSmiHash.combine(hash, location.hashCode); | |
| 331 hash = JenkinsSmiHash.combine(hash, message.hashCode); | |
| 332 hash = JenkinsSmiHash.combine(hash, correction.hashCode); | |
| 333 hash = JenkinsSmiHash.combine(hash, code.hashCode); | |
| 334 hash = JenkinsSmiHash.combine(hash, hasFix.hashCode); | |
| 335 return JenkinsSmiHash.finish(hash); | |
| 336 } | |
| 337 } | |
| 338 | |
| 339 /** | |
| 340 * AnalysisErrorFixes | |
| 341 * | |
| 342 * { | |
| 343 * "error": AnalysisError | |
| 344 * "fixes": List<PrioritizedSourceChange> | |
| 345 * } | |
| 346 * | |
| 347 * Clients may not extend, implement or mix-in this class. | |
| 348 */ | |
| 349 class AnalysisErrorFixes implements HasToJson { | |
| 350 AnalysisError _error; | |
| 351 | |
| 352 List<PrioritizedSourceChange> _fixes; | |
| 353 | |
| 354 /** | |
| 355 * The error with which the fixes are associated. | |
| 356 */ | |
| 357 AnalysisError get error => _error; | |
| 358 | |
| 359 /** | |
| 360 * The error with which the fixes are associated. | |
| 361 */ | |
| 362 void set error(AnalysisError value) { | |
| 363 assert(value != null); | |
| 364 this._error = value; | |
| 365 } | |
| 366 | |
| 367 /** | |
| 368 * The fixes associated with the error. | |
| 369 */ | |
| 370 List<PrioritizedSourceChange> get fixes => _fixes; | |
| 371 | |
| 372 /** | |
| 373 * The fixes associated with the error. | |
| 374 */ | |
| 375 void set fixes(List<PrioritizedSourceChange> value) { | |
| 376 assert(value != null); | |
| 377 this._fixes = value; | |
| 378 } | |
| 379 | |
| 380 AnalysisErrorFixes(AnalysisError error, {List<PrioritizedSourceChange> fixes})
{ | |
| 381 this.error = error; | |
| 382 if (fixes == null) { | |
| 383 this.fixes = <PrioritizedSourceChange>[]; | |
| 384 } else { | |
| 385 this.fixes = fixes; | |
| 386 } | |
| 387 } | |
| 388 | |
| 389 factory AnalysisErrorFixes.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 390 if (json == null) { | |
| 391 json = {}; | |
| 392 } | |
| 393 if (json is Map) { | |
| 394 AnalysisError error; | |
| 395 if (json.containsKey("error")) { | |
| 396 error = new AnalysisError.fromJson(jsonDecoder, jsonPath + ".error", jso
n["error"]); | |
| 397 } else { | |
| 398 throw jsonDecoder.mismatch(jsonPath, "error"); | |
| 399 } | |
| 400 List<PrioritizedSourceChange> fixes; | |
| 401 if (json.containsKey("fixes")) { | |
| 402 fixes = jsonDecoder.decodeList(jsonPath + ".fixes", json["fixes"], (Stri
ng jsonPath, Object json) => new PrioritizedSourceChange.fromJson(jsonDecoder, j
sonPath, json)); | |
| 403 } else { | |
| 404 throw jsonDecoder.mismatch(jsonPath, "fixes"); | |
| 405 } | |
| 406 return new AnalysisErrorFixes(error, fixes: fixes); | |
| 407 } else { | |
| 408 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorFixes", json); | |
| 409 } | |
| 410 } | |
| 411 | |
| 412 @override | |
| 413 Map<String, dynamic> toJson() { | |
| 414 Map<String, dynamic> result = {}; | |
| 415 result["error"] = error.toJson(); | |
| 416 result["fixes"] = fixes.map((PrioritizedSourceChange value) => value.toJson(
)).toList(); | |
| 417 return result; | |
| 418 } | |
| 419 | |
| 420 @override | |
| 421 String toString() => JSON.encode(toJson()); | |
| 422 | |
| 423 @override | |
| 424 bool operator==(other) { | |
| 425 if (other is AnalysisErrorFixes) { | |
| 426 return error == other.error && | |
| 427 listEqual(fixes, other.fixes, (PrioritizedSourceChange a, PrioritizedS
ourceChange b) => a == b); | |
| 428 } | |
| 429 return false; | |
| 430 } | |
| 431 | |
| 432 @override | |
| 433 int get hashCode { | |
| 434 int hash = 0; | |
| 435 hash = JenkinsSmiHash.combine(hash, error.hashCode); | |
| 436 hash = JenkinsSmiHash.combine(hash, fixes.hashCode); | |
| 437 return JenkinsSmiHash.finish(hash); | |
| 438 } | |
| 439 } | |
| 440 | |
| 441 /** | |
| 442 * AnalysisErrorSeverity | |
| 443 * | |
| 444 * enum { | |
| 445 * INFO | |
| 446 * WARNING | |
| 447 * ERROR | |
| 448 * } | |
| 449 * | |
| 450 * Clients may not extend, implement or mix-in this class. | |
| 451 */ | |
| 452 class AnalysisErrorSeverity implements Enum { | |
| 453 static const AnalysisErrorSeverity INFO = const AnalysisErrorSeverity._("INFO"
); | |
| 454 | |
| 455 static const AnalysisErrorSeverity WARNING = const AnalysisErrorSeverity._("WA
RNING"); | |
| 456 | |
| 457 static const AnalysisErrorSeverity ERROR = const AnalysisErrorSeverity._("ERRO
R"); | |
| 458 | |
| 459 /** | |
| 460 * A list containing all of the enum values that are defined. | |
| 461 */ | |
| 462 static const List<AnalysisErrorSeverity> VALUES = const <AnalysisErrorSeverity
>[INFO, WARNING, ERROR]; | |
| 463 | |
| 464 @override | |
| 465 final String name; | |
| 466 | |
| 467 const AnalysisErrorSeverity._(this.name); | |
| 468 | |
| 469 factory AnalysisErrorSeverity(String name) { | |
| 470 switch (name) { | |
| 471 case "INFO": | |
| 472 return INFO; | |
| 473 case "WARNING": | |
| 474 return WARNING; | |
| 475 case "ERROR": | |
| 476 return ERROR; | |
| 477 } | |
| 478 throw new Exception('Illegal enum value: $name'); | |
| 479 } | |
| 480 | |
| 481 factory AnalysisErrorSeverity.fromJson(JsonDecoder jsonDecoder, String jsonPat
h, Object json) { | |
| 482 if (json is String) { | |
| 483 try { | |
| 484 return new AnalysisErrorSeverity(json); | |
| 485 } catch(_) { | |
| 486 // Fall through | |
| 487 } | |
| 488 } | |
| 489 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorSeverity", json); | |
| 490 } | |
| 491 | |
| 492 @override | |
| 493 String toString() => "AnalysisErrorSeverity.$name"; | |
| 494 | |
| 495 String toJson() => name; | |
| 496 } | |
| 497 | |
| 498 /** | |
| 499 * AnalysisErrorType | |
| 500 * | |
| 501 * enum { | |
| 502 * CHECKED_MODE_COMPILE_TIME_ERROR | |
| 503 * COMPILE_TIME_ERROR | |
| 504 * HINT | |
| 505 * LINT | |
| 506 * STATIC_TYPE_WARNING | |
| 507 * STATIC_WARNING | |
| 508 * SYNTACTIC_ERROR | |
| 509 * TODO | |
| 510 * } | |
| 511 * | |
| 512 * Clients may not extend, implement or mix-in this class. | |
| 513 */ | |
| 514 class AnalysisErrorType implements Enum { | |
| 515 static const AnalysisErrorType CHECKED_MODE_COMPILE_TIME_ERROR = const Analysi
sErrorType._("CHECKED_MODE_COMPILE_TIME_ERROR"); | |
| 516 | |
| 517 static const AnalysisErrorType COMPILE_TIME_ERROR = const AnalysisErrorType._(
"COMPILE_TIME_ERROR"); | |
| 518 | |
| 519 static const AnalysisErrorType HINT = const AnalysisErrorType._("HINT"); | |
| 520 | |
| 521 static const AnalysisErrorType LINT = const AnalysisErrorType._("LINT"); | |
| 522 | |
| 523 static const AnalysisErrorType STATIC_TYPE_WARNING = const AnalysisErrorType._
("STATIC_TYPE_WARNING"); | |
| 524 | |
| 525 static const AnalysisErrorType STATIC_WARNING = const AnalysisErrorType._("STA
TIC_WARNING"); | |
| 526 | |
| 527 static const AnalysisErrorType SYNTACTIC_ERROR = const AnalysisErrorType._("SY
NTACTIC_ERROR"); | |
| 528 | |
| 529 static const AnalysisErrorType TODO = const AnalysisErrorType._("TODO"); | |
| 530 | |
| 531 /** | |
| 532 * A list containing all of the enum values that are defined. | |
| 533 */ | |
| 534 static const List<AnalysisErrorType> VALUES = const <AnalysisErrorType>[CHECKE
D_MODE_COMPILE_TIME_ERROR, COMPILE_TIME_ERROR, HINT, LINT, STATIC_TYPE_WARNING,
STATIC_WARNING, SYNTACTIC_ERROR, TODO]; | |
| 535 | |
| 536 @override | |
| 537 final String name; | |
| 538 | |
| 539 const AnalysisErrorType._(this.name); | |
| 540 | |
| 541 factory AnalysisErrorType(String name) { | |
| 542 switch (name) { | |
| 543 case "CHECKED_MODE_COMPILE_TIME_ERROR": | |
| 544 return CHECKED_MODE_COMPILE_TIME_ERROR; | |
| 545 case "COMPILE_TIME_ERROR": | |
| 546 return COMPILE_TIME_ERROR; | |
| 547 case "HINT": | |
| 548 return HINT; | |
| 549 case "LINT": | |
| 550 return LINT; | |
| 551 case "STATIC_TYPE_WARNING": | |
| 552 return STATIC_TYPE_WARNING; | |
| 553 case "STATIC_WARNING": | |
| 554 return STATIC_WARNING; | |
| 555 case "SYNTACTIC_ERROR": | |
| 556 return SYNTACTIC_ERROR; | |
| 557 case "TODO": | |
| 558 return TODO; | |
| 559 } | |
| 560 throw new Exception('Illegal enum value: $name'); | |
| 561 } | |
| 562 | |
| 563 factory AnalysisErrorType.fromJson(JsonDecoder jsonDecoder, String jsonPath, O
bject json) { | |
| 564 if (json is String) { | |
| 565 try { | |
| 566 return new AnalysisErrorType(json); | |
| 567 } catch(_) { | |
| 568 // Fall through | |
| 569 } | |
| 570 } | |
| 571 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorType", json); | |
| 572 } | |
| 573 | |
| 574 @override | |
| 575 String toString() => "AnalysisErrorType.$name"; | |
| 576 | |
| 577 String toJson() => name; | |
| 578 } | |
| 579 | |
| 580 /** | |
| 581 * analysis.errors params | |
| 582 * | |
| 583 * { | |
| 584 * "file": FilePath | |
| 585 * "errors": List<AnalysisError> | |
| 586 * } | |
| 587 * | |
| 588 * Clients may not extend, implement or mix-in this class. | |
| 589 */ | |
| 590 class AnalysisErrorsParams implements HasToJson { | |
| 591 String _file; | |
| 592 | |
| 593 List<AnalysisError> _errors; | |
| 594 | |
| 595 /** | |
| 596 * The file containing the errors. | |
| 597 */ | |
| 598 String get file => _file; | |
| 599 | |
| 600 /** | |
| 601 * The file containing the errors. | |
| 602 */ | |
| 603 void set file(String value) { | |
| 604 assert(value != null); | |
| 605 this._file = value; | |
| 606 } | |
| 607 | |
| 608 /** | |
| 609 * The errors contained in the file. | |
| 610 */ | |
| 611 List<AnalysisError> get errors => _errors; | |
| 612 | |
| 613 /** | |
| 614 * The errors contained in the file. | |
| 615 */ | |
| 616 void set errors(List<AnalysisError> value) { | |
| 617 assert(value != null); | |
| 618 this._errors = value; | |
| 619 } | |
| 620 | |
| 621 AnalysisErrorsParams(String file, List<AnalysisError> errors) { | |
| 622 this.file = file; | |
| 623 this.errors = errors; | |
| 624 } | |
| 625 | |
| 626 factory AnalysisErrorsParams.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 627 if (json == null) { | |
| 628 json = {}; | |
| 629 } | |
| 630 if (json is Map) { | |
| 631 String file; | |
| 632 if (json.containsKey("file")) { | |
| 633 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); | |
| 634 } else { | |
| 635 throw jsonDecoder.mismatch(jsonPath, "file"); | |
| 636 } | |
| 637 List<AnalysisError> errors; | |
| 638 if (json.containsKey("errors")) { | |
| 639 errors = jsonDecoder.decodeList(jsonPath + ".errors", json["errors"], (S
tring jsonPath, Object json) => new AnalysisError.fromJson(jsonDecoder, jsonPath
, json)); | |
| 640 } else { | |
| 641 throw jsonDecoder.mismatch(jsonPath, "errors"); | |
| 642 } | |
| 643 return new AnalysisErrorsParams(file, errors); | |
| 644 } else { | |
| 645 throw jsonDecoder.mismatch(jsonPath, "analysis.errors params", json); | |
| 646 } | |
| 647 } | |
| 648 | |
| 649 factory AnalysisErrorsParams.fromNotification(Notification notification) { | |
| 650 return new AnalysisErrorsParams.fromJson( | |
| 651 new ResponseDecoder(null), "params", notification.params); | |
| 652 } | |
| 653 | |
| 654 @override | |
| 655 Map<String, dynamic> toJson() { | |
| 656 Map<String, dynamic> result = {}; | |
| 657 result["file"] = file; | |
| 658 result["errors"] = errors.map((AnalysisError value) => value.toJson()).toLis
t(); | |
| 659 return result; | |
| 660 } | |
| 661 | |
| 662 Notification toNotification() { | |
| 663 return new Notification("analysis.errors", toJson()); | |
| 664 } | |
| 665 | |
| 666 @override | |
| 667 String toString() => JSON.encode(toJson()); | |
| 668 | |
| 669 @override | |
| 670 bool operator==(other) { | |
| 671 if (other is AnalysisErrorsParams) { | |
| 672 return file == other.file && | |
| 673 listEqual(errors, other.errors, (AnalysisError a, AnalysisError b) =>
a == b); | |
| 674 } | |
| 675 return false; | |
| 676 } | |
| 677 | |
| 678 @override | |
| 679 int get hashCode { | |
| 680 int hash = 0; | |
| 681 hash = JenkinsSmiHash.combine(hash, file.hashCode); | |
| 682 hash = JenkinsSmiHash.combine(hash, errors.hashCode); | |
| 683 return JenkinsSmiHash.finish(hash); | |
| 684 } | |
| 685 } | |
| 686 | |
| 687 /** | |
| 688 * analysis.folding params | |
| 689 * | |
| 690 * { | |
| 691 * "file": FilePath | |
| 692 * "regions": List<FoldingRegion> | |
| 693 * } | |
| 694 * | |
| 695 * Clients may not extend, implement or mix-in this class. | |
| 696 */ | |
| 697 class AnalysisFoldingParams implements HasToJson { | |
| 698 String _file; | |
| 699 | |
| 700 List<FoldingRegion> _regions; | |
| 701 | |
| 702 /** | |
| 703 * The file containing the folding regions. | |
| 704 */ | |
| 705 String get file => _file; | |
| 706 | |
| 707 /** | |
| 708 * The file containing the folding regions. | |
| 709 */ | |
| 710 void set file(String value) { | |
| 711 assert(value != null); | |
| 712 this._file = value; | |
| 713 } | |
| 714 | |
| 715 /** | |
| 716 * The folding regions contained in the file. | |
| 717 */ | |
| 718 List<FoldingRegion> get regions => _regions; | |
| 719 | |
| 720 /** | |
| 721 * The folding regions contained in the file. | |
| 722 */ | |
| 723 void set regions(List<FoldingRegion> value) { | |
| 724 assert(value != null); | |
| 725 this._regions = value; | |
| 726 } | |
| 727 | |
| 728 AnalysisFoldingParams(String file, List<FoldingRegion> regions) { | |
| 729 this.file = file; | |
| 730 this.regions = regions; | |
| 731 } | |
| 732 | |
| 733 factory AnalysisFoldingParams.fromJson(JsonDecoder jsonDecoder, String jsonPat
h, Object json) { | |
| 734 if (json == null) { | |
| 735 json = {}; | |
| 736 } | |
| 737 if (json is Map) { | |
| 738 String file; | |
| 739 if (json.containsKey("file")) { | |
| 740 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); | |
| 741 } else { | |
| 742 throw jsonDecoder.mismatch(jsonPath, "file"); | |
| 743 } | |
| 744 List<FoldingRegion> regions; | |
| 745 if (json.containsKey("regions")) { | |
| 746 regions = jsonDecoder.decodeList(jsonPath + ".regions", json["regions"],
(String jsonPath, Object json) => new FoldingRegion.fromJson(jsonDecoder, jsonP
ath, json)); | |
| 747 } else { | |
| 748 throw jsonDecoder.mismatch(jsonPath, "regions"); | |
| 749 } | |
| 750 return new AnalysisFoldingParams(file, regions); | |
| 751 } else { | |
| 752 throw jsonDecoder.mismatch(jsonPath, "analysis.folding params", json); | |
| 753 } | |
| 754 } | |
| 755 | |
| 756 factory AnalysisFoldingParams.fromNotification(Notification notification) { | |
| 757 return new AnalysisFoldingParams.fromJson( | |
| 758 new ResponseDecoder(null), "params", notification.params); | |
| 759 } | |
| 760 | |
| 761 @override | |
| 762 Map<String, dynamic> toJson() { | |
| 763 Map<String, dynamic> result = {}; | |
| 764 result["file"] = file; | |
| 765 result["regions"] = regions.map((FoldingRegion value) => value.toJson()).toL
ist(); | |
| 766 return result; | |
| 767 } | |
| 768 | |
| 769 Notification toNotification() { | |
| 770 return new Notification("analysis.folding", toJson()); | |
| 771 } | |
| 772 | |
| 773 @override | |
| 774 String toString() => JSON.encode(toJson()); | |
| 775 | |
| 776 @override | |
| 777 bool operator==(other) { | |
| 778 if (other is AnalysisFoldingParams) { | |
| 779 return file == other.file && | |
| 780 listEqual(regions, other.regions, (FoldingRegion a, FoldingRegion b) =
> a == b); | |
| 781 } | |
| 782 return false; | |
| 783 } | |
| 784 | |
| 785 @override | |
| 786 int get hashCode { | |
| 787 int hash = 0; | |
| 788 hash = JenkinsSmiHash.combine(hash, file.hashCode); | |
| 789 hash = JenkinsSmiHash.combine(hash, regions.hashCode); | |
| 790 return JenkinsSmiHash.finish(hash); | |
| 791 } | |
| 792 } | |
| 793 | |
| 794 /** | |
| 795 * analysis.handleWatchEvents params | |
| 796 * | |
| 797 * { | |
| 798 * "events": List<WatchEvent> | |
| 799 * } | |
| 800 * | |
| 801 * Clients may not extend, implement or mix-in this class. | |
| 802 */ | |
| 803 class AnalysisHandleWatchEventsParams implements RequestParams { | |
| 804 List<WatchEvent> _events; | |
| 805 | |
| 806 /** | |
| 807 * The watch events that the plugin should handle. | |
| 808 */ | |
| 809 List<WatchEvent> get events => _events; | |
| 810 | |
| 811 /** | |
| 812 * The watch events that the plugin should handle. | |
| 813 */ | |
| 814 void set events(List<WatchEvent> value) { | |
| 815 assert(value != null); | |
| 816 this._events = value; | |
| 817 } | |
| 818 | |
| 819 AnalysisHandleWatchEventsParams(List<WatchEvent> events) { | |
| 820 this.events = events; | |
| 821 } | |
| 822 | |
| 823 factory AnalysisHandleWatchEventsParams.fromJson(JsonDecoder jsonDecoder, Stri
ng jsonPath, Object json) { | |
| 824 if (json == null) { | |
| 825 json = {}; | |
| 826 } | |
| 827 if (json is Map) { | |
| 828 List<WatchEvent> events; | |
| 829 if (json.containsKey("events")) { | |
| 830 events = jsonDecoder.decodeList(jsonPath + ".events", json["events"], (S
tring jsonPath, Object json) => new WatchEvent.fromJson(jsonDecoder, jsonPath, j
son)); | |
| 831 } else { | |
| 832 throw jsonDecoder.mismatch(jsonPath, "events"); | |
| 833 } | |
| 834 return new AnalysisHandleWatchEventsParams(events); | |
| 835 } else { | |
| 836 throw jsonDecoder.mismatch(jsonPath, "analysis.handleWatchEvents params",
json); | |
| 837 } | |
| 838 } | |
| 839 | |
| 840 factory AnalysisHandleWatchEventsParams.fromRequest(Request request) { | |
| 841 return new AnalysisHandleWatchEventsParams.fromJson( | |
| 842 new RequestDecoder(request), "params", request.params); | |
| 843 } | |
| 844 | |
| 845 @override | |
| 846 Map<String, dynamic> toJson() { | |
| 847 Map<String, dynamic> result = {}; | |
| 848 result["events"] = events.map((WatchEvent value) => value.toJson()).toList()
; | |
| 849 return result; | |
| 850 } | |
| 851 | |
| 852 @override | |
| 853 Request toRequest(String id) { | |
| 854 return new Request(id, "analysis.handleWatchEvents", toJson()); | |
| 855 } | |
| 856 | |
| 857 @override | |
| 858 String toString() => JSON.encode(toJson()); | |
| 859 | |
| 860 @override | |
| 861 bool operator==(other) { | |
| 862 if (other is AnalysisHandleWatchEventsParams) { | |
| 863 return listEqual(events, other.events, (WatchEvent a, WatchEvent b) => a =
= b); | |
| 864 } | |
| 865 return false; | |
| 866 } | |
| 867 | |
| 868 @override | |
| 869 int get hashCode { | |
| 870 int hash = 0; | |
| 871 hash = JenkinsSmiHash.combine(hash, events.hashCode); | |
| 872 return JenkinsSmiHash.finish(hash); | |
| 873 } | |
| 874 } | |
| 875 | |
| 876 /** | |
| 877 * analysis.handleWatchEvents result | |
| 878 * | |
| 879 * Clients may not extend, implement or mix-in this class. | |
| 880 */ | |
| 881 class AnalysisHandleWatchEventsResult implements ResponseResult { | |
| 882 @override | |
| 883 Map<String, dynamic> toJson() => <String, dynamic>{}; | |
| 884 | |
| 885 @override | |
| 886 Response toResponse(String id) { | |
| 887 return new Response(id, result: null); | |
| 888 } | |
| 889 | |
| 890 @override | |
| 891 bool operator==(other) { | |
| 892 if (other is AnalysisHandleWatchEventsResult) { | |
| 893 return true; | |
| 894 } | |
| 895 return false; | |
| 896 } | |
| 897 | |
| 898 @override | |
| 899 int get hashCode { | |
| 900 return 779767607; | |
| 901 } | |
| 902 } | |
| 903 | |
| 904 /** | |
| 905 * analysis.highlights params | |
| 906 * | |
| 907 * { | |
| 908 * "file": FilePath | |
| 909 * "regions": List<HighlightRegion> | |
| 910 * } | |
| 911 * | |
| 912 * Clients may not extend, implement or mix-in this class. | |
| 913 */ | |
| 914 class AnalysisHighlightsParams implements HasToJson { | |
| 915 String _file; | |
| 916 | |
| 917 List<HighlightRegion> _regions; | |
| 918 | |
| 919 /** | |
| 920 * The file containing the highlight regions. | |
| 921 */ | |
| 922 String get file => _file; | |
| 923 | |
| 924 /** | |
| 925 * The file containing the highlight regions. | |
| 926 */ | |
| 927 void set file(String value) { | |
| 928 assert(value != null); | |
| 929 this._file = value; | |
| 930 } | |
| 931 | |
| 932 /** | |
| 933 * The highlight regions contained in the file. | |
| 934 */ | |
| 935 List<HighlightRegion> get regions => _regions; | |
| 936 | |
| 937 /** | |
| 938 * The highlight regions contained in the file. | |
| 939 */ | |
| 940 void set regions(List<HighlightRegion> value) { | |
| 941 assert(value != null); | |
| 942 this._regions = value; | |
| 943 } | |
| 944 | |
| 945 AnalysisHighlightsParams(String file, List<HighlightRegion> regions) { | |
| 946 this.file = file; | |
| 947 this.regions = regions; | |
| 948 } | |
| 949 | |
| 950 factory AnalysisHighlightsParams.fromJson(JsonDecoder jsonDecoder, String json
Path, Object json) { | |
| 951 if (json == null) { | |
| 952 json = {}; | |
| 953 } | |
| 954 if (json is Map) { | |
| 955 String file; | |
| 956 if (json.containsKey("file")) { | |
| 957 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); | |
| 958 } else { | |
| 959 throw jsonDecoder.mismatch(jsonPath, "file"); | |
| 960 } | |
| 961 List<HighlightRegion> regions; | |
| 962 if (json.containsKey("regions")) { | |
| 963 regions = jsonDecoder.decodeList(jsonPath + ".regions", json["regions"],
(String jsonPath, Object json) => new HighlightRegion.fromJson(jsonDecoder, jso
nPath, json)); | |
| 964 } else { | |
| 965 throw jsonDecoder.mismatch(jsonPath, "regions"); | |
| 966 } | |
| 967 return new AnalysisHighlightsParams(file, regions); | |
| 968 } else { | |
| 969 throw jsonDecoder.mismatch(jsonPath, "analysis.highlights params", json); | |
| 970 } | |
| 971 } | |
| 972 | |
| 973 factory AnalysisHighlightsParams.fromNotification(Notification notification) { | |
| 974 return new AnalysisHighlightsParams.fromJson( | |
| 975 new ResponseDecoder(null), "params", notification.params); | |
| 976 } | |
| 977 | |
| 978 @override | |
| 979 Map<String, dynamic> toJson() { | |
| 980 Map<String, dynamic> result = {}; | |
| 981 result["file"] = file; | |
| 982 result["regions"] = regions.map((HighlightRegion value) => value.toJson()).t
oList(); | |
| 983 return result; | |
| 984 } | |
| 985 | |
| 986 Notification toNotification() { | |
| 987 return new Notification("analysis.highlights", toJson()); | |
| 988 } | |
| 989 | |
| 990 @override | |
| 991 String toString() => JSON.encode(toJson()); | |
| 992 | |
| 993 @override | |
| 994 bool operator==(other) { | |
| 995 if (other is AnalysisHighlightsParams) { | |
| 996 return file == other.file && | |
| 997 listEqual(regions, other.regions, (HighlightRegion a, HighlightRegion
b) => a == b); | |
| 998 } | |
| 999 return false; | |
| 1000 } | |
| 1001 | |
| 1002 @override | |
| 1003 int get hashCode { | |
| 1004 int hash = 0; | |
| 1005 hash = JenkinsSmiHash.combine(hash, file.hashCode); | |
| 1006 hash = JenkinsSmiHash.combine(hash, regions.hashCode); | |
| 1007 return JenkinsSmiHash.finish(hash); | |
| 1008 } | |
| 1009 } | |
| 1010 | |
| 1011 /** | |
| 1012 * analysis.navigation params | |
| 1013 * | |
| 1014 * { | |
| 1015 * "file": FilePath | |
| 1016 * "regions": List<NavigationRegion> | |
| 1017 * "targets": List<NavigationTarget> | |
| 1018 * "files": List<FilePath> | |
| 1019 * } | |
| 1020 * | |
| 1021 * Clients may not extend, implement or mix-in this class. | |
| 1022 */ | |
| 1023 class AnalysisNavigationParams implements HasToJson { | |
| 1024 String _file; | |
| 1025 | |
| 1026 List<NavigationRegion> _regions; | |
| 1027 | |
| 1028 List<NavigationTarget> _targets; | |
| 1029 | |
| 1030 List<String> _files; | |
| 1031 | |
| 1032 /** | |
| 1033 * The file containing the navigation regions. | |
| 1034 */ | |
| 1035 String get file => _file; | |
| 1036 | |
| 1037 /** | |
| 1038 * The file containing the navigation regions. | |
| 1039 */ | |
| 1040 void set file(String value) { | |
| 1041 assert(value != null); | |
| 1042 this._file = value; | |
| 1043 } | |
| 1044 | |
| 1045 /** | |
| 1046 * The navigation regions contained in the file. | |
| 1047 */ | |
| 1048 List<NavigationRegion> get regions => _regions; | |
| 1049 | |
| 1050 /** | |
| 1051 * The navigation regions contained in the file. | |
| 1052 */ | |
| 1053 void set regions(List<NavigationRegion> value) { | |
| 1054 assert(value != null); | |
| 1055 this._regions = value; | |
| 1056 } | |
| 1057 | |
| 1058 /** | |
| 1059 * The navigation targets referenced in the file. They are referenced by | |
| 1060 * NavigationRegions by their index in this array. | |
| 1061 */ | |
| 1062 List<NavigationTarget> get targets => _targets; | |
| 1063 | |
| 1064 /** | |
| 1065 * The navigation targets referenced in the file. They are referenced by | |
| 1066 * NavigationRegions by their index in this array. | |
| 1067 */ | |
| 1068 void set targets(List<NavigationTarget> value) { | |
| 1069 assert(value != null); | |
| 1070 this._targets = value; | |
| 1071 } | |
| 1072 | |
| 1073 /** | |
| 1074 * The files containing navigation targets referenced in the file. They are | |
| 1075 * referenced by NavigationTargets by their index in this array. | |
| 1076 */ | |
| 1077 List<String> get files => _files; | |
| 1078 | |
| 1079 /** | |
| 1080 * The files containing navigation targets referenced in the file. They are | |
| 1081 * referenced by NavigationTargets by their index in this array. | |
| 1082 */ | |
| 1083 void set files(List<String> value) { | |
| 1084 assert(value != null); | |
| 1085 this._files = value; | |
| 1086 } | |
| 1087 | |
| 1088 AnalysisNavigationParams(String file, List<NavigationRegion> regions, List<Nav
igationTarget> targets, List<String> files) { | |
| 1089 this.file = file; | |
| 1090 this.regions = regions; | |
| 1091 this.targets = targets; | |
| 1092 this.files = files; | |
| 1093 } | |
| 1094 | |
| 1095 factory AnalysisNavigationParams.fromJson(JsonDecoder jsonDecoder, String json
Path, Object json) { | |
| 1096 if (json == null) { | |
| 1097 json = {}; | |
| 1098 } | |
| 1099 if (json is Map) { | |
| 1100 String file; | |
| 1101 if (json.containsKey("file")) { | |
| 1102 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); | |
| 1103 } else { | |
| 1104 throw jsonDecoder.mismatch(jsonPath, "file"); | |
| 1105 } | |
| 1106 List<NavigationRegion> regions; | |
| 1107 if (json.containsKey("regions")) { | |
| 1108 regions = jsonDecoder.decodeList(jsonPath + ".regions", json["regions"],
(String jsonPath, Object json) => new NavigationRegion.fromJson(jsonDecoder, js
onPath, json)); | |
| 1109 } else { | |
| 1110 throw jsonDecoder.mismatch(jsonPath, "regions"); | |
| 1111 } | |
| 1112 List<NavigationTarget> targets; | |
| 1113 if (json.containsKey("targets")) { | |
| 1114 targets = jsonDecoder.decodeList(jsonPath + ".targets", json["targets"],
(String jsonPath, Object json) => new NavigationTarget.fromJson(jsonDecoder, js
onPath, json)); | |
| 1115 } else { | |
| 1116 throw jsonDecoder.mismatch(jsonPath, "targets"); | |
| 1117 } | |
| 1118 List<String> files; | |
| 1119 if (json.containsKey("files")) { | |
| 1120 files = jsonDecoder.decodeList(jsonPath + ".files", json["files"], jsonD
ecoder.decodeString); | |
| 1121 } else { | |
| 1122 throw jsonDecoder.mismatch(jsonPath, "files"); | |
| 1123 } | |
| 1124 return new AnalysisNavigationParams(file, regions, targets, files); | |
| 1125 } else { | |
| 1126 throw jsonDecoder.mismatch(jsonPath, "analysis.navigation params", json); | |
| 1127 } | |
| 1128 } | |
| 1129 | |
| 1130 factory AnalysisNavigationParams.fromNotification(Notification notification) { | |
| 1131 return new AnalysisNavigationParams.fromJson( | |
| 1132 new ResponseDecoder(null), "params", notification.params); | |
| 1133 } | |
| 1134 | |
| 1135 @override | |
| 1136 Map<String, dynamic> toJson() { | |
| 1137 Map<String, dynamic> result = {}; | |
| 1138 result["file"] = file; | |
| 1139 result["regions"] = regions.map((NavigationRegion value) => value.toJson()).
toList(); | |
| 1140 result["targets"] = targets.map((NavigationTarget value) => value.toJson()).
toList(); | |
| 1141 result["files"] = files; | |
| 1142 return result; | |
| 1143 } | |
| 1144 | |
| 1145 Notification toNotification() { | |
| 1146 return new Notification("analysis.navigation", toJson()); | |
| 1147 } | |
| 1148 | |
| 1149 @override | |
| 1150 String toString() => JSON.encode(toJson()); | |
| 1151 | |
| 1152 @override | |
| 1153 bool operator==(other) { | |
| 1154 if (other is AnalysisNavigationParams) { | |
| 1155 return file == other.file && | |
| 1156 listEqual(regions, other.regions, (NavigationRegion a, NavigationRegio
n b) => a == b) && | |
| 1157 listEqual(targets, other.targets, (NavigationTarget a, NavigationTarge
t b) => a == b) && | |
| 1158 listEqual(files, other.files, (String a, String b) => a == b); | |
| 1159 } | |
| 1160 return false; | |
| 1161 } | |
| 1162 | |
| 1163 @override | |
| 1164 int get hashCode { | |
| 1165 int hash = 0; | |
| 1166 hash = JenkinsSmiHash.combine(hash, file.hashCode); | |
| 1167 hash = JenkinsSmiHash.combine(hash, regions.hashCode); | |
| 1168 hash = JenkinsSmiHash.combine(hash, targets.hashCode); | |
| 1169 hash = JenkinsSmiHash.combine(hash, files.hashCode); | |
| 1170 return JenkinsSmiHash.finish(hash); | |
| 1171 } | |
| 1172 } | |
| 1173 | |
| 1174 /** | |
| 1175 * analysis.occurrences params | |
| 1176 * | |
| 1177 * { | |
| 1178 * "file": FilePath | |
| 1179 * "occurrences": List<Occurrences> | |
| 1180 * } | |
| 1181 * | |
| 1182 * Clients may not extend, implement or mix-in this class. | |
| 1183 */ | |
| 1184 class AnalysisOccurrencesParams implements HasToJson { | |
| 1185 String _file; | |
| 1186 | |
| 1187 List<Occurrences> _occurrences; | |
| 1188 | |
| 1189 /** | |
| 1190 * The file in which the references occur. | |
| 1191 */ | |
| 1192 String get file => _file; | |
| 1193 | |
| 1194 /** | |
| 1195 * The file in which the references occur. | |
| 1196 */ | |
| 1197 void set file(String value) { | |
| 1198 assert(value != null); | |
| 1199 this._file = value; | |
| 1200 } | |
| 1201 | |
| 1202 /** | |
| 1203 * The occurrences of references to elements within the file. | |
| 1204 */ | |
| 1205 List<Occurrences> get occurrences => _occurrences; | |
| 1206 | |
| 1207 /** | |
| 1208 * The occurrences of references to elements within the file. | |
| 1209 */ | |
| 1210 void set occurrences(List<Occurrences> value) { | |
| 1211 assert(value != null); | |
| 1212 this._occurrences = value; | |
| 1213 } | |
| 1214 | |
| 1215 AnalysisOccurrencesParams(String file, List<Occurrences> occurrences) { | |
| 1216 this.file = file; | |
| 1217 this.occurrences = occurrences; | |
| 1218 } | |
| 1219 | |
| 1220 factory AnalysisOccurrencesParams.fromJson(JsonDecoder jsonDecoder, String jso
nPath, Object json) { | |
| 1221 if (json == null) { | |
| 1222 json = {}; | |
| 1223 } | |
| 1224 if (json is Map) { | |
| 1225 String file; | |
| 1226 if (json.containsKey("file")) { | |
| 1227 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); | |
| 1228 } else { | |
| 1229 throw jsonDecoder.mismatch(jsonPath, "file"); | |
| 1230 } | |
| 1231 List<Occurrences> occurrences; | |
| 1232 if (json.containsKey("occurrences")) { | |
| 1233 occurrences = jsonDecoder.decodeList(jsonPath + ".occurrences", json["oc
currences"], (String jsonPath, Object json) => new Occurrences.fromJson(jsonDeco
der, jsonPath, json)); | |
| 1234 } else { | |
| 1235 throw jsonDecoder.mismatch(jsonPath, "occurrences"); | |
| 1236 } | |
| 1237 return new AnalysisOccurrencesParams(file, occurrences); | |
| 1238 } else { | |
| 1239 throw jsonDecoder.mismatch(jsonPath, "analysis.occurrences params", json); | |
| 1240 } | |
| 1241 } | |
| 1242 | |
| 1243 factory AnalysisOccurrencesParams.fromNotification(Notification notification)
{ | |
| 1244 return new AnalysisOccurrencesParams.fromJson( | |
| 1245 new ResponseDecoder(null), "params", notification.params); | |
| 1246 } | |
| 1247 | |
| 1248 @override | |
| 1249 Map<String, dynamic> toJson() { | |
| 1250 Map<String, dynamic> result = {}; | |
| 1251 result["file"] = file; | |
| 1252 result["occurrences"] = occurrences.map((Occurrences value) => value.toJson(
)).toList(); | |
| 1253 return result; | |
| 1254 } | |
| 1255 | |
| 1256 Notification toNotification() { | |
| 1257 return new Notification("analysis.occurrences", toJson()); | |
| 1258 } | |
| 1259 | |
| 1260 @override | |
| 1261 String toString() => JSON.encode(toJson()); | |
| 1262 | |
| 1263 @override | |
| 1264 bool operator==(other) { | |
| 1265 if (other is AnalysisOccurrencesParams) { | |
| 1266 return file == other.file && | |
| 1267 listEqual(occurrences, other.occurrences, (Occurrences a, Occurrences
b) => a == b); | |
| 1268 } | |
| 1269 return false; | |
| 1270 } | |
| 1271 | |
| 1272 @override | |
| 1273 int get hashCode { | |
| 1274 int hash = 0; | |
| 1275 hash = JenkinsSmiHash.combine(hash, file.hashCode); | |
| 1276 hash = JenkinsSmiHash.combine(hash, occurrences.hashCode); | |
| 1277 return JenkinsSmiHash.finish(hash); | |
| 1278 } | |
| 1279 } | |
| 1280 | |
| 1281 /** | |
| 1282 * analysis.outline params | |
| 1283 * | |
| 1284 * { | |
| 1285 * "file": FilePath | |
| 1286 * "outline": List<Outline> | |
| 1287 * } | |
| 1288 * | |
| 1289 * Clients may not extend, implement or mix-in this class. | |
| 1290 */ | |
| 1291 class AnalysisOutlineParams implements HasToJson { | |
| 1292 String _file; | |
| 1293 | |
| 1294 List<Outline> _outline; | |
| 1295 | |
| 1296 /** | |
| 1297 * The file with which the outline is associated. | |
| 1298 */ | |
| 1299 String get file => _file; | |
| 1300 | |
| 1301 /** | |
| 1302 * The file with which the outline is associated. | |
| 1303 */ | |
| 1304 void set file(String value) { | |
| 1305 assert(value != null); | |
| 1306 this._file = value; | |
| 1307 } | |
| 1308 | |
| 1309 /** | |
| 1310 * The outline fragments associated with the file. | |
| 1311 */ | |
| 1312 List<Outline> get outline => _outline; | |
| 1313 | |
| 1314 /** | |
| 1315 * The outline fragments associated with the file. | |
| 1316 */ | |
| 1317 void set outline(List<Outline> value) { | |
| 1318 assert(value != null); | |
| 1319 this._outline = value; | |
| 1320 } | |
| 1321 | |
| 1322 AnalysisOutlineParams(String file, List<Outline> outline) { | |
| 1323 this.file = file; | |
| 1324 this.outline = outline; | |
| 1325 } | |
| 1326 | |
| 1327 factory AnalysisOutlineParams.fromJson(JsonDecoder jsonDecoder, String jsonPat
h, Object json) { | |
| 1328 if (json == null) { | |
| 1329 json = {}; | |
| 1330 } | |
| 1331 if (json is Map) { | |
| 1332 String file; | |
| 1333 if (json.containsKey("file")) { | |
| 1334 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); | |
| 1335 } else { | |
| 1336 throw jsonDecoder.mismatch(jsonPath, "file"); | |
| 1337 } | |
| 1338 List<Outline> outline; | |
| 1339 if (json.containsKey("outline")) { | |
| 1340 outline = jsonDecoder.decodeList(jsonPath + ".outline", json["outline"],
(String jsonPath, Object json) => new Outline.fromJson(jsonDecoder, jsonPath, j
son)); | |
| 1341 } else { | |
| 1342 throw jsonDecoder.mismatch(jsonPath, "outline"); | |
| 1343 } | |
| 1344 return new AnalysisOutlineParams(file, outline); | |
| 1345 } else { | |
| 1346 throw jsonDecoder.mismatch(jsonPath, "analysis.outline params", json); | |
| 1347 } | |
| 1348 } | |
| 1349 | |
| 1350 factory AnalysisOutlineParams.fromNotification(Notification notification) { | |
| 1351 return new AnalysisOutlineParams.fromJson( | |
| 1352 new ResponseDecoder(null), "params", notification.params); | |
| 1353 } | |
| 1354 | |
| 1355 @override | |
| 1356 Map<String, dynamic> toJson() { | |
| 1357 Map<String, dynamic> result = {}; | |
| 1358 result["file"] = file; | |
| 1359 result["outline"] = outline.map((Outline value) => value.toJson()).toList(); | |
| 1360 return result; | |
| 1361 } | |
| 1362 | |
| 1363 Notification toNotification() { | |
| 1364 return new Notification("analysis.outline", toJson()); | |
| 1365 } | |
| 1366 | |
| 1367 @override | |
| 1368 String toString() => JSON.encode(toJson()); | |
| 1369 | |
| 1370 @override | |
| 1371 bool operator==(other) { | |
| 1372 if (other is AnalysisOutlineParams) { | |
| 1373 return file == other.file && | |
| 1374 listEqual(outline, other.outline, (Outline a, Outline b) => a == b); | |
| 1375 } | |
| 1376 return false; | |
| 1377 } | |
| 1378 | |
| 1379 @override | |
| 1380 int get hashCode { | |
| 1381 int hash = 0; | |
| 1382 hash = JenkinsSmiHash.combine(hash, file.hashCode); | |
| 1383 hash = JenkinsSmiHash.combine(hash, outline.hashCode); | |
| 1384 return JenkinsSmiHash.finish(hash); | |
| 1385 } | |
| 1386 } | |
| 1387 | |
| 1388 /** | |
| 1389 * analysis.reanalyze params | |
| 1390 * | |
| 1391 * { | |
| 1392 * "roots": optional List<FilePath> | |
| 1393 * } | |
| 1394 * | |
| 1395 * Clients may not extend, implement or mix-in this class. | |
| 1396 */ | |
| 1397 class AnalysisReanalyzeParams implements RequestParams { | |
| 1398 List<String> _roots; | |
| 1399 | |
| 1400 /** | |
| 1401 * A list of the context roots that are to be re-analyzed. | |
| 1402 * | |
| 1403 * If no context roots are provided, then all current context roots should be | |
| 1404 * re-analyzed. | |
| 1405 */ | |
| 1406 List<String> get roots => _roots; | |
| 1407 | |
| 1408 /** | |
| 1409 * A list of the context roots that are to be re-analyzed. | |
| 1410 * | |
| 1411 * If no context roots are provided, then all current context roots should be | |
| 1412 * re-analyzed. | |
| 1413 */ | |
| 1414 void set roots(List<String> value) { | |
| 1415 this._roots = value; | |
| 1416 } | |
| 1417 | |
| 1418 AnalysisReanalyzeParams({List<String> roots}) { | |
| 1419 this.roots = roots; | |
| 1420 } | |
| 1421 | |
| 1422 factory AnalysisReanalyzeParams.fromJson(JsonDecoder jsonDecoder, String jsonP
ath, Object json) { | |
| 1423 if (json == null) { | |
| 1424 json = {}; | |
| 1425 } | |
| 1426 if (json is Map) { | |
| 1427 List<String> roots; | |
| 1428 if (json.containsKey("roots")) { | |
| 1429 roots = jsonDecoder.decodeList(jsonPath + ".roots", json["roots"], jsonD
ecoder.decodeString); | |
| 1430 } | |
| 1431 return new AnalysisReanalyzeParams(roots: roots); | |
| 1432 } else { | |
| 1433 throw jsonDecoder.mismatch(jsonPath, "analysis.reanalyze params", json); | |
| 1434 } | |
| 1435 } | |
| 1436 | |
| 1437 factory AnalysisReanalyzeParams.fromRequest(Request request) { | |
| 1438 return new AnalysisReanalyzeParams.fromJson( | |
| 1439 new RequestDecoder(request), "params", request.params); | |
| 1440 } | |
| 1441 | |
| 1442 @override | |
| 1443 Map<String, dynamic> toJson() { | |
| 1444 Map<String, dynamic> result = {}; | |
| 1445 if (roots != null) { | |
| 1446 result["roots"] = roots; | |
| 1447 } | |
| 1448 return result; | |
| 1449 } | |
| 1450 | |
| 1451 @override | |
| 1452 Request toRequest(String id) { | |
| 1453 return new Request(id, "analysis.reanalyze", toJson()); | |
| 1454 } | |
| 1455 | |
| 1456 @override | |
| 1457 String toString() => JSON.encode(toJson()); | |
| 1458 | |
| 1459 @override | |
| 1460 bool operator==(other) { | |
| 1461 if (other is AnalysisReanalyzeParams) { | |
| 1462 return listEqual(roots, other.roots, (String a, String b) => a == b); | |
| 1463 } | |
| 1464 return false; | |
| 1465 } | |
| 1466 | |
| 1467 @override | |
| 1468 int get hashCode { | |
| 1469 int hash = 0; | |
| 1470 hash = JenkinsSmiHash.combine(hash, roots.hashCode); | |
| 1471 return JenkinsSmiHash.finish(hash); | |
| 1472 } | |
| 1473 } | |
| 1474 | |
| 1475 /** | |
| 1476 * analysis.reanalyze result | |
| 1477 * | |
| 1478 * Clients may not extend, implement or mix-in this class. | |
| 1479 */ | |
| 1480 class AnalysisReanalyzeResult implements ResponseResult { | |
| 1481 @override | |
| 1482 Map<String, dynamic> toJson() => <String, dynamic>{}; | |
| 1483 | |
| 1484 @override | |
| 1485 Response toResponse(String id) { | |
| 1486 return new Response(id, result: null); | |
| 1487 } | |
| 1488 | |
| 1489 @override | |
| 1490 bool operator==(other) { | |
| 1491 if (other is AnalysisReanalyzeResult) { | |
| 1492 return true; | |
| 1493 } | |
| 1494 return false; | |
| 1495 } | |
| 1496 | |
| 1497 @override | |
| 1498 int get hashCode { | |
| 1499 return 846803925; | |
| 1500 } | |
| 1501 } | |
| 1502 | |
| 1503 /** | |
| 1504 * AnalysisService | |
| 1505 * | |
| 1506 * enum { | |
| 1507 * FOLDING | |
| 1508 * HIGHLIGHTS | |
| 1509 * NAVIGATION | |
| 1510 * OCCURRENCES | |
| 1511 * OUTLINE | |
| 1512 * } | |
| 1513 * | |
| 1514 * Clients may not extend, implement or mix-in this class. | |
| 1515 */ | |
| 1516 class AnalysisService implements Enum { | |
| 1517 static const AnalysisService FOLDING = const AnalysisService._("FOLDING"); | |
| 1518 | |
| 1519 static const AnalysisService HIGHLIGHTS = const AnalysisService._("HIGHLIGHTS"
); | |
| 1520 | |
| 1521 static const AnalysisService NAVIGATION = const AnalysisService._("NAVIGATION"
); | |
| 1522 | |
| 1523 static const AnalysisService OCCURRENCES = const AnalysisService._("OCCURRENCE
S"); | |
| 1524 | |
| 1525 static const AnalysisService OUTLINE = const AnalysisService._("OUTLINE"); | |
| 1526 | |
| 1527 /** | |
| 1528 * A list containing all of the enum values that are defined. | |
| 1529 */ | |
| 1530 static const List<AnalysisService> VALUES = const <AnalysisService>[FOLDING, H
IGHLIGHTS, NAVIGATION, OCCURRENCES, OUTLINE]; | |
| 1531 | |
| 1532 @override | |
| 1533 final String name; | |
| 1534 | |
| 1535 const AnalysisService._(this.name); | |
| 1536 | |
| 1537 factory AnalysisService(String name) { | |
| 1538 switch (name) { | |
| 1539 case "FOLDING": | |
| 1540 return FOLDING; | |
| 1541 case "HIGHLIGHTS": | |
| 1542 return HIGHLIGHTS; | |
| 1543 case "NAVIGATION": | |
| 1544 return NAVIGATION; | |
| 1545 case "OCCURRENCES": | |
| 1546 return OCCURRENCES; | |
| 1547 case "OUTLINE": | |
| 1548 return OUTLINE; | |
| 1549 } | |
| 1550 throw new Exception('Illegal enum value: $name'); | |
| 1551 } | |
| 1552 | |
| 1553 factory AnalysisService.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obj
ect json) { | |
| 1554 if (json is String) { | |
| 1555 try { | |
| 1556 return new AnalysisService(json); | |
| 1557 } catch(_) { | |
| 1558 // Fall through | |
| 1559 } | |
| 1560 } | |
| 1561 throw jsonDecoder.mismatch(jsonPath, "AnalysisService", json); | |
| 1562 } | |
| 1563 | |
| 1564 @override | |
| 1565 String toString() => "AnalysisService.$name"; | |
| 1566 | |
| 1567 String toJson() => name; | |
| 1568 } | |
| 1569 | |
| 1570 /** | |
| 1571 * analysis.setContextBuilderOptions params | |
| 1572 * | |
| 1573 * { | |
| 1574 * "options": ContextBuilderOptions | |
| 1575 * } | |
| 1576 * | |
| 1577 * Clients may not extend, implement or mix-in this class. | |
| 1578 */ | |
| 1579 class AnalysisSetContextBuilderOptionsParams implements RequestParams { | |
| 1580 ContextBuilderOptions _options; | |
| 1581 | |
| 1582 /** | |
| 1583 * The options used to build the analysis contexts. | |
| 1584 */ | |
| 1585 ContextBuilderOptions get options => _options; | |
| 1586 | |
| 1587 /** | |
| 1588 * The options used to build the analysis contexts. | |
| 1589 */ | |
| 1590 void set options(ContextBuilderOptions value) { | |
| 1591 assert(value != null); | |
| 1592 this._options = value; | |
| 1593 } | |
| 1594 | |
| 1595 AnalysisSetContextBuilderOptionsParams(ContextBuilderOptions options) { | |
| 1596 this.options = options; | |
| 1597 } | |
| 1598 | |
| 1599 factory AnalysisSetContextBuilderOptionsParams.fromJson(JsonDecoder jsonDecode
r, String jsonPath, Object json) { | |
| 1600 if (json == null) { | |
| 1601 json = {}; | |
| 1602 } | |
| 1603 if (json is Map) { | |
| 1604 ContextBuilderOptions options; | |
| 1605 if (json.containsKey("options")) { | |
| 1606 options = new ContextBuilderOptions.fromJson(jsonDecoder, jsonPath + ".o
ptions", json["options"]); | |
| 1607 } else { | |
| 1608 throw jsonDecoder.mismatch(jsonPath, "options"); | |
| 1609 } | |
| 1610 return new AnalysisSetContextBuilderOptionsParams(options); | |
| 1611 } else { | |
| 1612 throw jsonDecoder.mismatch(jsonPath, "analysis.setContextBuilderOptions pa
rams", json); | |
| 1613 } | |
| 1614 } | |
| 1615 | |
| 1616 factory AnalysisSetContextBuilderOptionsParams.fromRequest(Request request) { | |
| 1617 return new AnalysisSetContextBuilderOptionsParams.fromJson( | |
| 1618 new RequestDecoder(request), "params", request.params); | |
| 1619 } | |
| 1620 | |
| 1621 @override | |
| 1622 Map<String, dynamic> toJson() { | |
| 1623 Map<String, dynamic> result = {}; | |
| 1624 result["options"] = options.toJson(); | |
| 1625 return result; | |
| 1626 } | |
| 1627 | |
| 1628 @override | |
| 1629 Request toRequest(String id) { | |
| 1630 return new Request(id, "analysis.setContextBuilderOptions", toJson()); | |
| 1631 } | |
| 1632 | |
| 1633 @override | |
| 1634 String toString() => JSON.encode(toJson()); | |
| 1635 | |
| 1636 @override | |
| 1637 bool operator==(other) { | |
| 1638 if (other is AnalysisSetContextBuilderOptionsParams) { | |
| 1639 return options == other.options; | |
| 1640 } | |
| 1641 return false; | |
| 1642 } | |
| 1643 | |
| 1644 @override | |
| 1645 int get hashCode { | |
| 1646 int hash = 0; | |
| 1647 hash = JenkinsSmiHash.combine(hash, options.hashCode); | |
| 1648 return JenkinsSmiHash.finish(hash); | |
| 1649 } | |
| 1650 } | |
| 1651 | |
| 1652 /** | |
| 1653 * analysis.setContextBuilderOptions result | |
| 1654 * | |
| 1655 * Clients may not extend, implement or mix-in this class. | |
| 1656 */ | |
| 1657 class AnalysisSetContextBuilderOptionsResult implements ResponseResult { | |
| 1658 @override | |
| 1659 Map<String, dynamic> toJson() => <String, dynamic>{}; | |
| 1660 | |
| 1661 @override | |
| 1662 Response toResponse(String id) { | |
| 1663 return new Response(id, result: null); | |
| 1664 } | |
| 1665 | |
| 1666 @override | |
| 1667 bool operator==(other) { | |
| 1668 if (other is AnalysisSetContextBuilderOptionsResult) { | |
| 1669 return true; | |
| 1670 } | |
| 1671 return false; | |
| 1672 } | |
| 1673 | |
| 1674 @override | |
| 1675 int get hashCode { | |
| 1676 return 645412314; | |
| 1677 } | |
| 1678 } | |
| 1679 | |
| 1680 /** | |
| 1681 * analysis.setContextRoots params | |
| 1682 * | |
| 1683 * { | |
| 1684 * "roots": List<ContextRoot> | |
| 1685 * } | |
| 1686 * | |
| 1687 * Clients may not extend, implement or mix-in this class. | |
| 1688 */ | |
| 1689 class AnalysisSetContextRootsParams implements RequestParams { | |
| 1690 List<ContextRoot> _roots; | |
| 1691 | |
| 1692 /** | |
| 1693 * A list of the context roots that should be analyzed. | |
| 1694 */ | |
| 1695 List<ContextRoot> get roots => _roots; | |
| 1696 | |
| 1697 /** | |
| 1698 * A list of the context roots that should be analyzed. | |
| 1699 */ | |
| 1700 void set roots(List<ContextRoot> value) { | |
| 1701 assert(value != null); | |
| 1702 this._roots = value; | |
| 1703 } | |
| 1704 | |
| 1705 AnalysisSetContextRootsParams(List<ContextRoot> roots) { | |
| 1706 this.roots = roots; | |
| 1707 } | |
| 1708 | |
| 1709 factory AnalysisSetContextRootsParams.fromJson(JsonDecoder jsonDecoder, String
jsonPath, Object json) { | |
| 1710 if (json == null) { | |
| 1711 json = {}; | |
| 1712 } | |
| 1713 if (json is Map) { | |
| 1714 List<ContextRoot> roots; | |
| 1715 if (json.containsKey("roots")) { | |
| 1716 roots = jsonDecoder.decodeList(jsonPath + ".roots", json["roots"], (Stri
ng jsonPath, Object json) => new ContextRoot.fromJson(jsonDecoder, jsonPath, jso
n)); | |
| 1717 } else { | |
| 1718 throw jsonDecoder.mismatch(jsonPath, "roots"); | |
| 1719 } | |
| 1720 return new AnalysisSetContextRootsParams(roots); | |
| 1721 } else { | |
| 1722 throw jsonDecoder.mismatch(jsonPath, "analysis.setContextRoots params", js
on); | |
| 1723 } | |
| 1724 } | |
| 1725 | |
| 1726 factory AnalysisSetContextRootsParams.fromRequest(Request request) { | |
| 1727 return new AnalysisSetContextRootsParams.fromJson( | |
| 1728 new RequestDecoder(request), "params", request.params); | |
| 1729 } | |
| 1730 | |
| 1731 @override | |
| 1732 Map<String, dynamic> toJson() { | |
| 1733 Map<String, dynamic> result = {}; | |
| 1734 result["roots"] = roots.map((ContextRoot value) => value.toJson()).toList(); | |
| 1735 return result; | |
| 1736 } | |
| 1737 | |
| 1738 @override | |
| 1739 Request toRequest(String id) { | |
| 1740 return new Request(id, "analysis.setContextRoots", toJson()); | |
| 1741 } | |
| 1742 | |
| 1743 @override | |
| 1744 String toString() => JSON.encode(toJson()); | |
| 1745 | |
| 1746 @override | |
| 1747 bool operator==(other) { | |
| 1748 if (other is AnalysisSetContextRootsParams) { | |
| 1749 return listEqual(roots, other.roots, (ContextRoot a, ContextRoot b) => a =
= b); | |
| 1750 } | |
| 1751 return false; | |
| 1752 } | |
| 1753 | |
| 1754 @override | |
| 1755 int get hashCode { | |
| 1756 int hash = 0; | |
| 1757 hash = JenkinsSmiHash.combine(hash, roots.hashCode); | |
| 1758 return JenkinsSmiHash.finish(hash); | |
| 1759 } | |
| 1760 } | |
| 1761 | |
| 1762 /** | |
| 1763 * analysis.setContextRoots result | |
| 1764 * | |
| 1765 * Clients may not extend, implement or mix-in this class. | |
| 1766 */ | |
| 1767 class AnalysisSetContextRootsResult implements ResponseResult { | |
| 1768 @override | |
| 1769 Map<String, dynamic> toJson() => <String, dynamic>{}; | |
| 1770 | |
| 1771 @override | |
| 1772 Response toResponse(String id) { | |
| 1773 return new Response(id, result: null); | |
| 1774 } | |
| 1775 | |
| 1776 @override | |
| 1777 bool operator==(other) { | |
| 1778 if (other is AnalysisSetContextRootsResult) { | |
| 1779 return true; | |
| 1780 } | |
| 1781 return false; | |
| 1782 } | |
| 1783 | |
| 1784 @override | |
| 1785 int get hashCode { | |
| 1786 return 969645618; | |
| 1787 } | |
| 1788 } | |
| 1789 | |
| 1790 /** | |
| 1791 * analysis.setPriorityFiles params | |
| 1792 * | |
| 1793 * { | |
| 1794 * "files": List<FilePath> | |
| 1795 * } | |
| 1796 * | |
| 1797 * Clients may not extend, implement or mix-in this class. | |
| 1798 */ | |
| 1799 class AnalysisSetPriorityFilesParams implements RequestParams { | |
| 1800 List<String> _files; | |
| 1801 | |
| 1802 /** | |
| 1803 * The files that are to be a priority for analysis. | |
| 1804 */ | |
| 1805 List<String> get files => _files; | |
| 1806 | |
| 1807 /** | |
| 1808 * The files that are to be a priority for analysis. | |
| 1809 */ | |
| 1810 void set files(List<String> value) { | |
| 1811 assert(value != null); | |
| 1812 this._files = value; | |
| 1813 } | |
| 1814 | |
| 1815 AnalysisSetPriorityFilesParams(List<String> files) { | |
| 1816 this.files = files; | |
| 1817 } | |
| 1818 | |
| 1819 factory AnalysisSetPriorityFilesParams.fromJson(JsonDecoder jsonDecoder, Strin
g jsonPath, Object json) { | |
| 1820 if (json == null) { | |
| 1821 json = {}; | |
| 1822 } | |
| 1823 if (json is Map) { | |
| 1824 List<String> files; | |
| 1825 if (json.containsKey("files")) { | |
| 1826 files = jsonDecoder.decodeList(jsonPath + ".files", json["files"], jsonD
ecoder.decodeString); | |
| 1827 } else { | |
| 1828 throw jsonDecoder.mismatch(jsonPath, "files"); | |
| 1829 } | |
| 1830 return new AnalysisSetPriorityFilesParams(files); | |
| 1831 } else { | |
| 1832 throw jsonDecoder.mismatch(jsonPath, "analysis.setPriorityFiles params", j
son); | |
| 1833 } | |
| 1834 } | |
| 1835 | |
| 1836 factory AnalysisSetPriorityFilesParams.fromRequest(Request request) { | |
| 1837 return new AnalysisSetPriorityFilesParams.fromJson( | |
| 1838 new RequestDecoder(request), "params", request.params); | |
| 1839 } | |
| 1840 | |
| 1841 @override | |
| 1842 Map<String, dynamic> toJson() { | |
| 1843 Map<String, dynamic> result = {}; | |
| 1844 result["files"] = files; | |
| 1845 return result; | |
| 1846 } | |
| 1847 | |
| 1848 @override | |
| 1849 Request toRequest(String id) { | |
| 1850 return new Request(id, "analysis.setPriorityFiles", toJson()); | |
| 1851 } | |
| 1852 | |
| 1853 @override | |
| 1854 String toString() => JSON.encode(toJson()); | |
| 1855 | |
| 1856 @override | |
| 1857 bool operator==(other) { | |
| 1858 if (other is AnalysisSetPriorityFilesParams) { | |
| 1859 return listEqual(files, other.files, (String a, String b) => a == b); | |
| 1860 } | |
| 1861 return false; | |
| 1862 } | |
| 1863 | |
| 1864 @override | |
| 1865 int get hashCode { | |
| 1866 int hash = 0; | |
| 1867 hash = JenkinsSmiHash.combine(hash, files.hashCode); | |
| 1868 return JenkinsSmiHash.finish(hash); | |
| 1869 } | |
| 1870 } | |
| 1871 | |
| 1872 /** | |
| 1873 * analysis.setPriorityFiles result | |
| 1874 * | |
| 1875 * Clients may not extend, implement or mix-in this class. | |
| 1876 */ | |
| 1877 class AnalysisSetPriorityFilesResult implements ResponseResult { | |
| 1878 @override | |
| 1879 Map<String, dynamic> toJson() => <String, dynamic>{}; | |
| 1880 | |
| 1881 @override | |
| 1882 Response toResponse(String id) { | |
| 1883 return new Response(id, result: null); | |
| 1884 } | |
| 1885 | |
| 1886 @override | |
| 1887 bool operator==(other) { | |
| 1888 if (other is AnalysisSetPriorityFilesResult) { | |
| 1889 return true; | |
| 1890 } | |
| 1891 return false; | |
| 1892 } | |
| 1893 | |
| 1894 @override | |
| 1895 int get hashCode { | |
| 1896 return 330050055; | |
| 1897 } | |
| 1898 } | |
| 1899 | |
| 1900 /** | |
| 1901 * analysis.setSubscriptions params | |
| 1902 * | |
| 1903 * { | |
| 1904 * "subscriptions": Map<AnalysisService, List<FilePath>> | |
| 1905 * } | |
| 1906 * | |
| 1907 * Clients may not extend, implement or mix-in this class. | |
| 1908 */ | |
| 1909 class AnalysisSetSubscriptionsParams implements RequestParams { | |
| 1910 Map<AnalysisService, List<String>> _subscriptions; | |
| 1911 | |
| 1912 /** | |
| 1913 * A table mapping services to a list of the files being subscribed to the | |
| 1914 * service. | |
| 1915 */ | |
| 1916 Map<AnalysisService, List<String>> get subscriptions => _subscriptions; | |
| 1917 | |
| 1918 /** | |
| 1919 * A table mapping services to a list of the files being subscribed to the | |
| 1920 * service. | |
| 1921 */ | |
| 1922 void set subscriptions(Map<AnalysisService, List<String>> value) { | |
| 1923 assert(value != null); | |
| 1924 this._subscriptions = value; | |
| 1925 } | |
| 1926 | |
| 1927 AnalysisSetSubscriptionsParams(Map<AnalysisService, List<String>> subscription
s) { | |
| 1928 this.subscriptions = subscriptions; | |
| 1929 } | |
| 1930 | |
| 1931 factory AnalysisSetSubscriptionsParams.fromJson(JsonDecoder jsonDecoder, Strin
g jsonPath, Object json) { | |
| 1932 if (json == null) { | |
| 1933 json = {}; | |
| 1934 } | |
| 1935 if (json is Map) { | |
| 1936 Map<AnalysisService, List<String>> subscriptions; | |
| 1937 if (json.containsKey("subscriptions")) { | |
| 1938 subscriptions = jsonDecoder.decodeMap(jsonPath + ".subscriptions", json[
"subscriptions"], keyDecoder: (String jsonPath, Object json) => new AnalysisServ
ice.fromJson(jsonDecoder, jsonPath, json), valueDecoder: (String jsonPath, Objec
t json) => jsonDecoder.decodeList(jsonPath, json, jsonDecoder.decodeString)); | |
| 1939 } else { | |
| 1940 throw jsonDecoder.mismatch(jsonPath, "subscriptions"); | |
| 1941 } | |
| 1942 return new AnalysisSetSubscriptionsParams(subscriptions); | |
| 1943 } else { | |
| 1944 throw jsonDecoder.mismatch(jsonPath, "analysis.setSubscriptions params", j
son); | |
| 1945 } | |
| 1946 } | |
| 1947 | |
| 1948 factory AnalysisSetSubscriptionsParams.fromRequest(Request request) { | |
| 1949 return new AnalysisSetSubscriptionsParams.fromJson( | |
| 1950 new RequestDecoder(request), "params", request.params); | |
| 1951 } | |
| 1952 | |
| 1953 @override | |
| 1954 Map<String, dynamic> toJson() { | |
| 1955 Map<String, dynamic> result = {}; | |
| 1956 result["subscriptions"] = mapMap(subscriptions, keyCallback: (AnalysisServic
e value) => value.toJson()); | |
| 1957 return result; | |
| 1958 } | |
| 1959 | |
| 1960 @override | |
| 1961 Request toRequest(String id) { | |
| 1962 return new Request(id, "analysis.setSubscriptions", toJson()); | |
| 1963 } | |
| 1964 | |
| 1965 @override | |
| 1966 String toString() => JSON.encode(toJson()); | |
| 1967 | |
| 1968 @override | |
| 1969 bool operator==(other) { | |
| 1970 if (other is AnalysisSetSubscriptionsParams) { | |
| 1971 return mapEqual(subscriptions, other.subscriptions, (List<String> a, List<
String> b) => listEqual(a, b, (String a, String b) => a == b)); | |
| 1972 } | |
| 1973 return false; | |
| 1974 } | |
| 1975 | |
| 1976 @override | |
| 1977 int get hashCode { | |
| 1978 int hash = 0; | |
| 1979 hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode); | |
| 1980 return JenkinsSmiHash.finish(hash); | |
| 1981 } | |
| 1982 } | |
| 1983 | |
| 1984 /** | |
| 1985 * analysis.setSubscriptions result | |
| 1986 * | |
| 1987 * Clients may not extend, implement or mix-in this class. | |
| 1988 */ | |
| 1989 class AnalysisSetSubscriptionsResult implements ResponseResult { | |
| 1990 @override | |
| 1991 Map<String, dynamic> toJson() => <String, dynamic>{}; | |
| 1992 | |
| 1993 @override | |
| 1994 Response toResponse(String id) { | |
| 1995 return new Response(id, result: null); | |
| 1996 } | |
| 1997 | |
| 1998 @override | |
| 1999 bool operator==(other) { | |
| 2000 if (other is AnalysisSetSubscriptionsResult) { | |
| 2001 return true; | |
| 2002 } | |
| 2003 return false; | |
| 2004 } | |
| 2005 | |
| 2006 @override | |
| 2007 int get hashCode { | |
| 2008 return 218088493; | |
| 2009 } | |
| 2010 } | |
| 2011 | |
| 2012 /** | |
| 2013 * analysis.updateContent params | |
| 2014 * | |
| 2015 * { | |
| 2016 * "files": Map<FilePath, AddContentOverlay | ChangeContentOverlay | RemoveCon
tentOverlay> | |
| 2017 * } | |
| 2018 * | |
| 2019 * Clients may not extend, implement or mix-in this class. | |
| 2020 */ | |
| 2021 class AnalysisUpdateContentParams implements RequestParams { | |
| 2022 Map<String, dynamic> _files; | |
| 2023 | |
| 2024 /** | |
| 2025 * A table mapping the files whose content has changed to a description of | |
| 2026 * the content change. | |
| 2027 */ | |
| 2028 Map<String, dynamic> get files => _files; | |
| 2029 | |
| 2030 /** | |
| 2031 * A table mapping the files whose content has changed to a description of | |
| 2032 * the content change. | |
| 2033 */ | |
| 2034 void set files(Map<String, dynamic> value) { | |
| 2035 assert(value != null); | |
| 2036 this._files = value; | |
| 2037 } | |
| 2038 | |
| 2039 AnalysisUpdateContentParams(Map<String, dynamic> files) { | |
| 2040 this.files = files; | |
| 2041 } | |
| 2042 | |
| 2043 factory AnalysisUpdateContentParams.fromJson(JsonDecoder jsonDecoder, String j
sonPath, Object json) { | |
| 2044 if (json == null) { | |
| 2045 json = {}; | |
| 2046 } | |
| 2047 if (json is Map) { | |
| 2048 Map<String, dynamic> files; | |
| 2049 if (json.containsKey("files")) { | |
| 2050 files = jsonDecoder.decodeMap(jsonPath + ".files", json["files"], valueD
ecoder: (String jsonPath, Object json) => jsonDecoder.decodeUnion(jsonPath, json
, "type", {"add": (String jsonPath, Object json) => new AddContentOverlay.fromJs
on(jsonDecoder, jsonPath, json), "change": (String jsonPath, Object json) => new
ChangeContentOverlay.fromJson(jsonDecoder, jsonPath, json), "remove": (String j
sonPath, Object json) => new RemoveContentOverlay.fromJson(jsonDecoder, jsonPath
, json)})); | |
| 2051 } else { | |
| 2052 throw jsonDecoder.mismatch(jsonPath, "files"); | |
| 2053 } | |
| 2054 return new AnalysisUpdateContentParams(files); | |
| 2055 } else { | |
| 2056 throw jsonDecoder.mismatch(jsonPath, "analysis.updateContent params", json
); | |
| 2057 } | |
| 2058 } | |
| 2059 | |
| 2060 factory AnalysisUpdateContentParams.fromRequest(Request request) { | |
| 2061 return new AnalysisUpdateContentParams.fromJson( | |
| 2062 new RequestDecoder(request), "params", request.params); | |
| 2063 } | |
| 2064 | |
| 2065 @override | |
| 2066 Map<String, dynamic> toJson() { | |
| 2067 Map<String, dynamic> result = {}; | |
| 2068 result["files"] = mapMap(files, valueCallback: (dynamic value) => value.toJs
on()); | |
| 2069 return result; | |
| 2070 } | |
| 2071 | |
| 2072 @override | |
| 2073 Request toRequest(String id) { | |
| 2074 return new Request(id, "analysis.updateContent", toJson()); | |
| 2075 } | |
| 2076 | |
| 2077 @override | |
| 2078 String toString() => JSON.encode(toJson()); | |
| 2079 | |
| 2080 @override | |
| 2081 bool operator==(other) { | |
| 2082 if (other is AnalysisUpdateContentParams) { | |
| 2083 return mapEqual(files, other.files, (dynamic a, dynamic b) => a == b); | |
| 2084 } | |
| 2085 return false; | |
| 2086 } | |
| 2087 | |
| 2088 @override | |
| 2089 int get hashCode { | |
| 2090 int hash = 0; | |
| 2091 hash = JenkinsSmiHash.combine(hash, files.hashCode); | |
| 2092 return JenkinsSmiHash.finish(hash); | |
| 2093 } | |
| 2094 } | |
| 2095 | |
| 2096 /** | |
| 2097 * analysis.updateContent result | |
| 2098 * | |
| 2099 * Clients may not extend, implement or mix-in this class. | |
| 2100 */ | |
| 2101 class AnalysisUpdateContentResult implements ResponseResult { | |
| 2102 @override | |
| 2103 Map<String, dynamic> toJson() => <String, dynamic>{}; | |
| 2104 | |
| 2105 @override | |
| 2106 Response toResponse(String id) { | |
| 2107 return new Response(id, result: null); | |
| 2108 } | |
| 2109 | |
| 2110 @override | |
| 2111 bool operator==(other) { | |
| 2112 if (other is AnalysisUpdateContentResult) { | |
| 2113 return true; | |
| 2114 } | |
| 2115 return false; | |
| 2116 } | |
| 2117 | |
| 2118 @override | |
| 2119 int get hashCode { | |
| 2120 return 468798730; | |
| 2121 } | |
| 2122 } | |
| 2123 | |
| 2124 /** | |
| 2125 * ChangeContentOverlay | |
| 2126 * | |
| 2127 * { | |
| 2128 * "type": "change" | |
| 2129 * "edits": List<SourceEdit> | |
| 2130 * } | |
| 2131 * | |
| 2132 * Clients may not extend, implement or mix-in this class. | |
| 2133 */ | |
| 2134 class ChangeContentOverlay implements HasToJson { | |
| 2135 List<SourceEdit> _edits; | |
| 2136 | |
| 2137 /** | |
| 2138 * The edits to be applied to the file. | |
| 2139 */ | |
| 2140 List<SourceEdit> get edits => _edits; | |
| 2141 | |
| 2142 /** | |
| 2143 * The edits to be applied to the file. | |
| 2144 */ | |
| 2145 void set edits(List<SourceEdit> value) { | |
| 2146 assert(value != null); | |
| 2147 this._edits = value; | |
| 2148 } | |
| 2149 | |
| 2150 ChangeContentOverlay(List<SourceEdit> edits) { | |
| 2151 this.edits = edits; | |
| 2152 } | |
| 2153 | |
| 2154 factory ChangeContentOverlay.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 2155 if (json == null) { | |
| 2156 json = {}; | |
| 2157 } | |
| 2158 if (json is Map) { | |
| 2159 if (json["type"] != "change") { | |
| 2160 throw jsonDecoder.mismatch(jsonPath, "equal " + "change", json); | |
| 2161 } | |
| 2162 List<SourceEdit> edits; | |
| 2163 if (json.containsKey("edits")) { | |
| 2164 edits = jsonDecoder.decodeList(jsonPath + ".edits", json["edits"], (Stri
ng jsonPath, Object json) => new SourceEdit.fromJson(jsonDecoder, jsonPath, json
)); | |
| 2165 } else { | |
| 2166 throw jsonDecoder.mismatch(jsonPath, "edits"); | |
| 2167 } | |
| 2168 return new ChangeContentOverlay(edits); | |
| 2169 } else { | |
| 2170 throw jsonDecoder.mismatch(jsonPath, "ChangeContentOverlay", json); | |
| 2171 } | |
| 2172 } | |
| 2173 | |
| 2174 @override | |
| 2175 Map<String, dynamic> toJson() { | |
| 2176 Map<String, dynamic> result = {}; | |
| 2177 result["type"] = "change"; | |
| 2178 result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList(); | |
| 2179 return result; | |
| 2180 } | |
| 2181 | |
| 2182 @override | |
| 2183 String toString() => JSON.encode(toJson()); | |
| 2184 | |
| 2185 @override | |
| 2186 bool operator==(other) { | |
| 2187 if (other is ChangeContentOverlay) { | |
| 2188 return listEqual(edits, other.edits, (SourceEdit a, SourceEdit b) => a ==
b); | |
| 2189 } | |
| 2190 return false; | |
| 2191 } | |
| 2192 | |
| 2193 @override | |
| 2194 int get hashCode { | |
| 2195 int hash = 0; | |
| 2196 hash = JenkinsSmiHash.combine(hash, 873118866); | |
| 2197 hash = JenkinsSmiHash.combine(hash, edits.hashCode); | |
| 2198 return JenkinsSmiHash.finish(hash); | |
| 2199 } | |
| 2200 } | |
| 2201 | |
| 2202 /** | |
| 2203 * completion.getSuggestions params | |
| 2204 * | |
| 2205 * { | |
| 2206 * "file": FilePath | |
| 2207 * "offset": int | |
| 2208 * } | |
| 2209 * | |
| 2210 * Clients may not extend, implement or mix-in this class. | |
| 2211 */ | |
| 2212 class CompletionGetSuggestionsParams implements RequestParams { | |
| 2213 String _file; | |
| 2214 | |
| 2215 int _offset; | |
| 2216 | |
| 2217 /** | |
| 2218 * The file containing the point at which suggestions are to be made. | |
| 2219 */ | |
| 2220 String get file => _file; | |
| 2221 | |
| 2222 /** | |
| 2223 * The file containing the point at which suggestions are to be made. | |
| 2224 */ | |
| 2225 void set file(String value) { | |
| 2226 assert(value != null); | |
| 2227 this._file = value; | |
| 2228 } | |
| 2229 | |
| 2230 /** | |
| 2231 * The offset within the file at which suggestions are to be made. | |
| 2232 */ | |
| 2233 int get offset => _offset; | |
| 2234 | |
| 2235 /** | |
| 2236 * The offset within the file at which suggestions are to be made. | |
| 2237 */ | |
| 2238 void set offset(int value) { | |
| 2239 assert(value != null); | |
| 2240 this._offset = value; | |
| 2241 } | |
| 2242 | |
| 2243 CompletionGetSuggestionsParams(String file, int offset) { | |
| 2244 this.file = file; | |
| 2245 this.offset = offset; | |
| 2246 } | |
| 2247 | |
| 2248 factory CompletionGetSuggestionsParams.fromJson(JsonDecoder jsonDecoder, Strin
g jsonPath, Object json) { | |
| 2249 if (json == null) { | |
| 2250 json = {}; | |
| 2251 } | |
| 2252 if (json is Map) { | |
| 2253 String file; | |
| 2254 if (json.containsKey("file")) { | |
| 2255 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); | |
| 2256 } else { | |
| 2257 throw jsonDecoder.mismatch(jsonPath, "file"); | |
| 2258 } | |
| 2259 int offset; | |
| 2260 if (json.containsKey("offset")) { | |
| 2261 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 2262 } else { | |
| 2263 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 2264 } | |
| 2265 return new CompletionGetSuggestionsParams(file, offset); | |
| 2266 } else { | |
| 2267 throw jsonDecoder.mismatch(jsonPath, "completion.getSuggestions params", j
son); | |
| 2268 } | |
| 2269 } | |
| 2270 | |
| 2271 factory CompletionGetSuggestionsParams.fromRequest(Request request) { | |
| 2272 return new CompletionGetSuggestionsParams.fromJson( | |
| 2273 new RequestDecoder(request), "params", request.params); | |
| 2274 } | |
| 2275 | |
| 2276 @override | |
| 2277 Map<String, dynamic> toJson() { | |
| 2278 Map<String, dynamic> result = {}; | |
| 2279 result["file"] = file; | |
| 2280 result["offset"] = offset; | |
| 2281 return result; | |
| 2282 } | |
| 2283 | |
| 2284 @override | |
| 2285 Request toRequest(String id) { | |
| 2286 return new Request(id, "completion.getSuggestions", toJson()); | |
| 2287 } | |
| 2288 | |
| 2289 @override | |
| 2290 String toString() => JSON.encode(toJson()); | |
| 2291 | |
| 2292 @override | |
| 2293 bool operator==(other) { | |
| 2294 if (other is CompletionGetSuggestionsParams) { | |
| 2295 return file == other.file && | |
| 2296 offset == other.offset; | |
| 2297 } | |
| 2298 return false; | |
| 2299 } | |
| 2300 | |
| 2301 @override | |
| 2302 int get hashCode { | |
| 2303 int hash = 0; | |
| 2304 hash = JenkinsSmiHash.combine(hash, file.hashCode); | |
| 2305 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 2306 return JenkinsSmiHash.finish(hash); | |
| 2307 } | |
| 2308 } | |
| 2309 | |
| 2310 /** | |
| 2311 * completion.getSuggestions result | |
| 2312 * | |
| 2313 * { | |
| 2314 * "replacementOffset": int | |
| 2315 * "replacementLength": int | |
| 2316 * "results": List<CompletionSuggestion> | |
| 2317 * } | |
| 2318 * | |
| 2319 * Clients may not extend, implement or mix-in this class. | |
| 2320 */ | |
| 2321 class CompletionGetSuggestionsResult implements ResponseResult { | |
| 2322 int _replacementOffset; | |
| 2323 | |
| 2324 int _replacementLength; | |
| 2325 | |
| 2326 List<CompletionSuggestion> _results; | |
| 2327 | |
| 2328 /** | |
| 2329 * The offset of the start of the text to be replaced. This will be different | |
| 2330 * than the offset used to request the completion suggestions if there was a | |
| 2331 * portion of an identifier before the original offset. In particular, the | |
| 2332 * replacementOffset will be the offset of the beginning of said identifier. | |
| 2333 */ | |
| 2334 int get replacementOffset => _replacementOffset; | |
| 2335 | |
| 2336 /** | |
| 2337 * The offset of the start of the text to be replaced. This will be different | |
| 2338 * than the offset used to request the completion suggestions if there was a | |
| 2339 * portion of an identifier before the original offset. In particular, the | |
| 2340 * replacementOffset will be the offset of the beginning of said identifier. | |
| 2341 */ | |
| 2342 void set replacementOffset(int value) { | |
| 2343 assert(value != null); | |
| 2344 this._replacementOffset = value; | |
| 2345 } | |
| 2346 | |
| 2347 /** | |
| 2348 * The length of the text to be replaced if the remainder of the identifier | |
| 2349 * containing the cursor is to be replaced when the suggestion is applied | |
| 2350 * (that is, the number of characters in the existing identifier). | |
| 2351 */ | |
| 2352 int get replacementLength => _replacementLength; | |
| 2353 | |
| 2354 /** | |
| 2355 * The length of the text to be replaced if the remainder of the identifier | |
| 2356 * containing the cursor is to be replaced when the suggestion is applied | |
| 2357 * (that is, the number of characters in the existing identifier). | |
| 2358 */ | |
| 2359 void set replacementLength(int value) { | |
| 2360 assert(value != null); | |
| 2361 this._replacementLength = value; | |
| 2362 } | |
| 2363 | |
| 2364 /** | |
| 2365 * The completion suggestions being reported. The notification contains all | |
| 2366 * possible completions at the requested cursor position, even those that do | |
| 2367 * not match the characters the user has already typed. This allows the | |
| 2368 * client to respond to further keystrokes from the user without having to | |
| 2369 * make additional requests. | |
| 2370 */ | |
| 2371 List<CompletionSuggestion> get results => _results; | |
| 2372 | |
| 2373 /** | |
| 2374 * The completion suggestions being reported. The notification contains all | |
| 2375 * possible completions at the requested cursor position, even those that do | |
| 2376 * not match the characters the user has already typed. This allows the | |
| 2377 * client to respond to further keystrokes from the user without having to | |
| 2378 * make additional requests. | |
| 2379 */ | |
| 2380 void set results(List<CompletionSuggestion> value) { | |
| 2381 assert(value != null); | |
| 2382 this._results = value; | |
| 2383 } | |
| 2384 | |
| 2385 CompletionGetSuggestionsResult(int replacementOffset, int replacementLength, L
ist<CompletionSuggestion> results) { | |
| 2386 this.replacementOffset = replacementOffset; | |
| 2387 this.replacementLength = replacementLength; | |
| 2388 this.results = results; | |
| 2389 } | |
| 2390 | |
| 2391 factory CompletionGetSuggestionsResult.fromJson(JsonDecoder jsonDecoder, Strin
g jsonPath, Object json) { | |
| 2392 if (json == null) { | |
| 2393 json = {}; | |
| 2394 } | |
| 2395 if (json is Map) { | |
| 2396 int replacementOffset; | |
| 2397 if (json.containsKey("replacementOffset")) { | |
| 2398 replacementOffset = jsonDecoder.decodeInt(jsonPath + ".replacementOffset
", json["replacementOffset"]); | |
| 2399 } else { | |
| 2400 throw jsonDecoder.mismatch(jsonPath, "replacementOffset"); | |
| 2401 } | |
| 2402 int replacementLength; | |
| 2403 if (json.containsKey("replacementLength")) { | |
| 2404 replacementLength = jsonDecoder.decodeInt(jsonPath + ".replacementLength
", json["replacementLength"]); | |
| 2405 } else { | |
| 2406 throw jsonDecoder.mismatch(jsonPath, "replacementLength"); | |
| 2407 } | |
| 2408 List<CompletionSuggestion> results; | |
| 2409 if (json.containsKey("results")) { | |
| 2410 results = jsonDecoder.decodeList(jsonPath + ".results", json["results"],
(String jsonPath, Object json) => new CompletionSuggestion.fromJson(jsonDecoder
, jsonPath, json)); | |
| 2411 } else { | |
| 2412 throw jsonDecoder.mismatch(jsonPath, "results"); | |
| 2413 } | |
| 2414 return new CompletionGetSuggestionsResult(replacementOffset, replacementLe
ngth, results); | |
| 2415 } else { | |
| 2416 throw jsonDecoder.mismatch(jsonPath, "completion.getSuggestions result", j
son); | |
| 2417 } | |
| 2418 } | |
| 2419 | |
| 2420 factory CompletionGetSuggestionsResult.fromResponse(Response response) { | |
| 2421 return new CompletionGetSuggestionsResult.fromJson( | |
| 2422 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), "
result", response.result); | |
| 2423 } | |
| 2424 | |
| 2425 @override | |
| 2426 Map<String, dynamic> toJson() { | |
| 2427 Map<String, dynamic> result = {}; | |
| 2428 result["replacementOffset"] = replacementOffset; | |
| 2429 result["replacementLength"] = replacementLength; | |
| 2430 result["results"] = results.map((CompletionSuggestion value) => value.toJson
()).toList(); | |
| 2431 return result; | |
| 2432 } | |
| 2433 | |
| 2434 @override | |
| 2435 Response toResponse(String id) { | |
| 2436 return new Response(id, result: toJson()); | |
| 2437 } | |
| 2438 | |
| 2439 @override | |
| 2440 String toString() => JSON.encode(toJson()); | |
| 2441 | |
| 2442 @override | |
| 2443 bool operator==(other) { | |
| 2444 if (other is CompletionGetSuggestionsResult) { | |
| 2445 return replacementOffset == other.replacementOffset && | |
| 2446 replacementLength == other.replacementLength && | |
| 2447 listEqual(results, other.results, (CompletionSuggestion a, CompletionS
uggestion b) => a == b); | |
| 2448 } | |
| 2449 return false; | |
| 2450 } | |
| 2451 | |
| 2452 @override | |
| 2453 int get hashCode { | |
| 2454 int hash = 0; | |
| 2455 hash = JenkinsSmiHash.combine(hash, replacementOffset.hashCode); | |
| 2456 hash = JenkinsSmiHash.combine(hash, replacementLength.hashCode); | |
| 2457 hash = JenkinsSmiHash.combine(hash, results.hashCode); | |
| 2458 return JenkinsSmiHash.finish(hash); | |
| 2459 } | |
| 2460 } | |
| 2461 | |
| 2462 /** | |
| 2463 * CompletionSuggestion | |
| 2464 * | |
| 2465 * { | |
| 2466 * "kind": CompletionSuggestionKind | |
| 2467 * "relevance": int | |
| 2468 * "completion": String | |
| 2469 * "selectionOffset": int | |
| 2470 * "selectionLength": int | |
| 2471 * "isDeprecated": bool | |
| 2472 * "isPotential": bool | |
| 2473 * "docSummary": optional String | |
| 2474 * "docComplete": optional String | |
| 2475 * "declaringType": optional String | |
| 2476 * "element": optional Element | |
| 2477 * "returnType": optional String | |
| 2478 * "parameterNames": optional List<String> | |
| 2479 * "parameterTypes": optional List<String> | |
| 2480 * "requiredParameterCount": optional int | |
| 2481 * "hasNamedParameters": optional bool | |
| 2482 * "parameterName": optional String | |
| 2483 * "parameterType": optional String | |
| 2484 * "importUri": optional String | |
| 2485 * } | |
| 2486 * | |
| 2487 * Clients may not extend, implement or mix-in this class. | |
| 2488 */ | |
| 2489 class CompletionSuggestion implements HasToJson { | |
| 2490 CompletionSuggestionKind _kind; | |
| 2491 | |
| 2492 int _relevance; | |
| 2493 | |
| 2494 String _completion; | |
| 2495 | |
| 2496 int _selectionOffset; | |
| 2497 | |
| 2498 int _selectionLength; | |
| 2499 | |
| 2500 bool _isDeprecated; | |
| 2501 | |
| 2502 bool _isPotential; | |
| 2503 | |
| 2504 String _docSummary; | |
| 2505 | |
| 2506 String _docComplete; | |
| 2507 | |
| 2508 String _declaringType; | |
| 2509 | |
| 2510 Element _element; | |
| 2511 | |
| 2512 String _returnType; | |
| 2513 | |
| 2514 List<String> _parameterNames; | |
| 2515 | |
| 2516 List<String> _parameterTypes; | |
| 2517 | |
| 2518 int _requiredParameterCount; | |
| 2519 | |
| 2520 bool _hasNamedParameters; | |
| 2521 | |
| 2522 String _parameterName; | |
| 2523 | |
| 2524 String _parameterType; | |
| 2525 | |
| 2526 String _importUri; | |
| 2527 | |
| 2528 /** | |
| 2529 * The kind of element being suggested. | |
| 2530 */ | |
| 2531 CompletionSuggestionKind get kind => _kind; | |
| 2532 | |
| 2533 /** | |
| 2534 * The kind of element being suggested. | |
| 2535 */ | |
| 2536 void set kind(CompletionSuggestionKind value) { | |
| 2537 assert(value != null); | |
| 2538 this._kind = value; | |
| 2539 } | |
| 2540 | |
| 2541 /** | |
| 2542 * The relevance of this completion suggestion where a higher number | |
| 2543 * indicates a higher relevance. | |
| 2544 */ | |
| 2545 int get relevance => _relevance; | |
| 2546 | |
| 2547 /** | |
| 2548 * The relevance of this completion suggestion where a higher number | |
| 2549 * indicates a higher relevance. | |
| 2550 */ | |
| 2551 void set relevance(int value) { | |
| 2552 assert(value != null); | |
| 2553 this._relevance = value; | |
| 2554 } | |
| 2555 | |
| 2556 /** | |
| 2557 * The identifier to be inserted if the suggestion is selected. If the | |
| 2558 * suggestion is for a method or function, the client might want to | |
| 2559 * additionally insert a template for the parameters. The information | |
| 2560 * required in order to do so is contained in other fields. | |
| 2561 */ | |
| 2562 String get completion => _completion; | |
| 2563 | |
| 2564 /** | |
| 2565 * The identifier to be inserted if the suggestion is selected. If the | |
| 2566 * suggestion is for a method or function, the client might want to | |
| 2567 * additionally insert a template for the parameters. The information | |
| 2568 * required in order to do so is contained in other fields. | |
| 2569 */ | |
| 2570 void set completion(String value) { | |
| 2571 assert(value != null); | |
| 2572 this._completion = value; | |
| 2573 } | |
| 2574 | |
| 2575 /** | |
| 2576 * The offset, relative to the beginning of the completion, of where the | |
| 2577 * selection should be placed after insertion. | |
| 2578 */ | |
| 2579 int get selectionOffset => _selectionOffset; | |
| 2580 | |
| 2581 /** | |
| 2582 * The offset, relative to the beginning of the completion, of where the | |
| 2583 * selection should be placed after insertion. | |
| 2584 */ | |
| 2585 void set selectionOffset(int value) { | |
| 2586 assert(value != null); | |
| 2587 this._selectionOffset = value; | |
| 2588 } | |
| 2589 | |
| 2590 /** | |
| 2591 * The number of characters that should be selected after insertion. | |
| 2592 */ | |
| 2593 int get selectionLength => _selectionLength; | |
| 2594 | |
| 2595 /** | |
| 2596 * The number of characters that should be selected after insertion. | |
| 2597 */ | |
| 2598 void set selectionLength(int value) { | |
| 2599 assert(value != null); | |
| 2600 this._selectionLength = value; | |
| 2601 } | |
| 2602 | |
| 2603 /** | |
| 2604 * True if the suggested element is deprecated. | |
| 2605 */ | |
| 2606 bool get isDeprecated => _isDeprecated; | |
| 2607 | |
| 2608 /** | |
| 2609 * True if the suggested element is deprecated. | |
| 2610 */ | |
| 2611 void set isDeprecated(bool value) { | |
| 2612 assert(value != null); | |
| 2613 this._isDeprecated = value; | |
| 2614 } | |
| 2615 | |
| 2616 /** | |
| 2617 * True if the element is not known to be valid for the target. This happens | |
| 2618 * if the type of the target is dynamic. | |
| 2619 */ | |
| 2620 bool get isPotential => _isPotential; | |
| 2621 | |
| 2622 /** | |
| 2623 * True if the element is not known to be valid for the target. This happens | |
| 2624 * if the type of the target is dynamic. | |
| 2625 */ | |
| 2626 void set isPotential(bool value) { | |
| 2627 assert(value != null); | |
| 2628 this._isPotential = value; | |
| 2629 } | |
| 2630 | |
| 2631 /** | |
| 2632 * An abbreviated version of the Dartdoc associated with the element being | |
| 2633 * suggested, This field is omitted if there is no Dartdoc associated with | |
| 2634 * the element. | |
| 2635 */ | |
| 2636 String get docSummary => _docSummary; | |
| 2637 | |
| 2638 /** | |
| 2639 * An abbreviated version of the Dartdoc associated with the element being | |
| 2640 * suggested, This field is omitted if there is no Dartdoc associated with | |
| 2641 * the element. | |
| 2642 */ | |
| 2643 void set docSummary(String value) { | |
| 2644 this._docSummary = value; | |
| 2645 } | |
| 2646 | |
| 2647 /** | |
| 2648 * The Dartdoc associated with the element being suggested. This field is | |
| 2649 * omitted if there is no Dartdoc associated with the element. | |
| 2650 */ | |
| 2651 String get docComplete => _docComplete; | |
| 2652 | |
| 2653 /** | |
| 2654 * The Dartdoc associated with the element being suggested. This field is | |
| 2655 * omitted if there is no Dartdoc associated with the element. | |
| 2656 */ | |
| 2657 void set docComplete(String value) { | |
| 2658 this._docComplete = value; | |
| 2659 } | |
| 2660 | |
| 2661 /** | |
| 2662 * The class that declares the element being suggested. This field is omitted | |
| 2663 * if the suggested element is not a member of a class. | |
| 2664 */ | |
| 2665 String get declaringType => _declaringType; | |
| 2666 | |
| 2667 /** | |
| 2668 * The class that declares the element being suggested. This field is omitted | |
| 2669 * if the suggested element is not a member of a class. | |
| 2670 */ | |
| 2671 void set declaringType(String value) { | |
| 2672 this._declaringType = value; | |
| 2673 } | |
| 2674 | |
| 2675 /** | |
| 2676 * Information about the element reference being suggested. | |
| 2677 */ | |
| 2678 Element get element => _element; | |
| 2679 | |
| 2680 /** | |
| 2681 * Information about the element reference being suggested. | |
| 2682 */ | |
| 2683 void set element(Element value) { | |
| 2684 this._element = value; | |
| 2685 } | |
| 2686 | |
| 2687 /** | |
| 2688 * The return type of the getter, function or method or the type of the field | |
| 2689 * being suggested. This field is omitted if the suggested element is not a | |
| 2690 * getter, function or method. | |
| 2691 */ | |
| 2692 String get returnType => _returnType; | |
| 2693 | |
| 2694 /** | |
| 2695 * The return type of the getter, function or method or the type of the field | |
| 2696 * being suggested. This field is omitted if the suggested element is not a | |
| 2697 * getter, function or method. | |
| 2698 */ | |
| 2699 void set returnType(String value) { | |
| 2700 this._returnType = value; | |
| 2701 } | |
| 2702 | |
| 2703 /** | |
| 2704 * The names of the parameters of the function or method being suggested. | |
| 2705 * This field is omitted if the suggested element is not a setter, function | |
| 2706 * or method. | |
| 2707 */ | |
| 2708 List<String> get parameterNames => _parameterNames; | |
| 2709 | |
| 2710 /** | |
| 2711 * The names of the parameters of the function or method being suggested. | |
| 2712 * This field is omitted if the suggested element is not a setter, function | |
| 2713 * or method. | |
| 2714 */ | |
| 2715 void set parameterNames(List<String> value) { | |
| 2716 this._parameterNames = value; | |
| 2717 } | |
| 2718 | |
| 2719 /** | |
| 2720 * The types of the parameters of the function or method being suggested. | |
| 2721 * This field is omitted if the parameterNames field is omitted. | |
| 2722 */ | |
| 2723 List<String> get parameterTypes => _parameterTypes; | |
| 2724 | |
| 2725 /** | |
| 2726 * The types of the parameters of the function or method being suggested. | |
| 2727 * This field is omitted if the parameterNames field is omitted. | |
| 2728 */ | |
| 2729 void set parameterTypes(List<String> value) { | |
| 2730 this._parameterTypes = value; | |
| 2731 } | |
| 2732 | |
| 2733 /** | |
| 2734 * The number of required parameters for the function or method being | |
| 2735 * suggested. This field is omitted if the parameterNames field is omitted. | |
| 2736 */ | |
| 2737 int get requiredParameterCount => _requiredParameterCount; | |
| 2738 | |
| 2739 /** | |
| 2740 * The number of required parameters for the function or method being | |
| 2741 * suggested. This field is omitted if the parameterNames field is omitted. | |
| 2742 */ | |
| 2743 void set requiredParameterCount(int value) { | |
| 2744 this._requiredParameterCount = value; | |
| 2745 } | |
| 2746 | |
| 2747 /** | |
| 2748 * True if the function or method being suggested has at least one named | |
| 2749 * parameter. This field is omitted if the parameterNames field is omitted. | |
| 2750 */ | |
| 2751 bool get hasNamedParameters => _hasNamedParameters; | |
| 2752 | |
| 2753 /** | |
| 2754 * True if the function or method being suggested has at least one named | |
| 2755 * parameter. This field is omitted if the parameterNames field is omitted. | |
| 2756 */ | |
| 2757 void set hasNamedParameters(bool value) { | |
| 2758 this._hasNamedParameters = value; | |
| 2759 } | |
| 2760 | |
| 2761 /** | |
| 2762 * The name of the optional parameter being suggested. This field is omitted | |
| 2763 * if the suggestion is not the addition of an optional argument within an | |
| 2764 * argument list. | |
| 2765 */ | |
| 2766 String get parameterName => _parameterName; | |
| 2767 | |
| 2768 /** | |
| 2769 * The name of the optional parameter being suggested. This field is omitted | |
| 2770 * if the suggestion is not the addition of an optional argument within an | |
| 2771 * argument list. | |
| 2772 */ | |
| 2773 void set parameterName(String value) { | |
| 2774 this._parameterName = value; | |
| 2775 } | |
| 2776 | |
| 2777 /** | |
| 2778 * The type of the options parameter being suggested. This field is omitted | |
| 2779 * if the parameterName field is omitted. | |
| 2780 */ | |
| 2781 String get parameterType => _parameterType; | |
| 2782 | |
| 2783 /** | |
| 2784 * The type of the options parameter being suggested. This field is omitted | |
| 2785 * if the parameterName field is omitted. | |
| 2786 */ | |
| 2787 void set parameterType(String value) { | |
| 2788 this._parameterType = value; | |
| 2789 } | |
| 2790 | |
| 2791 /** | |
| 2792 * The import to be added if the suggestion is out of scope and needs an | |
| 2793 * import to be added to be in scope. | |
| 2794 */ | |
| 2795 String get importUri => _importUri; | |
| 2796 | |
| 2797 /** | |
| 2798 * The import to be added if the suggestion is out of scope and needs an | |
| 2799 * import to be added to be in scope. | |
| 2800 */ | |
| 2801 void set importUri(String value) { | |
| 2802 this._importUri = value; | |
| 2803 } | |
| 2804 | |
| 2805 CompletionSuggestion(CompletionSuggestionKind kind, int relevance, String comp
letion, int selectionOffset, int selectionLength, bool isDeprecated, bool isPote
ntial, {String docSummary, String docComplete, String declaringType, Element ele
ment, String returnType, List<String> parameterNames, List<String> parameterType
s, int requiredParameterCount, bool hasNamedParameters, String parameterName, St
ring parameterType, String importUri}) { | |
| 2806 this.kind = kind; | |
| 2807 this.relevance = relevance; | |
| 2808 this.completion = completion; | |
| 2809 this.selectionOffset = selectionOffset; | |
| 2810 this.selectionLength = selectionLength; | |
| 2811 this.isDeprecated = isDeprecated; | |
| 2812 this.isPotential = isPotential; | |
| 2813 this.docSummary = docSummary; | |
| 2814 this.docComplete = docComplete; | |
| 2815 this.declaringType = declaringType; | |
| 2816 this.element = element; | |
| 2817 this.returnType = returnType; | |
| 2818 this.parameterNames = parameterNames; | |
| 2819 this.parameterTypes = parameterTypes; | |
| 2820 this.requiredParameterCount = requiredParameterCount; | |
| 2821 this.hasNamedParameters = hasNamedParameters; | |
| 2822 this.parameterName = parameterName; | |
| 2823 this.parameterType = parameterType; | |
| 2824 this.importUri = importUri; | |
| 2825 } | |
| 2826 | |
| 2827 factory CompletionSuggestion.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 2828 if (json == null) { | |
| 2829 json = {}; | |
| 2830 } | |
| 2831 if (json is Map) { | |
| 2832 CompletionSuggestionKind kind; | |
| 2833 if (json.containsKey("kind")) { | |
| 2834 kind = new CompletionSuggestionKind.fromJson(jsonDecoder, jsonPath + ".k
ind", json["kind"]); | |
| 2835 } else { | |
| 2836 throw jsonDecoder.mismatch(jsonPath, "kind"); | |
| 2837 } | |
| 2838 int relevance; | |
| 2839 if (json.containsKey("relevance")) { | |
| 2840 relevance = jsonDecoder.decodeInt(jsonPath + ".relevance", json["relevan
ce"]); | |
| 2841 } else { | |
| 2842 throw jsonDecoder.mismatch(jsonPath, "relevance"); | |
| 2843 } | |
| 2844 String completion; | |
| 2845 if (json.containsKey("completion")) { | |
| 2846 completion = jsonDecoder.decodeString(jsonPath + ".completion", json["co
mpletion"]); | |
| 2847 } else { | |
| 2848 throw jsonDecoder.mismatch(jsonPath, "completion"); | |
| 2849 } | |
| 2850 int selectionOffset; | |
| 2851 if (json.containsKey("selectionOffset")) { | |
| 2852 selectionOffset = jsonDecoder.decodeInt(jsonPath + ".selectionOffset", j
son["selectionOffset"]); | |
| 2853 } else { | |
| 2854 throw jsonDecoder.mismatch(jsonPath, "selectionOffset"); | |
| 2855 } | |
| 2856 int selectionLength; | |
| 2857 if (json.containsKey("selectionLength")) { | |
| 2858 selectionLength = jsonDecoder.decodeInt(jsonPath + ".selectionLength", j
son["selectionLength"]); | |
| 2859 } else { | |
| 2860 throw jsonDecoder.mismatch(jsonPath, "selectionLength"); | |
| 2861 } | |
| 2862 bool isDeprecated; | |
| 2863 if (json.containsKey("isDeprecated")) { | |
| 2864 isDeprecated = jsonDecoder.decodeBool(jsonPath + ".isDeprecated", json["
isDeprecated"]); | |
| 2865 } else { | |
| 2866 throw jsonDecoder.mismatch(jsonPath, "isDeprecated"); | |
| 2867 } | |
| 2868 bool isPotential; | |
| 2869 if (json.containsKey("isPotential")) { | |
| 2870 isPotential = jsonDecoder.decodeBool(jsonPath + ".isPotential", json["is
Potential"]); | |
| 2871 } else { | |
| 2872 throw jsonDecoder.mismatch(jsonPath, "isPotential"); | |
| 2873 } | |
| 2874 String docSummary; | |
| 2875 if (json.containsKey("docSummary")) { | |
| 2876 docSummary = jsonDecoder.decodeString(jsonPath + ".docSummary", json["do
cSummary"]); | |
| 2877 } | |
| 2878 String docComplete; | |
| 2879 if (json.containsKey("docComplete")) { | |
| 2880 docComplete = jsonDecoder.decodeString(jsonPath + ".docComplete", json["
docComplete"]); | |
| 2881 } | |
| 2882 String declaringType; | |
| 2883 if (json.containsKey("declaringType")) { | |
| 2884 declaringType = jsonDecoder.decodeString(jsonPath + ".declaringType", js
on["declaringType"]); | |
| 2885 } | |
| 2886 Element element; | |
| 2887 if (json.containsKey("element")) { | |
| 2888 element = new Element.fromJson(jsonDecoder, jsonPath + ".element", json[
"element"]); | |
| 2889 } | |
| 2890 String returnType; | |
| 2891 if (json.containsKey("returnType")) { | |
| 2892 returnType = jsonDecoder.decodeString(jsonPath + ".returnType", json["re
turnType"]); | |
| 2893 } | |
| 2894 List<String> parameterNames; | |
| 2895 if (json.containsKey("parameterNames")) { | |
| 2896 parameterNames = jsonDecoder.decodeList(jsonPath + ".parameterNames", js
on["parameterNames"], jsonDecoder.decodeString); | |
| 2897 } | |
| 2898 List<String> parameterTypes; | |
| 2899 if (json.containsKey("parameterTypes")) { | |
| 2900 parameterTypes = jsonDecoder.decodeList(jsonPath + ".parameterTypes", js
on["parameterTypes"], jsonDecoder.decodeString); | |
| 2901 } | |
| 2902 int requiredParameterCount; | |
| 2903 if (json.containsKey("requiredParameterCount")) { | |
| 2904 requiredParameterCount = jsonDecoder.decodeInt(jsonPath + ".requiredPara
meterCount", json["requiredParameterCount"]); | |
| 2905 } | |
| 2906 bool hasNamedParameters; | |
| 2907 if (json.containsKey("hasNamedParameters")) { | |
| 2908 hasNamedParameters = jsonDecoder.decodeBool(jsonPath + ".hasNamedParamet
ers", json["hasNamedParameters"]); | |
| 2909 } | |
| 2910 String parameterName; | |
| 2911 if (json.containsKey("parameterName")) { | |
| 2912 parameterName = jsonDecoder.decodeString(jsonPath + ".parameterName", js
on["parameterName"]); | |
| 2913 } | |
| 2914 String parameterType; | |
| 2915 if (json.containsKey("parameterType")) { | |
| 2916 parameterType = jsonDecoder.decodeString(jsonPath + ".parameterType", js
on["parameterType"]); | |
| 2917 } | |
| 2918 String importUri; | |
| 2919 if (json.containsKey("importUri")) { | |
| 2920 importUri = jsonDecoder.decodeString(jsonPath + ".importUri", json["impo
rtUri"]); | |
| 2921 } | |
| 2922 return new CompletionSuggestion(kind, relevance, completion, selectionOffs
et, selectionLength, isDeprecated, isPotential, docSummary: docSummary, docCompl
ete: docComplete, declaringType: declaringType, element: element, returnType: re
turnType, parameterNames: parameterNames, parameterTypes: parameterTypes, requir
edParameterCount: requiredParameterCount, hasNamedParameters: hasNamedParameters
, parameterName: parameterName, parameterType: parameterType, importUri: importU
ri); | |
| 2923 } else { | |
| 2924 throw jsonDecoder.mismatch(jsonPath, "CompletionSuggestion", json); | |
| 2925 } | |
| 2926 } | |
| 2927 | |
| 2928 @override | |
| 2929 Map<String, dynamic> toJson() { | |
| 2930 Map<String, dynamic> result = {}; | |
| 2931 result["kind"] = kind.toJson(); | |
| 2932 result["relevance"] = relevance; | |
| 2933 result["completion"] = completion; | |
| 2934 result["selectionOffset"] = selectionOffset; | |
| 2935 result["selectionLength"] = selectionLength; | |
| 2936 result["isDeprecated"] = isDeprecated; | |
| 2937 result["isPotential"] = isPotential; | |
| 2938 if (docSummary != null) { | |
| 2939 result["docSummary"] = docSummary; | |
| 2940 } | |
| 2941 if (docComplete != null) { | |
| 2942 result["docComplete"] = docComplete; | |
| 2943 } | |
| 2944 if (declaringType != null) { | |
| 2945 result["declaringType"] = declaringType; | |
| 2946 } | |
| 2947 if (element != null) { | |
| 2948 result["element"] = element.toJson(); | |
| 2949 } | |
| 2950 if (returnType != null) { | |
| 2951 result["returnType"] = returnType; | |
| 2952 } | |
| 2953 if (parameterNames != null) { | |
| 2954 result["parameterNames"] = parameterNames; | |
| 2955 } | |
| 2956 if (parameterTypes != null) { | |
| 2957 result["parameterTypes"] = parameterTypes; | |
| 2958 } | |
| 2959 if (requiredParameterCount != null) { | |
| 2960 result["requiredParameterCount"] = requiredParameterCount; | |
| 2961 } | |
| 2962 if (hasNamedParameters != null) { | |
| 2963 result["hasNamedParameters"] = hasNamedParameters; | |
| 2964 } | |
| 2965 if (parameterName != null) { | |
| 2966 result["parameterName"] = parameterName; | |
| 2967 } | |
| 2968 if (parameterType != null) { | |
| 2969 result["parameterType"] = parameterType; | |
| 2970 } | |
| 2971 if (importUri != null) { | |
| 2972 result["importUri"] = importUri; | |
| 2973 } | |
| 2974 return result; | |
| 2975 } | |
| 2976 | |
| 2977 @override | |
| 2978 String toString() => JSON.encode(toJson()); | |
| 2979 | |
| 2980 @override | |
| 2981 bool operator==(other) { | |
| 2982 if (other is CompletionSuggestion) { | |
| 2983 return kind == other.kind && | |
| 2984 relevance == other.relevance && | |
| 2985 completion == other.completion && | |
| 2986 selectionOffset == other.selectionOffset && | |
| 2987 selectionLength == other.selectionLength && | |
| 2988 isDeprecated == other.isDeprecated && | |
| 2989 isPotential == other.isPotential && | |
| 2990 docSummary == other.docSummary && | |
| 2991 docComplete == other.docComplete && | |
| 2992 declaringType == other.declaringType && | |
| 2993 element == other.element && | |
| 2994 returnType == other.returnType && | |
| 2995 listEqual(parameterNames, other.parameterNames, (String a, String b) =
> a == b) && | |
| 2996 listEqual(parameterTypes, other.parameterTypes, (String a, String b) =
> a == b) && | |
| 2997 requiredParameterCount == other.requiredParameterCount && | |
| 2998 hasNamedParameters == other.hasNamedParameters && | |
| 2999 parameterName == other.parameterName && | |
| 3000 parameterType == other.parameterType && | |
| 3001 importUri == other.importUri; | |
| 3002 } | |
| 3003 return false; | |
| 3004 } | |
| 3005 | |
| 3006 @override | |
| 3007 int get hashCode { | |
| 3008 int hash = 0; | |
| 3009 hash = JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 3010 hash = JenkinsSmiHash.combine(hash, relevance.hashCode); | |
| 3011 hash = JenkinsSmiHash.combine(hash, completion.hashCode); | |
| 3012 hash = JenkinsSmiHash.combine(hash, selectionOffset.hashCode); | |
| 3013 hash = JenkinsSmiHash.combine(hash, selectionLength.hashCode); | |
| 3014 hash = JenkinsSmiHash.combine(hash, isDeprecated.hashCode); | |
| 3015 hash = JenkinsSmiHash.combine(hash, isPotential.hashCode); | |
| 3016 hash = JenkinsSmiHash.combine(hash, docSummary.hashCode); | |
| 3017 hash = JenkinsSmiHash.combine(hash, docComplete.hashCode); | |
| 3018 hash = JenkinsSmiHash.combine(hash, declaringType.hashCode); | |
| 3019 hash = JenkinsSmiHash.combine(hash, element.hashCode); | |
| 3020 hash = JenkinsSmiHash.combine(hash, returnType.hashCode); | |
| 3021 hash = JenkinsSmiHash.combine(hash, parameterNames.hashCode); | |
| 3022 hash = JenkinsSmiHash.combine(hash, parameterTypes.hashCode); | |
| 3023 hash = JenkinsSmiHash.combine(hash, requiredParameterCount.hashCode); | |
| 3024 hash = JenkinsSmiHash.combine(hash, hasNamedParameters.hashCode); | |
| 3025 hash = JenkinsSmiHash.combine(hash, parameterName.hashCode); | |
| 3026 hash = JenkinsSmiHash.combine(hash, parameterType.hashCode); | |
| 3027 hash = JenkinsSmiHash.combine(hash, importUri.hashCode); | |
| 3028 return JenkinsSmiHash.finish(hash); | |
| 3029 } | |
| 3030 } | |
| 3031 | |
| 3032 /** | |
| 3033 * CompletionSuggestionKind | |
| 3034 * | |
| 3035 * enum { | |
| 3036 * ARGUMENT_LIST | |
| 3037 * IMPORT | |
| 3038 * IDENTIFIER | |
| 3039 * INVOCATION | |
| 3040 * KEYWORD | |
| 3041 * NAMED_ARGUMENT | |
| 3042 * OPTIONAL_ARGUMENT | |
| 3043 * PARAMETER | |
| 3044 * } | |
| 3045 * | |
| 3046 * Clients may not extend, implement or mix-in this class. | |
| 3047 */ | |
| 3048 class CompletionSuggestionKind implements Enum { | |
| 3049 /** | |
| 3050 * A list of arguments for the method or function that is being invoked. For | |
| 3051 * this suggestion kind, the completion field is a textual representation of | |
| 3052 * the invocation and the parameterNames, parameterTypes, and | |
| 3053 * requiredParameterCount attributes are defined. | |
| 3054 */ | |
| 3055 static const CompletionSuggestionKind ARGUMENT_LIST = const CompletionSuggesti
onKind._("ARGUMENT_LIST"); | |
| 3056 | |
| 3057 static const CompletionSuggestionKind IMPORT = const CompletionSuggestionKind.
_("IMPORT"); | |
| 3058 | |
| 3059 /** | |
| 3060 * The element identifier should be inserted at the completion location. For | |
| 3061 * example "someMethod" in import 'myLib.dart' show someMethod;. For | |
| 3062 * suggestions of this kind, the element attribute is defined and the | |
| 3063 * completion field is the element's identifier. | |
| 3064 */ | |
| 3065 static const CompletionSuggestionKind IDENTIFIER = const CompletionSuggestionK
ind._("IDENTIFIER"); | |
| 3066 | |
| 3067 /** | |
| 3068 * The element is being invoked at the completion location. For example, | |
| 3069 * 'someMethod' in x.someMethod();. For suggestions of this kind, the element | |
| 3070 * attribute is defined and the completion field is the element's identifier. | |
| 3071 */ | |
| 3072 static const CompletionSuggestionKind INVOCATION = const CompletionSuggestionK
ind._("INVOCATION"); | |
| 3073 | |
| 3074 /** | |
| 3075 * A keyword is being suggested. For suggestions of this kind, the completion | |
| 3076 * is the keyword. | |
| 3077 */ | |
| 3078 static const CompletionSuggestionKind KEYWORD = const CompletionSuggestionKind
._("KEYWORD"); | |
| 3079 | |
| 3080 /** | |
| 3081 * A named argument for the current call site is being suggested. For | |
| 3082 * suggestions of this kind, the completion is the named argument identifier | |
| 3083 * including a trailing ':' and a space. | |
| 3084 */ | |
| 3085 static const CompletionSuggestionKind NAMED_ARGUMENT = const CompletionSuggest
ionKind._("NAMED_ARGUMENT"); | |
| 3086 | |
| 3087 static const CompletionSuggestionKind OPTIONAL_ARGUMENT = const CompletionSugg
estionKind._("OPTIONAL_ARGUMENT"); | |
| 3088 | |
| 3089 static const CompletionSuggestionKind PARAMETER = const CompletionSuggestionKi
nd._("PARAMETER"); | |
| 3090 | |
| 3091 /** | |
| 3092 * A list containing all of the enum values that are defined. | |
| 3093 */ | |
| 3094 static const List<CompletionSuggestionKind> VALUES = const <CompletionSuggesti
onKind>[ARGUMENT_LIST, IMPORT, IDENTIFIER, INVOCATION, KEYWORD, NAMED_ARGUMENT,
OPTIONAL_ARGUMENT, PARAMETER]; | |
| 3095 | |
| 3096 @override | |
| 3097 final String name; | |
| 3098 | |
| 3099 const CompletionSuggestionKind._(this.name); | |
| 3100 | |
| 3101 factory CompletionSuggestionKind(String name) { | |
| 3102 switch (name) { | |
| 3103 case "ARGUMENT_LIST": | |
| 3104 return ARGUMENT_LIST; | |
| 3105 case "IMPORT": | |
| 3106 return IMPORT; | |
| 3107 case "IDENTIFIER": | |
| 3108 return IDENTIFIER; | |
| 3109 case "INVOCATION": | |
| 3110 return INVOCATION; | |
| 3111 case "KEYWORD": | |
| 3112 return KEYWORD; | |
| 3113 case "NAMED_ARGUMENT": | |
| 3114 return NAMED_ARGUMENT; | |
| 3115 case "OPTIONAL_ARGUMENT": | |
| 3116 return OPTIONAL_ARGUMENT; | |
| 3117 case "PARAMETER": | |
| 3118 return PARAMETER; | |
| 3119 } | |
| 3120 throw new Exception('Illegal enum value: $name'); | |
| 3121 } | |
| 3122 | |
| 3123 factory CompletionSuggestionKind.fromJson(JsonDecoder jsonDecoder, String json
Path, Object json) { | |
| 3124 if (json is String) { | |
| 3125 try { | |
| 3126 return new CompletionSuggestionKind(json); | |
| 3127 } catch(_) { | |
| 3128 // Fall through | |
| 3129 } | |
| 3130 } | |
| 3131 throw jsonDecoder.mismatch(jsonPath, "CompletionSuggestionKind", json); | |
| 3132 } | |
| 3133 | |
| 3134 @override | |
| 3135 String toString() => "CompletionSuggestionKind.$name"; | |
| 3136 | |
| 3137 String toJson() => name; | |
| 3138 } | |
| 3139 | |
| 3140 /** | |
| 3141 * ContextBuilderOptions | |
| 3142 * | |
| 3143 * { | |
| 3144 * "dartSdkSummaryPath": optional String | |
| 3145 * "defaultAnalysisOptionsFilePath": optional List<String> | |
| 3146 * "declaredVariables": optional Map<String, String> | |
| 3147 * "defaultPackageFilePath": optional List<String> | |
| 3148 * "defaultPackagesDirectoryPath": optional List<String> | |
| 3149 * } | |
| 3150 * | |
| 3151 * Clients may not extend, implement or mix-in this class. | |
| 3152 */ | |
| 3153 class ContextBuilderOptions implements HasToJson { | |
| 3154 String _dartSdkSummaryPath; | |
| 3155 | |
| 3156 List<String> _defaultAnalysisOptionsFilePath; | |
| 3157 | |
| 3158 Map<String, String> _declaredVariables; | |
| 3159 | |
| 3160 List<String> _defaultPackageFilePath; | |
| 3161 | |
| 3162 List<String> _defaultPackagesDirectoryPath; | |
| 3163 | |
| 3164 /** | |
| 3165 * The file path of the file containing the summary of the SDK that should be | |
| 3166 * used to "analyze" the SDK. The field will be omitted if the summary should | |
| 3167 * be found in the SDK. | |
| 3168 */ | |
| 3169 String get dartSdkSummaryPath => _dartSdkSummaryPath; | |
| 3170 | |
| 3171 /** | |
| 3172 * The file path of the file containing the summary of the SDK that should be | |
| 3173 * used to "analyze" the SDK. The field will be omitted if the summary should | |
| 3174 * be found in the SDK. | |
| 3175 */ | |
| 3176 void set dartSdkSummaryPath(String value) { | |
| 3177 this._dartSdkSummaryPath = value; | |
| 3178 } | |
| 3179 | |
| 3180 /** | |
| 3181 * The file path of the analysis options file that should be used in place of | |
| 3182 * any file in the root directory or a parent of the root directory. The | |
| 3183 * field will be omitted if the normal lookup mechanism should be used. | |
| 3184 */ | |
| 3185 List<String> get defaultAnalysisOptionsFilePath => _defaultAnalysisOptionsFile
Path; | |
| 3186 | |
| 3187 /** | |
| 3188 * The file path of the analysis options file that should be used in place of | |
| 3189 * any file in the root directory or a parent of the root directory. The | |
| 3190 * field will be omitted if the normal lookup mechanism should be used. | |
| 3191 */ | |
| 3192 void set defaultAnalysisOptionsFilePath(List<String> value) { | |
| 3193 this._defaultAnalysisOptionsFilePath = value; | |
| 3194 } | |
| 3195 | |
| 3196 /** | |
| 3197 * A table mapping variable names to values for the declared variables. The | |
| 3198 * field will be omitted if no additional variables need to be declared. | |
| 3199 */ | |
| 3200 Map<String, String> get declaredVariables => _declaredVariables; | |
| 3201 | |
| 3202 /** | |
| 3203 * A table mapping variable names to values for the declared variables. The | |
| 3204 * field will be omitted if no additional variables need to be declared. | |
| 3205 */ | |
| 3206 void set declaredVariables(Map<String, String> value) { | |
| 3207 this._declaredVariables = value; | |
| 3208 } | |
| 3209 | |
| 3210 /** | |
| 3211 * The file path of the .packages file that should be used in place of any | |
| 3212 * file found using the normal (Package Specification DEP) lookup mechanism. | |
| 3213 * The field will be omitted if the normal lookup mechanism should be used. | |
| 3214 */ | |
| 3215 List<String> get defaultPackageFilePath => _defaultPackageFilePath; | |
| 3216 | |
| 3217 /** | |
| 3218 * The file path of the .packages file that should be used in place of any | |
| 3219 * file found using the normal (Package Specification DEP) lookup mechanism. | |
| 3220 * The field will be omitted if the normal lookup mechanism should be used. | |
| 3221 */ | |
| 3222 void set defaultPackageFilePath(List<String> value) { | |
| 3223 this._defaultPackageFilePath = value; | |
| 3224 } | |
| 3225 | |
| 3226 /** | |
| 3227 * The file path of the packages directory that should be used in place of | |
| 3228 * any file found using the normal (Package Specification DEP) lookup | |
| 3229 * mechanism. The field will be omitted if the normal lookup mechanism should | |
| 3230 * be used. | |
| 3231 */ | |
| 3232 List<String> get defaultPackagesDirectoryPath => _defaultPackagesDirectoryPath
; | |
| 3233 | |
| 3234 /** | |
| 3235 * The file path of the packages directory that should be used in place of | |
| 3236 * any file found using the normal (Package Specification DEP) lookup | |
| 3237 * mechanism. The field will be omitted if the normal lookup mechanism should | |
| 3238 * be used. | |
| 3239 */ | |
| 3240 void set defaultPackagesDirectoryPath(List<String> value) { | |
| 3241 this._defaultPackagesDirectoryPath = value; | |
| 3242 } | |
| 3243 | |
| 3244 ContextBuilderOptions({String dartSdkSummaryPath, List<String> defaultAnalysis
OptionsFilePath, Map<String, String> declaredVariables, List<String> defaultPack
ageFilePath, List<String> defaultPackagesDirectoryPath}) { | |
| 3245 this.dartSdkSummaryPath = dartSdkSummaryPath; | |
| 3246 this.defaultAnalysisOptionsFilePath = defaultAnalysisOptionsFilePath; | |
| 3247 this.declaredVariables = declaredVariables; | |
| 3248 this.defaultPackageFilePath = defaultPackageFilePath; | |
| 3249 this.defaultPackagesDirectoryPath = defaultPackagesDirectoryPath; | |
| 3250 } | |
| 3251 | |
| 3252 factory ContextBuilderOptions.fromJson(JsonDecoder jsonDecoder, String jsonPat
h, Object json) { | |
| 3253 if (json == null) { | |
| 3254 json = {}; | |
| 3255 } | |
| 3256 if (json is Map) { | |
| 3257 String dartSdkSummaryPath; | |
| 3258 if (json.containsKey("dartSdkSummaryPath")) { | |
| 3259 dartSdkSummaryPath = jsonDecoder.decodeString(jsonPath + ".dartSdkSummar
yPath", json["dartSdkSummaryPath"]); | |
| 3260 } | |
| 3261 List<String> defaultAnalysisOptionsFilePath; | |
| 3262 if (json.containsKey("defaultAnalysisOptionsFilePath")) { | |
| 3263 defaultAnalysisOptionsFilePath = jsonDecoder.decodeList(jsonPath + ".def
aultAnalysisOptionsFilePath", json["defaultAnalysisOptionsFilePath"], jsonDecode
r.decodeString); | |
| 3264 } | |
| 3265 Map<String, String> declaredVariables; | |
| 3266 if (json.containsKey("declaredVariables")) { | |
| 3267 declaredVariables = jsonDecoder.decodeMap(jsonPath + ".declaredVariables
", json["declaredVariables"], valueDecoder: jsonDecoder.decodeString); | |
| 3268 } | |
| 3269 List<String> defaultPackageFilePath; | |
| 3270 if (json.containsKey("defaultPackageFilePath")) { | |
| 3271 defaultPackageFilePath = jsonDecoder.decodeList(jsonPath + ".defaultPack
ageFilePath", json["defaultPackageFilePath"], jsonDecoder.decodeString); | |
| 3272 } | |
| 3273 List<String> defaultPackagesDirectoryPath; | |
| 3274 if (json.containsKey("defaultPackagesDirectoryPath")) { | |
| 3275 defaultPackagesDirectoryPath = jsonDecoder.decodeList(jsonPath + ".defau
ltPackagesDirectoryPath", json["defaultPackagesDirectoryPath"], jsonDecoder.deco
deString); | |
| 3276 } | |
| 3277 return new ContextBuilderOptions(dartSdkSummaryPath: dartSdkSummaryPath, d
efaultAnalysisOptionsFilePath: defaultAnalysisOptionsFilePath, declaredVariables
: declaredVariables, defaultPackageFilePath: defaultPackageFilePath, defaultPack
agesDirectoryPath: defaultPackagesDirectoryPath); | |
| 3278 } else { | |
| 3279 throw jsonDecoder.mismatch(jsonPath, "ContextBuilderOptions", json); | |
| 3280 } | |
| 3281 } | |
| 3282 | |
| 3283 @override | |
| 3284 Map<String, dynamic> toJson() { | |
| 3285 Map<String, dynamic> result = {}; | |
| 3286 if (dartSdkSummaryPath != null) { | |
| 3287 result["dartSdkSummaryPath"] = dartSdkSummaryPath; | |
| 3288 } | |
| 3289 if (defaultAnalysisOptionsFilePath != null) { | |
| 3290 result["defaultAnalysisOptionsFilePath"] = defaultAnalysisOptionsFilePath; | |
| 3291 } | |
| 3292 if (declaredVariables != null) { | |
| 3293 result["declaredVariables"] = declaredVariables; | |
| 3294 } | |
| 3295 if (defaultPackageFilePath != null) { | |
| 3296 result["defaultPackageFilePath"] = defaultPackageFilePath; | |
| 3297 } | |
| 3298 if (defaultPackagesDirectoryPath != null) { | |
| 3299 result["defaultPackagesDirectoryPath"] = defaultPackagesDirectoryPath; | |
| 3300 } | |
| 3301 return result; | |
| 3302 } | |
| 3303 | |
| 3304 @override | |
| 3305 String toString() => JSON.encode(toJson()); | |
| 3306 | |
| 3307 @override | |
| 3308 bool operator==(other) { | |
| 3309 if (other is ContextBuilderOptions) { | |
| 3310 return dartSdkSummaryPath == other.dartSdkSummaryPath && | |
| 3311 listEqual(defaultAnalysisOptionsFilePath, other.defaultAnalysisOptions
FilePath, (String a, String b) => a == b) && | |
| 3312 mapEqual(declaredVariables, other.declaredVariables, (String a, String
b) => a == b) && | |
| 3313 listEqual(defaultPackageFilePath, other.defaultPackageFilePath, (Strin
g a, String b) => a == b) && | |
| 3314 listEqual(defaultPackagesDirectoryPath, other.defaultPackagesDirectory
Path, (String a, String b) => a == b); | |
| 3315 } | |
| 3316 return false; | |
| 3317 } | |
| 3318 | |
| 3319 @override | |
| 3320 int get hashCode { | |
| 3321 int hash = 0; | |
| 3322 hash = JenkinsSmiHash.combine(hash, dartSdkSummaryPath.hashCode); | |
| 3323 hash = JenkinsSmiHash.combine(hash, defaultAnalysisOptionsFilePath.hashCode)
; | |
| 3324 hash = JenkinsSmiHash.combine(hash, declaredVariables.hashCode); | |
| 3325 hash = JenkinsSmiHash.combine(hash, defaultPackageFilePath.hashCode); | |
| 3326 hash = JenkinsSmiHash.combine(hash, defaultPackagesDirectoryPath.hashCode); | |
| 3327 return JenkinsSmiHash.finish(hash); | |
| 3328 } | |
| 3329 } | |
| 3330 | |
| 3331 /** | |
| 3332 * ContextRoot | |
| 3333 * | |
| 3334 * { | |
| 3335 * "root": String | |
| 3336 * "exclude": List<String> | |
| 3337 * } | |
| 3338 * | |
| 3339 * Clients may not extend, implement or mix-in this class. | |
| 3340 */ | |
| 3341 class ContextRoot implements HasToJson { | |
| 3342 String _root; | |
| 3343 | |
| 3344 List<String> _exclude; | |
| 3345 | |
| 3346 /** | |
| 3347 * The absolute path of the root directory containing the files to be | |
| 3348 * analyzed. | |
| 3349 */ | |
| 3350 String get root => _root; | |
| 3351 | |
| 3352 /** | |
| 3353 * The absolute path of the root directory containing the files to be | |
| 3354 * analyzed. | |
| 3355 */ | |
| 3356 void set root(String value) { | |
| 3357 assert(value != null); | |
| 3358 this._root = value; | |
| 3359 } | |
| 3360 | |
| 3361 /** | |
| 3362 * A list of the absolute paths of files and directories within the root | |
| 3363 * directory that should not be analyzed. | |
| 3364 */ | |
| 3365 List<String> get exclude => _exclude; | |
| 3366 | |
| 3367 /** | |
| 3368 * A list of the absolute paths of files and directories within the root | |
| 3369 * directory that should not be analyzed. | |
| 3370 */ | |
| 3371 void set exclude(List<String> value) { | |
| 3372 assert(value != null); | |
| 3373 this._exclude = value; | |
| 3374 } | |
| 3375 | |
| 3376 ContextRoot(String root, List<String> exclude) { | |
| 3377 this.root = root; | |
| 3378 this.exclude = exclude; | |
| 3379 } | |
| 3380 | |
| 3381 factory ContextRoot.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object
json) { | |
| 3382 if (json == null) { | |
| 3383 json = {}; | |
| 3384 } | |
| 3385 if (json is Map) { | |
| 3386 String root; | |
| 3387 if (json.containsKey("root")) { | |
| 3388 root = jsonDecoder.decodeString(jsonPath + ".root", json["root"]); | |
| 3389 } else { | |
| 3390 throw jsonDecoder.mismatch(jsonPath, "root"); | |
| 3391 } | |
| 3392 List<String> exclude; | |
| 3393 if (json.containsKey("exclude")) { | |
| 3394 exclude = jsonDecoder.decodeList(jsonPath + ".exclude", json["exclude"],
jsonDecoder.decodeString); | |
| 3395 } else { | |
| 3396 throw jsonDecoder.mismatch(jsonPath, "exclude"); | |
| 3397 } | |
| 3398 return new ContextRoot(root, exclude); | |
| 3399 } else { | |
| 3400 throw jsonDecoder.mismatch(jsonPath, "ContextRoot", json); | |
| 3401 } | |
| 3402 } | |
| 3403 | |
| 3404 @override | |
| 3405 Map<String, dynamic> toJson() { | |
| 3406 Map<String, dynamic> result = {}; | |
| 3407 result["root"] = root; | |
| 3408 result["exclude"] = exclude; | |
| 3409 return result; | |
| 3410 } | |
| 3411 | |
| 3412 @override | |
| 3413 String toString() => JSON.encode(toJson()); | |
| 3414 | |
| 3415 @override | |
| 3416 bool operator==(other) { | |
| 3417 if (other is ContextRoot) { | |
| 3418 return root == other.root && | |
| 3419 listEqual(exclude, other.exclude, (String a, String b) => a == b); | |
| 3420 } | |
| 3421 return false; | |
| 3422 } | |
| 3423 | |
| 3424 @override | |
| 3425 int get hashCode { | |
| 3426 int hash = 0; | |
| 3427 hash = JenkinsSmiHash.combine(hash, root.hashCode); | |
| 3428 hash = JenkinsSmiHash.combine(hash, exclude.hashCode); | |
| 3429 return JenkinsSmiHash.finish(hash); | |
| 3430 } | |
| 3431 } | |
| 3432 | |
| 3433 /** | |
| 3434 * convertGetterToMethod feedback | |
| 3435 * | |
| 3436 * Clients may not extend, implement or mix-in this class. | |
| 3437 */ | |
| 3438 class ConvertGetterToMethodFeedback extends RefactoringFeedback implements HasTo
Json { | |
| 3439 @override | |
| 3440 bool operator==(other) { | |
| 3441 if (other is ConvertGetterToMethodFeedback) { | |
| 3442 return true; | |
| 3443 } | |
| 3444 return false; | |
| 3445 } | |
| 3446 | |
| 3447 @override | |
| 3448 int get hashCode { | |
| 3449 return 616032599; | |
| 3450 } | |
| 3451 } | |
| 3452 | |
| 3453 /** | |
| 3454 * convertGetterToMethod options | |
| 3455 * | |
| 3456 * Clients may not extend, implement or mix-in this class. | |
| 3457 */ | |
| 3458 class ConvertGetterToMethodOptions extends RefactoringOptions implements HasToJs
on { | |
| 3459 @override | |
| 3460 bool operator==(other) { | |
| 3461 if (other is ConvertGetterToMethodOptions) { | |
| 3462 return true; | |
| 3463 } | |
| 3464 return false; | |
| 3465 } | |
| 3466 | |
| 3467 @override | |
| 3468 int get hashCode { | |
| 3469 return 488848400; | |
| 3470 } | |
| 3471 } | |
| 3472 | |
| 3473 /** | |
| 3474 * convertMethodToGetter feedback | |
| 3475 * | |
| 3476 * Clients may not extend, implement or mix-in this class. | |
| 3477 */ | |
| 3478 class ConvertMethodToGetterFeedback extends RefactoringFeedback implements HasTo
Json { | |
| 3479 @override | |
| 3480 bool operator==(other) { | |
| 3481 if (other is ConvertMethodToGetterFeedback) { | |
| 3482 return true; | |
| 3483 } | |
| 3484 return false; | |
| 3485 } | |
| 3486 | |
| 3487 @override | |
| 3488 int get hashCode { | |
| 3489 return 165291526; | |
| 3490 } | |
| 3491 } | |
| 3492 | |
| 3493 /** | |
| 3494 * convertMethodToGetter options | |
| 3495 * | |
| 3496 * Clients may not extend, implement or mix-in this class. | |
| 3497 */ | |
| 3498 class ConvertMethodToGetterOptions extends RefactoringOptions implements HasToJs
on { | |
| 3499 @override | |
| 3500 bool operator==(other) { | |
| 3501 if (other is ConvertMethodToGetterOptions) { | |
| 3502 return true; | |
| 3503 } | |
| 3504 return false; | |
| 3505 } | |
| 3506 | |
| 3507 @override | |
| 3508 int get hashCode { | |
| 3509 return 27952290; | |
| 3510 } | |
| 3511 } | |
| 3512 | |
| 3513 /** | |
| 3514 * edit.getAssists params | |
| 3515 * | |
| 3516 * { | |
| 3517 * "file": FilePath | |
| 3518 * "offset": int | |
| 3519 * "length": int | |
| 3520 * } | |
| 3521 * | |
| 3522 * Clients may not extend, implement or mix-in this class. | |
| 3523 */ | |
| 3524 class EditGetAssistsParams implements RequestParams { | |
| 3525 String _file; | |
| 3526 | |
| 3527 int _offset; | |
| 3528 | |
| 3529 int _length; | |
| 3530 | |
| 3531 /** | |
| 3532 * The file containing the code for which assists are being requested. | |
| 3533 */ | |
| 3534 String get file => _file; | |
| 3535 | |
| 3536 /** | |
| 3537 * The file containing the code for which assists are being requested. | |
| 3538 */ | |
| 3539 void set file(String value) { | |
| 3540 assert(value != null); | |
| 3541 this._file = value; | |
| 3542 } | |
| 3543 | |
| 3544 /** | |
| 3545 * The offset of the code for which assists are being requested. | |
| 3546 */ | |
| 3547 int get offset => _offset; | |
| 3548 | |
| 3549 /** | |
| 3550 * The offset of the code for which assists are being requested. | |
| 3551 */ | |
| 3552 void set offset(int value) { | |
| 3553 assert(value != null); | |
| 3554 this._offset = value; | |
| 3555 } | |
| 3556 | |
| 3557 /** | |
| 3558 * The length of the code for which assists are being requested. | |
| 3559 */ | |
| 3560 int get length => _length; | |
| 3561 | |
| 3562 /** | |
| 3563 * The length of the code for which assists are being requested. | |
| 3564 */ | |
| 3565 void set length(int value) { | |
| 3566 assert(value != null); | |
| 3567 this._length = value; | |
| 3568 } | |
| 3569 | |
| 3570 EditGetAssistsParams(String file, int offset, int length) { | |
| 3571 this.file = file; | |
| 3572 this.offset = offset; | |
| 3573 this.length = length; | |
| 3574 } | |
| 3575 | |
| 3576 factory EditGetAssistsParams.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 3577 if (json == null) { | |
| 3578 json = {}; | |
| 3579 } | |
| 3580 if (json is Map) { | |
| 3581 String file; | |
| 3582 if (json.containsKey("file")) { | |
| 3583 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); | |
| 3584 } else { | |
| 3585 throw jsonDecoder.mismatch(jsonPath, "file"); | |
| 3586 } | |
| 3587 int offset; | |
| 3588 if (json.containsKey("offset")) { | |
| 3589 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 3590 } else { | |
| 3591 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 3592 } | |
| 3593 int length; | |
| 3594 if (json.containsKey("length")) { | |
| 3595 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); | |
| 3596 } else { | |
| 3597 throw jsonDecoder.mismatch(jsonPath, "length"); | |
| 3598 } | |
| 3599 return new EditGetAssistsParams(file, offset, length); | |
| 3600 } else { | |
| 3601 throw jsonDecoder.mismatch(jsonPath, "edit.getAssists params", json); | |
| 3602 } | |
| 3603 } | |
| 3604 | |
| 3605 factory EditGetAssistsParams.fromRequest(Request request) { | |
| 3606 return new EditGetAssistsParams.fromJson( | |
| 3607 new RequestDecoder(request), "params", request.params); | |
| 3608 } | |
| 3609 | |
| 3610 @override | |
| 3611 Map<String, dynamic> toJson() { | |
| 3612 Map<String, dynamic> result = {}; | |
| 3613 result["file"] = file; | |
| 3614 result["offset"] = offset; | |
| 3615 result["length"] = length; | |
| 3616 return result; | |
| 3617 } | |
| 3618 | |
| 3619 @override | |
| 3620 Request toRequest(String id) { | |
| 3621 return new Request(id, "edit.getAssists", toJson()); | |
| 3622 } | |
| 3623 | |
| 3624 @override | |
| 3625 String toString() => JSON.encode(toJson()); | |
| 3626 | |
| 3627 @override | |
| 3628 bool operator==(other) { | |
| 3629 if (other is EditGetAssistsParams) { | |
| 3630 return file == other.file && | |
| 3631 offset == other.offset && | |
| 3632 length == other.length; | |
| 3633 } | |
| 3634 return false; | |
| 3635 } | |
| 3636 | |
| 3637 @override | |
| 3638 int get hashCode { | |
| 3639 int hash = 0; | |
| 3640 hash = JenkinsSmiHash.combine(hash, file.hashCode); | |
| 3641 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 3642 hash = JenkinsSmiHash.combine(hash, length.hashCode); | |
| 3643 return JenkinsSmiHash.finish(hash); | |
| 3644 } | |
| 3645 } | |
| 3646 | |
| 3647 /** | |
| 3648 * edit.getAssists result | |
| 3649 * | |
| 3650 * { | |
| 3651 * "assists": List<PrioritizedSourceChange> | |
| 3652 * } | |
| 3653 * | |
| 3654 * Clients may not extend, implement or mix-in this class. | |
| 3655 */ | |
| 3656 class EditGetAssistsResult implements ResponseResult { | |
| 3657 List<PrioritizedSourceChange> _assists; | |
| 3658 | |
| 3659 /** | |
| 3660 * The assists that are available at the given location. | |
| 3661 */ | |
| 3662 List<PrioritizedSourceChange> get assists => _assists; | |
| 3663 | |
| 3664 /** | |
| 3665 * The assists that are available at the given location. | |
| 3666 */ | |
| 3667 void set assists(List<PrioritizedSourceChange> value) { | |
| 3668 assert(value != null); | |
| 3669 this._assists = value; | |
| 3670 } | |
| 3671 | |
| 3672 EditGetAssistsResult(List<PrioritizedSourceChange> assists) { | |
| 3673 this.assists = assists; | |
| 3674 } | |
| 3675 | |
| 3676 factory EditGetAssistsResult.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 3677 if (json == null) { | |
| 3678 json = {}; | |
| 3679 } | |
| 3680 if (json is Map) { | |
| 3681 List<PrioritizedSourceChange> assists; | |
| 3682 if (json.containsKey("assists")) { | |
| 3683 assists = jsonDecoder.decodeList(jsonPath + ".assists", json["assists"],
(String jsonPath, Object json) => new PrioritizedSourceChange.fromJson(jsonDeco
der, jsonPath, json)); | |
| 3684 } else { | |
| 3685 throw jsonDecoder.mismatch(jsonPath, "assists"); | |
| 3686 } | |
| 3687 return new EditGetAssistsResult(assists); | |
| 3688 } else { | |
| 3689 throw jsonDecoder.mismatch(jsonPath, "edit.getAssists result", json); | |
| 3690 } | |
| 3691 } | |
| 3692 | |
| 3693 factory EditGetAssistsResult.fromResponse(Response response) { | |
| 3694 return new EditGetAssistsResult.fromJson( | |
| 3695 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), "
result", response.result); | |
| 3696 } | |
| 3697 | |
| 3698 @override | |
| 3699 Map<String, dynamic> toJson() { | |
| 3700 Map<String, dynamic> result = {}; | |
| 3701 result["assists"] = assists.map((PrioritizedSourceChange value) => value.toJ
son()).toList(); | |
| 3702 return result; | |
| 3703 } | |
| 3704 | |
| 3705 @override | |
| 3706 Response toResponse(String id) { | |
| 3707 return new Response(id, result: toJson()); | |
| 3708 } | |
| 3709 | |
| 3710 @override | |
| 3711 String toString() => JSON.encode(toJson()); | |
| 3712 | |
| 3713 @override | |
| 3714 bool operator==(other) { | |
| 3715 if (other is EditGetAssistsResult) { | |
| 3716 return listEqual(assists, other.assists, (PrioritizedSourceChange a, Prior
itizedSourceChange b) => a == b); | |
| 3717 } | |
| 3718 return false; | |
| 3719 } | |
| 3720 | |
| 3721 @override | |
| 3722 int get hashCode { | |
| 3723 int hash = 0; | |
| 3724 hash = JenkinsSmiHash.combine(hash, assists.hashCode); | |
| 3725 return JenkinsSmiHash.finish(hash); | |
| 3726 } | |
| 3727 } | |
| 3728 | |
| 3729 /** | |
| 3730 * edit.getAvailableRefactorings params | |
| 3731 * | |
| 3732 * { | |
| 3733 * "file": FilePath | |
| 3734 * "offset": int | |
| 3735 * "length": int | |
| 3736 * } | |
| 3737 * | |
| 3738 * Clients may not extend, implement or mix-in this class. | |
| 3739 */ | |
| 3740 class EditGetAvailableRefactoringsParams implements RequestParams { | |
| 3741 String _file; | |
| 3742 | |
| 3743 int _offset; | |
| 3744 | |
| 3745 int _length; | |
| 3746 | |
| 3747 /** | |
| 3748 * The file containing the code on which the refactoring would be based. | |
| 3749 */ | |
| 3750 String get file => _file; | |
| 3751 | |
| 3752 /** | |
| 3753 * The file containing the code on which the refactoring would be based. | |
| 3754 */ | |
| 3755 void set file(String value) { | |
| 3756 assert(value != null); | |
| 3757 this._file = value; | |
| 3758 } | |
| 3759 | |
| 3760 /** | |
| 3761 * The offset of the code on which the refactoring would be based. | |
| 3762 */ | |
| 3763 int get offset => _offset; | |
| 3764 | |
| 3765 /** | |
| 3766 * The offset of the code on which the refactoring would be based. | |
| 3767 */ | |
| 3768 void set offset(int value) { | |
| 3769 assert(value != null); | |
| 3770 this._offset = value; | |
| 3771 } | |
| 3772 | |
| 3773 /** | |
| 3774 * The length of the code on which the refactoring would be based. | |
| 3775 */ | |
| 3776 int get length => _length; | |
| 3777 | |
| 3778 /** | |
| 3779 * The length of the code on which the refactoring would be based. | |
| 3780 */ | |
| 3781 void set length(int value) { | |
| 3782 assert(value != null); | |
| 3783 this._length = value; | |
| 3784 } | |
| 3785 | |
| 3786 EditGetAvailableRefactoringsParams(String file, int offset, int length) { | |
| 3787 this.file = file; | |
| 3788 this.offset = offset; | |
| 3789 this.length = length; | |
| 3790 } | |
| 3791 | |
| 3792 factory EditGetAvailableRefactoringsParams.fromJson(JsonDecoder jsonDecoder, S
tring jsonPath, Object json) { | |
| 3793 if (json == null) { | |
| 3794 json = {}; | |
| 3795 } | |
| 3796 if (json is Map) { | |
| 3797 String file; | |
| 3798 if (json.containsKey("file")) { | |
| 3799 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); | |
| 3800 } else { | |
| 3801 throw jsonDecoder.mismatch(jsonPath, "file"); | |
| 3802 } | |
| 3803 int offset; | |
| 3804 if (json.containsKey("offset")) { | |
| 3805 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 3806 } else { | |
| 3807 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 3808 } | |
| 3809 int length; | |
| 3810 if (json.containsKey("length")) { | |
| 3811 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); | |
| 3812 } else { | |
| 3813 throw jsonDecoder.mismatch(jsonPath, "length"); | |
| 3814 } | |
| 3815 return new EditGetAvailableRefactoringsParams(file, offset, length); | |
| 3816 } else { | |
| 3817 throw jsonDecoder.mismatch(jsonPath, "edit.getAvailableRefactorings params
", json); | |
| 3818 } | |
| 3819 } | |
| 3820 | |
| 3821 factory EditGetAvailableRefactoringsParams.fromRequest(Request request) { | |
| 3822 return new EditGetAvailableRefactoringsParams.fromJson( | |
| 3823 new RequestDecoder(request), "params", request.params); | |
| 3824 } | |
| 3825 | |
| 3826 @override | |
| 3827 Map<String, dynamic> toJson() { | |
| 3828 Map<String, dynamic> result = {}; | |
| 3829 result["file"] = file; | |
| 3830 result["offset"] = offset; | |
| 3831 result["length"] = length; | |
| 3832 return result; | |
| 3833 } | |
| 3834 | |
| 3835 @override | |
| 3836 Request toRequest(String id) { | |
| 3837 return new Request(id, "edit.getAvailableRefactorings", toJson()); | |
| 3838 } | |
| 3839 | |
| 3840 @override | |
| 3841 String toString() => JSON.encode(toJson()); | |
| 3842 | |
| 3843 @override | |
| 3844 bool operator==(other) { | |
| 3845 if (other is EditGetAvailableRefactoringsParams) { | |
| 3846 return file == other.file && | |
| 3847 offset == other.offset && | |
| 3848 length == other.length; | |
| 3849 } | |
| 3850 return false; | |
| 3851 } | |
| 3852 | |
| 3853 @override | |
| 3854 int get hashCode { | |
| 3855 int hash = 0; | |
| 3856 hash = JenkinsSmiHash.combine(hash, file.hashCode); | |
| 3857 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 3858 hash = JenkinsSmiHash.combine(hash, length.hashCode); | |
| 3859 return JenkinsSmiHash.finish(hash); | |
| 3860 } | |
| 3861 } | |
| 3862 | |
| 3863 /** | |
| 3864 * edit.getAvailableRefactorings result | |
| 3865 * | |
| 3866 * { | |
| 3867 * "kinds": List<RefactoringKind> | |
| 3868 * } | |
| 3869 * | |
| 3870 * Clients may not extend, implement or mix-in this class. | |
| 3871 */ | |
| 3872 class EditGetAvailableRefactoringsResult implements ResponseResult { | |
| 3873 List<RefactoringKind> _kinds; | |
| 3874 | |
| 3875 /** | |
| 3876 * The kinds of refactorings that are valid for the given selection. | |
| 3877 * | |
| 3878 * The list of refactoring kinds is currently limited to those defined by the | |
| 3879 * server API, preventing plugins from adding their own refactorings. | |
| 3880 * However, plugins can support pre-defined refactorings, such as a rename | |
| 3881 * refactoring, at locations not supported by server. | |
| 3882 */ | |
| 3883 List<RefactoringKind> get kinds => _kinds; | |
| 3884 | |
| 3885 /** | |
| 3886 * The kinds of refactorings that are valid for the given selection. | |
| 3887 * | |
| 3888 * The list of refactoring kinds is currently limited to those defined by the | |
| 3889 * server API, preventing plugins from adding their own refactorings. | |
| 3890 * However, plugins can support pre-defined refactorings, such as a rename | |
| 3891 * refactoring, at locations not supported by server. | |
| 3892 */ | |
| 3893 void set kinds(List<RefactoringKind> value) { | |
| 3894 assert(value != null); | |
| 3895 this._kinds = value; | |
| 3896 } | |
| 3897 | |
| 3898 EditGetAvailableRefactoringsResult(List<RefactoringKind> kinds) { | |
| 3899 this.kinds = kinds; | |
| 3900 } | |
| 3901 | |
| 3902 factory EditGetAvailableRefactoringsResult.fromJson(JsonDecoder jsonDecoder, S
tring jsonPath, Object json) { | |
| 3903 if (json == null) { | |
| 3904 json = {}; | |
| 3905 } | |
| 3906 if (json is Map) { | |
| 3907 List<RefactoringKind> kinds; | |
| 3908 if (json.containsKey("kinds")) { | |
| 3909 kinds = jsonDecoder.decodeList(jsonPath + ".kinds", json["kinds"], (Stri
ng jsonPath, Object json) => new RefactoringKind.fromJson(jsonDecoder, jsonPath,
json)); | |
| 3910 } else { | |
| 3911 throw jsonDecoder.mismatch(jsonPath, "kinds"); | |
| 3912 } | |
| 3913 return new EditGetAvailableRefactoringsResult(kinds); | |
| 3914 } else { | |
| 3915 throw jsonDecoder.mismatch(jsonPath, "edit.getAvailableRefactorings result
", json); | |
| 3916 } | |
| 3917 } | |
| 3918 | |
| 3919 factory EditGetAvailableRefactoringsResult.fromResponse(Response response) { | |
| 3920 return new EditGetAvailableRefactoringsResult.fromJson( | |
| 3921 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), "
result", response.result); | |
| 3922 } | |
| 3923 | |
| 3924 @override | |
| 3925 Map<String, dynamic> toJson() { | |
| 3926 Map<String, dynamic> result = {}; | |
| 3927 result["kinds"] = kinds.map((RefactoringKind value) => value.toJson()).toLis
t(); | |
| 3928 return result; | |
| 3929 } | |
| 3930 | |
| 3931 @override | |
| 3932 Response toResponse(String id) { | |
| 3933 return new Response(id, result: toJson()); | |
| 3934 } | |
| 3935 | |
| 3936 @override | |
| 3937 String toString() => JSON.encode(toJson()); | |
| 3938 | |
| 3939 @override | |
| 3940 bool operator==(other) { | |
| 3941 if (other is EditGetAvailableRefactoringsResult) { | |
| 3942 return listEqual(kinds, other.kinds, (RefactoringKind a, RefactoringKind b
) => a == b); | |
| 3943 } | |
| 3944 return false; | |
| 3945 } | |
| 3946 | |
| 3947 @override | |
| 3948 int get hashCode { | |
| 3949 int hash = 0; | |
| 3950 hash = JenkinsSmiHash.combine(hash, kinds.hashCode); | |
| 3951 return JenkinsSmiHash.finish(hash); | |
| 3952 } | |
| 3953 } | |
| 3954 | |
| 3955 /** | |
| 3956 * edit.getFixes params | |
| 3957 * | |
| 3958 * { | |
| 3959 * "file": FilePath | |
| 3960 * "offset": int | |
| 3961 * } | |
| 3962 * | |
| 3963 * Clients may not extend, implement or mix-in this class. | |
| 3964 */ | |
| 3965 class EditGetFixesParams implements RequestParams { | |
| 3966 String _file; | |
| 3967 | |
| 3968 int _offset; | |
| 3969 | |
| 3970 /** | |
| 3971 * The file containing the errors for which fixes are being requested. | |
| 3972 */ | |
| 3973 String get file => _file; | |
| 3974 | |
| 3975 /** | |
| 3976 * The file containing the errors for which fixes are being requested. | |
| 3977 */ | |
| 3978 void set file(String value) { | |
| 3979 assert(value != null); | |
| 3980 this._file = value; | |
| 3981 } | |
| 3982 | |
| 3983 /** | |
| 3984 * The offset used to select the errors for which fixes will be returned. | |
| 3985 */ | |
| 3986 int get offset => _offset; | |
| 3987 | |
| 3988 /** | |
| 3989 * The offset used to select the errors for which fixes will be returned. | |
| 3990 */ | |
| 3991 void set offset(int value) { | |
| 3992 assert(value != null); | |
| 3993 this._offset = value; | |
| 3994 } | |
| 3995 | |
| 3996 EditGetFixesParams(String file, int offset) { | |
| 3997 this.file = file; | |
| 3998 this.offset = offset; | |
| 3999 } | |
| 4000 | |
| 4001 factory EditGetFixesParams.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 4002 if (json == null) { | |
| 4003 json = {}; | |
| 4004 } | |
| 4005 if (json is Map) { | |
| 4006 String file; | |
| 4007 if (json.containsKey("file")) { | |
| 4008 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); | |
| 4009 } else { | |
| 4010 throw jsonDecoder.mismatch(jsonPath, "file"); | |
| 4011 } | |
| 4012 int offset; | |
| 4013 if (json.containsKey("offset")) { | |
| 4014 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 4015 } else { | |
| 4016 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 4017 } | |
| 4018 return new EditGetFixesParams(file, offset); | |
| 4019 } else { | |
| 4020 throw jsonDecoder.mismatch(jsonPath, "edit.getFixes params", json); | |
| 4021 } | |
| 4022 } | |
| 4023 | |
| 4024 factory EditGetFixesParams.fromRequest(Request request) { | |
| 4025 return new EditGetFixesParams.fromJson( | |
| 4026 new RequestDecoder(request), "params", request.params); | |
| 4027 } | |
| 4028 | |
| 4029 @override | |
| 4030 Map<String, dynamic> toJson() { | |
| 4031 Map<String, dynamic> result = {}; | |
| 4032 result["file"] = file; | |
| 4033 result["offset"] = offset; | |
| 4034 return result; | |
| 4035 } | |
| 4036 | |
| 4037 @override | |
| 4038 Request toRequest(String id) { | |
| 4039 return new Request(id, "edit.getFixes", toJson()); | |
| 4040 } | |
| 4041 | |
| 4042 @override | |
| 4043 String toString() => JSON.encode(toJson()); | |
| 4044 | |
| 4045 @override | |
| 4046 bool operator==(other) { | |
| 4047 if (other is EditGetFixesParams) { | |
| 4048 return file == other.file && | |
| 4049 offset == other.offset; | |
| 4050 } | |
| 4051 return false; | |
| 4052 } | |
| 4053 | |
| 4054 @override | |
| 4055 int get hashCode { | |
| 4056 int hash = 0; | |
| 4057 hash = JenkinsSmiHash.combine(hash, file.hashCode); | |
| 4058 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 4059 return JenkinsSmiHash.finish(hash); | |
| 4060 } | |
| 4061 } | |
| 4062 | |
| 4063 /** | |
| 4064 * edit.getFixes result | |
| 4065 * | |
| 4066 * { | |
| 4067 * "fixes": List<AnalysisErrorFixes> | |
| 4068 * } | |
| 4069 * | |
| 4070 * Clients may not extend, implement or mix-in this class. | |
| 4071 */ | |
| 4072 class EditGetFixesResult implements ResponseResult { | |
| 4073 List<AnalysisErrorFixes> _fixes; | |
| 4074 | |
| 4075 /** | |
| 4076 * The fixes that are available for the errors at the given offset. | |
| 4077 */ | |
| 4078 List<AnalysisErrorFixes> get fixes => _fixes; | |
| 4079 | |
| 4080 /** | |
| 4081 * The fixes that are available for the errors at the given offset. | |
| 4082 */ | |
| 4083 void set fixes(List<AnalysisErrorFixes> value) { | |
| 4084 assert(value != null); | |
| 4085 this._fixes = value; | |
| 4086 } | |
| 4087 | |
| 4088 EditGetFixesResult(List<AnalysisErrorFixes> fixes) { | |
| 4089 this.fixes = fixes; | |
| 4090 } | |
| 4091 | |
| 4092 factory EditGetFixesResult.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 4093 if (json == null) { | |
| 4094 json = {}; | |
| 4095 } | |
| 4096 if (json is Map) { | |
| 4097 List<AnalysisErrorFixes> fixes; | |
| 4098 if (json.containsKey("fixes")) { | |
| 4099 fixes = jsonDecoder.decodeList(jsonPath + ".fixes", json["fixes"], (Stri
ng jsonPath, Object json) => new AnalysisErrorFixes.fromJson(jsonDecoder, jsonPa
th, json)); | |
| 4100 } else { | |
| 4101 throw jsonDecoder.mismatch(jsonPath, "fixes"); | |
| 4102 } | |
| 4103 return new EditGetFixesResult(fixes); | |
| 4104 } else { | |
| 4105 throw jsonDecoder.mismatch(jsonPath, "edit.getFixes result", json); | |
| 4106 } | |
| 4107 } | |
| 4108 | |
| 4109 factory EditGetFixesResult.fromResponse(Response response) { | |
| 4110 return new EditGetFixesResult.fromJson( | |
| 4111 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), "
result", response.result); | |
| 4112 } | |
| 4113 | |
| 4114 @override | |
| 4115 Map<String, dynamic> toJson() { | |
| 4116 Map<String, dynamic> result = {}; | |
| 4117 result["fixes"] = fixes.map((AnalysisErrorFixes value) => value.toJson()).to
List(); | |
| 4118 return result; | |
| 4119 } | |
| 4120 | |
| 4121 @override | |
| 4122 Response toResponse(String id) { | |
| 4123 return new Response(id, result: toJson()); | |
| 4124 } | |
| 4125 | |
| 4126 @override | |
| 4127 String toString() => JSON.encode(toJson()); | |
| 4128 | |
| 4129 @override | |
| 4130 bool operator==(other) { | |
| 4131 if (other is EditGetFixesResult) { | |
| 4132 return listEqual(fixes, other.fixes, (AnalysisErrorFixes a, AnalysisErrorF
ixes b) => a == b); | |
| 4133 } | |
| 4134 return false; | |
| 4135 } | |
| 4136 | |
| 4137 @override | |
| 4138 int get hashCode { | |
| 4139 int hash = 0; | |
| 4140 hash = JenkinsSmiHash.combine(hash, fixes.hashCode); | |
| 4141 return JenkinsSmiHash.finish(hash); | |
| 4142 } | |
| 4143 } | |
| 4144 | |
| 4145 /** | |
| 4146 * edit.getRefactoring params | |
| 4147 * | |
| 4148 * { | |
| 4149 * "kind": RefactoringKind | |
| 4150 * "file": FilePath | |
| 4151 * "offset": int | |
| 4152 * "length": int | |
| 4153 * "validateOnly": bool | |
| 4154 * "options": optional RefactoringOptions | |
| 4155 * } | |
| 4156 * | |
| 4157 * Clients may not extend, implement or mix-in this class. | |
| 4158 */ | |
| 4159 class EditGetRefactoringParams implements RequestParams { | |
| 4160 RefactoringKind _kind; | |
| 4161 | |
| 4162 String _file; | |
| 4163 | |
| 4164 int _offset; | |
| 4165 | |
| 4166 int _length; | |
| 4167 | |
| 4168 bool _validateOnly; | |
| 4169 | |
| 4170 RefactoringOptions _options; | |
| 4171 | |
| 4172 /** | |
| 4173 * The kind of refactoring to be performed. | |
| 4174 */ | |
| 4175 RefactoringKind get kind => _kind; | |
| 4176 | |
| 4177 /** | |
| 4178 * The kind of refactoring to be performed. | |
| 4179 */ | |
| 4180 void set kind(RefactoringKind value) { | |
| 4181 assert(value != null); | |
| 4182 this._kind = value; | |
| 4183 } | |
| 4184 | |
| 4185 /** | |
| 4186 * The file containing the code involved in the refactoring. | |
| 4187 */ | |
| 4188 String get file => _file; | |
| 4189 | |
| 4190 /** | |
| 4191 * The file containing the code involved in the refactoring. | |
| 4192 */ | |
| 4193 void set file(String value) { | |
| 4194 assert(value != null); | |
| 4195 this._file = value; | |
| 4196 } | |
| 4197 | |
| 4198 /** | |
| 4199 * The offset of the region involved in the refactoring. | |
| 4200 */ | |
| 4201 int get offset => _offset; | |
| 4202 | |
| 4203 /** | |
| 4204 * The offset of the region involved in the refactoring. | |
| 4205 */ | |
| 4206 void set offset(int value) { | |
| 4207 assert(value != null); | |
| 4208 this._offset = value; | |
| 4209 } | |
| 4210 | |
| 4211 /** | |
| 4212 * The length of the region involved in the refactoring. | |
| 4213 */ | |
| 4214 int get length => _length; | |
| 4215 | |
| 4216 /** | |
| 4217 * The length of the region involved in the refactoring. | |
| 4218 */ | |
| 4219 void set length(int value) { | |
| 4220 assert(value != null); | |
| 4221 this._length = value; | |
| 4222 } | |
| 4223 | |
| 4224 /** | |
| 4225 * True if the client is only requesting that the values of the options be | |
| 4226 * validated and no change be generated. | |
| 4227 */ | |
| 4228 bool get validateOnly => _validateOnly; | |
| 4229 | |
| 4230 /** | |
| 4231 * True if the client is only requesting that the values of the options be | |
| 4232 * validated and no change be generated. | |
| 4233 */ | |
| 4234 void set validateOnly(bool value) { | |
| 4235 assert(value != null); | |
| 4236 this._validateOnly = value; | |
| 4237 } | |
| 4238 | |
| 4239 /** | |
| 4240 * Data used to provide values provided by the user. The structure of the | |
| 4241 * data is dependent on the kind of refactoring being performed. The data | |
| 4242 * that is expected is documented in the section titled Refactorings, labeled | |
| 4243 * as "Options". This field can be omitted if the refactoring does not | |
| 4244 * require any options or if the values of those options are not known. | |
| 4245 */ | |
| 4246 RefactoringOptions get options => _options; | |
| 4247 | |
| 4248 /** | |
| 4249 * Data used to provide values provided by the user. The structure of the | |
| 4250 * data is dependent on the kind of refactoring being performed. The data | |
| 4251 * that is expected is documented in the section titled Refactorings, labeled | |
| 4252 * as "Options". This field can be omitted if the refactoring does not | |
| 4253 * require any options or if the values of those options are not known. | |
| 4254 */ | |
| 4255 void set options(RefactoringOptions value) { | |
| 4256 this._options = value; | |
| 4257 } | |
| 4258 | |
| 4259 EditGetRefactoringParams(RefactoringKind kind, String file, int offset, int le
ngth, bool validateOnly, {RefactoringOptions options}) { | |
| 4260 this.kind = kind; | |
| 4261 this.file = file; | |
| 4262 this.offset = offset; | |
| 4263 this.length = length; | |
| 4264 this.validateOnly = validateOnly; | |
| 4265 this.options = options; | |
| 4266 } | |
| 4267 | |
| 4268 factory EditGetRefactoringParams.fromJson(JsonDecoder jsonDecoder, String json
Path, Object json) { | |
| 4269 if (json == null) { | |
| 4270 json = {}; | |
| 4271 } | |
| 4272 if (json is Map) { | |
| 4273 RefactoringKind kind; | |
| 4274 if (json.containsKey("kind")) { | |
| 4275 kind = new RefactoringKind.fromJson(jsonDecoder, jsonPath + ".kind", jso
n["kind"]); | |
| 4276 } else { | |
| 4277 throw jsonDecoder.mismatch(jsonPath, "kind"); | |
| 4278 } | |
| 4279 String file; | |
| 4280 if (json.containsKey("file")) { | |
| 4281 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); | |
| 4282 } else { | |
| 4283 throw jsonDecoder.mismatch(jsonPath, "file"); | |
| 4284 } | |
| 4285 int offset; | |
| 4286 if (json.containsKey("offset")) { | |
| 4287 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 4288 } else { | |
| 4289 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 4290 } | |
| 4291 int length; | |
| 4292 if (json.containsKey("length")) { | |
| 4293 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); | |
| 4294 } else { | |
| 4295 throw jsonDecoder.mismatch(jsonPath, "length"); | |
| 4296 } | |
| 4297 bool validateOnly; | |
| 4298 if (json.containsKey("validateOnly")) { | |
| 4299 validateOnly = jsonDecoder.decodeBool(jsonPath + ".validateOnly", json["
validateOnly"]); | |
| 4300 } else { | |
| 4301 throw jsonDecoder.mismatch(jsonPath, "validateOnly"); | |
| 4302 } | |
| 4303 RefactoringOptions options; | |
| 4304 if (json.containsKey("options")) { | |
| 4305 options = new RefactoringOptions.fromJson(jsonDecoder, jsonPath + ".opti
ons", json["options"], kind); | |
| 4306 } | |
| 4307 return new EditGetRefactoringParams(kind, file, offset, length, validateOn
ly, options: options); | |
| 4308 } else { | |
| 4309 throw jsonDecoder.mismatch(jsonPath, "edit.getRefactoring params", json); | |
| 4310 } | |
| 4311 } | |
| 4312 | |
| 4313 factory EditGetRefactoringParams.fromRequest(Request request) { | |
| 4314 var params = new EditGetRefactoringParams.fromJson( | |
| 4315 new RequestDecoder(request), "params", request.params); | |
| 4316 REQUEST_ID_REFACTORING_KINDS[request.id] = params.kind; | |
| 4317 return params; | |
| 4318 } | |
| 4319 | |
| 4320 @override | |
| 4321 Map<String, dynamic> toJson() { | |
| 4322 Map<String, dynamic> result = {}; | |
| 4323 result["kind"] = kind.toJson(); | |
| 4324 result["file"] = file; | |
| 4325 result["offset"] = offset; | |
| 4326 result["length"] = length; | |
| 4327 result["validateOnly"] = validateOnly; | |
| 4328 if (options != null) { | |
| 4329 result["options"] = options.toJson(); | |
| 4330 } | |
| 4331 return result; | |
| 4332 } | |
| 4333 | |
| 4334 @override | |
| 4335 Request toRequest(String id) { | |
| 4336 return new Request(id, "edit.getRefactoring", toJson()); | |
| 4337 } | |
| 4338 | |
| 4339 @override | |
| 4340 String toString() => JSON.encode(toJson()); | |
| 4341 | |
| 4342 @override | |
| 4343 bool operator==(other) { | |
| 4344 if (other is EditGetRefactoringParams) { | |
| 4345 return kind == other.kind && | |
| 4346 file == other.file && | |
| 4347 offset == other.offset && | |
| 4348 length == other.length && | |
| 4349 validateOnly == other.validateOnly && | |
| 4350 options == other.options; | |
| 4351 } | |
| 4352 return false; | |
| 4353 } | |
| 4354 | |
| 4355 @override | |
| 4356 int get hashCode { | |
| 4357 int hash = 0; | |
| 4358 hash = JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 4359 hash = JenkinsSmiHash.combine(hash, file.hashCode); | |
| 4360 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 4361 hash = JenkinsSmiHash.combine(hash, length.hashCode); | |
| 4362 hash = JenkinsSmiHash.combine(hash, validateOnly.hashCode); | |
| 4363 hash = JenkinsSmiHash.combine(hash, options.hashCode); | |
| 4364 return JenkinsSmiHash.finish(hash); | |
| 4365 } | |
| 4366 } | |
| 4367 | |
| 4368 /** | |
| 4369 * edit.getRefactoring result | |
| 4370 * | |
| 4371 * { | |
| 4372 * "initialProblems": List<RefactoringProblem> | |
| 4373 * "optionsProblems": List<RefactoringProblem> | |
| 4374 * "finalProblems": List<RefactoringProblem> | |
| 4375 * "feedback": optional RefactoringFeedback | |
| 4376 * "change": optional SourceChange | |
| 4377 * "potentialEdits": optional List<String> | |
| 4378 * } | |
| 4379 * | |
| 4380 * Clients may not extend, implement or mix-in this class. | |
| 4381 */ | |
| 4382 class EditGetRefactoringResult implements ResponseResult { | |
| 4383 List<RefactoringProblem> _initialProblems; | |
| 4384 | |
| 4385 List<RefactoringProblem> _optionsProblems; | |
| 4386 | |
| 4387 List<RefactoringProblem> _finalProblems; | |
| 4388 | |
| 4389 RefactoringFeedback _feedback; | |
| 4390 | |
| 4391 SourceChange _change; | |
| 4392 | |
| 4393 List<String> _potentialEdits; | |
| 4394 | |
| 4395 /** | |
| 4396 * The initial status of the refactoring, that is, problems related to the | |
| 4397 * context in which the refactoring is requested. The list should be empty if | |
| 4398 * there are no known problems. | |
| 4399 */ | |
| 4400 List<RefactoringProblem> get initialProblems => _initialProblems; | |
| 4401 | |
| 4402 /** | |
| 4403 * The initial status of the refactoring, that is, problems related to the | |
| 4404 * context in which the refactoring is requested. The list should be empty if | |
| 4405 * there are no known problems. | |
| 4406 */ | |
| 4407 void set initialProblems(List<RefactoringProblem> value) { | |
| 4408 assert(value != null); | |
| 4409 this._initialProblems = value; | |
| 4410 } | |
| 4411 | |
| 4412 /** | |
| 4413 * The options validation status, that is, problems in the given options, | |
| 4414 * such as light-weight validation of a new name, flags compatibility, etc. | |
| 4415 * The list should be empty if there are no known problems. | |
| 4416 */ | |
| 4417 List<RefactoringProblem> get optionsProblems => _optionsProblems; | |
| 4418 | |
| 4419 /** | |
| 4420 * The options validation status, that is, problems in the given options, | |
| 4421 * such as light-weight validation of a new name, flags compatibility, etc. | |
| 4422 * The list should be empty if there are no known problems. | |
| 4423 */ | |
| 4424 void set optionsProblems(List<RefactoringProblem> value) { | |
| 4425 assert(value != null); | |
| 4426 this._optionsProblems = value; | |
| 4427 } | |
| 4428 | |
| 4429 /** | |
| 4430 * The final status of the refactoring, that is, problems identified in the | |
| 4431 * result of a full, potentially expensive validation and / or change | |
| 4432 * creation. The list should be empty if there are no known problems. | |
| 4433 */ | |
| 4434 List<RefactoringProblem> get finalProblems => _finalProblems; | |
| 4435 | |
| 4436 /** | |
| 4437 * The final status of the refactoring, that is, problems identified in the | |
| 4438 * result of a full, potentially expensive validation and / or change | |
| 4439 * creation. The list should be empty if there are no known problems. | |
| 4440 */ | |
| 4441 void set finalProblems(List<RefactoringProblem> value) { | |
| 4442 assert(value != null); | |
| 4443 this._finalProblems = value; | |
| 4444 } | |
| 4445 | |
| 4446 /** | |
| 4447 * Data used to provide feedback to the user. The structure of the data is | |
| 4448 * dependent on the kind of refactoring being created. The data that is | |
| 4449 * returned is documented in the section titled Refactorings, labeled as | |
| 4450 * "Feedback". | |
| 4451 */ | |
| 4452 RefactoringFeedback get feedback => _feedback; | |
| 4453 | |
| 4454 /** | |
| 4455 * Data used to provide feedback to the user. The structure of the data is | |
| 4456 * dependent on the kind of refactoring being created. The data that is | |
| 4457 * returned is documented in the section titled Refactorings, labeled as | |
| 4458 * "Feedback". | |
| 4459 */ | |
| 4460 void set feedback(RefactoringFeedback value) { | |
| 4461 this._feedback = value; | |
| 4462 } | |
| 4463 | |
| 4464 /** | |
| 4465 * The changes that are to be applied to affect the refactoring. This field | |
| 4466 * can be omitted if there are problems that prevent a set of changes from | |
| 4467 * being computed, such as having no options specified for a refactoring that | |
| 4468 * requires them, or if only validation was requested. | |
| 4469 */ | |
| 4470 SourceChange get change => _change; | |
| 4471 | |
| 4472 /** | |
| 4473 * The changes that are to be applied to affect the refactoring. This field | |
| 4474 * can be omitted if there are problems that prevent a set of changes from | |
| 4475 * being computed, such as having no options specified for a refactoring that | |
| 4476 * requires them, or if only validation was requested. | |
| 4477 */ | |
| 4478 void set change(SourceChange value) { | |
| 4479 this._change = value; | |
| 4480 } | |
| 4481 | |
| 4482 /** | |
| 4483 * The ids of source edits that are not known to be valid. An edit is not | |
| 4484 * known to be valid if there was insufficient type information for the | |
| 4485 * plugin to be able to determine whether or not the code needs to be | |
| 4486 * modified, such as when a member is being renamed and there is a reference | |
| 4487 * to a member from an unknown type. This field can be omitted if the change | |
| 4488 * field is omitted or if there are no potential edits for the refactoring. | |
| 4489 */ | |
| 4490 List<String> get potentialEdits => _potentialEdits; | |
| 4491 | |
| 4492 /** | |
| 4493 * The ids of source edits that are not known to be valid. An edit is not | |
| 4494 * known to be valid if there was insufficient type information for the | |
| 4495 * plugin to be able to determine whether or not the code needs to be | |
| 4496 * modified, such as when a member is being renamed and there is a reference | |
| 4497 * to a member from an unknown type. This field can be omitted if the change | |
| 4498 * field is omitted or if there are no potential edits for the refactoring. | |
| 4499 */ | |
| 4500 void set potentialEdits(List<String> value) { | |
| 4501 this._potentialEdits = value; | |
| 4502 } | |
| 4503 | |
| 4504 EditGetRefactoringResult(List<RefactoringProblem> initialProblems, List<Refact
oringProblem> optionsProblems, List<RefactoringProblem> finalProblems, {Refactor
ingFeedback feedback, SourceChange change, List<String> potentialEdits}) { | |
| 4505 this.initialProblems = initialProblems; | |
| 4506 this.optionsProblems = optionsProblems; | |
| 4507 this.finalProblems = finalProblems; | |
| 4508 this.feedback = feedback; | |
| 4509 this.change = change; | |
| 4510 this.potentialEdits = potentialEdits; | |
| 4511 } | |
| 4512 | |
| 4513 factory EditGetRefactoringResult.fromJson(JsonDecoder jsonDecoder, String json
Path, Object json) { | |
| 4514 if (json == null) { | |
| 4515 json = {}; | |
| 4516 } | |
| 4517 if (json is Map) { | |
| 4518 List<RefactoringProblem> initialProblems; | |
| 4519 if (json.containsKey("initialProblems")) { | |
| 4520 initialProblems = jsonDecoder.decodeList(jsonPath + ".initialProblems",
json["initialProblems"], (String jsonPath, Object json) => new RefactoringProble
m.fromJson(jsonDecoder, jsonPath, json)); | |
| 4521 } else { | |
| 4522 throw jsonDecoder.mismatch(jsonPath, "initialProblems"); | |
| 4523 } | |
| 4524 List<RefactoringProblem> optionsProblems; | |
| 4525 if (json.containsKey("optionsProblems")) { | |
| 4526 optionsProblems = jsonDecoder.decodeList(jsonPath + ".optionsProblems",
json["optionsProblems"], (String jsonPath, Object json) => new RefactoringProble
m.fromJson(jsonDecoder, jsonPath, json)); | |
| 4527 } else { | |
| 4528 throw jsonDecoder.mismatch(jsonPath, "optionsProblems"); | |
| 4529 } | |
| 4530 List<RefactoringProblem> finalProblems; | |
| 4531 if (json.containsKey("finalProblems")) { | |
| 4532 finalProblems = jsonDecoder.decodeList(jsonPath + ".finalProblems", json
["finalProblems"], (String jsonPath, Object json) => new RefactoringProblem.from
Json(jsonDecoder, jsonPath, json)); | |
| 4533 } else { | |
| 4534 throw jsonDecoder.mismatch(jsonPath, "finalProblems"); | |
| 4535 } | |
| 4536 RefactoringFeedback feedback; | |
| 4537 if (json.containsKey("feedback")) { | |
| 4538 feedback = new RefactoringFeedback.fromJson(jsonDecoder, jsonPath + ".fe
edback", json["feedback"], json); | |
| 4539 } | |
| 4540 SourceChange change; | |
| 4541 if (json.containsKey("change")) { | |
| 4542 change = new SourceChange.fromJson(jsonDecoder, jsonPath + ".change", js
on["change"]); | |
| 4543 } | |
| 4544 List<String> potentialEdits; | |
| 4545 if (json.containsKey("potentialEdits")) { | |
| 4546 potentialEdits = jsonDecoder.decodeList(jsonPath + ".potentialEdits", js
on["potentialEdits"], jsonDecoder.decodeString); | |
| 4547 } | |
| 4548 return new EditGetRefactoringResult(initialProblems, optionsProblems, fina
lProblems, feedback: feedback, change: change, potentialEdits: potentialEdits); | |
| 4549 } else { | |
| 4550 throw jsonDecoder.mismatch(jsonPath, "edit.getRefactoring result", json); | |
| 4551 } | |
| 4552 } | |
| 4553 | |
| 4554 factory EditGetRefactoringResult.fromResponse(Response response) { | |
| 4555 return new EditGetRefactoringResult.fromJson( | |
| 4556 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), "
result", response.result); | |
| 4557 } | |
| 4558 | |
| 4559 @override | |
| 4560 Map<String, dynamic> toJson() { | |
| 4561 Map<String, dynamic> result = {}; | |
| 4562 result["initialProblems"] = initialProblems.map((RefactoringProblem value) =
> value.toJson()).toList(); | |
| 4563 result["optionsProblems"] = optionsProblems.map((RefactoringProblem value) =
> value.toJson()).toList(); | |
| 4564 result["finalProblems"] = finalProblems.map((RefactoringProblem value) => va
lue.toJson()).toList(); | |
| 4565 if (feedback != null) { | |
| 4566 result["feedback"] = feedback.toJson(); | |
| 4567 } | |
| 4568 if (change != null) { | |
| 4569 result["change"] = change.toJson(); | |
| 4570 } | |
| 4571 if (potentialEdits != null) { | |
| 4572 result["potentialEdits"] = potentialEdits; | |
| 4573 } | |
| 4574 return result; | |
| 4575 } | |
| 4576 | |
| 4577 @override | |
| 4578 Response toResponse(String id) { | |
| 4579 return new Response(id, result: toJson()); | |
| 4580 } | |
| 4581 | |
| 4582 @override | |
| 4583 String toString() => JSON.encode(toJson()); | |
| 4584 | |
| 4585 @override | |
| 4586 bool operator==(other) { | |
| 4587 if (other is EditGetRefactoringResult) { | |
| 4588 return listEqual(initialProblems, other.initialProblems, (RefactoringProbl
em a, RefactoringProblem b) => a == b) && | |
| 4589 listEqual(optionsProblems, other.optionsProblems, (RefactoringProblem
a, RefactoringProblem b) => a == b) && | |
| 4590 listEqual(finalProblems, other.finalProblems, (RefactoringProblem a, R
efactoringProblem b) => a == b) && | |
| 4591 feedback == other.feedback && | |
| 4592 change == other.change && | |
| 4593 listEqual(potentialEdits, other.potentialEdits, (String a, String b) =
> a == b); | |
| 4594 } | |
| 4595 return false; | |
| 4596 } | |
| 4597 | |
| 4598 @override | |
| 4599 int get hashCode { | |
| 4600 int hash = 0; | |
| 4601 hash = JenkinsSmiHash.combine(hash, initialProblems.hashCode); | |
| 4602 hash = JenkinsSmiHash.combine(hash, optionsProblems.hashCode); | |
| 4603 hash = JenkinsSmiHash.combine(hash, finalProblems.hashCode); | |
| 4604 hash = JenkinsSmiHash.combine(hash, feedback.hashCode); | |
| 4605 hash = JenkinsSmiHash.combine(hash, change.hashCode); | |
| 4606 hash = JenkinsSmiHash.combine(hash, potentialEdits.hashCode); | |
| 4607 return JenkinsSmiHash.finish(hash); | |
| 4608 } | |
| 4609 } | |
| 4610 | |
| 4611 /** | |
| 4612 * Element | |
| 4613 * | |
| 4614 * { | |
| 4615 * "kind": ElementKind | |
| 4616 * "name": String | |
| 4617 * "location": optional Location | |
| 4618 * "flags": int | |
| 4619 * "parameters": optional String | |
| 4620 * "returnType": optional String | |
| 4621 * "typeParameters": optional String | |
| 4622 * } | |
| 4623 * | |
| 4624 * Clients may not extend, implement or mix-in this class. | |
| 4625 */ | |
| 4626 class Element implements HasToJson { | |
| 4627 static const int FLAG_ABSTRACT = 0x01; | |
| 4628 static const int FLAG_CONST = 0x02; | |
| 4629 static const int FLAG_FINAL = 0x04; | |
| 4630 static const int FLAG_STATIC = 0x08; | |
| 4631 static const int FLAG_PRIVATE = 0x10; | |
| 4632 static const int FLAG_DEPRECATED = 0x20; | |
| 4633 | |
| 4634 static int makeFlags({isAbstract: false, isConst: false, isFinal: false, isSta
tic: false, isPrivate: false, isDeprecated: false}) { | |
| 4635 int flags = 0; | |
| 4636 if (isAbstract) flags |= FLAG_ABSTRACT; | |
| 4637 if (isConst) flags |= FLAG_CONST; | |
| 4638 if (isFinal) flags |= FLAG_FINAL; | |
| 4639 if (isStatic) flags |= FLAG_STATIC; | |
| 4640 if (isPrivate) flags |= FLAG_PRIVATE; | |
| 4641 if (isDeprecated) flags |= FLAG_DEPRECATED; | |
| 4642 return flags; | |
| 4643 } | |
| 4644 | |
| 4645 ElementKind _kind; | |
| 4646 | |
| 4647 String _name; | |
| 4648 | |
| 4649 Location _location; | |
| 4650 | |
| 4651 int _flags; | |
| 4652 | |
| 4653 String _parameters; | |
| 4654 | |
| 4655 String _returnType; | |
| 4656 | |
| 4657 String _typeParameters; | |
| 4658 | |
| 4659 /** | |
| 4660 * The kind of the element. | |
| 4661 */ | |
| 4662 ElementKind get kind => _kind; | |
| 4663 | |
| 4664 /** | |
| 4665 * The kind of the element. | |
| 4666 */ | |
| 4667 void set kind(ElementKind value) { | |
| 4668 assert(value != null); | |
| 4669 this._kind = value; | |
| 4670 } | |
| 4671 | |
| 4672 /** | |
| 4673 * The name of the element. This is typically used as the label in the | |
| 4674 * outline. | |
| 4675 */ | |
| 4676 String get name => _name; | |
| 4677 | |
| 4678 /** | |
| 4679 * The name of the element. This is typically used as the label in the | |
| 4680 * outline. | |
| 4681 */ | |
| 4682 void set name(String value) { | |
| 4683 assert(value != null); | |
| 4684 this._name = value; | |
| 4685 } | |
| 4686 | |
| 4687 /** | |
| 4688 * The location of the name in the declaration of the element. | |
| 4689 */ | |
| 4690 Location get location => _location; | |
| 4691 | |
| 4692 /** | |
| 4693 * The location of the name in the declaration of the element. | |
| 4694 */ | |
| 4695 void set location(Location value) { | |
| 4696 this._location = value; | |
| 4697 } | |
| 4698 | |
| 4699 /** | |
| 4700 * A bit-map containing the following flags: | |
| 4701 * | |
| 4702 * - 0x01 - set if the element is explicitly or implicitly abstract | |
| 4703 * - 0x02 - set if the element was declared to be ‘const’ | |
| 4704 * - 0x04 - set if the element was declared to be ‘final’ | |
| 4705 * - 0x08 - set if the element is a static member of a class or is a | |
| 4706 * top-level function or field | |
| 4707 * - 0x10 - set if the element is private | |
| 4708 * - 0x20 - set if the element is deprecated | |
| 4709 */ | |
| 4710 int get flags => _flags; | |
| 4711 | |
| 4712 /** | |
| 4713 * A bit-map containing the following flags: | |
| 4714 * | |
| 4715 * - 0x01 - set if the element is explicitly or implicitly abstract | |
| 4716 * - 0x02 - set if the element was declared to be ‘const’ | |
| 4717 * - 0x04 - set if the element was declared to be ‘final’ | |
| 4718 * - 0x08 - set if the element is a static member of a class or is a | |
| 4719 * top-level function or field | |
| 4720 * - 0x10 - set if the element is private | |
| 4721 * - 0x20 - set if the element is deprecated | |
| 4722 */ | |
| 4723 void set flags(int value) { | |
| 4724 assert(value != null); | |
| 4725 this._flags = value; | |
| 4726 } | |
| 4727 | |
| 4728 /** | |
| 4729 * The parameter list for the element. If the element is not a method or | |
| 4730 * function this field will not be defined. If the element doesn't have | |
| 4731 * parameters (e.g. getter), this field will not be defined. If the element | |
| 4732 * has zero parameters, this field will have a value of "()". | |
| 4733 */ | |
| 4734 String get parameters => _parameters; | |
| 4735 | |
| 4736 /** | |
| 4737 * The parameter list for the element. If the element is not a method or | |
| 4738 * function this field will not be defined. If the element doesn't have | |
| 4739 * parameters (e.g. getter), this field will not be defined. If the element | |
| 4740 * has zero parameters, this field will have a value of "()". | |
| 4741 */ | |
| 4742 void set parameters(String value) { | |
| 4743 this._parameters = value; | |
| 4744 } | |
| 4745 | |
| 4746 /** | |
| 4747 * The return type of the element. If the element is not a method or function | |
| 4748 * this field will not be defined. If the element does not have a declared | |
| 4749 * return type, this field will contain an empty string. | |
| 4750 */ | |
| 4751 String get returnType => _returnType; | |
| 4752 | |
| 4753 /** | |
| 4754 * The return type of the element. If the element is not a method or function | |
| 4755 * this field will not be defined. If the element does not have a declared | |
| 4756 * return type, this field will contain an empty string. | |
| 4757 */ | |
| 4758 void set returnType(String value) { | |
| 4759 this._returnType = value; | |
| 4760 } | |
| 4761 | |
| 4762 /** | |
| 4763 * The type parameter list for the element. If the element doesn't have type | |
| 4764 * parameters, this field will not be defined. | |
| 4765 */ | |
| 4766 String get typeParameters => _typeParameters; | |
| 4767 | |
| 4768 /** | |
| 4769 * The type parameter list for the element. If the element doesn't have type | |
| 4770 * parameters, this field will not be defined. | |
| 4771 */ | |
| 4772 void set typeParameters(String value) { | |
| 4773 this._typeParameters = value; | |
| 4774 } | |
| 4775 | |
| 4776 Element(ElementKind kind, String name, int flags, {Location location, String p
arameters, String returnType, String typeParameters}) { | |
| 4777 this.kind = kind; | |
| 4778 this.name = name; | |
| 4779 this.location = location; | |
| 4780 this.flags = flags; | |
| 4781 this.parameters = parameters; | |
| 4782 this.returnType = returnType; | |
| 4783 this.typeParameters = typeParameters; | |
| 4784 } | |
| 4785 | |
| 4786 factory Element.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json
) { | |
| 4787 if (json == null) { | |
| 4788 json = {}; | |
| 4789 } | |
| 4790 if (json is Map) { | |
| 4791 ElementKind kind; | |
| 4792 if (json.containsKey("kind")) { | |
| 4793 kind = new ElementKind.fromJson(jsonDecoder, jsonPath + ".kind", json["k
ind"]); | |
| 4794 } else { | |
| 4795 throw jsonDecoder.mismatch(jsonPath, "kind"); | |
| 4796 } | |
| 4797 String name; | |
| 4798 if (json.containsKey("name")) { | |
| 4799 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]); | |
| 4800 } else { | |
| 4801 throw jsonDecoder.mismatch(jsonPath, "name"); | |
| 4802 } | |
| 4803 Location location; | |
| 4804 if (json.containsKey("location")) { | |
| 4805 location = new Location.fromJson(jsonDecoder, jsonPath + ".location", js
on["location"]); | |
| 4806 } | |
| 4807 int flags; | |
| 4808 if (json.containsKey("flags")) { | |
| 4809 flags = jsonDecoder.decodeInt(jsonPath + ".flags", json["flags"]); | |
| 4810 } else { | |
| 4811 throw jsonDecoder.mismatch(jsonPath, "flags"); | |
| 4812 } | |
| 4813 String parameters; | |
| 4814 if (json.containsKey("parameters")) { | |
| 4815 parameters = jsonDecoder.decodeString(jsonPath + ".parameters", json["pa
rameters"]); | |
| 4816 } | |
| 4817 String returnType; | |
| 4818 if (json.containsKey("returnType")) { | |
| 4819 returnType = jsonDecoder.decodeString(jsonPath + ".returnType", json["re
turnType"]); | |
| 4820 } | |
| 4821 String typeParameters; | |
| 4822 if (json.containsKey("typeParameters")) { | |
| 4823 typeParameters = jsonDecoder.decodeString(jsonPath + ".typeParameters",
json["typeParameters"]); | |
| 4824 } | |
| 4825 return new Element(kind, name, flags, location: location, parameters: para
meters, returnType: returnType, typeParameters: typeParameters); | |
| 4826 } else { | |
| 4827 throw jsonDecoder.mismatch(jsonPath, "Element", json); | |
| 4828 } | |
| 4829 } | |
| 4830 | |
| 4831 bool get isAbstract => (flags & FLAG_ABSTRACT) != 0; | |
| 4832 bool get isConst => (flags & FLAG_CONST) != 0; | |
| 4833 bool get isFinal => (flags & FLAG_FINAL) != 0; | |
| 4834 bool get isStatic => (flags & FLAG_STATIC) != 0; | |
| 4835 bool get isPrivate => (flags & FLAG_PRIVATE) != 0; | |
| 4836 bool get isDeprecated => (flags & FLAG_DEPRECATED) != 0; | |
| 4837 | |
| 4838 @override | |
| 4839 Map<String, dynamic> toJson() { | |
| 4840 Map<String, dynamic> result = {}; | |
| 4841 result["kind"] = kind.toJson(); | |
| 4842 result["name"] = name; | |
| 4843 if (location != null) { | |
| 4844 result["location"] = location.toJson(); | |
| 4845 } | |
| 4846 result["flags"] = flags; | |
| 4847 if (parameters != null) { | |
| 4848 result["parameters"] = parameters; | |
| 4849 } | |
| 4850 if (returnType != null) { | |
| 4851 result["returnType"] = returnType; | |
| 4852 } | |
| 4853 if (typeParameters != null) { | |
| 4854 result["typeParameters"] = typeParameters; | |
| 4855 } | |
| 4856 return result; | |
| 4857 } | |
| 4858 | |
| 4859 @override | |
| 4860 String toString() => JSON.encode(toJson()); | |
| 4861 | |
| 4862 @override | |
| 4863 bool operator==(other) { | |
| 4864 if (other is Element) { | |
| 4865 return kind == other.kind && | |
| 4866 name == other.name && | |
| 4867 location == other.location && | |
| 4868 flags == other.flags && | |
| 4869 parameters == other.parameters && | |
| 4870 returnType == other.returnType && | |
| 4871 typeParameters == other.typeParameters; | |
| 4872 } | |
| 4873 return false; | |
| 4874 } | |
| 4875 | |
| 4876 @override | |
| 4877 int get hashCode { | |
| 4878 int hash = 0; | |
| 4879 hash = JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 4880 hash = JenkinsSmiHash.combine(hash, name.hashCode); | |
| 4881 hash = JenkinsSmiHash.combine(hash, location.hashCode); | |
| 4882 hash = JenkinsSmiHash.combine(hash, flags.hashCode); | |
| 4883 hash = JenkinsSmiHash.combine(hash, parameters.hashCode); | |
| 4884 hash = JenkinsSmiHash.combine(hash, returnType.hashCode); | |
| 4885 hash = JenkinsSmiHash.combine(hash, typeParameters.hashCode); | |
| 4886 return JenkinsSmiHash.finish(hash); | |
| 4887 } | |
| 4888 } | |
| 4889 | |
| 4890 /** | |
| 4891 * ElementKind | |
| 4892 * | |
| 4893 * enum { | |
| 4894 * CLASS | |
| 4895 * CLASS_TYPE_ALIAS | |
| 4896 * COMPILATION_UNIT | |
| 4897 * CONSTRUCTOR | |
| 4898 * ENUM | |
| 4899 * ENUM_CONSTANT | |
| 4900 * FIELD | |
| 4901 * FILE | |
| 4902 * FUNCTION | |
| 4903 * FUNCTION_TYPE_ALIAS | |
| 4904 * GETTER | |
| 4905 * LABEL | |
| 4906 * LIBRARY | |
| 4907 * LOCAL_VARIABLE | |
| 4908 * METHOD | |
| 4909 * PARAMETER | |
| 4910 * PREFIX | |
| 4911 * SETTER | |
| 4912 * TOP_LEVEL_VARIABLE | |
| 4913 * TYPE_PARAMETER | |
| 4914 * UNKNOWN | |
| 4915 * } | |
| 4916 * | |
| 4917 * Clients may not extend, implement or mix-in this class. | |
| 4918 */ | |
| 4919 class ElementKind implements Enum { | |
| 4920 static const ElementKind CLASS = const ElementKind._("CLASS"); | |
| 4921 | |
| 4922 static const ElementKind CLASS_TYPE_ALIAS = const ElementKind._("CLASS_TYPE_AL
IAS"); | |
| 4923 | |
| 4924 static const ElementKind COMPILATION_UNIT = const ElementKind._("COMPILATION_U
NIT"); | |
| 4925 | |
| 4926 static const ElementKind CONSTRUCTOR = const ElementKind._("CONSTRUCTOR"); | |
| 4927 | |
| 4928 static const ElementKind ENUM = const ElementKind._("ENUM"); | |
| 4929 | |
| 4930 static const ElementKind ENUM_CONSTANT = const ElementKind._("ENUM_CONSTANT"); | |
| 4931 | |
| 4932 static const ElementKind FIELD = const ElementKind._("FIELD"); | |
| 4933 | |
| 4934 static const ElementKind FILE = const ElementKind._("FILE"); | |
| 4935 | |
| 4936 static const ElementKind FUNCTION = const ElementKind._("FUNCTION"); | |
| 4937 | |
| 4938 static const ElementKind FUNCTION_TYPE_ALIAS = const ElementKind._("FUNCTION_T
YPE_ALIAS"); | |
| 4939 | |
| 4940 static const ElementKind GETTER = const ElementKind._("GETTER"); | |
| 4941 | |
| 4942 static const ElementKind LABEL = const ElementKind._("LABEL"); | |
| 4943 | |
| 4944 static const ElementKind LIBRARY = const ElementKind._("LIBRARY"); | |
| 4945 | |
| 4946 static const ElementKind LOCAL_VARIABLE = const ElementKind._("LOCAL_VARIABLE"
); | |
| 4947 | |
| 4948 static const ElementKind METHOD = const ElementKind._("METHOD"); | |
| 4949 | |
| 4950 static const ElementKind PARAMETER = const ElementKind._("PARAMETER"); | |
| 4951 | |
| 4952 static const ElementKind PREFIX = const ElementKind._("PREFIX"); | |
| 4953 | |
| 4954 static const ElementKind SETTER = const ElementKind._("SETTER"); | |
| 4955 | |
| 4956 static const ElementKind TOP_LEVEL_VARIABLE = const ElementKind._("TOP_LEVEL_V
ARIABLE"); | |
| 4957 | |
| 4958 static const ElementKind TYPE_PARAMETER = const ElementKind._("TYPE_PARAMETER"
); | |
| 4959 | |
| 4960 static const ElementKind UNKNOWN = const ElementKind._("UNKNOWN"); | |
| 4961 | |
| 4962 /** | |
| 4963 * A list containing all of the enum values that are defined. | |
| 4964 */ | |
| 4965 static const List<ElementKind> VALUES = const <ElementKind>[CLASS, CLASS_TYPE_
ALIAS, COMPILATION_UNIT, CONSTRUCTOR, ENUM, ENUM_CONSTANT, FIELD, FILE, FUNCTION
, FUNCTION_TYPE_ALIAS, GETTER, LABEL, LIBRARY, LOCAL_VARIABLE, METHOD, PARAMETER
, PREFIX, SETTER, TOP_LEVEL_VARIABLE, TYPE_PARAMETER, UNKNOWN]; | |
| 4966 | |
| 4967 @override | |
| 4968 final String name; | |
| 4969 | |
| 4970 const ElementKind._(this.name); | |
| 4971 | |
| 4972 factory ElementKind(String name) { | |
| 4973 switch (name) { | |
| 4974 case "CLASS": | |
| 4975 return CLASS; | |
| 4976 case "CLASS_TYPE_ALIAS": | |
| 4977 return CLASS_TYPE_ALIAS; | |
| 4978 case "COMPILATION_UNIT": | |
| 4979 return COMPILATION_UNIT; | |
| 4980 case "CONSTRUCTOR": | |
| 4981 return CONSTRUCTOR; | |
| 4982 case "ENUM": | |
| 4983 return ENUM; | |
| 4984 case "ENUM_CONSTANT": | |
| 4985 return ENUM_CONSTANT; | |
| 4986 case "FIELD": | |
| 4987 return FIELD; | |
| 4988 case "FILE": | |
| 4989 return FILE; | |
| 4990 case "FUNCTION": | |
| 4991 return FUNCTION; | |
| 4992 case "FUNCTION_TYPE_ALIAS": | |
| 4993 return FUNCTION_TYPE_ALIAS; | |
| 4994 case "GETTER": | |
| 4995 return GETTER; | |
| 4996 case "LABEL": | |
| 4997 return LABEL; | |
| 4998 case "LIBRARY": | |
| 4999 return LIBRARY; | |
| 5000 case "LOCAL_VARIABLE": | |
| 5001 return LOCAL_VARIABLE; | |
| 5002 case "METHOD": | |
| 5003 return METHOD; | |
| 5004 case "PARAMETER": | |
| 5005 return PARAMETER; | |
| 5006 case "PREFIX": | |
| 5007 return PREFIX; | |
| 5008 case "SETTER": | |
| 5009 return SETTER; | |
| 5010 case "TOP_LEVEL_VARIABLE": | |
| 5011 return TOP_LEVEL_VARIABLE; | |
| 5012 case "TYPE_PARAMETER": | |
| 5013 return TYPE_PARAMETER; | |
| 5014 case "UNKNOWN": | |
| 5015 return UNKNOWN; | |
| 5016 } | |
| 5017 throw new Exception('Illegal enum value: $name'); | |
| 5018 } | |
| 5019 | |
| 5020 factory ElementKind.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object
json) { | |
| 5021 if (json is String) { | |
| 5022 try { | |
| 5023 return new ElementKind(json); | |
| 5024 } catch(_) { | |
| 5025 // Fall through | |
| 5026 } | |
| 5027 } | |
| 5028 throw jsonDecoder.mismatch(jsonPath, "ElementKind", json); | |
| 5029 } | |
| 5030 | |
| 5031 @override | |
| 5032 String toString() => "ElementKind.$name"; | |
| 5033 | |
| 5034 String toJson() => name; | |
| 5035 } | |
| 5036 | |
| 5037 /** | |
| 5038 * extractLocalVariable feedback | |
| 5039 * | |
| 5040 * { | |
| 5041 * "coveringExpressionOffsets": optional List<int> | |
| 5042 * "coveringExpressionLengths": optional List<int> | |
| 5043 * "names": List<String> | |
| 5044 * "offsets": List<int> | |
| 5045 * "lengths": List<int> | |
| 5046 * } | |
| 5047 * | |
| 5048 * Clients may not extend, implement or mix-in this class. | |
| 5049 */ | |
| 5050 class ExtractLocalVariableFeedback extends RefactoringFeedback { | |
| 5051 List<int> _coveringExpressionOffsets; | |
| 5052 | |
| 5053 List<int> _coveringExpressionLengths; | |
| 5054 | |
| 5055 List<String> _names; | |
| 5056 | |
| 5057 List<int> _offsets; | |
| 5058 | |
| 5059 List<int> _lengths; | |
| 5060 | |
| 5061 /** | |
| 5062 * The offsets of the expressions that cover the specified selection, from | |
| 5063 * the down most to the up most. | |
| 5064 */ | |
| 5065 List<int> get coveringExpressionOffsets => _coveringExpressionOffsets; | |
| 5066 | |
| 5067 /** | |
| 5068 * The offsets of the expressions that cover the specified selection, from | |
| 5069 * the down most to the up most. | |
| 5070 */ | |
| 5071 void set coveringExpressionOffsets(List<int> value) { | |
| 5072 this._coveringExpressionOffsets = value; | |
| 5073 } | |
| 5074 | |
| 5075 /** | |
| 5076 * The lengths of the expressions that cover the specified selection, from | |
| 5077 * the down most to the up most. | |
| 5078 */ | |
| 5079 List<int> get coveringExpressionLengths => _coveringExpressionLengths; | |
| 5080 | |
| 5081 /** | |
| 5082 * The lengths of the expressions that cover the specified selection, from | |
| 5083 * the down most to the up most. | |
| 5084 */ | |
| 5085 void set coveringExpressionLengths(List<int> value) { | |
| 5086 this._coveringExpressionLengths = value; | |
| 5087 } | |
| 5088 | |
| 5089 /** | |
| 5090 * The proposed names for the local variable. | |
| 5091 */ | |
| 5092 List<String> get names => _names; | |
| 5093 | |
| 5094 /** | |
| 5095 * The proposed names for the local variable. | |
| 5096 */ | |
| 5097 void set names(List<String> value) { | |
| 5098 assert(value != null); | |
| 5099 this._names = value; | |
| 5100 } | |
| 5101 | |
| 5102 /** | |
| 5103 * The offsets of the expressions that would be replaced by a reference to | |
| 5104 * the variable. | |
| 5105 */ | |
| 5106 List<int> get offsets => _offsets; | |
| 5107 | |
| 5108 /** | |
| 5109 * The offsets of the expressions that would be replaced by a reference to | |
| 5110 * the variable. | |
| 5111 */ | |
| 5112 void set offsets(List<int> value) { | |
| 5113 assert(value != null); | |
| 5114 this._offsets = value; | |
| 5115 } | |
| 5116 | |
| 5117 /** | |
| 5118 * The lengths of the expressions that would be replaced by a reference to | |
| 5119 * the variable. The lengths correspond to the offsets. In other words, for a | |
| 5120 * given expression, if the offset of that expression is offsets[i], then the | |
| 5121 * length of that expression is lengths[i]. | |
| 5122 */ | |
| 5123 List<int> get lengths => _lengths; | |
| 5124 | |
| 5125 /** | |
| 5126 * The lengths of the expressions that would be replaced by a reference to | |
| 5127 * the variable. The lengths correspond to the offsets. In other words, for a | |
| 5128 * given expression, if the offset of that expression is offsets[i], then the | |
| 5129 * length of that expression is lengths[i]. | |
| 5130 */ | |
| 5131 void set lengths(List<int> value) { | |
| 5132 assert(value != null); | |
| 5133 this._lengths = value; | |
| 5134 } | |
| 5135 | |
| 5136 ExtractLocalVariableFeedback(List<String> names, List<int> offsets, List<int>
lengths, {List<int> coveringExpressionOffsets, List<int> coveringExpressionLengt
hs}) { | |
| 5137 this.coveringExpressionOffsets = coveringExpressionOffsets; | |
| 5138 this.coveringExpressionLengths = coveringExpressionLengths; | |
| 5139 this.names = names; | |
| 5140 this.offsets = offsets; | |
| 5141 this.lengths = lengths; | |
| 5142 } | |
| 5143 | |
| 5144 factory ExtractLocalVariableFeedback.fromJson(JsonDecoder jsonDecoder, String
jsonPath, Object json) { | |
| 5145 if (json == null) { | |
| 5146 json = {}; | |
| 5147 } | |
| 5148 if (json is Map) { | |
| 5149 List<int> coveringExpressionOffsets; | |
| 5150 if (json.containsKey("coveringExpressionOffsets")) { | |
| 5151 coveringExpressionOffsets = jsonDecoder.decodeList(jsonPath + ".covering
ExpressionOffsets", json["coveringExpressionOffsets"], jsonDecoder.decodeInt); | |
| 5152 } | |
| 5153 List<int> coveringExpressionLengths; | |
| 5154 if (json.containsKey("coveringExpressionLengths")) { | |
| 5155 coveringExpressionLengths = jsonDecoder.decodeList(jsonPath + ".covering
ExpressionLengths", json["coveringExpressionLengths"], jsonDecoder.decodeInt); | |
| 5156 } | |
| 5157 List<String> names; | |
| 5158 if (json.containsKey("names")) { | |
| 5159 names = jsonDecoder.decodeList(jsonPath + ".names", json["names"], jsonD
ecoder.decodeString); | |
| 5160 } else { | |
| 5161 throw jsonDecoder.mismatch(jsonPath, "names"); | |
| 5162 } | |
| 5163 List<int> offsets; | |
| 5164 if (json.containsKey("offsets")) { | |
| 5165 offsets = jsonDecoder.decodeList(jsonPath + ".offsets", json["offsets"],
jsonDecoder.decodeInt); | |
| 5166 } else { | |
| 5167 throw jsonDecoder.mismatch(jsonPath, "offsets"); | |
| 5168 } | |
| 5169 List<int> lengths; | |
| 5170 if (json.containsKey("lengths")) { | |
| 5171 lengths = jsonDecoder.decodeList(jsonPath + ".lengths", json["lengths"],
jsonDecoder.decodeInt); | |
| 5172 } else { | |
| 5173 throw jsonDecoder.mismatch(jsonPath, "lengths"); | |
| 5174 } | |
| 5175 return new ExtractLocalVariableFeedback(names, offsets, lengths, coveringE
xpressionOffsets: coveringExpressionOffsets, coveringExpressionLengths: covering
ExpressionLengths); | |
| 5176 } else { | |
| 5177 throw jsonDecoder.mismatch(jsonPath, "extractLocalVariable feedback", json
); | |
| 5178 } | |
| 5179 } | |
| 5180 | |
| 5181 @override | |
| 5182 Map<String, dynamic> toJson() { | |
| 5183 Map<String, dynamic> result = {}; | |
| 5184 if (coveringExpressionOffsets != null) { | |
| 5185 result["coveringExpressionOffsets"] = coveringExpressionOffsets; | |
| 5186 } | |
| 5187 if (coveringExpressionLengths != null) { | |
| 5188 result["coveringExpressionLengths"] = coveringExpressionLengths; | |
| 5189 } | |
| 5190 result["names"] = names; | |
| 5191 result["offsets"] = offsets; | |
| 5192 result["lengths"] = lengths; | |
| 5193 return result; | |
| 5194 } | |
| 5195 | |
| 5196 @override | |
| 5197 String toString() => JSON.encode(toJson()); | |
| 5198 | |
| 5199 @override | |
| 5200 bool operator==(other) { | |
| 5201 if (other is ExtractLocalVariableFeedback) { | |
| 5202 return listEqual(coveringExpressionOffsets, other.coveringExpressionOffset
s, (int a, int b) => a == b) && | |
| 5203 listEqual(coveringExpressionLengths, other.coveringExpressionLengths,
(int a, int b) => a == b) && | |
| 5204 listEqual(names, other.names, (String a, String b) => a == b) && | |
| 5205 listEqual(offsets, other.offsets, (int a, int b) => a == b) && | |
| 5206 listEqual(lengths, other.lengths, (int a, int b) => a == b); | |
| 5207 } | |
| 5208 return false; | |
| 5209 } | |
| 5210 | |
| 5211 @override | |
| 5212 int get hashCode { | |
| 5213 int hash = 0; | |
| 5214 hash = JenkinsSmiHash.combine(hash, coveringExpressionOffsets.hashCode); | |
| 5215 hash = JenkinsSmiHash.combine(hash, coveringExpressionLengths.hashCode); | |
| 5216 hash = JenkinsSmiHash.combine(hash, names.hashCode); | |
| 5217 hash = JenkinsSmiHash.combine(hash, offsets.hashCode); | |
| 5218 hash = JenkinsSmiHash.combine(hash, lengths.hashCode); | |
| 5219 return JenkinsSmiHash.finish(hash); | |
| 5220 } | |
| 5221 } | |
| 5222 | |
| 5223 /** | |
| 5224 * extractLocalVariable options | |
| 5225 * | |
| 5226 * { | |
| 5227 * "name": String | |
| 5228 * "extractAll": bool | |
| 5229 * } | |
| 5230 * | |
| 5231 * Clients may not extend, implement or mix-in this class. | |
| 5232 */ | |
| 5233 class ExtractLocalVariableOptions extends RefactoringOptions { | |
| 5234 String _name; | |
| 5235 | |
| 5236 bool _extractAll; | |
| 5237 | |
| 5238 /** | |
| 5239 * The name that the local variable should be given. | |
| 5240 */ | |
| 5241 String get name => _name; | |
| 5242 | |
| 5243 /** | |
| 5244 * The name that the local variable should be given. | |
| 5245 */ | |
| 5246 void set name(String value) { | |
| 5247 assert(value != null); | |
| 5248 this._name = value; | |
| 5249 } | |
| 5250 | |
| 5251 /** | |
| 5252 * True if all occurrences of the expression within the scope in which the | |
| 5253 * variable will be defined should be replaced by a reference to the local | |
| 5254 * variable. The expression used to initiate the refactoring will always be | |
| 5255 * replaced. | |
| 5256 */ | |
| 5257 bool get extractAll => _extractAll; | |
| 5258 | |
| 5259 /** | |
| 5260 * True if all occurrences of the expression within the scope in which the | |
| 5261 * variable will be defined should be replaced by a reference to the local | |
| 5262 * variable. The expression used to initiate the refactoring will always be | |
| 5263 * replaced. | |
| 5264 */ | |
| 5265 void set extractAll(bool value) { | |
| 5266 assert(value != null); | |
| 5267 this._extractAll = value; | |
| 5268 } | |
| 5269 | |
| 5270 ExtractLocalVariableOptions(String name, bool extractAll) { | |
| 5271 this.name = name; | |
| 5272 this.extractAll = extractAll; | |
| 5273 } | |
| 5274 | |
| 5275 factory ExtractLocalVariableOptions.fromJson(JsonDecoder jsonDecoder, String j
sonPath, Object json) { | |
| 5276 if (json == null) { | |
| 5277 json = {}; | |
| 5278 } | |
| 5279 if (json is Map) { | |
| 5280 String name; | |
| 5281 if (json.containsKey("name")) { | |
| 5282 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]); | |
| 5283 } else { | |
| 5284 throw jsonDecoder.mismatch(jsonPath, "name"); | |
| 5285 } | |
| 5286 bool extractAll; | |
| 5287 if (json.containsKey("extractAll")) { | |
| 5288 extractAll = jsonDecoder.decodeBool(jsonPath + ".extractAll", json["extr
actAll"]); | |
| 5289 } else { | |
| 5290 throw jsonDecoder.mismatch(jsonPath, "extractAll"); | |
| 5291 } | |
| 5292 return new ExtractLocalVariableOptions(name, extractAll); | |
| 5293 } else { | |
| 5294 throw jsonDecoder.mismatch(jsonPath, "extractLocalVariable options", json)
; | |
| 5295 } | |
| 5296 } | |
| 5297 | |
| 5298 factory ExtractLocalVariableOptions.fromRefactoringParams(EditGetRefactoringPa
rams refactoringParams, Request request) { | |
| 5299 return new ExtractLocalVariableOptions.fromJson( | |
| 5300 new RequestDecoder(request), "options", refactoringParams.options); | |
| 5301 } | |
| 5302 | |
| 5303 @override | |
| 5304 Map<String, dynamic> toJson() { | |
| 5305 Map<String, dynamic> result = {}; | |
| 5306 result["name"] = name; | |
| 5307 result["extractAll"] = extractAll; | |
| 5308 return result; | |
| 5309 } | |
| 5310 | |
| 5311 @override | |
| 5312 String toString() => JSON.encode(toJson()); | |
| 5313 | |
| 5314 @override | |
| 5315 bool operator==(other) { | |
| 5316 if (other is ExtractLocalVariableOptions) { | |
| 5317 return name == other.name && | |
| 5318 extractAll == other.extractAll; | |
| 5319 } | |
| 5320 return false; | |
| 5321 } | |
| 5322 | |
| 5323 @override | |
| 5324 int get hashCode { | |
| 5325 int hash = 0; | |
| 5326 hash = JenkinsSmiHash.combine(hash, name.hashCode); | |
| 5327 hash = JenkinsSmiHash.combine(hash, extractAll.hashCode); | |
| 5328 return JenkinsSmiHash.finish(hash); | |
| 5329 } | |
| 5330 } | |
| 5331 | |
| 5332 /** | |
| 5333 * extractMethod feedback | |
| 5334 * | |
| 5335 * { | |
| 5336 * "offset": int | |
| 5337 * "length": int | |
| 5338 * "returnType": String | |
| 5339 * "names": List<String> | |
| 5340 * "canCreateGetter": bool | |
| 5341 * "parameters": List<RefactoringMethodParameter> | |
| 5342 * "offsets": List<int> | |
| 5343 * "lengths": List<int> | |
| 5344 * } | |
| 5345 * | |
| 5346 * Clients may not extend, implement or mix-in this class. | |
| 5347 */ | |
| 5348 class ExtractMethodFeedback extends RefactoringFeedback { | |
| 5349 int _offset; | |
| 5350 | |
| 5351 int _length; | |
| 5352 | |
| 5353 String _returnType; | |
| 5354 | |
| 5355 List<String> _names; | |
| 5356 | |
| 5357 bool _canCreateGetter; | |
| 5358 | |
| 5359 List<RefactoringMethodParameter> _parameters; | |
| 5360 | |
| 5361 List<int> _offsets; | |
| 5362 | |
| 5363 List<int> _lengths; | |
| 5364 | |
| 5365 /** | |
| 5366 * The offset to the beginning of the expression or statements that will be | |
| 5367 * extracted. | |
| 5368 */ | |
| 5369 int get offset => _offset; | |
| 5370 | |
| 5371 /** | |
| 5372 * The offset to the beginning of the expression or statements that will be | |
| 5373 * extracted. | |
| 5374 */ | |
| 5375 void set offset(int value) { | |
| 5376 assert(value != null); | |
| 5377 this._offset = value; | |
| 5378 } | |
| 5379 | |
| 5380 /** | |
| 5381 * The length of the expression or statements that will be extracted. | |
| 5382 */ | |
| 5383 int get length => _length; | |
| 5384 | |
| 5385 /** | |
| 5386 * The length of the expression or statements that will be extracted. | |
| 5387 */ | |
| 5388 void set length(int value) { | |
| 5389 assert(value != null); | |
| 5390 this._length = value; | |
| 5391 } | |
| 5392 | |
| 5393 /** | |
| 5394 * The proposed return type for the method. If the returned element does not | |
| 5395 * have a declared return type, this field will contain an empty string. | |
| 5396 */ | |
| 5397 String get returnType => _returnType; | |
| 5398 | |
| 5399 /** | |
| 5400 * The proposed return type for the method. If the returned element does not | |
| 5401 * have a declared return type, this field will contain an empty string. | |
| 5402 */ | |
| 5403 void set returnType(String value) { | |
| 5404 assert(value != null); | |
| 5405 this._returnType = value; | |
| 5406 } | |
| 5407 | |
| 5408 /** | |
| 5409 * The proposed names for the method. | |
| 5410 */ | |
| 5411 List<String> get names => _names; | |
| 5412 | |
| 5413 /** | |
| 5414 * The proposed names for the method. | |
| 5415 */ | |
| 5416 void set names(List<String> value) { | |
| 5417 assert(value != null); | |
| 5418 this._names = value; | |
| 5419 } | |
| 5420 | |
| 5421 /** | |
| 5422 * True if a getter could be created rather than a method. | |
| 5423 */ | |
| 5424 bool get canCreateGetter => _canCreateGetter; | |
| 5425 | |
| 5426 /** | |
| 5427 * True if a getter could be created rather than a method. | |
| 5428 */ | |
| 5429 void set canCreateGetter(bool value) { | |
| 5430 assert(value != null); | |
| 5431 this._canCreateGetter = value; | |
| 5432 } | |
| 5433 | |
| 5434 /** | |
| 5435 * The proposed parameters for the method. | |
| 5436 */ | |
| 5437 List<RefactoringMethodParameter> get parameters => _parameters; | |
| 5438 | |
| 5439 /** | |
| 5440 * The proposed parameters for the method. | |
| 5441 */ | |
| 5442 void set parameters(List<RefactoringMethodParameter> value) { | |
| 5443 assert(value != null); | |
| 5444 this._parameters = value; | |
| 5445 } | |
| 5446 | |
| 5447 /** | |
| 5448 * The offsets of the expressions or statements that would be replaced by an | |
| 5449 * invocation of the method. | |
| 5450 */ | |
| 5451 List<int> get offsets => _offsets; | |
| 5452 | |
| 5453 /** | |
| 5454 * The offsets of the expressions or statements that would be replaced by an | |
| 5455 * invocation of the method. | |
| 5456 */ | |
| 5457 void set offsets(List<int> value) { | |
| 5458 assert(value != null); | |
| 5459 this._offsets = value; | |
| 5460 } | |
| 5461 | |
| 5462 /** | |
| 5463 * The lengths of the expressions or statements that would be replaced by an | |
| 5464 * invocation of the method. The lengths correspond to the offsets. In other | |
| 5465 * words, for a given expression (or block of statements), if the offset of | |
| 5466 * that expression is offsets[i], then the length of that expression is | |
| 5467 * lengths[i]. | |
| 5468 */ | |
| 5469 List<int> get lengths => _lengths; | |
| 5470 | |
| 5471 /** | |
| 5472 * The lengths of the expressions or statements that would be replaced by an | |
| 5473 * invocation of the method. The lengths correspond to the offsets. In other | |
| 5474 * words, for a given expression (or block of statements), if the offset of | |
| 5475 * that expression is offsets[i], then the length of that expression is | |
| 5476 * lengths[i]. | |
| 5477 */ | |
| 5478 void set lengths(List<int> value) { | |
| 5479 assert(value != null); | |
| 5480 this._lengths = value; | |
| 5481 } | |
| 5482 | |
| 5483 ExtractMethodFeedback(int offset, int length, String returnType, List<String>
names, bool canCreateGetter, List<RefactoringMethodParameter> parameters, List<i
nt> offsets, List<int> lengths) { | |
| 5484 this.offset = offset; | |
| 5485 this.length = length; | |
| 5486 this.returnType = returnType; | |
| 5487 this.names = names; | |
| 5488 this.canCreateGetter = canCreateGetter; | |
| 5489 this.parameters = parameters; | |
| 5490 this.offsets = offsets; | |
| 5491 this.lengths = lengths; | |
| 5492 } | |
| 5493 | |
| 5494 factory ExtractMethodFeedback.fromJson(JsonDecoder jsonDecoder, String jsonPat
h, Object json) { | |
| 5495 if (json == null) { | |
| 5496 json = {}; | |
| 5497 } | |
| 5498 if (json is Map) { | |
| 5499 int offset; | |
| 5500 if (json.containsKey("offset")) { | |
| 5501 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 5502 } else { | |
| 5503 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 5504 } | |
| 5505 int length; | |
| 5506 if (json.containsKey("length")) { | |
| 5507 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); | |
| 5508 } else { | |
| 5509 throw jsonDecoder.mismatch(jsonPath, "length"); | |
| 5510 } | |
| 5511 String returnType; | |
| 5512 if (json.containsKey("returnType")) { | |
| 5513 returnType = jsonDecoder.decodeString(jsonPath + ".returnType", json["re
turnType"]); | |
| 5514 } else { | |
| 5515 throw jsonDecoder.mismatch(jsonPath, "returnType"); | |
| 5516 } | |
| 5517 List<String> names; | |
| 5518 if (json.containsKey("names")) { | |
| 5519 names = jsonDecoder.decodeList(jsonPath + ".names", json["names"], jsonD
ecoder.decodeString); | |
| 5520 } else { | |
| 5521 throw jsonDecoder.mismatch(jsonPath, "names"); | |
| 5522 } | |
| 5523 bool canCreateGetter; | |
| 5524 if (json.containsKey("canCreateGetter")) { | |
| 5525 canCreateGetter = jsonDecoder.decodeBool(jsonPath + ".canCreateGetter",
json["canCreateGetter"]); | |
| 5526 } else { | |
| 5527 throw jsonDecoder.mismatch(jsonPath, "canCreateGetter"); | |
| 5528 } | |
| 5529 List<RefactoringMethodParameter> parameters; | |
| 5530 if (json.containsKey("parameters")) { | |
| 5531 parameters = jsonDecoder.decodeList(jsonPath + ".parameters", json["para
meters"], (String jsonPath, Object json) => new RefactoringMethodParameter.fromJ
son(jsonDecoder, jsonPath, json)); | |
| 5532 } else { | |
| 5533 throw jsonDecoder.mismatch(jsonPath, "parameters"); | |
| 5534 } | |
| 5535 List<int> offsets; | |
| 5536 if (json.containsKey("offsets")) { | |
| 5537 offsets = jsonDecoder.decodeList(jsonPath + ".offsets", json["offsets"],
jsonDecoder.decodeInt); | |
| 5538 } else { | |
| 5539 throw jsonDecoder.mismatch(jsonPath, "offsets"); | |
| 5540 } | |
| 5541 List<int> lengths; | |
| 5542 if (json.containsKey("lengths")) { | |
| 5543 lengths = jsonDecoder.decodeList(jsonPath + ".lengths", json["lengths"],
jsonDecoder.decodeInt); | |
| 5544 } else { | |
| 5545 throw jsonDecoder.mismatch(jsonPath, "lengths"); | |
| 5546 } | |
| 5547 return new ExtractMethodFeedback(offset, length, returnType, names, canCre
ateGetter, parameters, offsets, lengths); | |
| 5548 } else { | |
| 5549 throw jsonDecoder.mismatch(jsonPath, "extractMethod feedback", json); | |
| 5550 } | |
| 5551 } | |
| 5552 | |
| 5553 @override | |
| 5554 Map<String, dynamic> toJson() { | |
| 5555 Map<String, dynamic> result = {}; | |
| 5556 result["offset"] = offset; | |
| 5557 result["length"] = length; | |
| 5558 result["returnType"] = returnType; | |
| 5559 result["names"] = names; | |
| 5560 result["canCreateGetter"] = canCreateGetter; | |
| 5561 result["parameters"] = parameters.map((RefactoringMethodParameter value) =>
value.toJson()).toList(); | |
| 5562 result["offsets"] = offsets; | |
| 5563 result["lengths"] = lengths; | |
| 5564 return result; | |
| 5565 } | |
| 5566 | |
| 5567 @override | |
| 5568 String toString() => JSON.encode(toJson()); | |
| 5569 | |
| 5570 @override | |
| 5571 bool operator==(other) { | |
| 5572 if (other is ExtractMethodFeedback) { | |
| 5573 return offset == other.offset && | |
| 5574 length == other.length && | |
| 5575 returnType == other.returnType && | |
| 5576 listEqual(names, other.names, (String a, String b) => a == b) && | |
| 5577 canCreateGetter == other.canCreateGetter && | |
| 5578 listEqual(parameters, other.parameters, (RefactoringMethodParameter a,
RefactoringMethodParameter b) => a == b) && | |
| 5579 listEqual(offsets, other.offsets, (int a, int b) => a == b) && | |
| 5580 listEqual(lengths, other.lengths, (int a, int b) => a == b); | |
| 5581 } | |
| 5582 return false; | |
| 5583 } | |
| 5584 | |
| 5585 @override | |
| 5586 int get hashCode { | |
| 5587 int hash = 0; | |
| 5588 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 5589 hash = JenkinsSmiHash.combine(hash, length.hashCode); | |
| 5590 hash = JenkinsSmiHash.combine(hash, returnType.hashCode); | |
| 5591 hash = JenkinsSmiHash.combine(hash, names.hashCode); | |
| 5592 hash = JenkinsSmiHash.combine(hash, canCreateGetter.hashCode); | |
| 5593 hash = JenkinsSmiHash.combine(hash, parameters.hashCode); | |
| 5594 hash = JenkinsSmiHash.combine(hash, offsets.hashCode); | |
| 5595 hash = JenkinsSmiHash.combine(hash, lengths.hashCode); | |
| 5596 return JenkinsSmiHash.finish(hash); | |
| 5597 } | |
| 5598 } | |
| 5599 | |
| 5600 /** | |
| 5601 * extractMethod options | |
| 5602 * | |
| 5603 * { | |
| 5604 * "returnType": String | |
| 5605 * "createGetter": bool | |
| 5606 * "name": String | |
| 5607 * "parameters": List<RefactoringMethodParameter> | |
| 5608 * "extractAll": bool | |
| 5609 * } | |
| 5610 * | |
| 5611 * Clients may not extend, implement or mix-in this class. | |
| 5612 */ | |
| 5613 class ExtractMethodOptions extends RefactoringOptions { | |
| 5614 String _returnType; | |
| 5615 | |
| 5616 bool _createGetter; | |
| 5617 | |
| 5618 String _name; | |
| 5619 | |
| 5620 List<RefactoringMethodParameter> _parameters; | |
| 5621 | |
| 5622 bool _extractAll; | |
| 5623 | |
| 5624 /** | |
| 5625 * The return type that should be defined for the method. | |
| 5626 */ | |
| 5627 String get returnType => _returnType; | |
| 5628 | |
| 5629 /** | |
| 5630 * The return type that should be defined for the method. | |
| 5631 */ | |
| 5632 void set returnType(String value) { | |
| 5633 assert(value != null); | |
| 5634 this._returnType = value; | |
| 5635 } | |
| 5636 | |
| 5637 /** | |
| 5638 * True if a getter should be created rather than a method. It is an error if | |
| 5639 * this field is true and the list of parameters is non-empty. | |
| 5640 */ | |
| 5641 bool get createGetter => _createGetter; | |
| 5642 | |
| 5643 /** | |
| 5644 * True if a getter should be created rather than a method. It is an error if | |
| 5645 * this field is true and the list of parameters is non-empty. | |
| 5646 */ | |
| 5647 void set createGetter(bool value) { | |
| 5648 assert(value != null); | |
| 5649 this._createGetter = value; | |
| 5650 } | |
| 5651 | |
| 5652 /** | |
| 5653 * The name that the method should be given. | |
| 5654 */ | |
| 5655 String get name => _name; | |
| 5656 | |
| 5657 /** | |
| 5658 * The name that the method should be given. | |
| 5659 */ | |
| 5660 void set name(String value) { | |
| 5661 assert(value != null); | |
| 5662 this._name = value; | |
| 5663 } | |
| 5664 | |
| 5665 /** | |
| 5666 * The parameters that should be defined for the method. | |
| 5667 * | |
| 5668 * It is an error if a REQUIRED or NAMED parameter follows a POSITIONAL | |
| 5669 * parameter. It is an error if a REQUIRED or POSITIONAL parameter follows a | |
| 5670 * NAMED parameter. | |
| 5671 * | |
| 5672 * - To change the order and/or update proposed parameters, add parameters | |
| 5673 * with the same identifiers as proposed. | |
| 5674 * - To add new parameters, omit their identifier. | |
| 5675 * - To remove some parameters, omit them in this list. | |
| 5676 */ | |
| 5677 List<RefactoringMethodParameter> get parameters => _parameters; | |
| 5678 | |
| 5679 /** | |
| 5680 * The parameters that should be defined for the method. | |
| 5681 * | |
| 5682 * It is an error if a REQUIRED or NAMED parameter follows a POSITIONAL | |
| 5683 * parameter. It is an error if a REQUIRED or POSITIONAL parameter follows a | |
| 5684 * NAMED parameter. | |
| 5685 * | |
| 5686 * - To change the order and/or update proposed parameters, add parameters | |
| 5687 * with the same identifiers as proposed. | |
| 5688 * - To add new parameters, omit their identifier. | |
| 5689 * - To remove some parameters, omit them in this list. | |
| 5690 */ | |
| 5691 void set parameters(List<RefactoringMethodParameter> value) { | |
| 5692 assert(value != null); | |
| 5693 this._parameters = value; | |
| 5694 } | |
| 5695 | |
| 5696 /** | |
| 5697 * True if all occurrences of the expression or statements should be replaced | |
| 5698 * by an invocation of the method. The expression or statements used to | |
| 5699 * initiate the refactoring will always be replaced. | |
| 5700 */ | |
| 5701 bool get extractAll => _extractAll; | |
| 5702 | |
| 5703 /** | |
| 5704 * True if all occurrences of the expression or statements should be replaced | |
| 5705 * by an invocation of the method. The expression or statements used to | |
| 5706 * initiate the refactoring will always be replaced. | |
| 5707 */ | |
| 5708 void set extractAll(bool value) { | |
| 5709 assert(value != null); | |
| 5710 this._extractAll = value; | |
| 5711 } | |
| 5712 | |
| 5713 ExtractMethodOptions(String returnType, bool createGetter, String name, List<R
efactoringMethodParameter> parameters, bool extractAll) { | |
| 5714 this.returnType = returnType; | |
| 5715 this.createGetter = createGetter; | |
| 5716 this.name = name; | |
| 5717 this.parameters = parameters; | |
| 5718 this.extractAll = extractAll; | |
| 5719 } | |
| 5720 | |
| 5721 factory ExtractMethodOptions.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 5722 if (json == null) { | |
| 5723 json = {}; | |
| 5724 } | |
| 5725 if (json is Map) { | |
| 5726 String returnType; | |
| 5727 if (json.containsKey("returnType")) { | |
| 5728 returnType = jsonDecoder.decodeString(jsonPath + ".returnType", json["re
turnType"]); | |
| 5729 } else { | |
| 5730 throw jsonDecoder.mismatch(jsonPath, "returnType"); | |
| 5731 } | |
| 5732 bool createGetter; | |
| 5733 if (json.containsKey("createGetter")) { | |
| 5734 createGetter = jsonDecoder.decodeBool(jsonPath + ".createGetter", json["
createGetter"]); | |
| 5735 } else { | |
| 5736 throw jsonDecoder.mismatch(jsonPath, "createGetter"); | |
| 5737 } | |
| 5738 String name; | |
| 5739 if (json.containsKey("name")) { | |
| 5740 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]); | |
| 5741 } else { | |
| 5742 throw jsonDecoder.mismatch(jsonPath, "name"); | |
| 5743 } | |
| 5744 List<RefactoringMethodParameter> parameters; | |
| 5745 if (json.containsKey("parameters")) { | |
| 5746 parameters = jsonDecoder.decodeList(jsonPath + ".parameters", json["para
meters"], (String jsonPath, Object json) => new RefactoringMethodParameter.fromJ
son(jsonDecoder, jsonPath, json)); | |
| 5747 } else { | |
| 5748 throw jsonDecoder.mismatch(jsonPath, "parameters"); | |
| 5749 } | |
| 5750 bool extractAll; | |
| 5751 if (json.containsKey("extractAll")) { | |
| 5752 extractAll = jsonDecoder.decodeBool(jsonPath + ".extractAll", json["extr
actAll"]); | |
| 5753 } else { | |
| 5754 throw jsonDecoder.mismatch(jsonPath, "extractAll"); | |
| 5755 } | |
| 5756 return new ExtractMethodOptions(returnType, createGetter, name, parameters
, extractAll); | |
| 5757 } else { | |
| 5758 throw jsonDecoder.mismatch(jsonPath, "extractMethod options", json); | |
| 5759 } | |
| 5760 } | |
| 5761 | |
| 5762 factory ExtractMethodOptions.fromRefactoringParams(EditGetRefactoringParams re
factoringParams, Request request) { | |
| 5763 return new ExtractMethodOptions.fromJson( | |
| 5764 new RequestDecoder(request), "options", refactoringParams.options); | |
| 5765 } | |
| 5766 | |
| 5767 @override | |
| 5768 Map<String, dynamic> toJson() { | |
| 5769 Map<String, dynamic> result = {}; | |
| 5770 result["returnType"] = returnType; | |
| 5771 result["createGetter"] = createGetter; | |
| 5772 result["name"] = name; | |
| 5773 result["parameters"] = parameters.map((RefactoringMethodParameter value) =>
value.toJson()).toList(); | |
| 5774 result["extractAll"] = extractAll; | |
| 5775 return result; | |
| 5776 } | |
| 5777 | |
| 5778 @override | |
| 5779 String toString() => JSON.encode(toJson()); | |
| 5780 | |
| 5781 @override | |
| 5782 bool operator==(other) { | |
| 5783 if (other is ExtractMethodOptions) { | |
| 5784 return returnType == other.returnType && | |
| 5785 createGetter == other.createGetter && | |
| 5786 name == other.name && | |
| 5787 listEqual(parameters, other.parameters, (RefactoringMethodParameter a,
RefactoringMethodParameter b) => a == b) && | |
| 5788 extractAll == other.extractAll; | |
| 5789 } | |
| 5790 return false; | |
| 5791 } | |
| 5792 | |
| 5793 @override | |
| 5794 int get hashCode { | |
| 5795 int hash = 0; | |
| 5796 hash = JenkinsSmiHash.combine(hash, returnType.hashCode); | |
| 5797 hash = JenkinsSmiHash.combine(hash, createGetter.hashCode); | |
| 5798 hash = JenkinsSmiHash.combine(hash, name.hashCode); | |
| 5799 hash = JenkinsSmiHash.combine(hash, parameters.hashCode); | |
| 5800 hash = JenkinsSmiHash.combine(hash, extractAll.hashCode); | |
| 5801 return JenkinsSmiHash.finish(hash); | |
| 5802 } | |
| 5803 } | |
| 5804 | |
| 5805 /** | |
| 5806 * FoldingKind | |
| 5807 * | |
| 5808 * enum { | |
| 5809 * COMMENT | |
| 5810 * CLASS_MEMBER | |
| 5811 * DIRECTIVES | |
| 5812 * DOCUMENTATION_COMMENT | |
| 5813 * TOP_LEVEL_DECLARATION | |
| 5814 * } | |
| 5815 * | |
| 5816 * Clients may not extend, implement or mix-in this class. | |
| 5817 */ | |
| 5818 class FoldingKind implements Enum { | |
| 5819 static const FoldingKind COMMENT = const FoldingKind._("COMMENT"); | |
| 5820 | |
| 5821 static const FoldingKind CLASS_MEMBER = const FoldingKind._("CLASS_MEMBER"); | |
| 5822 | |
| 5823 static const FoldingKind DIRECTIVES = const FoldingKind._("DIRECTIVES"); | |
| 5824 | |
| 5825 static const FoldingKind DOCUMENTATION_COMMENT = const FoldingKind._("DOCUMENT
ATION_COMMENT"); | |
| 5826 | |
| 5827 static const FoldingKind TOP_LEVEL_DECLARATION = const FoldingKind._("TOP_LEVE
L_DECLARATION"); | |
| 5828 | |
| 5829 /** | |
| 5830 * A list containing all of the enum values that are defined. | |
| 5831 */ | |
| 5832 static const List<FoldingKind> VALUES = const <FoldingKind>[COMMENT, CLASS_MEM
BER, DIRECTIVES, DOCUMENTATION_COMMENT, TOP_LEVEL_DECLARATION]; | |
| 5833 | |
| 5834 @override | |
| 5835 final String name; | |
| 5836 | |
| 5837 const FoldingKind._(this.name); | |
| 5838 | |
| 5839 factory FoldingKind(String name) { | |
| 5840 switch (name) { | |
| 5841 case "COMMENT": | |
| 5842 return COMMENT; | |
| 5843 case "CLASS_MEMBER": | |
| 5844 return CLASS_MEMBER; | |
| 5845 case "DIRECTIVES": | |
| 5846 return DIRECTIVES; | |
| 5847 case "DOCUMENTATION_COMMENT": | |
| 5848 return DOCUMENTATION_COMMENT; | |
| 5849 case "TOP_LEVEL_DECLARATION": | |
| 5850 return TOP_LEVEL_DECLARATION; | |
| 5851 } | |
| 5852 throw new Exception('Illegal enum value: $name'); | |
| 5853 } | |
| 5854 | |
| 5855 factory FoldingKind.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object
json) { | |
| 5856 if (json is String) { | |
| 5857 try { | |
| 5858 return new FoldingKind(json); | |
| 5859 } catch(_) { | |
| 5860 // Fall through | |
| 5861 } | |
| 5862 } | |
| 5863 throw jsonDecoder.mismatch(jsonPath, "FoldingKind", json); | |
| 5864 } | |
| 5865 | |
| 5866 @override | |
| 5867 String toString() => "FoldingKind.$name"; | |
| 5868 | |
| 5869 String toJson() => name; | |
| 5870 } | |
| 5871 | |
| 5872 /** | |
| 5873 * FoldingRegion | |
| 5874 * | |
| 5875 * { | |
| 5876 * "kind": FoldingKind | |
| 5877 * "offset": int | |
| 5878 * "length": int | |
| 5879 * } | |
| 5880 * | |
| 5881 * Clients may not extend, implement or mix-in this class. | |
| 5882 */ | |
| 5883 class FoldingRegion implements HasToJson { | |
| 5884 FoldingKind _kind; | |
| 5885 | |
| 5886 int _offset; | |
| 5887 | |
| 5888 int _length; | |
| 5889 | |
| 5890 /** | |
| 5891 * The kind of the region. | |
| 5892 */ | |
| 5893 FoldingKind get kind => _kind; | |
| 5894 | |
| 5895 /** | |
| 5896 * The kind of the region. | |
| 5897 */ | |
| 5898 void set kind(FoldingKind value) { | |
| 5899 assert(value != null); | |
| 5900 this._kind = value; | |
| 5901 } | |
| 5902 | |
| 5903 /** | |
| 5904 * The offset of the region to be folded. | |
| 5905 */ | |
| 5906 int get offset => _offset; | |
| 5907 | |
| 5908 /** | |
| 5909 * The offset of the region to be folded. | |
| 5910 */ | |
| 5911 void set offset(int value) { | |
| 5912 assert(value != null); | |
| 5913 this._offset = value; | |
| 5914 } | |
| 5915 | |
| 5916 /** | |
| 5917 * The length of the region to be folded. | |
| 5918 */ | |
| 5919 int get length => _length; | |
| 5920 | |
| 5921 /** | |
| 5922 * The length of the region to be folded. | |
| 5923 */ | |
| 5924 void set length(int value) { | |
| 5925 assert(value != null); | |
| 5926 this._length = value; | |
| 5927 } | |
| 5928 | |
| 5929 FoldingRegion(FoldingKind kind, int offset, int length) { | |
| 5930 this.kind = kind; | |
| 5931 this.offset = offset; | |
| 5932 this.length = length; | |
| 5933 } | |
| 5934 | |
| 5935 factory FoldingRegion.fromJson(JsonDecoder jsonDecoder, String jsonPath, Objec
t json) { | |
| 5936 if (json == null) { | |
| 5937 json = {}; | |
| 5938 } | |
| 5939 if (json is Map) { | |
| 5940 FoldingKind kind; | |
| 5941 if (json.containsKey("kind")) { | |
| 5942 kind = new FoldingKind.fromJson(jsonDecoder, jsonPath + ".kind", json["k
ind"]); | |
| 5943 } else { | |
| 5944 throw jsonDecoder.mismatch(jsonPath, "kind"); | |
| 5945 } | |
| 5946 int offset; | |
| 5947 if (json.containsKey("offset")) { | |
| 5948 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 5949 } else { | |
| 5950 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 5951 } | |
| 5952 int length; | |
| 5953 if (json.containsKey("length")) { | |
| 5954 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); | |
| 5955 } else { | |
| 5956 throw jsonDecoder.mismatch(jsonPath, "length"); | |
| 5957 } | |
| 5958 return new FoldingRegion(kind, offset, length); | |
| 5959 } else { | |
| 5960 throw jsonDecoder.mismatch(jsonPath, "FoldingRegion", json); | |
| 5961 } | |
| 5962 } | |
| 5963 | |
| 5964 @override | |
| 5965 Map<String, dynamic> toJson() { | |
| 5966 Map<String, dynamic> result = {}; | |
| 5967 result["kind"] = kind.toJson(); | |
| 5968 result["offset"] = offset; | |
| 5969 result["length"] = length; | |
| 5970 return result; | |
| 5971 } | |
| 5972 | |
| 5973 @override | |
| 5974 String toString() => JSON.encode(toJson()); | |
| 5975 | |
| 5976 @override | |
| 5977 bool operator==(other) { | |
| 5978 if (other is FoldingRegion) { | |
| 5979 return kind == other.kind && | |
| 5980 offset == other.offset && | |
| 5981 length == other.length; | |
| 5982 } | |
| 5983 return false; | |
| 5984 } | |
| 5985 | |
| 5986 @override | |
| 5987 int get hashCode { | |
| 5988 int hash = 0; | |
| 5989 hash = JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 5990 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 5991 hash = JenkinsSmiHash.combine(hash, length.hashCode); | |
| 5992 return JenkinsSmiHash.finish(hash); | |
| 5993 } | |
| 5994 } | |
| 5995 | |
| 5996 /** | |
| 5997 * HighlightRegion | |
| 5998 * | |
| 5999 * { | |
| 6000 * "type": HighlightRegionType | |
| 6001 * "offset": int | |
| 6002 * "length": int | |
| 6003 * } | |
| 6004 * | |
| 6005 * Clients may not extend, implement or mix-in this class. | |
| 6006 */ | |
| 6007 class HighlightRegion implements HasToJson { | |
| 6008 HighlightRegionType _type; | |
| 6009 | |
| 6010 int _offset; | |
| 6011 | |
| 6012 int _length; | |
| 6013 | |
| 6014 /** | |
| 6015 * The type of highlight associated with the region. | |
| 6016 */ | |
| 6017 HighlightRegionType get type => _type; | |
| 6018 | |
| 6019 /** | |
| 6020 * The type of highlight associated with the region. | |
| 6021 */ | |
| 6022 void set type(HighlightRegionType value) { | |
| 6023 assert(value != null); | |
| 6024 this._type = value; | |
| 6025 } | |
| 6026 | |
| 6027 /** | |
| 6028 * The offset of the region to be highlighted. | |
| 6029 */ | |
| 6030 int get offset => _offset; | |
| 6031 | |
| 6032 /** | |
| 6033 * The offset of the region to be highlighted. | |
| 6034 */ | |
| 6035 void set offset(int value) { | |
| 6036 assert(value != null); | |
| 6037 this._offset = value; | |
| 6038 } | |
| 6039 | |
| 6040 /** | |
| 6041 * The length of the region to be highlighted. | |
| 6042 */ | |
| 6043 int get length => _length; | |
| 6044 | |
| 6045 /** | |
| 6046 * The length of the region to be highlighted. | |
| 6047 */ | |
| 6048 void set length(int value) { | |
| 6049 assert(value != null); | |
| 6050 this._length = value; | |
| 6051 } | |
| 6052 | |
| 6053 HighlightRegion(HighlightRegionType type, int offset, int length) { | |
| 6054 this.type = type; | |
| 6055 this.offset = offset; | |
| 6056 this.length = length; | |
| 6057 } | |
| 6058 | |
| 6059 factory HighlightRegion.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obj
ect json) { | |
| 6060 if (json == null) { | |
| 6061 json = {}; | |
| 6062 } | |
| 6063 if (json is Map) { | |
| 6064 HighlightRegionType type; | |
| 6065 if (json.containsKey("type")) { | |
| 6066 type = new HighlightRegionType.fromJson(jsonDecoder, jsonPath + ".type",
json["type"]); | |
| 6067 } else { | |
| 6068 throw jsonDecoder.mismatch(jsonPath, "type"); | |
| 6069 } | |
| 6070 int offset; | |
| 6071 if (json.containsKey("offset")) { | |
| 6072 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 6073 } else { | |
| 6074 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 6075 } | |
| 6076 int length; | |
| 6077 if (json.containsKey("length")) { | |
| 6078 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); | |
| 6079 } else { | |
| 6080 throw jsonDecoder.mismatch(jsonPath, "length"); | |
| 6081 } | |
| 6082 return new HighlightRegion(type, offset, length); | |
| 6083 } else { | |
| 6084 throw jsonDecoder.mismatch(jsonPath, "HighlightRegion", json); | |
| 6085 } | |
| 6086 } | |
| 6087 | |
| 6088 @override | |
| 6089 Map<String, dynamic> toJson() { | |
| 6090 Map<String, dynamic> result = {}; | |
| 6091 result["type"] = type.toJson(); | |
| 6092 result["offset"] = offset; | |
| 6093 result["length"] = length; | |
| 6094 return result; | |
| 6095 } | |
| 6096 | |
| 6097 @override | |
| 6098 String toString() => JSON.encode(toJson()); | |
| 6099 | |
| 6100 @override | |
| 6101 bool operator==(other) { | |
| 6102 if (other is HighlightRegion) { | |
| 6103 return type == other.type && | |
| 6104 offset == other.offset && | |
| 6105 length == other.length; | |
| 6106 } | |
| 6107 return false; | |
| 6108 } | |
| 6109 | |
| 6110 @override | |
| 6111 int get hashCode { | |
| 6112 int hash = 0; | |
| 6113 hash = JenkinsSmiHash.combine(hash, type.hashCode); | |
| 6114 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 6115 hash = JenkinsSmiHash.combine(hash, length.hashCode); | |
| 6116 return JenkinsSmiHash.finish(hash); | |
| 6117 } | |
| 6118 } | |
| 6119 | |
| 6120 /** | |
| 6121 * HighlightRegionType | |
| 6122 * | |
| 6123 * enum { | |
| 6124 * ANNOTATION | |
| 6125 * BUILT_IN | |
| 6126 * CLASS | |
| 6127 * COMMENT_BLOCK | |
| 6128 * COMMENT_DOCUMENTATION | |
| 6129 * COMMENT_END_OF_LINE | |
| 6130 * CONSTRUCTOR | |
| 6131 * DIRECTIVE | |
| 6132 * DYNAMIC_TYPE | |
| 6133 * DYNAMIC_LOCAL_VARIABLE_DECLARATION | |
| 6134 * DYNAMIC_LOCAL_VARIABLE_REFERENCE | |
| 6135 * DYNAMIC_PARAMETER_DECLARATION | |
| 6136 * DYNAMIC_PARAMETER_REFERENCE | |
| 6137 * ENUM | |
| 6138 * ENUM_CONSTANT | |
| 6139 * FIELD | |
| 6140 * FIELD_STATIC | |
| 6141 * FUNCTION | |
| 6142 * FUNCTION_DECLARATION | |
| 6143 * FUNCTION_TYPE_ALIAS | |
| 6144 * GETTER_DECLARATION | |
| 6145 * IDENTIFIER_DEFAULT | |
| 6146 * IMPORT_PREFIX | |
| 6147 * INSTANCE_FIELD_DECLARATION | |
| 6148 * INSTANCE_FIELD_REFERENCE | |
| 6149 * INSTANCE_GETTER_DECLARATION | |
| 6150 * INSTANCE_GETTER_REFERENCE | |
| 6151 * INSTANCE_METHOD_DECLARATION | |
| 6152 * INSTANCE_METHOD_REFERENCE | |
| 6153 * INSTANCE_SETTER_DECLARATION | |
| 6154 * INSTANCE_SETTER_REFERENCE | |
| 6155 * INVALID_STRING_ESCAPE | |
| 6156 * KEYWORD | |
| 6157 * LABEL | |
| 6158 * LIBRARY_NAME | |
| 6159 * LITERAL_BOOLEAN | |
| 6160 * LITERAL_DOUBLE | |
| 6161 * LITERAL_INTEGER | |
| 6162 * LITERAL_LIST | |
| 6163 * LITERAL_MAP | |
| 6164 * LITERAL_STRING | |
| 6165 * LOCAL_FUNCTION_DECLARATION | |
| 6166 * LOCAL_FUNCTION_REFERENCE | |
| 6167 * LOCAL_VARIABLE | |
| 6168 * LOCAL_VARIABLE_DECLARATION | |
| 6169 * LOCAL_VARIABLE_REFERENCE | |
| 6170 * METHOD | |
| 6171 * METHOD_DECLARATION | |
| 6172 * METHOD_DECLARATION_STATIC | |
| 6173 * METHOD_STATIC | |
| 6174 * PARAMETER | |
| 6175 * SETTER_DECLARATION | |
| 6176 * TOP_LEVEL_VARIABLE | |
| 6177 * PARAMETER_DECLARATION | |
| 6178 * PARAMETER_REFERENCE | |
| 6179 * STATIC_FIELD_DECLARATION | |
| 6180 * STATIC_GETTER_DECLARATION | |
| 6181 * STATIC_GETTER_REFERENCE | |
| 6182 * STATIC_METHOD_DECLARATION | |
| 6183 * STATIC_METHOD_REFERENCE | |
| 6184 * STATIC_SETTER_DECLARATION | |
| 6185 * STATIC_SETTER_REFERENCE | |
| 6186 * TOP_LEVEL_FUNCTION_DECLARATION | |
| 6187 * TOP_LEVEL_FUNCTION_REFERENCE | |
| 6188 * TOP_LEVEL_GETTER_DECLARATION | |
| 6189 * TOP_LEVEL_GETTER_REFERENCE | |
| 6190 * TOP_LEVEL_SETTER_DECLARATION | |
| 6191 * TOP_LEVEL_SETTER_REFERENCE | |
| 6192 * TOP_LEVEL_VARIABLE_DECLARATION | |
| 6193 * TYPE_NAME_DYNAMIC | |
| 6194 * TYPE_PARAMETER | |
| 6195 * UNRESOLVED_INSTANCE_MEMBER_REFERENCE | |
| 6196 * VALID_STRING_ESCAPE | |
| 6197 * } | |
| 6198 * | |
| 6199 * Clients may not extend, implement or mix-in this class. | |
| 6200 */ | |
| 6201 class HighlightRegionType implements Enum { | |
| 6202 static const HighlightRegionType ANNOTATION = const HighlightRegionType._("ANN
OTATION"); | |
| 6203 | |
| 6204 static const HighlightRegionType BUILT_IN = const HighlightRegionType._("BUILT
_IN"); | |
| 6205 | |
| 6206 static const HighlightRegionType CLASS = const HighlightRegionType._("CLASS"); | |
| 6207 | |
| 6208 static const HighlightRegionType COMMENT_BLOCK = const HighlightRegionType._("
COMMENT_BLOCK"); | |
| 6209 | |
| 6210 static const HighlightRegionType COMMENT_DOCUMENTATION = const HighlightRegion
Type._("COMMENT_DOCUMENTATION"); | |
| 6211 | |
| 6212 static const HighlightRegionType COMMENT_END_OF_LINE = const HighlightRegionTy
pe._("COMMENT_END_OF_LINE"); | |
| 6213 | |
| 6214 static const HighlightRegionType CONSTRUCTOR = const HighlightRegionType._("CO
NSTRUCTOR"); | |
| 6215 | |
| 6216 static const HighlightRegionType DIRECTIVE = const HighlightRegionType._("DIRE
CTIVE"); | |
| 6217 | |
| 6218 /** | |
| 6219 * Only for version 1 of highlight. | |
| 6220 */ | |
| 6221 static const HighlightRegionType DYNAMIC_TYPE = const HighlightRegionType._("D
YNAMIC_TYPE"); | |
| 6222 | |
| 6223 /** | |
| 6224 * Only for version 2 of highlight. | |
| 6225 */ | |
| 6226 static const HighlightRegionType DYNAMIC_LOCAL_VARIABLE_DECLARATION = const Hi
ghlightRegionType._("DYNAMIC_LOCAL_VARIABLE_DECLARATION"); | |
| 6227 | |
| 6228 /** | |
| 6229 * Only for version 2 of highlight. | |
| 6230 */ | |
| 6231 static const HighlightRegionType DYNAMIC_LOCAL_VARIABLE_REFERENCE = const High
lightRegionType._("DYNAMIC_LOCAL_VARIABLE_REFERENCE"); | |
| 6232 | |
| 6233 /** | |
| 6234 * Only for version 2 of highlight. | |
| 6235 */ | |
| 6236 static const HighlightRegionType DYNAMIC_PARAMETER_DECLARATION = const Highlig
htRegionType._("DYNAMIC_PARAMETER_DECLARATION"); | |
| 6237 | |
| 6238 /** | |
| 6239 * Only for version 2 of highlight. | |
| 6240 */ | |
| 6241 static const HighlightRegionType DYNAMIC_PARAMETER_REFERENCE = const Highlight
RegionType._("DYNAMIC_PARAMETER_REFERENCE"); | |
| 6242 | |
| 6243 static const HighlightRegionType ENUM = const HighlightRegionType._("ENUM"); | |
| 6244 | |
| 6245 static const HighlightRegionType ENUM_CONSTANT = const HighlightRegionType._("
ENUM_CONSTANT"); | |
| 6246 | |
| 6247 /** | |
| 6248 * Only for version 1 of highlight. | |
| 6249 */ | |
| 6250 static const HighlightRegionType FIELD = const HighlightRegionType._("FIELD"); | |
| 6251 | |
| 6252 /** | |
| 6253 * Only for version 1 of highlight. | |
| 6254 */ | |
| 6255 static const HighlightRegionType FIELD_STATIC = const HighlightRegionType._("F
IELD_STATIC"); | |
| 6256 | |
| 6257 /** | |
| 6258 * Only for version 1 of highlight. | |
| 6259 */ | |
| 6260 static const HighlightRegionType FUNCTION = const HighlightRegionType._("FUNCT
ION"); | |
| 6261 | |
| 6262 /** | |
| 6263 * Only for version 1 of highlight. | |
| 6264 */ | |
| 6265 static const HighlightRegionType FUNCTION_DECLARATION = const HighlightRegionT
ype._("FUNCTION_DECLARATION"); | |
| 6266 | |
| 6267 static const HighlightRegionType FUNCTION_TYPE_ALIAS = const HighlightRegionTy
pe._("FUNCTION_TYPE_ALIAS"); | |
| 6268 | |
| 6269 /** | |
| 6270 * Only for version 1 of highlight. | |
| 6271 */ | |
| 6272 static const HighlightRegionType GETTER_DECLARATION = const HighlightRegionTyp
e._("GETTER_DECLARATION"); | |
| 6273 | |
| 6274 static const HighlightRegionType IDENTIFIER_DEFAULT = const HighlightRegionTyp
e._("IDENTIFIER_DEFAULT"); | |
| 6275 | |
| 6276 static const HighlightRegionType IMPORT_PREFIX = const HighlightRegionType._("
IMPORT_PREFIX"); | |
| 6277 | |
| 6278 /** | |
| 6279 * Only for version 2 of highlight. | |
| 6280 */ | |
| 6281 static const HighlightRegionType INSTANCE_FIELD_DECLARATION = const HighlightR
egionType._("INSTANCE_FIELD_DECLARATION"); | |
| 6282 | |
| 6283 /** | |
| 6284 * Only for version 2 of highlight. | |
| 6285 */ | |
| 6286 static const HighlightRegionType INSTANCE_FIELD_REFERENCE = const HighlightReg
ionType._("INSTANCE_FIELD_REFERENCE"); | |
| 6287 | |
| 6288 /** | |
| 6289 * Only for version 2 of highlight. | |
| 6290 */ | |
| 6291 static const HighlightRegionType INSTANCE_GETTER_DECLARATION = const Highlight
RegionType._("INSTANCE_GETTER_DECLARATION"); | |
| 6292 | |
| 6293 /** | |
| 6294 * Only for version 2 of highlight. | |
| 6295 */ | |
| 6296 static const HighlightRegionType INSTANCE_GETTER_REFERENCE = const HighlightRe
gionType._("INSTANCE_GETTER_REFERENCE"); | |
| 6297 | |
| 6298 /** | |
| 6299 * Only for version 2 of highlight. | |
| 6300 */ | |
| 6301 static const HighlightRegionType INSTANCE_METHOD_DECLARATION = const Highlight
RegionType._("INSTANCE_METHOD_DECLARATION"); | |
| 6302 | |
| 6303 /** | |
| 6304 * Only for version 2 of highlight. | |
| 6305 */ | |
| 6306 static const HighlightRegionType INSTANCE_METHOD_REFERENCE = const HighlightRe
gionType._("INSTANCE_METHOD_REFERENCE"); | |
| 6307 | |
| 6308 /** | |
| 6309 * Only for version 2 of highlight. | |
| 6310 */ | |
| 6311 static const HighlightRegionType INSTANCE_SETTER_DECLARATION = const Highlight
RegionType._("INSTANCE_SETTER_DECLARATION"); | |
| 6312 | |
| 6313 /** | |
| 6314 * Only for version 2 of highlight. | |
| 6315 */ | |
| 6316 static const HighlightRegionType INSTANCE_SETTER_REFERENCE = const HighlightRe
gionType._("INSTANCE_SETTER_REFERENCE"); | |
| 6317 | |
| 6318 /** | |
| 6319 * Only for version 2 of highlight. | |
| 6320 */ | |
| 6321 static const HighlightRegionType INVALID_STRING_ESCAPE = const HighlightRegion
Type._("INVALID_STRING_ESCAPE"); | |
| 6322 | |
| 6323 static const HighlightRegionType KEYWORD = const HighlightRegionType._("KEYWOR
D"); | |
| 6324 | |
| 6325 static const HighlightRegionType LABEL = const HighlightRegionType._("LABEL"); | |
| 6326 | |
| 6327 /** | |
| 6328 * Only for version 2 of highlight. | |
| 6329 */ | |
| 6330 static const HighlightRegionType LIBRARY_NAME = const HighlightRegionType._("L
IBRARY_NAME"); | |
| 6331 | |
| 6332 static const HighlightRegionType LITERAL_BOOLEAN = const HighlightRegionType._
("LITERAL_BOOLEAN"); | |
| 6333 | |
| 6334 static const HighlightRegionType LITERAL_DOUBLE = const HighlightRegionType._(
"LITERAL_DOUBLE"); | |
| 6335 | |
| 6336 static const HighlightRegionType LITERAL_INTEGER = const HighlightRegionType._
("LITERAL_INTEGER"); | |
| 6337 | |
| 6338 static const HighlightRegionType LITERAL_LIST = const HighlightRegionType._("L
ITERAL_LIST"); | |
| 6339 | |
| 6340 static const HighlightRegionType LITERAL_MAP = const HighlightRegionType._("LI
TERAL_MAP"); | |
| 6341 | |
| 6342 static const HighlightRegionType LITERAL_STRING = const HighlightRegionType._(
"LITERAL_STRING"); | |
| 6343 | |
| 6344 /** | |
| 6345 * Only for version 2 of highlight. | |
| 6346 */ | |
| 6347 static const HighlightRegionType LOCAL_FUNCTION_DECLARATION = const HighlightR
egionType._("LOCAL_FUNCTION_DECLARATION"); | |
| 6348 | |
| 6349 /** | |
| 6350 * Only for version 2 of highlight. | |
| 6351 */ | |
| 6352 static const HighlightRegionType LOCAL_FUNCTION_REFERENCE = const HighlightReg
ionType._("LOCAL_FUNCTION_REFERENCE"); | |
| 6353 | |
| 6354 /** | |
| 6355 * Only for version 1 of highlight. | |
| 6356 */ | |
| 6357 static const HighlightRegionType LOCAL_VARIABLE = const HighlightRegionType._(
"LOCAL_VARIABLE"); | |
| 6358 | |
| 6359 static const HighlightRegionType LOCAL_VARIABLE_DECLARATION = const HighlightR
egionType._("LOCAL_VARIABLE_DECLARATION"); | |
| 6360 | |
| 6361 /** | |
| 6362 * Only for version 2 of highlight. | |
| 6363 */ | |
| 6364 static const HighlightRegionType LOCAL_VARIABLE_REFERENCE = const HighlightReg
ionType._("LOCAL_VARIABLE_REFERENCE"); | |
| 6365 | |
| 6366 /** | |
| 6367 * Only for version 1 of highlight. | |
| 6368 */ | |
| 6369 static const HighlightRegionType METHOD = const HighlightRegionType._("METHOD"
); | |
| 6370 | |
| 6371 /** | |
| 6372 * Only for version 1 of highlight. | |
| 6373 */ | |
| 6374 static const HighlightRegionType METHOD_DECLARATION = const HighlightRegionTyp
e._("METHOD_DECLARATION"); | |
| 6375 | |
| 6376 /** | |
| 6377 * Only for version 1 of highlight. | |
| 6378 */ | |
| 6379 static const HighlightRegionType METHOD_DECLARATION_STATIC = const HighlightRe
gionType._("METHOD_DECLARATION_STATIC"); | |
| 6380 | |
| 6381 /** | |
| 6382 * Only for version 1 of highlight. | |
| 6383 */ | |
| 6384 static const HighlightRegionType METHOD_STATIC = const HighlightRegionType._("
METHOD_STATIC"); | |
| 6385 | |
| 6386 /** | |
| 6387 * Only for version 1 of highlight. | |
| 6388 */ | |
| 6389 static const HighlightRegionType PARAMETER = const HighlightRegionType._("PARA
METER"); | |
| 6390 | |
| 6391 /** | |
| 6392 * Only for version 1 of highlight. | |
| 6393 */ | |
| 6394 static const HighlightRegionType SETTER_DECLARATION = const HighlightRegionTyp
e._("SETTER_DECLARATION"); | |
| 6395 | |
| 6396 /** | |
| 6397 * Only for version 1 of highlight. | |
| 6398 */ | |
| 6399 static const HighlightRegionType TOP_LEVEL_VARIABLE = const HighlightRegionTyp
e._("TOP_LEVEL_VARIABLE"); | |
| 6400 | |
| 6401 /** | |
| 6402 * Only for version 2 of highlight. | |
| 6403 */ | |
| 6404 static const HighlightRegionType PARAMETER_DECLARATION = const HighlightRegion
Type._("PARAMETER_DECLARATION"); | |
| 6405 | |
| 6406 /** | |
| 6407 * Only for version 2 of highlight. | |
| 6408 */ | |
| 6409 static const HighlightRegionType PARAMETER_REFERENCE = const HighlightRegionTy
pe._("PARAMETER_REFERENCE"); | |
| 6410 | |
| 6411 /** | |
| 6412 * Only for version 2 of highlight. | |
| 6413 */ | |
| 6414 static const HighlightRegionType STATIC_FIELD_DECLARATION = const HighlightReg
ionType._("STATIC_FIELD_DECLARATION"); | |
| 6415 | |
| 6416 /** | |
| 6417 * Only for version 2 of highlight. | |
| 6418 */ | |
| 6419 static const HighlightRegionType STATIC_GETTER_DECLARATION = const HighlightRe
gionType._("STATIC_GETTER_DECLARATION"); | |
| 6420 | |
| 6421 /** | |
| 6422 * Only for version 2 of highlight. | |
| 6423 */ | |
| 6424 static const HighlightRegionType STATIC_GETTER_REFERENCE = const HighlightRegi
onType._("STATIC_GETTER_REFERENCE"); | |
| 6425 | |
| 6426 /** | |
| 6427 * Only for version 2 of highlight. | |
| 6428 */ | |
| 6429 static const HighlightRegionType STATIC_METHOD_DECLARATION = const HighlightRe
gionType._("STATIC_METHOD_DECLARATION"); | |
| 6430 | |
| 6431 /** | |
| 6432 * Only for version 2 of highlight. | |
| 6433 */ | |
| 6434 static const HighlightRegionType STATIC_METHOD_REFERENCE = const HighlightRegi
onType._("STATIC_METHOD_REFERENCE"); | |
| 6435 | |
| 6436 /** | |
| 6437 * Only for version 2 of highlight. | |
| 6438 */ | |
| 6439 static const HighlightRegionType STATIC_SETTER_DECLARATION = const HighlightRe
gionType._("STATIC_SETTER_DECLARATION"); | |
| 6440 | |
| 6441 /** | |
| 6442 * Only for version 2 of highlight. | |
| 6443 */ | |
| 6444 static const HighlightRegionType STATIC_SETTER_REFERENCE = const HighlightRegi
onType._("STATIC_SETTER_REFERENCE"); | |
| 6445 | |
| 6446 /** | |
| 6447 * Only for version 2 of highlight. | |
| 6448 */ | |
| 6449 static const HighlightRegionType TOP_LEVEL_FUNCTION_DECLARATION = const Highli
ghtRegionType._("TOP_LEVEL_FUNCTION_DECLARATION"); | |
| 6450 | |
| 6451 /** | |
| 6452 * Only for version 2 of highlight. | |
| 6453 */ | |
| 6454 static const HighlightRegionType TOP_LEVEL_FUNCTION_REFERENCE = const Highligh
tRegionType._("TOP_LEVEL_FUNCTION_REFERENCE"); | |
| 6455 | |
| 6456 /** | |
| 6457 * Only for version 2 of highlight. | |
| 6458 */ | |
| 6459 static const HighlightRegionType TOP_LEVEL_GETTER_DECLARATION = const Highligh
tRegionType._("TOP_LEVEL_GETTER_DECLARATION"); | |
| 6460 | |
| 6461 /** | |
| 6462 * Only for version 2 of highlight. | |
| 6463 */ | |
| 6464 static const HighlightRegionType TOP_LEVEL_GETTER_REFERENCE = const HighlightR
egionType._("TOP_LEVEL_GETTER_REFERENCE"); | |
| 6465 | |
| 6466 /** | |
| 6467 * Only for version 2 of highlight. | |
| 6468 */ | |
| 6469 static const HighlightRegionType TOP_LEVEL_SETTER_DECLARATION = const Highligh
tRegionType._("TOP_LEVEL_SETTER_DECLARATION"); | |
| 6470 | |
| 6471 /** | |
| 6472 * Only for version 2 of highlight. | |
| 6473 */ | |
| 6474 static const HighlightRegionType TOP_LEVEL_SETTER_REFERENCE = const HighlightR
egionType._("TOP_LEVEL_SETTER_REFERENCE"); | |
| 6475 | |
| 6476 /** | |
| 6477 * Only for version 2 of highlight. | |
| 6478 */ | |
| 6479 static const HighlightRegionType TOP_LEVEL_VARIABLE_DECLARATION = const Highli
ghtRegionType._("TOP_LEVEL_VARIABLE_DECLARATION"); | |
| 6480 | |
| 6481 static const HighlightRegionType TYPE_NAME_DYNAMIC = const HighlightRegionType
._("TYPE_NAME_DYNAMIC"); | |
| 6482 | |
| 6483 static const HighlightRegionType TYPE_PARAMETER = const HighlightRegionType._(
"TYPE_PARAMETER"); | |
| 6484 | |
| 6485 /** | |
| 6486 * Only for version 2 of highlight. | |
| 6487 */ | |
| 6488 static const HighlightRegionType UNRESOLVED_INSTANCE_MEMBER_REFERENCE = const
HighlightRegionType._("UNRESOLVED_INSTANCE_MEMBER_REFERENCE"); | |
| 6489 | |
| 6490 /** | |
| 6491 * Only for version 2 of highlight. | |
| 6492 */ | |
| 6493 static const HighlightRegionType VALID_STRING_ESCAPE = const HighlightRegionTy
pe._("VALID_STRING_ESCAPE"); | |
| 6494 | |
| 6495 /** | |
| 6496 * A list containing all of the enum values that are defined. | |
| 6497 */ | |
| 6498 static const List<HighlightRegionType> VALUES = const <HighlightRegionType>[AN
NOTATION, BUILT_IN, CLASS, COMMENT_BLOCK, COMMENT_DOCUMENTATION, COMMENT_END_OF_
LINE, CONSTRUCTOR, DIRECTIVE, DYNAMIC_TYPE, DYNAMIC_LOCAL_VARIABLE_DECLARATION,
DYNAMIC_LOCAL_VARIABLE_REFERENCE, DYNAMIC_PARAMETER_DECLARATION, DYNAMIC_PARAMET
ER_REFERENCE, ENUM, ENUM_CONSTANT, FIELD, FIELD_STATIC, FUNCTION, FUNCTION_DECLA
RATION, FUNCTION_TYPE_ALIAS, GETTER_DECLARATION, IDENTIFIER_DEFAULT, IMPORT_PREF
IX, INSTANCE_FIELD_DECLARATION, INSTANCE_FIELD_REFERENCE, INSTANCE_GETTER_DECLAR
ATION, INSTANCE_GETTER_REFERENCE, INSTANCE_METHOD_DECLARATION, INSTANCE_METHOD_R
EFERENCE, INSTANCE_SETTER_DECLARATION, INSTANCE_SETTER_REFERENCE, INVALID_STRING
_ESCAPE, KEYWORD, LABEL, LIBRARY_NAME, LITERAL_BOOLEAN, LITERAL_DOUBLE, LITERAL_
INTEGER, LITERAL_LIST, LITERAL_MAP, LITERAL_STRING, LOCAL_FUNCTION_DECLARATION,
LOCAL_FUNCTION_REFERENCE, LOCAL_VARIABLE, LOCAL_VARIABLE_DECLARATION, LOCAL_VARI
ABLE_REFERENCE, METHOD, METHOD_DECLARATION, METHOD_DECLARATION_STATIC, METHOD_ST
ATIC, PARAMETER, SETTER_DECLARATION, TOP_LEVEL_VARIABLE, PARAMETER_DECLARATION,
PARAMETER_REFERENCE, STATIC_FIELD_DECLARATION, STATIC_GETTER_DECLARATION, STATIC
_GETTER_REFERENCE, STATIC_METHOD_DECLARATION, STATIC_METHOD_REFERENCE, STATIC_SE
TTER_DECLARATION, STATIC_SETTER_REFERENCE, TOP_LEVEL_FUNCTION_DECLARATION, TOP_L
EVEL_FUNCTION_REFERENCE, TOP_LEVEL_GETTER_DECLARATION, TOP_LEVEL_GETTER_REFERENC
E, TOP_LEVEL_SETTER_DECLARATION, TOP_LEVEL_SETTER_REFERENCE, TOP_LEVEL_VARIABLE_
DECLARATION, TYPE_NAME_DYNAMIC, TYPE_PARAMETER, UNRESOLVED_INSTANCE_MEMBER_REFER
ENCE, VALID_STRING_ESCAPE]; | |
| 6499 | |
| 6500 @override | |
| 6501 final String name; | |
| 6502 | |
| 6503 const HighlightRegionType._(this.name); | |
| 6504 | |
| 6505 factory HighlightRegionType(String name) { | |
| 6506 switch (name) { | |
| 6507 case "ANNOTATION": | |
| 6508 return ANNOTATION; | |
| 6509 case "BUILT_IN": | |
| 6510 return BUILT_IN; | |
| 6511 case "CLASS": | |
| 6512 return CLASS; | |
| 6513 case "COMMENT_BLOCK": | |
| 6514 return COMMENT_BLOCK; | |
| 6515 case "COMMENT_DOCUMENTATION": | |
| 6516 return COMMENT_DOCUMENTATION; | |
| 6517 case "COMMENT_END_OF_LINE": | |
| 6518 return COMMENT_END_OF_LINE; | |
| 6519 case "CONSTRUCTOR": | |
| 6520 return CONSTRUCTOR; | |
| 6521 case "DIRECTIVE": | |
| 6522 return DIRECTIVE; | |
| 6523 case "DYNAMIC_TYPE": | |
| 6524 return DYNAMIC_TYPE; | |
| 6525 case "DYNAMIC_LOCAL_VARIABLE_DECLARATION": | |
| 6526 return DYNAMIC_LOCAL_VARIABLE_DECLARATION; | |
| 6527 case "DYNAMIC_LOCAL_VARIABLE_REFERENCE": | |
| 6528 return DYNAMIC_LOCAL_VARIABLE_REFERENCE; | |
| 6529 case "DYNAMIC_PARAMETER_DECLARATION": | |
| 6530 return DYNAMIC_PARAMETER_DECLARATION; | |
| 6531 case "DYNAMIC_PARAMETER_REFERENCE": | |
| 6532 return DYNAMIC_PARAMETER_REFERENCE; | |
| 6533 case "ENUM": | |
| 6534 return ENUM; | |
| 6535 case "ENUM_CONSTANT": | |
| 6536 return ENUM_CONSTANT; | |
| 6537 case "FIELD": | |
| 6538 return FIELD; | |
| 6539 case "FIELD_STATIC": | |
| 6540 return FIELD_STATIC; | |
| 6541 case "FUNCTION": | |
| 6542 return FUNCTION; | |
| 6543 case "FUNCTION_DECLARATION": | |
| 6544 return FUNCTION_DECLARATION; | |
| 6545 case "FUNCTION_TYPE_ALIAS": | |
| 6546 return FUNCTION_TYPE_ALIAS; | |
| 6547 case "GETTER_DECLARATION": | |
| 6548 return GETTER_DECLARATION; | |
| 6549 case "IDENTIFIER_DEFAULT": | |
| 6550 return IDENTIFIER_DEFAULT; | |
| 6551 case "IMPORT_PREFIX": | |
| 6552 return IMPORT_PREFIX; | |
| 6553 case "INSTANCE_FIELD_DECLARATION": | |
| 6554 return INSTANCE_FIELD_DECLARATION; | |
| 6555 case "INSTANCE_FIELD_REFERENCE": | |
| 6556 return INSTANCE_FIELD_REFERENCE; | |
| 6557 case "INSTANCE_GETTER_DECLARATION": | |
| 6558 return INSTANCE_GETTER_DECLARATION; | |
| 6559 case "INSTANCE_GETTER_REFERENCE": | |
| 6560 return INSTANCE_GETTER_REFERENCE; | |
| 6561 case "INSTANCE_METHOD_DECLARATION": | |
| 6562 return INSTANCE_METHOD_DECLARATION; | |
| 6563 case "INSTANCE_METHOD_REFERENCE": | |
| 6564 return INSTANCE_METHOD_REFERENCE; | |
| 6565 case "INSTANCE_SETTER_DECLARATION": | |
| 6566 return INSTANCE_SETTER_DECLARATION; | |
| 6567 case "INSTANCE_SETTER_REFERENCE": | |
| 6568 return INSTANCE_SETTER_REFERENCE; | |
| 6569 case "INVALID_STRING_ESCAPE": | |
| 6570 return INVALID_STRING_ESCAPE; | |
| 6571 case "KEYWORD": | |
| 6572 return KEYWORD; | |
| 6573 case "LABEL": | |
| 6574 return LABEL; | |
| 6575 case "LIBRARY_NAME": | |
| 6576 return LIBRARY_NAME; | |
| 6577 case "LITERAL_BOOLEAN": | |
| 6578 return LITERAL_BOOLEAN; | |
| 6579 case "LITERAL_DOUBLE": | |
| 6580 return LITERAL_DOUBLE; | |
| 6581 case "LITERAL_INTEGER": | |
| 6582 return LITERAL_INTEGER; | |
| 6583 case "LITERAL_LIST": | |
| 6584 return LITERAL_LIST; | |
| 6585 case "LITERAL_MAP": | |
| 6586 return LITERAL_MAP; | |
| 6587 case "LITERAL_STRING": | |
| 6588 return LITERAL_STRING; | |
| 6589 case "LOCAL_FUNCTION_DECLARATION": | |
| 6590 return LOCAL_FUNCTION_DECLARATION; | |
| 6591 case "LOCAL_FUNCTION_REFERENCE": | |
| 6592 return LOCAL_FUNCTION_REFERENCE; | |
| 6593 case "LOCAL_VARIABLE": | |
| 6594 return LOCAL_VARIABLE; | |
| 6595 case "LOCAL_VARIABLE_DECLARATION": | |
| 6596 return LOCAL_VARIABLE_DECLARATION; | |
| 6597 case "LOCAL_VARIABLE_REFERENCE": | |
| 6598 return LOCAL_VARIABLE_REFERENCE; | |
| 6599 case "METHOD": | |
| 6600 return METHOD; | |
| 6601 case "METHOD_DECLARATION": | |
| 6602 return METHOD_DECLARATION; | |
| 6603 case "METHOD_DECLARATION_STATIC": | |
| 6604 return METHOD_DECLARATION_STATIC; | |
| 6605 case "METHOD_STATIC": | |
| 6606 return METHOD_STATIC; | |
| 6607 case "PARAMETER": | |
| 6608 return PARAMETER; | |
| 6609 case "SETTER_DECLARATION": | |
| 6610 return SETTER_DECLARATION; | |
| 6611 case "TOP_LEVEL_VARIABLE": | |
| 6612 return TOP_LEVEL_VARIABLE; | |
| 6613 case "PARAMETER_DECLARATION": | |
| 6614 return PARAMETER_DECLARATION; | |
| 6615 case "PARAMETER_REFERENCE": | |
| 6616 return PARAMETER_REFERENCE; | |
| 6617 case "STATIC_FIELD_DECLARATION": | |
| 6618 return STATIC_FIELD_DECLARATION; | |
| 6619 case "STATIC_GETTER_DECLARATION": | |
| 6620 return STATIC_GETTER_DECLARATION; | |
| 6621 case "STATIC_GETTER_REFERENCE": | |
| 6622 return STATIC_GETTER_REFERENCE; | |
| 6623 case "STATIC_METHOD_DECLARATION": | |
| 6624 return STATIC_METHOD_DECLARATION; | |
| 6625 case "STATIC_METHOD_REFERENCE": | |
| 6626 return STATIC_METHOD_REFERENCE; | |
| 6627 case "STATIC_SETTER_DECLARATION": | |
| 6628 return STATIC_SETTER_DECLARATION; | |
| 6629 case "STATIC_SETTER_REFERENCE": | |
| 6630 return STATIC_SETTER_REFERENCE; | |
| 6631 case "TOP_LEVEL_FUNCTION_DECLARATION": | |
| 6632 return TOP_LEVEL_FUNCTION_DECLARATION; | |
| 6633 case "TOP_LEVEL_FUNCTION_REFERENCE": | |
| 6634 return TOP_LEVEL_FUNCTION_REFERENCE; | |
| 6635 case "TOP_LEVEL_GETTER_DECLARATION": | |
| 6636 return TOP_LEVEL_GETTER_DECLARATION; | |
| 6637 case "TOP_LEVEL_GETTER_REFERENCE": | |
| 6638 return TOP_LEVEL_GETTER_REFERENCE; | |
| 6639 case "TOP_LEVEL_SETTER_DECLARATION": | |
| 6640 return TOP_LEVEL_SETTER_DECLARATION; | |
| 6641 case "TOP_LEVEL_SETTER_REFERENCE": | |
| 6642 return TOP_LEVEL_SETTER_REFERENCE; | |
| 6643 case "TOP_LEVEL_VARIABLE_DECLARATION": | |
| 6644 return TOP_LEVEL_VARIABLE_DECLARATION; | |
| 6645 case "TYPE_NAME_DYNAMIC": | |
| 6646 return TYPE_NAME_DYNAMIC; | |
| 6647 case "TYPE_PARAMETER": | |
| 6648 return TYPE_PARAMETER; | |
| 6649 case "UNRESOLVED_INSTANCE_MEMBER_REFERENCE": | |
| 6650 return UNRESOLVED_INSTANCE_MEMBER_REFERENCE; | |
| 6651 case "VALID_STRING_ESCAPE": | |
| 6652 return VALID_STRING_ESCAPE; | |
| 6653 } | |
| 6654 throw new Exception('Illegal enum value: $name'); | |
| 6655 } | |
| 6656 | |
| 6657 factory HighlightRegionType.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 6658 if (json is String) { | |
| 6659 try { | |
| 6660 return new HighlightRegionType(json); | |
| 6661 } catch(_) { | |
| 6662 // Fall through | |
| 6663 } | |
| 6664 } | |
| 6665 throw jsonDecoder.mismatch(jsonPath, "HighlightRegionType", json); | |
| 6666 } | |
| 6667 | |
| 6668 @override | |
| 6669 String toString() => "HighlightRegionType.$name"; | |
| 6670 | |
| 6671 String toJson() => name; | |
| 6672 } | |
| 6673 | |
| 6674 /** | |
| 6675 * inlineLocalVariable feedback | |
| 6676 * | |
| 6677 * { | |
| 6678 * "name": String | |
| 6679 * "occurrences": int | |
| 6680 * } | |
| 6681 * | |
| 6682 * Clients may not extend, implement or mix-in this class. | |
| 6683 */ | |
| 6684 class InlineLocalVariableFeedback extends RefactoringFeedback { | |
| 6685 String _name; | |
| 6686 | |
| 6687 int _occurrences; | |
| 6688 | |
| 6689 /** | |
| 6690 * The name of the variable being inlined. | |
| 6691 */ | |
| 6692 String get name => _name; | |
| 6693 | |
| 6694 /** | |
| 6695 * The name of the variable being inlined. | |
| 6696 */ | |
| 6697 void set name(String value) { | |
| 6698 assert(value != null); | |
| 6699 this._name = value; | |
| 6700 } | |
| 6701 | |
| 6702 /** | |
| 6703 * The number of times the variable occurs. | |
| 6704 */ | |
| 6705 int get occurrences => _occurrences; | |
| 6706 | |
| 6707 /** | |
| 6708 * The number of times the variable occurs. | |
| 6709 */ | |
| 6710 void set occurrences(int value) { | |
| 6711 assert(value != null); | |
| 6712 this._occurrences = value; | |
| 6713 } | |
| 6714 | |
| 6715 InlineLocalVariableFeedback(String name, int occurrences) { | |
| 6716 this.name = name; | |
| 6717 this.occurrences = occurrences; | |
| 6718 } | |
| 6719 | |
| 6720 factory InlineLocalVariableFeedback.fromJson(JsonDecoder jsonDecoder, String j
sonPath, Object json) { | |
| 6721 if (json == null) { | |
| 6722 json = {}; | |
| 6723 } | |
| 6724 if (json is Map) { | |
| 6725 String name; | |
| 6726 if (json.containsKey("name")) { | |
| 6727 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]); | |
| 6728 } else { | |
| 6729 throw jsonDecoder.mismatch(jsonPath, "name"); | |
| 6730 } | |
| 6731 int occurrences; | |
| 6732 if (json.containsKey("occurrences")) { | |
| 6733 occurrences = jsonDecoder.decodeInt(jsonPath + ".occurrences", json["occ
urrences"]); | |
| 6734 } else { | |
| 6735 throw jsonDecoder.mismatch(jsonPath, "occurrences"); | |
| 6736 } | |
| 6737 return new InlineLocalVariableFeedback(name, occurrences); | |
| 6738 } else { | |
| 6739 throw jsonDecoder.mismatch(jsonPath, "inlineLocalVariable feedback", json)
; | |
| 6740 } | |
| 6741 } | |
| 6742 | |
| 6743 @override | |
| 6744 Map<String, dynamic> toJson() { | |
| 6745 Map<String, dynamic> result = {}; | |
| 6746 result["name"] = name; | |
| 6747 result["occurrences"] = occurrences; | |
| 6748 return result; | |
| 6749 } | |
| 6750 | |
| 6751 @override | |
| 6752 String toString() => JSON.encode(toJson()); | |
| 6753 | |
| 6754 @override | |
| 6755 bool operator==(other) { | |
| 6756 if (other is InlineLocalVariableFeedback) { | |
| 6757 return name == other.name && | |
| 6758 occurrences == other.occurrences; | |
| 6759 } | |
| 6760 return false; | |
| 6761 } | |
| 6762 | |
| 6763 @override | |
| 6764 int get hashCode { | |
| 6765 int hash = 0; | |
| 6766 hash = JenkinsSmiHash.combine(hash, name.hashCode); | |
| 6767 hash = JenkinsSmiHash.combine(hash, occurrences.hashCode); | |
| 6768 return JenkinsSmiHash.finish(hash); | |
| 6769 } | |
| 6770 } | |
| 6771 | |
| 6772 /** | |
| 6773 * inlineLocalVariable options | |
| 6774 * | |
| 6775 * Clients may not extend, implement or mix-in this class. | |
| 6776 */ | |
| 6777 class InlineLocalVariableOptions extends RefactoringOptions implements HasToJson
{ | |
| 6778 @override | |
| 6779 bool operator==(other) { | |
| 6780 if (other is InlineLocalVariableOptions) { | |
| 6781 return true; | |
| 6782 } | |
| 6783 return false; | |
| 6784 } | |
| 6785 | |
| 6786 @override | |
| 6787 int get hashCode { | |
| 6788 return 540364977; | |
| 6789 } | |
| 6790 } | |
| 6791 | |
| 6792 /** | |
| 6793 * inlineMethod feedback | |
| 6794 * | |
| 6795 * { | |
| 6796 * "className": optional String | |
| 6797 * "methodName": String | |
| 6798 * "isDeclaration": bool | |
| 6799 * } | |
| 6800 * | |
| 6801 * Clients may not extend, implement or mix-in this class. | |
| 6802 */ | |
| 6803 class InlineMethodFeedback extends RefactoringFeedback { | |
| 6804 String _className; | |
| 6805 | |
| 6806 String _methodName; | |
| 6807 | |
| 6808 bool _isDeclaration; | |
| 6809 | |
| 6810 /** | |
| 6811 * The name of the class enclosing the method being inlined. If not a class | |
| 6812 * member is being inlined, this field will be absent. | |
| 6813 */ | |
| 6814 String get className => _className; | |
| 6815 | |
| 6816 /** | |
| 6817 * The name of the class enclosing the method being inlined. If not a class | |
| 6818 * member is being inlined, this field will be absent. | |
| 6819 */ | |
| 6820 void set className(String value) { | |
| 6821 this._className = value; | |
| 6822 } | |
| 6823 | |
| 6824 /** | |
| 6825 * The name of the method (or function) being inlined. | |
| 6826 */ | |
| 6827 String get methodName => _methodName; | |
| 6828 | |
| 6829 /** | |
| 6830 * The name of the method (or function) being inlined. | |
| 6831 */ | |
| 6832 void set methodName(String value) { | |
| 6833 assert(value != null); | |
| 6834 this._methodName = value; | |
| 6835 } | |
| 6836 | |
| 6837 /** | |
| 6838 * True if the declaration of the method is selected and all references | |
| 6839 * should be inlined. | |
| 6840 */ | |
| 6841 bool get isDeclaration => _isDeclaration; | |
| 6842 | |
| 6843 /** | |
| 6844 * True if the declaration of the method is selected and all references | |
| 6845 * should be inlined. | |
| 6846 */ | |
| 6847 void set isDeclaration(bool value) { | |
| 6848 assert(value != null); | |
| 6849 this._isDeclaration = value; | |
| 6850 } | |
| 6851 | |
| 6852 InlineMethodFeedback(String methodName, bool isDeclaration, {String className}
) { | |
| 6853 this.className = className; | |
| 6854 this.methodName = methodName; | |
| 6855 this.isDeclaration = isDeclaration; | |
| 6856 } | |
| 6857 | |
| 6858 factory InlineMethodFeedback.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 6859 if (json == null) { | |
| 6860 json = {}; | |
| 6861 } | |
| 6862 if (json is Map) { | |
| 6863 String className; | |
| 6864 if (json.containsKey("className")) { | |
| 6865 className = jsonDecoder.decodeString(jsonPath + ".className", json["clas
sName"]); | |
| 6866 } | |
| 6867 String methodName; | |
| 6868 if (json.containsKey("methodName")) { | |
| 6869 methodName = jsonDecoder.decodeString(jsonPath + ".methodName", json["me
thodName"]); | |
| 6870 } else { | |
| 6871 throw jsonDecoder.mismatch(jsonPath, "methodName"); | |
| 6872 } | |
| 6873 bool isDeclaration; | |
| 6874 if (json.containsKey("isDeclaration")) { | |
| 6875 isDeclaration = jsonDecoder.decodeBool(jsonPath + ".isDeclaration", json
["isDeclaration"]); | |
| 6876 } else { | |
| 6877 throw jsonDecoder.mismatch(jsonPath, "isDeclaration"); | |
| 6878 } | |
| 6879 return new InlineMethodFeedback(methodName, isDeclaration, className: clas
sName); | |
| 6880 } else { | |
| 6881 throw jsonDecoder.mismatch(jsonPath, "inlineMethod feedback", json); | |
| 6882 } | |
| 6883 } | |
| 6884 | |
| 6885 @override | |
| 6886 Map<String, dynamic> toJson() { | |
| 6887 Map<String, dynamic> result = {}; | |
| 6888 if (className != null) { | |
| 6889 result["className"] = className; | |
| 6890 } | |
| 6891 result["methodName"] = methodName; | |
| 6892 result["isDeclaration"] = isDeclaration; | |
| 6893 return result; | |
| 6894 } | |
| 6895 | |
| 6896 @override | |
| 6897 String toString() => JSON.encode(toJson()); | |
| 6898 | |
| 6899 @override | |
| 6900 bool operator==(other) { | |
| 6901 if (other is InlineMethodFeedback) { | |
| 6902 return className == other.className && | |
| 6903 methodName == other.methodName && | |
| 6904 isDeclaration == other.isDeclaration; | |
| 6905 } | |
| 6906 return false; | |
| 6907 } | |
| 6908 | |
| 6909 @override | |
| 6910 int get hashCode { | |
| 6911 int hash = 0; | |
| 6912 hash = JenkinsSmiHash.combine(hash, className.hashCode); | |
| 6913 hash = JenkinsSmiHash.combine(hash, methodName.hashCode); | |
| 6914 hash = JenkinsSmiHash.combine(hash, isDeclaration.hashCode); | |
| 6915 return JenkinsSmiHash.finish(hash); | |
| 6916 } | |
| 6917 } | |
| 6918 | |
| 6919 /** | |
| 6920 * inlineMethod options | |
| 6921 * | |
| 6922 * { | |
| 6923 * "deleteSource": bool | |
| 6924 * "inlineAll": bool | |
| 6925 * } | |
| 6926 * | |
| 6927 * Clients may not extend, implement or mix-in this class. | |
| 6928 */ | |
| 6929 class InlineMethodOptions extends RefactoringOptions { | |
| 6930 bool _deleteSource; | |
| 6931 | |
| 6932 bool _inlineAll; | |
| 6933 | |
| 6934 /** | |
| 6935 * True if the method being inlined should be removed. It is an error if this | |
| 6936 * field is true and inlineAll is false. | |
| 6937 */ | |
| 6938 bool get deleteSource => _deleteSource; | |
| 6939 | |
| 6940 /** | |
| 6941 * True if the method being inlined should be removed. It is an error if this | |
| 6942 * field is true and inlineAll is false. | |
| 6943 */ | |
| 6944 void set deleteSource(bool value) { | |
| 6945 assert(value != null); | |
| 6946 this._deleteSource = value; | |
| 6947 } | |
| 6948 | |
| 6949 /** | |
| 6950 * True if all invocations of the method should be inlined, or false if only | |
| 6951 * the invocation site used to create this refactoring should be inlined. | |
| 6952 */ | |
| 6953 bool get inlineAll => _inlineAll; | |
| 6954 | |
| 6955 /** | |
| 6956 * True if all invocations of the method should be inlined, or false if only | |
| 6957 * the invocation site used to create this refactoring should be inlined. | |
| 6958 */ | |
| 6959 void set inlineAll(bool value) { | |
| 6960 assert(value != null); | |
| 6961 this._inlineAll = value; | |
| 6962 } | |
| 6963 | |
| 6964 InlineMethodOptions(bool deleteSource, bool inlineAll) { | |
| 6965 this.deleteSource = deleteSource; | |
| 6966 this.inlineAll = inlineAll; | |
| 6967 } | |
| 6968 | |
| 6969 factory InlineMethodOptions.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 6970 if (json == null) { | |
| 6971 json = {}; | |
| 6972 } | |
| 6973 if (json is Map) { | |
| 6974 bool deleteSource; | |
| 6975 if (json.containsKey("deleteSource")) { | |
| 6976 deleteSource = jsonDecoder.decodeBool(jsonPath + ".deleteSource", json["
deleteSource"]); | |
| 6977 } else { | |
| 6978 throw jsonDecoder.mismatch(jsonPath, "deleteSource"); | |
| 6979 } | |
| 6980 bool inlineAll; | |
| 6981 if (json.containsKey("inlineAll")) { | |
| 6982 inlineAll = jsonDecoder.decodeBool(jsonPath + ".inlineAll", json["inline
All"]); | |
| 6983 } else { | |
| 6984 throw jsonDecoder.mismatch(jsonPath, "inlineAll"); | |
| 6985 } | |
| 6986 return new InlineMethodOptions(deleteSource, inlineAll); | |
| 6987 } else { | |
| 6988 throw jsonDecoder.mismatch(jsonPath, "inlineMethod options", json); | |
| 6989 } | |
| 6990 } | |
| 6991 | |
| 6992 factory InlineMethodOptions.fromRefactoringParams(EditGetRefactoringParams ref
actoringParams, Request request) { | |
| 6993 return new InlineMethodOptions.fromJson( | |
| 6994 new RequestDecoder(request), "options", refactoringParams.options); | |
| 6995 } | |
| 6996 | |
| 6997 @override | |
| 6998 Map<String, dynamic> toJson() { | |
| 6999 Map<String, dynamic> result = {}; | |
| 7000 result["deleteSource"] = deleteSource; | |
| 7001 result["inlineAll"] = inlineAll; | |
| 7002 return result; | |
| 7003 } | |
| 7004 | |
| 7005 @override | |
| 7006 String toString() => JSON.encode(toJson()); | |
| 7007 | |
| 7008 @override | |
| 7009 bool operator==(other) { | |
| 7010 if (other is InlineMethodOptions) { | |
| 7011 return deleteSource == other.deleteSource && | |
| 7012 inlineAll == other.inlineAll; | |
| 7013 } | |
| 7014 return false; | |
| 7015 } | |
| 7016 | |
| 7017 @override | |
| 7018 int get hashCode { | |
| 7019 int hash = 0; | |
| 7020 hash = JenkinsSmiHash.combine(hash, deleteSource.hashCode); | |
| 7021 hash = JenkinsSmiHash.combine(hash, inlineAll.hashCode); | |
| 7022 return JenkinsSmiHash.finish(hash); | |
| 7023 } | |
| 7024 } | |
| 7025 | |
| 7026 /** | |
| 7027 * LinkedEditGroup | |
| 7028 * | |
| 7029 * { | |
| 7030 * "positions": List<Position> | |
| 7031 * "length": int | |
| 7032 * "suggestions": List<LinkedEditSuggestion> | |
| 7033 * } | |
| 7034 * | |
| 7035 * Clients may not extend, implement or mix-in this class. | |
| 7036 */ | |
| 7037 class LinkedEditGroup implements HasToJson { | |
| 7038 List<Position> _positions; | |
| 7039 | |
| 7040 int _length; | |
| 7041 | |
| 7042 List<LinkedEditSuggestion> _suggestions; | |
| 7043 | |
| 7044 /** | |
| 7045 * The positions of the regions that should be edited simultaneously. | |
| 7046 */ | |
| 7047 List<Position> get positions => _positions; | |
| 7048 | |
| 7049 /** | |
| 7050 * The positions of the regions that should be edited simultaneously. | |
| 7051 */ | |
| 7052 void set positions(List<Position> value) { | |
| 7053 assert(value != null); | |
| 7054 this._positions = value; | |
| 7055 } | |
| 7056 | |
| 7057 /** | |
| 7058 * The length of the regions that should be edited simultaneously. | |
| 7059 */ | |
| 7060 int get length => _length; | |
| 7061 | |
| 7062 /** | |
| 7063 * The length of the regions that should be edited simultaneously. | |
| 7064 */ | |
| 7065 void set length(int value) { | |
| 7066 assert(value != null); | |
| 7067 this._length = value; | |
| 7068 } | |
| 7069 | |
| 7070 /** | |
| 7071 * Pre-computed suggestions for what every region might want to be changed | |
| 7072 * to. | |
| 7073 */ | |
| 7074 List<LinkedEditSuggestion> get suggestions => _suggestions; | |
| 7075 | |
| 7076 /** | |
| 7077 * Pre-computed suggestions for what every region might want to be changed | |
| 7078 * to. | |
| 7079 */ | |
| 7080 void set suggestions(List<LinkedEditSuggestion> value) { | |
| 7081 assert(value != null); | |
| 7082 this._suggestions = value; | |
| 7083 } | |
| 7084 | |
| 7085 LinkedEditGroup(List<Position> positions, int length, List<LinkedEditSuggestio
n> suggestions) { | |
| 7086 this.positions = positions; | |
| 7087 this.length = length; | |
| 7088 this.suggestions = suggestions; | |
| 7089 } | |
| 7090 | |
| 7091 factory LinkedEditGroup.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obj
ect json) { | |
| 7092 if (json == null) { | |
| 7093 json = {}; | |
| 7094 } | |
| 7095 if (json is Map) { | |
| 7096 List<Position> positions; | |
| 7097 if (json.containsKey("positions")) { | |
| 7098 positions = jsonDecoder.decodeList(jsonPath + ".positions", json["positi
ons"], (String jsonPath, Object json) => new Position.fromJson(jsonDecoder, json
Path, json)); | |
| 7099 } else { | |
| 7100 throw jsonDecoder.mismatch(jsonPath, "positions"); | |
| 7101 } | |
| 7102 int length; | |
| 7103 if (json.containsKey("length")) { | |
| 7104 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); | |
| 7105 } else { | |
| 7106 throw jsonDecoder.mismatch(jsonPath, "length"); | |
| 7107 } | |
| 7108 List<LinkedEditSuggestion> suggestions; | |
| 7109 if (json.containsKey("suggestions")) { | |
| 7110 suggestions = jsonDecoder.decodeList(jsonPath + ".suggestions", json["su
ggestions"], (String jsonPath, Object json) => new LinkedEditSuggestion.fromJson
(jsonDecoder, jsonPath, json)); | |
| 7111 } else { | |
| 7112 throw jsonDecoder.mismatch(jsonPath, "suggestions"); | |
| 7113 } | |
| 7114 return new LinkedEditGroup(positions, length, suggestions); | |
| 7115 } else { | |
| 7116 throw jsonDecoder.mismatch(jsonPath, "LinkedEditGroup", json); | |
| 7117 } | |
| 7118 } | |
| 7119 | |
| 7120 /** | |
| 7121 * Construct an empty LinkedEditGroup. | |
| 7122 */ | |
| 7123 LinkedEditGroup.empty() : this(<Position>[], 0, <LinkedEditSuggestion>[]); | |
| 7124 | |
| 7125 @override | |
| 7126 Map<String, dynamic> toJson() { | |
| 7127 Map<String, dynamic> result = {}; | |
| 7128 result["positions"] = positions.map((Position value) => value.toJson()).toLi
st(); | |
| 7129 result["length"] = length; | |
| 7130 result["suggestions"] = suggestions.map((LinkedEditSuggestion value) => valu
e.toJson()).toList(); | |
| 7131 return result; | |
| 7132 } | |
| 7133 | |
| 7134 /** | |
| 7135 * Add a new position and change the length. | |
| 7136 */ | |
| 7137 void addPosition(Position position, int length) { | |
| 7138 positions.add(position); | |
| 7139 this.length = length; | |
| 7140 } | |
| 7141 | |
| 7142 /** | |
| 7143 * Add a new suggestion. | |
| 7144 */ | |
| 7145 void addSuggestion(LinkedEditSuggestion suggestion) { | |
| 7146 suggestions.add(suggestion); | |
| 7147 } | |
| 7148 | |
| 7149 @override | |
| 7150 String toString() => JSON.encode(toJson()); | |
| 7151 | |
| 7152 @override | |
| 7153 bool operator==(other) { | |
| 7154 if (other is LinkedEditGroup) { | |
| 7155 return listEqual(positions, other.positions, (Position a, Position b) => a
== b) && | |
| 7156 length == other.length && | |
| 7157 listEqual(suggestions, other.suggestions, (LinkedEditSuggestion a, Lin
kedEditSuggestion b) => a == b); | |
| 7158 } | |
| 7159 return false; | |
| 7160 } | |
| 7161 | |
| 7162 @override | |
| 7163 int get hashCode { | |
| 7164 int hash = 0; | |
| 7165 hash = JenkinsSmiHash.combine(hash, positions.hashCode); | |
| 7166 hash = JenkinsSmiHash.combine(hash, length.hashCode); | |
| 7167 hash = JenkinsSmiHash.combine(hash, suggestions.hashCode); | |
| 7168 return JenkinsSmiHash.finish(hash); | |
| 7169 } | |
| 7170 } | |
| 7171 | |
| 7172 /** | |
| 7173 * LinkedEditSuggestion | |
| 7174 * | |
| 7175 * { | |
| 7176 * "value": String | |
| 7177 * "kind": LinkedEditSuggestionKind | |
| 7178 * } | |
| 7179 * | |
| 7180 * Clients may not extend, implement or mix-in this class. | |
| 7181 */ | |
| 7182 class LinkedEditSuggestion implements HasToJson { | |
| 7183 String _value; | |
| 7184 | |
| 7185 LinkedEditSuggestionKind _kind; | |
| 7186 | |
| 7187 /** | |
| 7188 * The value that could be used to replace all of the linked edit regions. | |
| 7189 */ | |
| 7190 String get value => _value; | |
| 7191 | |
| 7192 /** | |
| 7193 * The value that could be used to replace all of the linked edit regions. | |
| 7194 */ | |
| 7195 void set value(String value) { | |
| 7196 assert(value != null); | |
| 7197 this._value = value; | |
| 7198 } | |
| 7199 | |
| 7200 /** | |
| 7201 * The kind of value being proposed. | |
| 7202 */ | |
| 7203 LinkedEditSuggestionKind get kind => _kind; | |
| 7204 | |
| 7205 /** | |
| 7206 * The kind of value being proposed. | |
| 7207 */ | |
| 7208 void set kind(LinkedEditSuggestionKind value) { | |
| 7209 assert(value != null); | |
| 7210 this._kind = value; | |
| 7211 } | |
| 7212 | |
| 7213 LinkedEditSuggestion(String value, LinkedEditSuggestionKind kind) { | |
| 7214 this.value = value; | |
| 7215 this.kind = kind; | |
| 7216 } | |
| 7217 | |
| 7218 factory LinkedEditSuggestion.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 7219 if (json == null) { | |
| 7220 json = {}; | |
| 7221 } | |
| 7222 if (json is Map) { | |
| 7223 String value; | |
| 7224 if (json.containsKey("value")) { | |
| 7225 value = jsonDecoder.decodeString(jsonPath + ".value", json["value"]); | |
| 7226 } else { | |
| 7227 throw jsonDecoder.mismatch(jsonPath, "value"); | |
| 7228 } | |
| 7229 LinkedEditSuggestionKind kind; | |
| 7230 if (json.containsKey("kind")) { | |
| 7231 kind = new LinkedEditSuggestionKind.fromJson(jsonDecoder, jsonPath + ".k
ind", json["kind"]); | |
| 7232 } else { | |
| 7233 throw jsonDecoder.mismatch(jsonPath, "kind"); | |
| 7234 } | |
| 7235 return new LinkedEditSuggestion(value, kind); | |
| 7236 } else { | |
| 7237 throw jsonDecoder.mismatch(jsonPath, "LinkedEditSuggestion", json); | |
| 7238 } | |
| 7239 } | |
| 7240 | |
| 7241 @override | |
| 7242 Map<String, dynamic> toJson() { | |
| 7243 Map<String, dynamic> result = {}; | |
| 7244 result["value"] = value; | |
| 7245 result["kind"] = kind.toJson(); | |
| 7246 return result; | |
| 7247 } | |
| 7248 | |
| 7249 @override | |
| 7250 String toString() => JSON.encode(toJson()); | |
| 7251 | |
| 7252 @override | |
| 7253 bool operator==(other) { | |
| 7254 if (other is LinkedEditSuggestion) { | |
| 7255 return value == other.value && | |
| 7256 kind == other.kind; | |
| 7257 } | |
| 7258 return false; | |
| 7259 } | |
| 7260 | |
| 7261 @override | |
| 7262 int get hashCode { | |
| 7263 int hash = 0; | |
| 7264 hash = JenkinsSmiHash.combine(hash, value.hashCode); | |
| 7265 hash = JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 7266 return JenkinsSmiHash.finish(hash); | |
| 7267 } | |
| 7268 } | |
| 7269 | |
| 7270 /** | |
| 7271 * LinkedEditSuggestionKind | |
| 7272 * | |
| 7273 * enum { | |
| 7274 * METHOD | |
| 7275 * PARAMETER | |
| 7276 * TYPE | |
| 7277 * VARIABLE | |
| 7278 * } | |
| 7279 * | |
| 7280 * Clients may not extend, implement or mix-in this class. | |
| 7281 */ | |
| 7282 class LinkedEditSuggestionKind implements Enum { | |
| 7283 static const LinkedEditSuggestionKind METHOD = const LinkedEditSuggestionKind.
_("METHOD"); | |
| 7284 | |
| 7285 static const LinkedEditSuggestionKind PARAMETER = const LinkedEditSuggestionKi
nd._("PARAMETER"); | |
| 7286 | |
| 7287 static const LinkedEditSuggestionKind TYPE = const LinkedEditSuggestionKind._(
"TYPE"); | |
| 7288 | |
| 7289 static const LinkedEditSuggestionKind VARIABLE = const LinkedEditSuggestionKin
d._("VARIABLE"); | |
| 7290 | |
| 7291 /** | |
| 7292 * A list containing all of the enum values that are defined. | |
| 7293 */ | |
| 7294 static const List<LinkedEditSuggestionKind> VALUES = const <LinkedEditSuggesti
onKind>[METHOD, PARAMETER, TYPE, VARIABLE]; | |
| 7295 | |
| 7296 @override | |
| 7297 final String name; | |
| 7298 | |
| 7299 const LinkedEditSuggestionKind._(this.name); | |
| 7300 | |
| 7301 factory LinkedEditSuggestionKind(String name) { | |
| 7302 switch (name) { | |
| 7303 case "METHOD": | |
| 7304 return METHOD; | |
| 7305 case "PARAMETER": | |
| 7306 return PARAMETER; | |
| 7307 case "TYPE": | |
| 7308 return TYPE; | |
| 7309 case "VARIABLE": | |
| 7310 return VARIABLE; | |
| 7311 } | |
| 7312 throw new Exception('Illegal enum value: $name'); | |
| 7313 } | |
| 7314 | |
| 7315 factory LinkedEditSuggestionKind.fromJson(JsonDecoder jsonDecoder, String json
Path, Object json) { | |
| 7316 if (json is String) { | |
| 7317 try { | |
| 7318 return new LinkedEditSuggestionKind(json); | |
| 7319 } catch(_) { | |
| 7320 // Fall through | |
| 7321 } | |
| 7322 } | |
| 7323 throw jsonDecoder.mismatch(jsonPath, "LinkedEditSuggestionKind", json); | |
| 7324 } | |
| 7325 | |
| 7326 @override | |
| 7327 String toString() => "LinkedEditSuggestionKind.$name"; | |
| 7328 | |
| 7329 String toJson() => name; | |
| 7330 } | |
| 7331 | |
| 7332 /** | |
| 7333 * Location | |
| 7334 * | |
| 7335 * { | |
| 7336 * "file": FilePath | |
| 7337 * "offset": int | |
| 7338 * "length": int | |
| 7339 * "startLine": int | |
| 7340 * "startColumn": int | |
| 7341 * } | |
| 7342 * | |
| 7343 * Clients may not extend, implement or mix-in this class. | |
| 7344 */ | |
| 7345 class Location implements HasToJson { | |
| 7346 String _file; | |
| 7347 | |
| 7348 int _offset; | |
| 7349 | |
| 7350 int _length; | |
| 7351 | |
| 7352 int _startLine; | |
| 7353 | |
| 7354 int _startColumn; | |
| 7355 | |
| 7356 /** | |
| 7357 * The file containing the range. | |
| 7358 */ | |
| 7359 String get file => _file; | |
| 7360 | |
| 7361 /** | |
| 7362 * The file containing the range. | |
| 7363 */ | |
| 7364 void set file(String value) { | |
| 7365 assert(value != null); | |
| 7366 this._file = value; | |
| 7367 } | |
| 7368 | |
| 7369 /** | |
| 7370 * The offset of the range. | |
| 7371 */ | |
| 7372 int get offset => _offset; | |
| 7373 | |
| 7374 /** | |
| 7375 * The offset of the range. | |
| 7376 */ | |
| 7377 void set offset(int value) { | |
| 7378 assert(value != null); | |
| 7379 this._offset = value; | |
| 7380 } | |
| 7381 | |
| 7382 /** | |
| 7383 * The length of the range. | |
| 7384 */ | |
| 7385 int get length => _length; | |
| 7386 | |
| 7387 /** | |
| 7388 * The length of the range. | |
| 7389 */ | |
| 7390 void set length(int value) { | |
| 7391 assert(value != null); | |
| 7392 this._length = value; | |
| 7393 } | |
| 7394 | |
| 7395 /** | |
| 7396 * The one-based index of the line containing the first character of the | |
| 7397 * range. | |
| 7398 */ | |
| 7399 int get startLine => _startLine; | |
| 7400 | |
| 7401 /** | |
| 7402 * The one-based index of the line containing the first character of the | |
| 7403 * range. | |
| 7404 */ | |
| 7405 void set startLine(int value) { | |
| 7406 assert(value != null); | |
| 7407 this._startLine = value; | |
| 7408 } | |
| 7409 | |
| 7410 /** | |
| 7411 * The one-based index of the column containing the first character of the | |
| 7412 * range. | |
| 7413 */ | |
| 7414 int get startColumn => _startColumn; | |
| 7415 | |
| 7416 /** | |
| 7417 * The one-based index of the column containing the first character of the | |
| 7418 * range. | |
| 7419 */ | |
| 7420 void set startColumn(int value) { | |
| 7421 assert(value != null); | |
| 7422 this._startColumn = value; | |
| 7423 } | |
| 7424 | |
| 7425 Location(String file, int offset, int length, int startLine, int startColumn)
{ | |
| 7426 this.file = file; | |
| 7427 this.offset = offset; | |
| 7428 this.length = length; | |
| 7429 this.startLine = startLine; | |
| 7430 this.startColumn = startColumn; | |
| 7431 } | |
| 7432 | |
| 7433 factory Location.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object jso
n) { | |
| 7434 if (json == null) { | |
| 7435 json = {}; | |
| 7436 } | |
| 7437 if (json is Map) { | |
| 7438 String file; | |
| 7439 if (json.containsKey("file")) { | |
| 7440 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); | |
| 7441 } else { | |
| 7442 throw jsonDecoder.mismatch(jsonPath, "file"); | |
| 7443 } | |
| 7444 int offset; | |
| 7445 if (json.containsKey("offset")) { | |
| 7446 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 7447 } else { | |
| 7448 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 7449 } | |
| 7450 int length; | |
| 7451 if (json.containsKey("length")) { | |
| 7452 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); | |
| 7453 } else { | |
| 7454 throw jsonDecoder.mismatch(jsonPath, "length"); | |
| 7455 } | |
| 7456 int startLine; | |
| 7457 if (json.containsKey("startLine")) { | |
| 7458 startLine = jsonDecoder.decodeInt(jsonPath + ".startLine", json["startLi
ne"]); | |
| 7459 } else { | |
| 7460 throw jsonDecoder.mismatch(jsonPath, "startLine"); | |
| 7461 } | |
| 7462 int startColumn; | |
| 7463 if (json.containsKey("startColumn")) { | |
| 7464 startColumn = jsonDecoder.decodeInt(jsonPath + ".startColumn", json["sta
rtColumn"]); | |
| 7465 } else { | |
| 7466 throw jsonDecoder.mismatch(jsonPath, "startColumn"); | |
| 7467 } | |
| 7468 return new Location(file, offset, length, startLine, startColumn); | |
| 7469 } else { | |
| 7470 throw jsonDecoder.mismatch(jsonPath, "Location", json); | |
| 7471 } | |
| 7472 } | |
| 7473 | |
| 7474 @override | |
| 7475 Map<String, dynamic> toJson() { | |
| 7476 Map<String, dynamic> result = {}; | |
| 7477 result["file"] = file; | |
| 7478 result["offset"] = offset; | |
| 7479 result["length"] = length; | |
| 7480 result["startLine"] = startLine; | |
| 7481 result["startColumn"] = startColumn; | |
| 7482 return result; | |
| 7483 } | |
| 7484 | |
| 7485 @override | |
| 7486 String toString() => JSON.encode(toJson()); | |
| 7487 | |
| 7488 @override | |
| 7489 bool operator==(other) { | |
| 7490 if (other is Location) { | |
| 7491 return file == other.file && | |
| 7492 offset == other.offset && | |
| 7493 length == other.length && | |
| 7494 startLine == other.startLine && | |
| 7495 startColumn == other.startColumn; | |
| 7496 } | |
| 7497 return false; | |
| 7498 } | |
| 7499 | |
| 7500 @override | |
| 7501 int get hashCode { | |
| 7502 int hash = 0; | |
| 7503 hash = JenkinsSmiHash.combine(hash, file.hashCode); | |
| 7504 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 7505 hash = JenkinsSmiHash.combine(hash, length.hashCode); | |
| 7506 hash = JenkinsSmiHash.combine(hash, startLine.hashCode); | |
| 7507 hash = JenkinsSmiHash.combine(hash, startColumn.hashCode); | |
| 7508 return JenkinsSmiHash.finish(hash); | |
| 7509 } | |
| 7510 } | |
| 7511 | |
| 7512 /** | |
| 7513 * moveFile feedback | |
| 7514 * | |
| 7515 * Clients may not extend, implement or mix-in this class. | |
| 7516 */ | |
| 7517 class MoveFileFeedback extends RefactoringFeedback implements HasToJson { | |
| 7518 @override | |
| 7519 bool operator==(other) { | |
| 7520 if (other is MoveFileFeedback) { | |
| 7521 return true; | |
| 7522 } | |
| 7523 return false; | |
| 7524 } | |
| 7525 | |
| 7526 @override | |
| 7527 int get hashCode { | |
| 7528 return 438975893; | |
| 7529 } | |
| 7530 } | |
| 7531 | |
| 7532 /** | |
| 7533 * moveFile options | |
| 7534 * | |
| 7535 * { | |
| 7536 * "newFile": FilePath | |
| 7537 * } | |
| 7538 * | |
| 7539 * Clients may not extend, implement or mix-in this class. | |
| 7540 */ | |
| 7541 class MoveFileOptions extends RefactoringOptions { | |
| 7542 String _newFile; | |
| 7543 | |
| 7544 /** | |
| 7545 * The new file path to which the given file is being moved. | |
| 7546 */ | |
| 7547 String get newFile => _newFile; | |
| 7548 | |
| 7549 /** | |
| 7550 * The new file path to which the given file is being moved. | |
| 7551 */ | |
| 7552 void set newFile(String value) { | |
| 7553 assert(value != null); | |
| 7554 this._newFile = value; | |
| 7555 } | |
| 7556 | |
| 7557 MoveFileOptions(String newFile) { | |
| 7558 this.newFile = newFile; | |
| 7559 } | |
| 7560 | |
| 7561 factory MoveFileOptions.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obj
ect json) { | |
| 7562 if (json == null) { | |
| 7563 json = {}; | |
| 7564 } | |
| 7565 if (json is Map) { | |
| 7566 String newFile; | |
| 7567 if (json.containsKey("newFile")) { | |
| 7568 newFile = jsonDecoder.decodeString(jsonPath + ".newFile", json["newFile"
]); | |
| 7569 } else { | |
| 7570 throw jsonDecoder.mismatch(jsonPath, "newFile"); | |
| 7571 } | |
| 7572 return new MoveFileOptions(newFile); | |
| 7573 } else { | |
| 7574 throw jsonDecoder.mismatch(jsonPath, "moveFile options", json); | |
| 7575 } | |
| 7576 } | |
| 7577 | |
| 7578 factory MoveFileOptions.fromRefactoringParams(EditGetRefactoringParams refacto
ringParams, Request request) { | |
| 7579 return new MoveFileOptions.fromJson( | |
| 7580 new RequestDecoder(request), "options", refactoringParams.options); | |
| 7581 } | |
| 7582 | |
| 7583 @override | |
| 7584 Map<String, dynamic> toJson() { | |
| 7585 Map<String, dynamic> result = {}; | |
| 7586 result["newFile"] = newFile; | |
| 7587 return result; | |
| 7588 } | |
| 7589 | |
| 7590 @override | |
| 7591 String toString() => JSON.encode(toJson()); | |
| 7592 | |
| 7593 @override | |
| 7594 bool operator==(other) { | |
| 7595 if (other is MoveFileOptions) { | |
| 7596 return newFile == other.newFile; | |
| 7597 } | |
| 7598 return false; | |
| 7599 } | |
| 7600 | |
| 7601 @override | |
| 7602 int get hashCode { | |
| 7603 int hash = 0; | |
| 7604 hash = JenkinsSmiHash.combine(hash, newFile.hashCode); | |
| 7605 return JenkinsSmiHash.finish(hash); | |
| 7606 } | |
| 7607 } | |
| 7608 | |
| 7609 /** | |
| 7610 * NavigationRegion | |
| 7611 * | |
| 7612 * { | |
| 7613 * "offset": int | |
| 7614 * "length": int | |
| 7615 * "targets": List<int> | |
| 7616 * } | |
| 7617 * | |
| 7618 * Clients may not extend, implement or mix-in this class. | |
| 7619 */ | |
| 7620 class NavigationRegion implements HasToJson { | |
| 7621 int _offset; | |
| 7622 | |
| 7623 int _length; | |
| 7624 | |
| 7625 List<int> _targets; | |
| 7626 | |
| 7627 /** | |
| 7628 * The offset of the region from which the user can navigate. | |
| 7629 */ | |
| 7630 int get offset => _offset; | |
| 7631 | |
| 7632 /** | |
| 7633 * The offset of the region from which the user can navigate. | |
| 7634 */ | |
| 7635 void set offset(int value) { | |
| 7636 assert(value != null); | |
| 7637 this._offset = value; | |
| 7638 } | |
| 7639 | |
| 7640 /** | |
| 7641 * The length of the region from which the user can navigate. | |
| 7642 */ | |
| 7643 int get length => _length; | |
| 7644 | |
| 7645 /** | |
| 7646 * The length of the region from which the user can navigate. | |
| 7647 */ | |
| 7648 void set length(int value) { | |
| 7649 assert(value != null); | |
| 7650 this._length = value; | |
| 7651 } | |
| 7652 | |
| 7653 /** | |
| 7654 * The indexes of the targets (in the enclosing navigation response) to which | |
| 7655 * the given region is bound. By opening the target, clients can implement | |
| 7656 * one form of navigation. This list cannot be empty. | |
| 7657 */ | |
| 7658 List<int> get targets => _targets; | |
| 7659 | |
| 7660 /** | |
| 7661 * The indexes of the targets (in the enclosing navigation response) to which | |
| 7662 * the given region is bound. By opening the target, clients can implement | |
| 7663 * one form of navigation. This list cannot be empty. | |
| 7664 */ | |
| 7665 void set targets(List<int> value) { | |
| 7666 assert(value != null); | |
| 7667 this._targets = value; | |
| 7668 } | |
| 7669 | |
| 7670 NavigationRegion(int offset, int length, List<int> targets) { | |
| 7671 this.offset = offset; | |
| 7672 this.length = length; | |
| 7673 this.targets = targets; | |
| 7674 } | |
| 7675 | |
| 7676 factory NavigationRegion.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob
ject json) { | |
| 7677 if (json == null) { | |
| 7678 json = {}; | |
| 7679 } | |
| 7680 if (json is Map) { | |
| 7681 int offset; | |
| 7682 if (json.containsKey("offset")) { | |
| 7683 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 7684 } else { | |
| 7685 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 7686 } | |
| 7687 int length; | |
| 7688 if (json.containsKey("length")) { | |
| 7689 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); | |
| 7690 } else { | |
| 7691 throw jsonDecoder.mismatch(jsonPath, "length"); | |
| 7692 } | |
| 7693 List<int> targets; | |
| 7694 if (json.containsKey("targets")) { | |
| 7695 targets = jsonDecoder.decodeList(jsonPath + ".targets", json["targets"],
jsonDecoder.decodeInt); | |
| 7696 } else { | |
| 7697 throw jsonDecoder.mismatch(jsonPath, "targets"); | |
| 7698 } | |
| 7699 return new NavigationRegion(offset, length, targets); | |
| 7700 } else { | |
| 7701 throw jsonDecoder.mismatch(jsonPath, "NavigationRegion", json); | |
| 7702 } | |
| 7703 } | |
| 7704 | |
| 7705 @override | |
| 7706 Map<String, dynamic> toJson() { | |
| 7707 Map<String, dynamic> result = {}; | |
| 7708 result["offset"] = offset; | |
| 7709 result["length"] = length; | |
| 7710 result["targets"] = targets; | |
| 7711 return result; | |
| 7712 } | |
| 7713 | |
| 7714 @override | |
| 7715 String toString() => JSON.encode(toJson()); | |
| 7716 | |
| 7717 @override | |
| 7718 bool operator==(other) { | |
| 7719 if (other is NavigationRegion) { | |
| 7720 return offset == other.offset && | |
| 7721 length == other.length && | |
| 7722 listEqual(targets, other.targets, (int a, int b) => a == b); | |
| 7723 } | |
| 7724 return false; | |
| 7725 } | |
| 7726 | |
| 7727 @override | |
| 7728 int get hashCode { | |
| 7729 int hash = 0; | |
| 7730 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 7731 hash = JenkinsSmiHash.combine(hash, length.hashCode); | |
| 7732 hash = JenkinsSmiHash.combine(hash, targets.hashCode); | |
| 7733 return JenkinsSmiHash.finish(hash); | |
| 7734 } | |
| 7735 } | |
| 7736 | |
| 7737 /** | |
| 7738 * NavigationTarget | |
| 7739 * | |
| 7740 * { | |
| 7741 * "kind": ElementKind | |
| 7742 * "fileIndex": int | |
| 7743 * "offset": int | |
| 7744 * "length": int | |
| 7745 * "startLine": int | |
| 7746 * "startColumn": int | |
| 7747 * } | |
| 7748 * | |
| 7749 * Clients may not extend, implement or mix-in this class. | |
| 7750 */ | |
| 7751 class NavigationTarget implements HasToJson { | |
| 7752 ElementKind _kind; | |
| 7753 | |
| 7754 int _fileIndex; | |
| 7755 | |
| 7756 int _offset; | |
| 7757 | |
| 7758 int _length; | |
| 7759 | |
| 7760 int _startLine; | |
| 7761 | |
| 7762 int _startColumn; | |
| 7763 | |
| 7764 /** | |
| 7765 * The kind of the element. | |
| 7766 */ | |
| 7767 ElementKind get kind => _kind; | |
| 7768 | |
| 7769 /** | |
| 7770 * The kind of the element. | |
| 7771 */ | |
| 7772 void set kind(ElementKind value) { | |
| 7773 assert(value != null); | |
| 7774 this._kind = value; | |
| 7775 } | |
| 7776 | |
| 7777 /** | |
| 7778 * The index of the file (in the enclosing navigation response) to navigate | |
| 7779 * to. | |
| 7780 */ | |
| 7781 int get fileIndex => _fileIndex; | |
| 7782 | |
| 7783 /** | |
| 7784 * The index of the file (in the enclosing navigation response) to navigate | |
| 7785 * to. | |
| 7786 */ | |
| 7787 void set fileIndex(int value) { | |
| 7788 assert(value != null); | |
| 7789 this._fileIndex = value; | |
| 7790 } | |
| 7791 | |
| 7792 /** | |
| 7793 * The offset of the region to which the user can navigate. | |
| 7794 */ | |
| 7795 int get offset => _offset; | |
| 7796 | |
| 7797 /** | |
| 7798 * The offset of the region to which the user can navigate. | |
| 7799 */ | |
| 7800 void set offset(int value) { | |
| 7801 assert(value != null); | |
| 7802 this._offset = value; | |
| 7803 } | |
| 7804 | |
| 7805 /** | |
| 7806 * The length of the region to which the user can navigate. | |
| 7807 */ | |
| 7808 int get length => _length; | |
| 7809 | |
| 7810 /** | |
| 7811 * The length of the region to which the user can navigate. | |
| 7812 */ | |
| 7813 void set length(int value) { | |
| 7814 assert(value != null); | |
| 7815 this._length = value; | |
| 7816 } | |
| 7817 | |
| 7818 /** | |
| 7819 * The one-based index of the line containing the first character of the | |
| 7820 * region. | |
| 7821 */ | |
| 7822 int get startLine => _startLine; | |
| 7823 | |
| 7824 /** | |
| 7825 * The one-based index of the line containing the first character of the | |
| 7826 * region. | |
| 7827 */ | |
| 7828 void set startLine(int value) { | |
| 7829 assert(value != null); | |
| 7830 this._startLine = value; | |
| 7831 } | |
| 7832 | |
| 7833 /** | |
| 7834 * The one-based index of the column containing the first character of the | |
| 7835 * region. | |
| 7836 */ | |
| 7837 int get startColumn => _startColumn; | |
| 7838 | |
| 7839 /** | |
| 7840 * The one-based index of the column containing the first character of the | |
| 7841 * region. | |
| 7842 */ | |
| 7843 void set startColumn(int value) { | |
| 7844 assert(value != null); | |
| 7845 this._startColumn = value; | |
| 7846 } | |
| 7847 | |
| 7848 NavigationTarget(ElementKind kind, int fileIndex, int offset, int length, int
startLine, int startColumn) { | |
| 7849 this.kind = kind; | |
| 7850 this.fileIndex = fileIndex; | |
| 7851 this.offset = offset; | |
| 7852 this.length = length; | |
| 7853 this.startLine = startLine; | |
| 7854 this.startColumn = startColumn; | |
| 7855 } | |
| 7856 | |
| 7857 factory NavigationTarget.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob
ject json) { | |
| 7858 if (json == null) { | |
| 7859 json = {}; | |
| 7860 } | |
| 7861 if (json is Map) { | |
| 7862 ElementKind kind; | |
| 7863 if (json.containsKey("kind")) { | |
| 7864 kind = new ElementKind.fromJson(jsonDecoder, jsonPath + ".kind", json["k
ind"]); | |
| 7865 } else { | |
| 7866 throw jsonDecoder.mismatch(jsonPath, "kind"); | |
| 7867 } | |
| 7868 int fileIndex; | |
| 7869 if (json.containsKey("fileIndex")) { | |
| 7870 fileIndex = jsonDecoder.decodeInt(jsonPath + ".fileIndex", json["fileInd
ex"]); | |
| 7871 } else { | |
| 7872 throw jsonDecoder.mismatch(jsonPath, "fileIndex"); | |
| 7873 } | |
| 7874 int offset; | |
| 7875 if (json.containsKey("offset")) { | |
| 7876 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 7877 } else { | |
| 7878 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 7879 } | |
| 7880 int length; | |
| 7881 if (json.containsKey("length")) { | |
| 7882 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); | |
| 7883 } else { | |
| 7884 throw jsonDecoder.mismatch(jsonPath, "length"); | |
| 7885 } | |
| 7886 int startLine; | |
| 7887 if (json.containsKey("startLine")) { | |
| 7888 startLine = jsonDecoder.decodeInt(jsonPath + ".startLine", json["startLi
ne"]); | |
| 7889 } else { | |
| 7890 throw jsonDecoder.mismatch(jsonPath, "startLine"); | |
| 7891 } | |
| 7892 int startColumn; | |
| 7893 if (json.containsKey("startColumn")) { | |
| 7894 startColumn = jsonDecoder.decodeInt(jsonPath + ".startColumn", json["sta
rtColumn"]); | |
| 7895 } else { | |
| 7896 throw jsonDecoder.mismatch(jsonPath, "startColumn"); | |
| 7897 } | |
| 7898 return new NavigationTarget(kind, fileIndex, offset, length, startLine, st
artColumn); | |
| 7899 } else { | |
| 7900 throw jsonDecoder.mismatch(jsonPath, "NavigationTarget", json); | |
| 7901 } | |
| 7902 } | |
| 7903 | |
| 7904 @override | |
| 7905 Map<String, dynamic> toJson() { | |
| 7906 Map<String, dynamic> result = {}; | |
| 7907 result["kind"] = kind.toJson(); | |
| 7908 result["fileIndex"] = fileIndex; | |
| 7909 result["offset"] = offset; | |
| 7910 result["length"] = length; | |
| 7911 result["startLine"] = startLine; | |
| 7912 result["startColumn"] = startColumn; | |
| 7913 return result; | |
| 7914 } | |
| 7915 | |
| 7916 @override | |
| 7917 String toString() => JSON.encode(toJson()); | |
| 7918 | |
| 7919 @override | |
| 7920 bool operator==(other) { | |
| 7921 if (other is NavigationTarget) { | |
| 7922 return kind == other.kind && | |
| 7923 fileIndex == other.fileIndex && | |
| 7924 offset == other.offset && | |
| 7925 length == other.length && | |
| 7926 startLine == other.startLine && | |
| 7927 startColumn == other.startColumn; | |
| 7928 } | |
| 7929 return false; | |
| 7930 } | |
| 7931 | |
| 7932 @override | |
| 7933 int get hashCode { | |
| 7934 int hash = 0; | |
| 7935 hash = JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 7936 hash = JenkinsSmiHash.combine(hash, fileIndex.hashCode); | |
| 7937 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 7938 hash = JenkinsSmiHash.combine(hash, length.hashCode); | |
| 7939 hash = JenkinsSmiHash.combine(hash, startLine.hashCode); | |
| 7940 hash = JenkinsSmiHash.combine(hash, startColumn.hashCode); | |
| 7941 return JenkinsSmiHash.finish(hash); | |
| 7942 } | |
| 7943 } | |
| 7944 | |
| 7945 /** | |
| 7946 * Occurrences | |
| 7947 * | |
| 7948 * { | |
| 7949 * "element": Element | |
| 7950 * "offsets": List<int> | |
| 7951 * "length": int | |
| 7952 * } | |
| 7953 * | |
| 7954 * Clients may not extend, implement or mix-in this class. | |
| 7955 */ | |
| 7956 class Occurrences implements HasToJson { | |
| 7957 Element _element; | |
| 7958 | |
| 7959 List<int> _offsets; | |
| 7960 | |
| 7961 int _length; | |
| 7962 | |
| 7963 /** | |
| 7964 * The element that was referenced. | |
| 7965 */ | |
| 7966 Element get element => _element; | |
| 7967 | |
| 7968 /** | |
| 7969 * The element that was referenced. | |
| 7970 */ | |
| 7971 void set element(Element value) { | |
| 7972 assert(value != null); | |
| 7973 this._element = value; | |
| 7974 } | |
| 7975 | |
| 7976 /** | |
| 7977 * The offsets of the name of the referenced element within the file. | |
| 7978 */ | |
| 7979 List<int> get offsets => _offsets; | |
| 7980 | |
| 7981 /** | |
| 7982 * The offsets of the name of the referenced element within the file. | |
| 7983 */ | |
| 7984 void set offsets(List<int> value) { | |
| 7985 assert(value != null); | |
| 7986 this._offsets = value; | |
| 7987 } | |
| 7988 | |
| 7989 /** | |
| 7990 * The length of the name of the referenced element. | |
| 7991 */ | |
| 7992 int get length => _length; | |
| 7993 | |
| 7994 /** | |
| 7995 * The length of the name of the referenced element. | |
| 7996 */ | |
| 7997 void set length(int value) { | |
| 7998 assert(value != null); | |
| 7999 this._length = value; | |
| 8000 } | |
| 8001 | |
| 8002 Occurrences(Element element, List<int> offsets, int length) { | |
| 8003 this.element = element; | |
| 8004 this.offsets = offsets; | |
| 8005 this.length = length; | |
| 8006 } | |
| 8007 | |
| 8008 factory Occurrences.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object
json) { | |
| 8009 if (json == null) { | |
| 8010 json = {}; | |
| 8011 } | |
| 8012 if (json is Map) { | |
| 8013 Element element; | |
| 8014 if (json.containsKey("element")) { | |
| 8015 element = new Element.fromJson(jsonDecoder, jsonPath + ".element", json[
"element"]); | |
| 8016 } else { | |
| 8017 throw jsonDecoder.mismatch(jsonPath, "element"); | |
| 8018 } | |
| 8019 List<int> offsets; | |
| 8020 if (json.containsKey("offsets")) { | |
| 8021 offsets = jsonDecoder.decodeList(jsonPath + ".offsets", json["offsets"],
jsonDecoder.decodeInt); | |
| 8022 } else { | |
| 8023 throw jsonDecoder.mismatch(jsonPath, "offsets"); | |
| 8024 } | |
| 8025 int length; | |
| 8026 if (json.containsKey("length")) { | |
| 8027 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); | |
| 8028 } else { | |
| 8029 throw jsonDecoder.mismatch(jsonPath, "length"); | |
| 8030 } | |
| 8031 return new Occurrences(element, offsets, length); | |
| 8032 } else { | |
| 8033 throw jsonDecoder.mismatch(jsonPath, "Occurrences", json); | |
| 8034 } | |
| 8035 } | |
| 8036 | |
| 8037 @override | |
| 8038 Map<String, dynamic> toJson() { | |
| 8039 Map<String, dynamic> result = {}; | |
| 8040 result["element"] = element.toJson(); | |
| 8041 result["offsets"] = offsets; | |
| 8042 result["length"] = length; | |
| 8043 return result; | |
| 8044 } | |
| 8045 | |
| 8046 @override | |
| 8047 String toString() => JSON.encode(toJson()); | |
| 8048 | |
| 8049 @override | |
| 8050 bool operator==(other) { | |
| 8051 if (other is Occurrences) { | |
| 8052 return element == other.element && | |
| 8053 listEqual(offsets, other.offsets, (int a, int b) => a == b) && | |
| 8054 length == other.length; | |
| 8055 } | |
| 8056 return false; | |
| 8057 } | |
| 8058 | |
| 8059 @override | |
| 8060 int get hashCode { | |
| 8061 int hash = 0; | |
| 8062 hash = JenkinsSmiHash.combine(hash, element.hashCode); | |
| 8063 hash = JenkinsSmiHash.combine(hash, offsets.hashCode); | |
| 8064 hash = JenkinsSmiHash.combine(hash, length.hashCode); | |
| 8065 return JenkinsSmiHash.finish(hash); | |
| 8066 } | |
| 8067 } | |
| 8068 | |
| 8069 /** | |
| 8070 * Outline | |
| 8071 * | |
| 8072 * { | |
| 8073 * "element": Element | |
| 8074 * "offset": int | |
| 8075 * "length": int | |
| 8076 * "children": optional List<Outline> | |
| 8077 * } | |
| 8078 * | |
| 8079 * Clients may not extend, implement or mix-in this class. | |
| 8080 */ | |
| 8081 class Outline implements HasToJson { | |
| 8082 Element _element; | |
| 8083 | |
| 8084 int _offset; | |
| 8085 | |
| 8086 int _length; | |
| 8087 | |
| 8088 List<Outline> _children; | |
| 8089 | |
| 8090 /** | |
| 8091 * A description of the element represented by this node. | |
| 8092 */ | |
| 8093 Element get element => _element; | |
| 8094 | |
| 8095 /** | |
| 8096 * A description of the element represented by this node. | |
| 8097 */ | |
| 8098 void set element(Element value) { | |
| 8099 assert(value != null); | |
| 8100 this._element = value; | |
| 8101 } | |
| 8102 | |
| 8103 /** | |
| 8104 * The offset of the first character of the element. This is different than | |
| 8105 * the offset in the Element, which is the offset of the name of the element. | |
| 8106 * It can be used, for example, to map locations in the file back to an | |
| 8107 * outline. | |
| 8108 */ | |
| 8109 int get offset => _offset; | |
| 8110 | |
| 8111 /** | |
| 8112 * The offset of the first character of the element. This is different than | |
| 8113 * the offset in the Element, which is the offset of the name of the element. | |
| 8114 * It can be used, for example, to map locations in the file back to an | |
| 8115 * outline. | |
| 8116 */ | |
| 8117 void set offset(int value) { | |
| 8118 assert(value != null); | |
| 8119 this._offset = value; | |
| 8120 } | |
| 8121 | |
| 8122 /** | |
| 8123 * The length of the element. | |
| 8124 */ | |
| 8125 int get length => _length; | |
| 8126 | |
| 8127 /** | |
| 8128 * The length of the element. | |
| 8129 */ | |
| 8130 void set length(int value) { | |
| 8131 assert(value != null); | |
| 8132 this._length = value; | |
| 8133 } | |
| 8134 | |
| 8135 /** | |
| 8136 * The children of the node. The field will be omitted if the node has no | |
| 8137 * children. | |
| 8138 */ | |
| 8139 List<Outline> get children => _children; | |
| 8140 | |
| 8141 /** | |
| 8142 * The children of the node. The field will be omitted if the node has no | |
| 8143 * children. | |
| 8144 */ | |
| 8145 void set children(List<Outline> value) { | |
| 8146 this._children = value; | |
| 8147 } | |
| 8148 | |
| 8149 Outline(Element element, int offset, int length, {List<Outline> children}) { | |
| 8150 this.element = element; | |
| 8151 this.offset = offset; | |
| 8152 this.length = length; | |
| 8153 this.children = children; | |
| 8154 } | |
| 8155 | |
| 8156 factory Outline.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json
) { | |
| 8157 if (json == null) { | |
| 8158 json = {}; | |
| 8159 } | |
| 8160 if (json is Map) { | |
| 8161 Element element; | |
| 8162 if (json.containsKey("element")) { | |
| 8163 element = new Element.fromJson(jsonDecoder, jsonPath + ".element", json[
"element"]); | |
| 8164 } else { | |
| 8165 throw jsonDecoder.mismatch(jsonPath, "element"); | |
| 8166 } | |
| 8167 int offset; | |
| 8168 if (json.containsKey("offset")) { | |
| 8169 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 8170 } else { | |
| 8171 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 8172 } | |
| 8173 int length; | |
| 8174 if (json.containsKey("length")) { | |
| 8175 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); | |
| 8176 } else { | |
| 8177 throw jsonDecoder.mismatch(jsonPath, "length"); | |
| 8178 } | |
| 8179 List<Outline> children; | |
| 8180 if (json.containsKey("children")) { | |
| 8181 children = jsonDecoder.decodeList(jsonPath + ".children", json["children
"], (String jsonPath, Object json) => new Outline.fromJson(jsonDecoder, jsonPath
, json)); | |
| 8182 } | |
| 8183 return new Outline(element, offset, length, children: children); | |
| 8184 } else { | |
| 8185 throw jsonDecoder.mismatch(jsonPath, "Outline", json); | |
| 8186 } | |
| 8187 } | |
| 8188 | |
| 8189 @override | |
| 8190 Map<String, dynamic> toJson() { | |
| 8191 Map<String, dynamic> result = {}; | |
| 8192 result["element"] = element.toJson(); | |
| 8193 result["offset"] = offset; | |
| 8194 result["length"] = length; | |
| 8195 if (children != null) { | |
| 8196 result["children"] = children.map((Outline value) => value.toJson()).toLis
t(); | |
| 8197 } | |
| 8198 return result; | |
| 8199 } | |
| 8200 | |
| 8201 @override | |
| 8202 String toString() => JSON.encode(toJson()); | |
| 8203 | |
| 8204 @override | |
| 8205 bool operator==(other) { | |
| 8206 if (other is Outline) { | |
| 8207 return element == other.element && | |
| 8208 offset == other.offset && | |
| 8209 length == other.length && | |
| 8210 listEqual(children, other.children, (Outline a, Outline b) => a == b); | |
| 8211 } | |
| 8212 return false; | |
| 8213 } | |
| 8214 | |
| 8215 @override | |
| 8216 int get hashCode { | |
| 8217 int hash = 0; | |
| 8218 hash = JenkinsSmiHash.combine(hash, element.hashCode); | |
| 8219 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 8220 hash = JenkinsSmiHash.combine(hash, length.hashCode); | |
| 8221 hash = JenkinsSmiHash.combine(hash, children.hashCode); | |
| 8222 return JenkinsSmiHash.finish(hash); | |
| 8223 } | |
| 8224 } | |
| 8225 | |
| 8226 /** | |
| 8227 * plugin.error params | |
| 8228 * | |
| 8229 * { | |
| 8230 * "isFatal": bool | |
| 8231 * "message": String | |
| 8232 * "stackTrace": String | |
| 8233 * } | |
| 8234 * | |
| 8235 * Clients may not extend, implement or mix-in this class. | |
| 8236 */ | |
| 8237 class PluginErrorParams implements HasToJson { | |
| 8238 bool _isFatal; | |
| 8239 | |
| 8240 String _message; | |
| 8241 | |
| 8242 String _stackTrace; | |
| 8243 | |
| 8244 /** | |
| 8245 * A flag indicating whether the error is a fatal error, meaning that the | |
| 8246 * plugin will shutdown automatically after sending this notification. If | |
| 8247 * true, the server will not expect any other responses or notifications from | |
| 8248 * the plugin. | |
| 8249 */ | |
| 8250 bool get isFatal => _isFatal; | |
| 8251 | |
| 8252 /** | |
| 8253 * A flag indicating whether the error is a fatal error, meaning that the | |
| 8254 * plugin will shutdown automatically after sending this notification. If | |
| 8255 * true, the server will not expect any other responses or notifications from | |
| 8256 * the plugin. | |
| 8257 */ | |
| 8258 void set isFatal(bool value) { | |
| 8259 assert(value != null); | |
| 8260 this._isFatal = value; | |
| 8261 } | |
| 8262 | |
| 8263 /** | |
| 8264 * The error message indicating what kind of error was encountered. | |
| 8265 */ | |
| 8266 String get message => _message; | |
| 8267 | |
| 8268 /** | |
| 8269 * The error message indicating what kind of error was encountered. | |
| 8270 */ | |
| 8271 void set message(String value) { | |
| 8272 assert(value != null); | |
| 8273 this._message = value; | |
| 8274 } | |
| 8275 | |
| 8276 /** | |
| 8277 * The stack trace associated with the generation of the error, used for | |
| 8278 * debugging the plugin. | |
| 8279 */ | |
| 8280 String get stackTrace => _stackTrace; | |
| 8281 | |
| 8282 /** | |
| 8283 * The stack trace associated with the generation of the error, used for | |
| 8284 * debugging the plugin. | |
| 8285 */ | |
| 8286 void set stackTrace(String value) { | |
| 8287 assert(value != null); | |
| 8288 this._stackTrace = value; | |
| 8289 } | |
| 8290 | |
| 8291 PluginErrorParams(bool isFatal, String message, String stackTrace) { | |
| 8292 this.isFatal = isFatal; | |
| 8293 this.message = message; | |
| 8294 this.stackTrace = stackTrace; | |
| 8295 } | |
| 8296 | |
| 8297 factory PluginErrorParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, O
bject json) { | |
| 8298 if (json == null) { | |
| 8299 json = {}; | |
| 8300 } | |
| 8301 if (json is Map) { | |
| 8302 bool isFatal; | |
| 8303 if (json.containsKey("isFatal")) { | |
| 8304 isFatal = jsonDecoder.decodeBool(jsonPath + ".isFatal", json["isFatal"])
; | |
| 8305 } else { | |
| 8306 throw jsonDecoder.mismatch(jsonPath, "isFatal"); | |
| 8307 } | |
| 8308 String message; | |
| 8309 if (json.containsKey("message")) { | |
| 8310 message = jsonDecoder.decodeString(jsonPath + ".message", json["message"
]); | |
| 8311 } else { | |
| 8312 throw jsonDecoder.mismatch(jsonPath, "message"); | |
| 8313 } | |
| 8314 String stackTrace; | |
| 8315 if (json.containsKey("stackTrace")) { | |
| 8316 stackTrace = jsonDecoder.decodeString(jsonPath + ".stackTrace", json["st
ackTrace"]); | |
| 8317 } else { | |
| 8318 throw jsonDecoder.mismatch(jsonPath, "stackTrace"); | |
| 8319 } | |
| 8320 return new PluginErrorParams(isFatal, message, stackTrace); | |
| 8321 } else { | |
| 8322 throw jsonDecoder.mismatch(jsonPath, "plugin.error params", json); | |
| 8323 } | |
| 8324 } | |
| 8325 | |
| 8326 factory PluginErrorParams.fromNotification(Notification notification) { | |
| 8327 return new PluginErrorParams.fromJson( | |
| 8328 new ResponseDecoder(null), "params", notification.params); | |
| 8329 } | |
| 8330 | |
| 8331 @override | |
| 8332 Map<String, dynamic> toJson() { | |
| 8333 Map<String, dynamic> result = {}; | |
| 8334 result["isFatal"] = isFatal; | |
| 8335 result["message"] = message; | |
| 8336 result["stackTrace"] = stackTrace; | |
| 8337 return result; | |
| 8338 } | |
| 8339 | |
| 8340 Notification toNotification() { | |
| 8341 return new Notification("plugin.error", toJson()); | |
| 8342 } | |
| 8343 | |
| 8344 @override | |
| 8345 String toString() => JSON.encode(toJson()); | |
| 8346 | |
| 8347 @override | |
| 8348 bool operator==(other) { | |
| 8349 if (other is PluginErrorParams) { | |
| 8350 return isFatal == other.isFatal && | |
| 8351 message == other.message && | |
| 8352 stackTrace == other.stackTrace; | |
| 8353 } | |
| 8354 return false; | |
| 8355 } | |
| 8356 | |
| 8357 @override | |
| 8358 int get hashCode { | |
| 8359 int hash = 0; | |
| 8360 hash = JenkinsSmiHash.combine(hash, isFatal.hashCode); | |
| 8361 hash = JenkinsSmiHash.combine(hash, message.hashCode); | |
| 8362 hash = JenkinsSmiHash.combine(hash, stackTrace.hashCode); | |
| 8363 return JenkinsSmiHash.finish(hash); | |
| 8364 } | |
| 8365 } | |
| 8366 | |
| 8367 /** | |
| 8368 * plugin.shutdown params | |
| 8369 * | |
| 8370 * Clients may not extend, implement or mix-in this class. | |
| 8371 */ | |
| 8372 class PluginShutdownParams implements RequestParams { | |
| 8373 @override | |
| 8374 Map<String, dynamic> toJson() => <String, dynamic>{}; | |
| 8375 | |
| 8376 @override | |
| 8377 Request toRequest(String id) { | |
| 8378 return new Request(id, "plugin.shutdown", null); | |
| 8379 } | |
| 8380 | |
| 8381 @override | |
| 8382 bool operator==(other) { | |
| 8383 if (other is PluginShutdownParams) { | |
| 8384 return true; | |
| 8385 } | |
| 8386 return false; | |
| 8387 } | |
| 8388 | |
| 8389 @override | |
| 8390 int get hashCode { | |
| 8391 return 478064585; | |
| 8392 } | |
| 8393 } | |
| 8394 | |
| 8395 /** | |
| 8396 * plugin.shutdown result | |
| 8397 * | |
| 8398 * Clients may not extend, implement or mix-in this class. | |
| 8399 */ | |
| 8400 class PluginShutdownResult implements ResponseResult { | |
| 8401 @override | |
| 8402 Map<String, dynamic> toJson() => <String, dynamic>{}; | |
| 8403 | |
| 8404 @override | |
| 8405 Response toResponse(String id) { | |
| 8406 return new Response(id, result: null); | |
| 8407 } | |
| 8408 | |
| 8409 @override | |
| 8410 bool operator==(other) { | |
| 8411 if (other is PluginShutdownResult) { | |
| 8412 return true; | |
| 8413 } | |
| 8414 return false; | |
| 8415 } | |
| 8416 | |
| 8417 @override | |
| 8418 int get hashCode { | |
| 8419 return 9389109; | |
| 8420 } | |
| 8421 } | |
| 8422 | |
| 8423 /** | |
| 8424 * plugin.versionCheck params | |
| 8425 * | |
| 8426 * { | |
| 8427 * "byteStorePath": String | |
| 8428 * "version": String | |
| 8429 * } | |
| 8430 * | |
| 8431 * Clients may not extend, implement or mix-in this class. | |
| 8432 */ | |
| 8433 class PluginVersionCheckParams implements RequestParams { | |
| 8434 String _byteStorePath; | |
| 8435 | |
| 8436 String _version; | |
| 8437 | |
| 8438 /** | |
| 8439 * The path to the directory containing the on-disk byte store that is to be | |
| 8440 * used by any analysis drivers that are created. | |
| 8441 */ | |
| 8442 String get byteStorePath => _byteStorePath; | |
| 8443 | |
| 8444 /** | |
| 8445 * The path to the directory containing the on-disk byte store that is to be | |
| 8446 * used by any analysis drivers that are created. | |
| 8447 */ | |
| 8448 void set byteStorePath(String value) { | |
| 8449 assert(value != null); | |
| 8450 this._byteStorePath = value; | |
| 8451 } | |
| 8452 | |
| 8453 /** | |
| 8454 * The version number of the plugin spec supported by the analysis server | |
| 8455 * that is executing the plugin. | |
| 8456 */ | |
| 8457 String get version => _version; | |
| 8458 | |
| 8459 /** | |
| 8460 * The version number of the plugin spec supported by the analysis server | |
| 8461 * that is executing the plugin. | |
| 8462 */ | |
| 8463 void set version(String value) { | |
| 8464 assert(value != null); | |
| 8465 this._version = value; | |
| 8466 } | |
| 8467 | |
| 8468 PluginVersionCheckParams(String byteStorePath, String version) { | |
| 8469 this.byteStorePath = byteStorePath; | |
| 8470 this.version = version; | |
| 8471 } | |
| 8472 | |
| 8473 factory PluginVersionCheckParams.fromJson(JsonDecoder jsonDecoder, String json
Path, Object json) { | |
| 8474 if (json == null) { | |
| 8475 json = {}; | |
| 8476 } | |
| 8477 if (json is Map) { | |
| 8478 String byteStorePath; | |
| 8479 if (json.containsKey("byteStorePath")) { | |
| 8480 byteStorePath = jsonDecoder.decodeString(jsonPath + ".byteStorePath", js
on["byteStorePath"]); | |
| 8481 } else { | |
| 8482 throw jsonDecoder.mismatch(jsonPath, "byteStorePath"); | |
| 8483 } | |
| 8484 String version; | |
| 8485 if (json.containsKey("version")) { | |
| 8486 version = jsonDecoder.decodeString(jsonPath + ".version", json["version"
]); | |
| 8487 } else { | |
| 8488 throw jsonDecoder.mismatch(jsonPath, "version"); | |
| 8489 } | |
| 8490 return new PluginVersionCheckParams(byteStorePath, version); | |
| 8491 } else { | |
| 8492 throw jsonDecoder.mismatch(jsonPath, "plugin.versionCheck params", json); | |
| 8493 } | |
| 8494 } | |
| 8495 | |
| 8496 factory PluginVersionCheckParams.fromRequest(Request request) { | |
| 8497 return new PluginVersionCheckParams.fromJson( | |
| 8498 new RequestDecoder(request), "params", request.params); | |
| 8499 } | |
| 8500 | |
| 8501 @override | |
| 8502 Map<String, dynamic> toJson() { | |
| 8503 Map<String, dynamic> result = {}; | |
| 8504 result["byteStorePath"] = byteStorePath; | |
| 8505 result["version"] = version; | |
| 8506 return result; | |
| 8507 } | |
| 8508 | |
| 8509 @override | |
| 8510 Request toRequest(String id) { | |
| 8511 return new Request(id, "plugin.versionCheck", toJson()); | |
| 8512 } | |
| 8513 | |
| 8514 @override | |
| 8515 String toString() => JSON.encode(toJson()); | |
| 8516 | |
| 8517 @override | |
| 8518 bool operator==(other) { | |
| 8519 if (other is PluginVersionCheckParams) { | |
| 8520 return byteStorePath == other.byteStorePath && | |
| 8521 version == other.version; | |
| 8522 } | |
| 8523 return false; | |
| 8524 } | |
| 8525 | |
| 8526 @override | |
| 8527 int get hashCode { | |
| 8528 int hash = 0; | |
| 8529 hash = JenkinsSmiHash.combine(hash, byteStorePath.hashCode); | |
| 8530 hash = JenkinsSmiHash.combine(hash, version.hashCode); | |
| 8531 return JenkinsSmiHash.finish(hash); | |
| 8532 } | |
| 8533 } | |
| 8534 | |
| 8535 /** | |
| 8536 * plugin.versionCheck result | |
| 8537 * | |
| 8538 * { | |
| 8539 * "isCompatible": bool | |
| 8540 * "name": String | |
| 8541 * "version": String | |
| 8542 * "contactInfo": optional String | |
| 8543 * "interestingFiles": List<String> | |
| 8544 * } | |
| 8545 * | |
| 8546 * Clients may not extend, implement or mix-in this class. | |
| 8547 */ | |
| 8548 class PluginVersionCheckResult implements ResponseResult { | |
| 8549 bool _isCompatible; | |
| 8550 | |
| 8551 String _name; | |
| 8552 | |
| 8553 String _version; | |
| 8554 | |
| 8555 String _contactInfo; | |
| 8556 | |
| 8557 List<String> _interestingFiles; | |
| 8558 | |
| 8559 /** | |
| 8560 * A flag indicating whether the plugin supports the same version of the | |
| 8561 * plugin spec as the analysis server. If the value is false, then the plugin | |
| 8562 * is expected to shutdown after returning the response. | |
| 8563 */ | |
| 8564 bool get isCompatible => _isCompatible; | |
| 8565 | |
| 8566 /** | |
| 8567 * A flag indicating whether the plugin supports the same version of the | |
| 8568 * plugin spec as the analysis server. If the value is false, then the plugin | |
| 8569 * is expected to shutdown after returning the response. | |
| 8570 */ | |
| 8571 void set isCompatible(bool value) { | |
| 8572 assert(value != null); | |
| 8573 this._isCompatible = value; | |
| 8574 } | |
| 8575 | |
| 8576 /** | |
| 8577 * The name of the plugin. This value is only used when the server needs to | |
| 8578 * identify the plugin, either to the user or for debugging purposes. | |
| 8579 */ | |
| 8580 String get name => _name; | |
| 8581 | |
| 8582 /** | |
| 8583 * The name of the plugin. This value is only used when the server needs to | |
| 8584 * identify the plugin, either to the user or for debugging purposes. | |
| 8585 */ | |
| 8586 void set name(String value) { | |
| 8587 assert(value != null); | |
| 8588 this._name = value; | |
| 8589 } | |
| 8590 | |
| 8591 /** | |
| 8592 * The version of the plugin. This value is only used when the server needs | |
| 8593 * to identify the plugin, either to the user or for debugging purposes. | |
| 8594 */ | |
| 8595 String get version => _version; | |
| 8596 | |
| 8597 /** | |
| 8598 * The version of the plugin. This value is only used when the server needs | |
| 8599 * to identify the plugin, either to the user or for debugging purposes. | |
| 8600 */ | |
| 8601 void set version(String value) { | |
| 8602 assert(value != null); | |
| 8603 this._version = value; | |
| 8604 } | |
| 8605 | |
| 8606 /** | |
| 8607 * Information that the user can use to use to contact the maintainers of the | |
| 8608 * plugin when there is a problem. | |
| 8609 */ | |
| 8610 String get contactInfo => _contactInfo; | |
| 8611 | |
| 8612 /** | |
| 8613 * Information that the user can use to use to contact the maintainers of the | |
| 8614 * plugin when there is a problem. | |
| 8615 */ | |
| 8616 void set contactInfo(String value) { | |
| 8617 this._contactInfo = value; | |
| 8618 } | |
| 8619 | |
| 8620 /** | |
| 8621 * The glob patterns of the files for which the plugin will provide | |
| 8622 * information. This value is ignored if the isCompatible field is false. | |
| 8623 * Otherwise, it will be used to identify the files for which the plugin | |
| 8624 * should be notified of changes. | |
| 8625 */ | |
| 8626 List<String> get interestingFiles => _interestingFiles; | |
| 8627 | |
| 8628 /** | |
| 8629 * The glob patterns of the files for which the plugin will provide | |
| 8630 * information. This value is ignored if the isCompatible field is false. | |
| 8631 * Otherwise, it will be used to identify the files for which the plugin | |
| 8632 * should be notified of changes. | |
| 8633 */ | |
| 8634 void set interestingFiles(List<String> value) { | |
| 8635 assert(value != null); | |
| 8636 this._interestingFiles = value; | |
| 8637 } | |
| 8638 | |
| 8639 PluginVersionCheckResult(bool isCompatible, String name, String version, List<
String> interestingFiles, {String contactInfo}) { | |
| 8640 this.isCompatible = isCompatible; | |
| 8641 this.name = name; | |
| 8642 this.version = version; | |
| 8643 this.contactInfo = contactInfo; | |
| 8644 this.interestingFiles = interestingFiles; | |
| 8645 } | |
| 8646 | |
| 8647 factory PluginVersionCheckResult.fromJson(JsonDecoder jsonDecoder, String json
Path, Object json) { | |
| 8648 if (json == null) { | |
| 8649 json = {}; | |
| 8650 } | |
| 8651 if (json is Map) { | |
| 8652 bool isCompatible; | |
| 8653 if (json.containsKey("isCompatible")) { | |
| 8654 isCompatible = jsonDecoder.decodeBool(jsonPath + ".isCompatible", json["
isCompatible"]); | |
| 8655 } else { | |
| 8656 throw jsonDecoder.mismatch(jsonPath, "isCompatible"); | |
| 8657 } | |
| 8658 String name; | |
| 8659 if (json.containsKey("name")) { | |
| 8660 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]); | |
| 8661 } else { | |
| 8662 throw jsonDecoder.mismatch(jsonPath, "name"); | |
| 8663 } | |
| 8664 String version; | |
| 8665 if (json.containsKey("version")) { | |
| 8666 version = jsonDecoder.decodeString(jsonPath + ".version", json["version"
]); | |
| 8667 } else { | |
| 8668 throw jsonDecoder.mismatch(jsonPath, "version"); | |
| 8669 } | |
| 8670 String contactInfo; | |
| 8671 if (json.containsKey("contactInfo")) { | |
| 8672 contactInfo = jsonDecoder.decodeString(jsonPath + ".contactInfo", json["
contactInfo"]); | |
| 8673 } | |
| 8674 List<String> interestingFiles; | |
| 8675 if (json.containsKey("interestingFiles")) { | |
| 8676 interestingFiles = jsonDecoder.decodeList(jsonPath + ".interestingFiles"
, json["interestingFiles"], jsonDecoder.decodeString); | |
| 8677 } else { | |
| 8678 throw jsonDecoder.mismatch(jsonPath, "interestingFiles"); | |
| 8679 } | |
| 8680 return new PluginVersionCheckResult(isCompatible, name, version, interesti
ngFiles, contactInfo: contactInfo); | |
| 8681 } else { | |
| 8682 throw jsonDecoder.mismatch(jsonPath, "plugin.versionCheck result", json); | |
| 8683 } | |
| 8684 } | |
| 8685 | |
| 8686 factory PluginVersionCheckResult.fromResponse(Response response) { | |
| 8687 return new PluginVersionCheckResult.fromJson( | |
| 8688 new ResponseDecoder(REQUEST_ID_REFACTORING_KINDS.remove(response.id)), "
result", response.result); | |
| 8689 } | |
| 8690 | |
| 8691 @override | |
| 8692 Map<String, dynamic> toJson() { | |
| 8693 Map<String, dynamic> result = {}; | |
| 8694 result["isCompatible"] = isCompatible; | |
| 8695 result["name"] = name; | |
| 8696 result["version"] = version; | |
| 8697 if (contactInfo != null) { | |
| 8698 result["contactInfo"] = contactInfo; | |
| 8699 } | |
| 8700 result["interestingFiles"] = interestingFiles; | |
| 8701 return result; | |
| 8702 } | |
| 8703 | |
| 8704 @override | |
| 8705 Response toResponse(String id) { | |
| 8706 return new Response(id, result: toJson()); | |
| 8707 } | |
| 8708 | |
| 8709 @override | |
| 8710 String toString() => JSON.encode(toJson()); | |
| 8711 | |
| 8712 @override | |
| 8713 bool operator==(other) { | |
| 8714 if (other is PluginVersionCheckResult) { | |
| 8715 return isCompatible == other.isCompatible && | |
| 8716 name == other.name && | |
| 8717 version == other.version && | |
| 8718 contactInfo == other.contactInfo && | |
| 8719 listEqual(interestingFiles, other.interestingFiles, (String a, String
b) => a == b); | |
| 8720 } | |
| 8721 return false; | |
| 8722 } | |
| 8723 | |
| 8724 @override | |
| 8725 int get hashCode { | |
| 8726 int hash = 0; | |
| 8727 hash = JenkinsSmiHash.combine(hash, isCompatible.hashCode); | |
| 8728 hash = JenkinsSmiHash.combine(hash, name.hashCode); | |
| 8729 hash = JenkinsSmiHash.combine(hash, version.hashCode); | |
| 8730 hash = JenkinsSmiHash.combine(hash, contactInfo.hashCode); | |
| 8731 hash = JenkinsSmiHash.combine(hash, interestingFiles.hashCode); | |
| 8732 return JenkinsSmiHash.finish(hash); | |
| 8733 } | |
| 8734 } | |
| 8735 | |
| 8736 /** | |
| 8737 * Position | |
| 8738 * | |
| 8739 * { | |
| 8740 * "file": FilePath | |
| 8741 * "offset": int | |
| 8742 * } | |
| 8743 * | |
| 8744 * Clients may not extend, implement or mix-in this class. | |
| 8745 */ | |
| 8746 class Position implements HasToJson { | |
| 8747 String _file; | |
| 8748 | |
| 8749 int _offset; | |
| 8750 | |
| 8751 /** | |
| 8752 * The file containing the position. | |
| 8753 */ | |
| 8754 String get file => _file; | |
| 8755 | |
| 8756 /** | |
| 8757 * The file containing the position. | |
| 8758 */ | |
| 8759 void set file(String value) { | |
| 8760 assert(value != null); | |
| 8761 this._file = value; | |
| 8762 } | |
| 8763 | |
| 8764 /** | |
| 8765 * The offset of the position. | |
| 8766 */ | |
| 8767 int get offset => _offset; | |
| 8768 | |
| 8769 /** | |
| 8770 * The offset of the position. | |
| 8771 */ | |
| 8772 void set offset(int value) { | |
| 8773 assert(value != null); | |
| 8774 this._offset = value; | |
| 8775 } | |
| 8776 | |
| 8777 Position(String file, int offset) { | |
| 8778 this.file = file; | |
| 8779 this.offset = offset; | |
| 8780 } | |
| 8781 | |
| 8782 factory Position.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object jso
n) { | |
| 8783 if (json == null) { | |
| 8784 json = {}; | |
| 8785 } | |
| 8786 if (json is Map) { | |
| 8787 String file; | |
| 8788 if (json.containsKey("file")) { | |
| 8789 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); | |
| 8790 } else { | |
| 8791 throw jsonDecoder.mismatch(jsonPath, "file"); | |
| 8792 } | |
| 8793 int offset; | |
| 8794 if (json.containsKey("offset")) { | |
| 8795 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 8796 } else { | |
| 8797 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 8798 } | |
| 8799 return new Position(file, offset); | |
| 8800 } else { | |
| 8801 throw jsonDecoder.mismatch(jsonPath, "Position", json); | |
| 8802 } | |
| 8803 } | |
| 8804 | |
| 8805 @override | |
| 8806 Map<String, dynamic> toJson() { | |
| 8807 Map<String, dynamic> result = {}; | |
| 8808 result["file"] = file; | |
| 8809 result["offset"] = offset; | |
| 8810 return result; | |
| 8811 } | |
| 8812 | |
| 8813 @override | |
| 8814 String toString() => JSON.encode(toJson()); | |
| 8815 | |
| 8816 @override | |
| 8817 bool operator==(other) { | |
| 8818 if (other is Position) { | |
| 8819 return file == other.file && | |
| 8820 offset == other.offset; | |
| 8821 } | |
| 8822 return false; | |
| 8823 } | |
| 8824 | |
| 8825 @override | |
| 8826 int get hashCode { | |
| 8827 int hash = 0; | |
| 8828 hash = JenkinsSmiHash.combine(hash, file.hashCode); | |
| 8829 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 8830 return JenkinsSmiHash.finish(hash); | |
| 8831 } | |
| 8832 } | |
| 8833 | |
| 8834 /** | |
| 8835 * PrioritizedSourceChange | |
| 8836 * | |
| 8837 * { | |
| 8838 * "priority": int | |
| 8839 * "change": SourceChange | |
| 8840 * } | |
| 8841 * | |
| 8842 * Clients may not extend, implement or mix-in this class. | |
| 8843 */ | |
| 8844 class PrioritizedSourceChange implements HasToJson { | |
| 8845 int _priority; | |
| 8846 | |
| 8847 SourceChange _change; | |
| 8848 | |
| 8849 /** | |
| 8850 * The priority of the change. The value is expected to be non-negative, and | |
| 8851 * zero (0) is the lowest priority. | |
| 8852 */ | |
| 8853 int get priority => _priority; | |
| 8854 | |
| 8855 /** | |
| 8856 * The priority of the change. The value is expected to be non-negative, and | |
| 8857 * zero (0) is the lowest priority. | |
| 8858 */ | |
| 8859 void set priority(int value) { | |
| 8860 assert(value != null); | |
| 8861 this._priority = value; | |
| 8862 } | |
| 8863 | |
| 8864 /** | |
| 8865 * The change with which the relevance is associated. | |
| 8866 */ | |
| 8867 SourceChange get change => _change; | |
| 8868 | |
| 8869 /** | |
| 8870 * The change with which the relevance is associated. | |
| 8871 */ | |
| 8872 void set change(SourceChange value) { | |
| 8873 assert(value != null); | |
| 8874 this._change = value; | |
| 8875 } | |
| 8876 | |
| 8877 PrioritizedSourceChange(int priority, SourceChange change) { | |
| 8878 this.priority = priority; | |
| 8879 this.change = change; | |
| 8880 } | |
| 8881 | |
| 8882 factory PrioritizedSourceChange.fromJson(JsonDecoder jsonDecoder, String jsonP
ath, Object json) { | |
| 8883 if (json == null) { | |
| 8884 json = {}; | |
| 8885 } | |
| 8886 if (json is Map) { | |
| 8887 int priority; | |
| 8888 if (json.containsKey("priority")) { | |
| 8889 priority = jsonDecoder.decodeInt(jsonPath + ".priority", json["priority"
]); | |
| 8890 } else { | |
| 8891 throw jsonDecoder.mismatch(jsonPath, "priority"); | |
| 8892 } | |
| 8893 SourceChange change; | |
| 8894 if (json.containsKey("change")) { | |
| 8895 change = new SourceChange.fromJson(jsonDecoder, jsonPath + ".change", js
on["change"]); | |
| 8896 } else { | |
| 8897 throw jsonDecoder.mismatch(jsonPath, "change"); | |
| 8898 } | |
| 8899 return new PrioritizedSourceChange(priority, change); | |
| 8900 } else { | |
| 8901 throw jsonDecoder.mismatch(jsonPath, "PrioritizedSourceChange", json); | |
| 8902 } | |
| 8903 } | |
| 8904 | |
| 8905 @override | |
| 8906 Map<String, dynamic> toJson() { | |
| 8907 Map<String, dynamic> result = {}; | |
| 8908 result["priority"] = priority; | |
| 8909 result["change"] = change.toJson(); | |
| 8910 return result; | |
| 8911 } | |
| 8912 | |
| 8913 @override | |
| 8914 String toString() => JSON.encode(toJson()); | |
| 8915 | |
| 8916 @override | |
| 8917 bool operator==(other) { | |
| 8918 if (other is PrioritizedSourceChange) { | |
| 8919 return priority == other.priority && | |
| 8920 change == other.change; | |
| 8921 } | |
| 8922 return false; | |
| 8923 } | |
| 8924 | |
| 8925 @override | |
| 8926 int get hashCode { | |
| 8927 int hash = 0; | |
| 8928 hash = JenkinsSmiHash.combine(hash, priority.hashCode); | |
| 8929 hash = JenkinsSmiHash.combine(hash, change.hashCode); | |
| 8930 return JenkinsSmiHash.finish(hash); | |
| 8931 } | |
| 8932 } | |
| 8933 | |
| 8934 /** | |
| 8935 * RefactoringFeedback | |
| 8936 * | |
| 8937 * { | |
| 8938 * } | |
| 8939 * | |
| 8940 * Clients may not extend, implement or mix-in this class. | |
| 8941 */ | |
| 8942 class RefactoringFeedback implements HasToJson { | |
| 8943 RefactoringFeedback(); | |
| 8944 | |
| 8945 factory RefactoringFeedback.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json, Map responseJson) { | |
| 8946 return refactoringFeedbackFromJson(jsonDecoder, jsonPath, json, responseJson
); | |
| 8947 } | |
| 8948 | |
| 8949 @override | |
| 8950 Map<String, dynamic> toJson() { | |
| 8951 Map<String, dynamic> result = {}; | |
| 8952 return result; | |
| 8953 } | |
| 8954 | |
| 8955 @override | |
| 8956 String toString() => JSON.encode(toJson()); | |
| 8957 | |
| 8958 @override | |
| 8959 bool operator==(other) { | |
| 8960 if (other is RefactoringFeedback) { | |
| 8961 return true; | |
| 8962 } | |
| 8963 return false; | |
| 8964 } | |
| 8965 | |
| 8966 @override | |
| 8967 int get hashCode { | |
| 8968 int hash = 0; | |
| 8969 return JenkinsSmiHash.finish(hash); | |
| 8970 } | |
| 8971 } | |
| 8972 | |
| 8973 /** | |
| 8974 * RefactoringKind | |
| 8975 * | |
| 8976 * enum { | |
| 8977 * CONVERT_GETTER_TO_METHOD | |
| 8978 * CONVERT_METHOD_TO_GETTER | |
| 8979 * EXTRACT_LOCAL_VARIABLE | |
| 8980 * EXTRACT_METHOD | |
| 8981 * INLINE_LOCAL_VARIABLE | |
| 8982 * INLINE_METHOD | |
| 8983 * MOVE_FILE | |
| 8984 * RENAME | |
| 8985 * SORT_MEMBERS | |
| 8986 * } | |
| 8987 * | |
| 8988 * Clients may not extend, implement or mix-in this class. | |
| 8989 */ | |
| 8990 class RefactoringKind implements Enum { | |
| 8991 static const RefactoringKind CONVERT_GETTER_TO_METHOD = const RefactoringKind.
_("CONVERT_GETTER_TO_METHOD"); | |
| 8992 | |
| 8993 static const RefactoringKind CONVERT_METHOD_TO_GETTER = const RefactoringKind.
_("CONVERT_METHOD_TO_GETTER"); | |
| 8994 | |
| 8995 static const RefactoringKind EXTRACT_LOCAL_VARIABLE = const RefactoringKind._(
"EXTRACT_LOCAL_VARIABLE"); | |
| 8996 | |
| 8997 static const RefactoringKind EXTRACT_METHOD = const RefactoringKind._("EXTRACT
_METHOD"); | |
| 8998 | |
| 8999 static const RefactoringKind INLINE_LOCAL_VARIABLE = const RefactoringKind._("
INLINE_LOCAL_VARIABLE"); | |
| 9000 | |
| 9001 static const RefactoringKind INLINE_METHOD = const RefactoringKind._("INLINE_M
ETHOD"); | |
| 9002 | |
| 9003 static const RefactoringKind MOVE_FILE = const RefactoringKind._("MOVE_FILE"); | |
| 9004 | |
| 9005 static const RefactoringKind RENAME = const RefactoringKind._("RENAME"); | |
| 9006 | |
| 9007 static const RefactoringKind SORT_MEMBERS = const RefactoringKind._("SORT_MEMB
ERS"); | |
| 9008 | |
| 9009 /** | |
| 9010 * A list containing all of the enum values that are defined. | |
| 9011 */ | |
| 9012 static const List<RefactoringKind> VALUES = const <RefactoringKind>[CONVERT_GE
TTER_TO_METHOD, CONVERT_METHOD_TO_GETTER, EXTRACT_LOCAL_VARIABLE, EXTRACT_METHOD
, INLINE_LOCAL_VARIABLE, INLINE_METHOD, MOVE_FILE, RENAME, SORT_MEMBERS]; | |
| 9013 | |
| 9014 @override | |
| 9015 final String name; | |
| 9016 | |
| 9017 const RefactoringKind._(this.name); | |
| 9018 | |
| 9019 factory RefactoringKind(String name) { | |
| 9020 switch (name) { | |
| 9021 case "CONVERT_GETTER_TO_METHOD": | |
| 9022 return CONVERT_GETTER_TO_METHOD; | |
| 9023 case "CONVERT_METHOD_TO_GETTER": | |
| 9024 return CONVERT_METHOD_TO_GETTER; | |
| 9025 case "EXTRACT_LOCAL_VARIABLE": | |
| 9026 return EXTRACT_LOCAL_VARIABLE; | |
| 9027 case "EXTRACT_METHOD": | |
| 9028 return EXTRACT_METHOD; | |
| 9029 case "INLINE_LOCAL_VARIABLE": | |
| 9030 return INLINE_LOCAL_VARIABLE; | |
| 9031 case "INLINE_METHOD": | |
| 9032 return INLINE_METHOD; | |
| 9033 case "MOVE_FILE": | |
| 9034 return MOVE_FILE; | |
| 9035 case "RENAME": | |
| 9036 return RENAME; | |
| 9037 case "SORT_MEMBERS": | |
| 9038 return SORT_MEMBERS; | |
| 9039 } | |
| 9040 throw new Exception('Illegal enum value: $name'); | |
| 9041 } | |
| 9042 | |
| 9043 factory RefactoringKind.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obj
ect json) { | |
| 9044 if (json is String) { | |
| 9045 try { | |
| 9046 return new RefactoringKind(json); | |
| 9047 } catch(_) { | |
| 9048 // Fall through | |
| 9049 } | |
| 9050 } | |
| 9051 throw jsonDecoder.mismatch(jsonPath, "RefactoringKind", json); | |
| 9052 } | |
| 9053 | |
| 9054 @override | |
| 9055 String toString() => "RefactoringKind.$name"; | |
| 9056 | |
| 9057 String toJson() => name; | |
| 9058 } | |
| 9059 | |
| 9060 /** | |
| 9061 * RefactoringMethodParameter | |
| 9062 * | |
| 9063 * { | |
| 9064 * "id": optional String | |
| 9065 * "kind": RefactoringMethodParameterKind | |
| 9066 * "type": String | |
| 9067 * "name": String | |
| 9068 * "parameters": optional String | |
| 9069 * } | |
| 9070 * | |
| 9071 * Clients may not extend, implement or mix-in this class. | |
| 9072 */ | |
| 9073 class RefactoringMethodParameter implements HasToJson { | |
| 9074 String _id; | |
| 9075 | |
| 9076 RefactoringMethodParameterKind _kind; | |
| 9077 | |
| 9078 String _type; | |
| 9079 | |
| 9080 String _name; | |
| 9081 | |
| 9082 String _parameters; | |
| 9083 | |
| 9084 /** | |
| 9085 * The unique identifier of the parameter. Clients may omit this field for | |
| 9086 * the parameters they want to add. | |
| 9087 */ | |
| 9088 String get id => _id; | |
| 9089 | |
| 9090 /** | |
| 9091 * The unique identifier of the parameter. Clients may omit this field for | |
| 9092 * the parameters they want to add. | |
| 9093 */ | |
| 9094 void set id(String value) { | |
| 9095 this._id = value; | |
| 9096 } | |
| 9097 | |
| 9098 /** | |
| 9099 * The kind of the parameter. | |
| 9100 */ | |
| 9101 RefactoringMethodParameterKind get kind => _kind; | |
| 9102 | |
| 9103 /** | |
| 9104 * The kind of the parameter. | |
| 9105 */ | |
| 9106 void set kind(RefactoringMethodParameterKind value) { | |
| 9107 assert(value != null); | |
| 9108 this._kind = value; | |
| 9109 } | |
| 9110 | |
| 9111 /** | |
| 9112 * The type that should be given to the parameter, or the return type of the | |
| 9113 * parameter's function type. | |
| 9114 */ | |
| 9115 String get type => _type; | |
| 9116 | |
| 9117 /** | |
| 9118 * The type that should be given to the parameter, or the return type of the | |
| 9119 * parameter's function type. | |
| 9120 */ | |
| 9121 void set type(String value) { | |
| 9122 assert(value != null); | |
| 9123 this._type = value; | |
| 9124 } | |
| 9125 | |
| 9126 /** | |
| 9127 * The name that should be given to the parameter. | |
| 9128 */ | |
| 9129 String get name => _name; | |
| 9130 | |
| 9131 /** | |
| 9132 * The name that should be given to the parameter. | |
| 9133 */ | |
| 9134 void set name(String value) { | |
| 9135 assert(value != null); | |
| 9136 this._name = value; | |
| 9137 } | |
| 9138 | |
| 9139 /** | |
| 9140 * The parameter list of the parameter's function type. If the parameter is | |
| 9141 * not of a function type, this field will not be defined. If the function | |
| 9142 * type has zero parameters, this field will have a value of '()'. | |
| 9143 */ | |
| 9144 String get parameters => _parameters; | |
| 9145 | |
| 9146 /** | |
| 9147 * The parameter list of the parameter's function type. If the parameter is | |
| 9148 * not of a function type, this field will not be defined. If the function | |
| 9149 * type has zero parameters, this field will have a value of '()'. | |
| 9150 */ | |
| 9151 void set parameters(String value) { | |
| 9152 this._parameters = value; | |
| 9153 } | |
| 9154 | |
| 9155 RefactoringMethodParameter(RefactoringMethodParameterKind kind, String type, S
tring name, {String id, String parameters}) { | |
| 9156 this.id = id; | |
| 9157 this.kind = kind; | |
| 9158 this.type = type; | |
| 9159 this.name = name; | |
| 9160 this.parameters = parameters; | |
| 9161 } | |
| 9162 | |
| 9163 factory RefactoringMethodParameter.fromJson(JsonDecoder jsonDecoder, String js
onPath, Object json) { | |
| 9164 if (json == null) { | |
| 9165 json = {}; | |
| 9166 } | |
| 9167 if (json is Map) { | |
| 9168 String id; | |
| 9169 if (json.containsKey("id")) { | |
| 9170 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]); | |
| 9171 } | |
| 9172 RefactoringMethodParameterKind kind; | |
| 9173 if (json.containsKey("kind")) { | |
| 9174 kind = new RefactoringMethodParameterKind.fromJson(jsonDecoder, jsonPath
+ ".kind", json["kind"]); | |
| 9175 } else { | |
| 9176 throw jsonDecoder.mismatch(jsonPath, "kind"); | |
| 9177 } | |
| 9178 String type; | |
| 9179 if (json.containsKey("type")) { | |
| 9180 type = jsonDecoder.decodeString(jsonPath + ".type", json["type"]); | |
| 9181 } else { | |
| 9182 throw jsonDecoder.mismatch(jsonPath, "type"); | |
| 9183 } | |
| 9184 String name; | |
| 9185 if (json.containsKey("name")) { | |
| 9186 name = jsonDecoder.decodeString(jsonPath + ".name", json["name"]); | |
| 9187 } else { | |
| 9188 throw jsonDecoder.mismatch(jsonPath, "name"); | |
| 9189 } | |
| 9190 String parameters; | |
| 9191 if (json.containsKey("parameters")) { | |
| 9192 parameters = jsonDecoder.decodeString(jsonPath + ".parameters", json["pa
rameters"]); | |
| 9193 } | |
| 9194 return new RefactoringMethodParameter(kind, type, name, id: id, parameters
: parameters); | |
| 9195 } else { | |
| 9196 throw jsonDecoder.mismatch(jsonPath, "RefactoringMethodParameter", json); | |
| 9197 } | |
| 9198 } | |
| 9199 | |
| 9200 @override | |
| 9201 Map<String, dynamic> toJson() { | |
| 9202 Map<String, dynamic> result = {}; | |
| 9203 if (id != null) { | |
| 9204 result["id"] = id; | |
| 9205 } | |
| 9206 result["kind"] = kind.toJson(); | |
| 9207 result["type"] = type; | |
| 9208 result["name"] = name; | |
| 9209 if (parameters != null) { | |
| 9210 result["parameters"] = parameters; | |
| 9211 } | |
| 9212 return result; | |
| 9213 } | |
| 9214 | |
| 9215 @override | |
| 9216 String toString() => JSON.encode(toJson()); | |
| 9217 | |
| 9218 @override | |
| 9219 bool operator==(other) { | |
| 9220 if (other is RefactoringMethodParameter) { | |
| 9221 return id == other.id && | |
| 9222 kind == other.kind && | |
| 9223 type == other.type && | |
| 9224 name == other.name && | |
| 9225 parameters == other.parameters; | |
| 9226 } | |
| 9227 return false; | |
| 9228 } | |
| 9229 | |
| 9230 @override | |
| 9231 int get hashCode { | |
| 9232 int hash = 0; | |
| 9233 hash = JenkinsSmiHash.combine(hash, id.hashCode); | |
| 9234 hash = JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 9235 hash = JenkinsSmiHash.combine(hash, type.hashCode); | |
| 9236 hash = JenkinsSmiHash.combine(hash, name.hashCode); | |
| 9237 hash = JenkinsSmiHash.combine(hash, parameters.hashCode); | |
| 9238 return JenkinsSmiHash.finish(hash); | |
| 9239 } | |
| 9240 } | |
| 9241 | |
| 9242 /** | |
| 9243 * RefactoringMethodParameterKind | |
| 9244 * | |
| 9245 * enum { | |
| 9246 * REQUIRED | |
| 9247 * POSITIONAL | |
| 9248 * NAMED | |
| 9249 * } | |
| 9250 * | |
| 9251 * Clients may not extend, implement or mix-in this class. | |
| 9252 */ | |
| 9253 class RefactoringMethodParameterKind implements Enum { | |
| 9254 static const RefactoringMethodParameterKind REQUIRED = const RefactoringMethod
ParameterKind._("REQUIRED"); | |
| 9255 | |
| 9256 static const RefactoringMethodParameterKind POSITIONAL = const RefactoringMeth
odParameterKind._("POSITIONAL"); | |
| 9257 | |
| 9258 static const RefactoringMethodParameterKind NAMED = const RefactoringMethodPar
ameterKind._("NAMED"); | |
| 9259 | |
| 9260 /** | |
| 9261 * A list containing all of the enum values that are defined. | |
| 9262 */ | |
| 9263 static const List<RefactoringMethodParameterKind> VALUES = const <RefactoringM
ethodParameterKind>[REQUIRED, POSITIONAL, NAMED]; | |
| 9264 | |
| 9265 @override | |
| 9266 final String name; | |
| 9267 | |
| 9268 const RefactoringMethodParameterKind._(this.name); | |
| 9269 | |
| 9270 factory RefactoringMethodParameterKind(String name) { | |
| 9271 switch (name) { | |
| 9272 case "REQUIRED": | |
| 9273 return REQUIRED; | |
| 9274 case "POSITIONAL": | |
| 9275 return POSITIONAL; | |
| 9276 case "NAMED": | |
| 9277 return NAMED; | |
| 9278 } | |
| 9279 throw new Exception('Illegal enum value: $name'); | |
| 9280 } | |
| 9281 | |
| 9282 factory RefactoringMethodParameterKind.fromJson(JsonDecoder jsonDecoder, Strin
g jsonPath, Object json) { | |
| 9283 if (json is String) { | |
| 9284 try { | |
| 9285 return new RefactoringMethodParameterKind(json); | |
| 9286 } catch(_) { | |
| 9287 // Fall through | |
| 9288 } | |
| 9289 } | |
| 9290 throw jsonDecoder.mismatch(jsonPath, "RefactoringMethodParameterKind", json)
; | |
| 9291 } | |
| 9292 | |
| 9293 @override | |
| 9294 String toString() => "RefactoringMethodParameterKind.$name"; | |
| 9295 | |
| 9296 String toJson() => name; | |
| 9297 } | |
| 9298 | |
| 9299 /** | |
| 9300 * RefactoringOptions | |
| 9301 * | |
| 9302 * { | |
| 9303 * } | |
| 9304 * | |
| 9305 * Clients may not extend, implement or mix-in this class. | |
| 9306 */ | |
| 9307 class RefactoringOptions implements HasToJson { | |
| 9308 RefactoringOptions(); | |
| 9309 | |
| 9310 factory RefactoringOptions.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json, RefactoringKind kind) { | |
| 9311 return refactoringOptionsFromJson(jsonDecoder, jsonPath, json, kind); | |
| 9312 } | |
| 9313 | |
| 9314 @override | |
| 9315 Map<String, dynamic> toJson() { | |
| 9316 Map<String, dynamic> result = {}; | |
| 9317 return result; | |
| 9318 } | |
| 9319 | |
| 9320 @override | |
| 9321 String toString() => JSON.encode(toJson()); | |
| 9322 | |
| 9323 @override | |
| 9324 bool operator==(other) { | |
| 9325 if (other is RefactoringOptions) { | |
| 9326 return true; | |
| 9327 } | |
| 9328 return false; | |
| 9329 } | |
| 9330 | |
| 9331 @override | |
| 9332 int get hashCode { | |
| 9333 int hash = 0; | |
| 9334 return JenkinsSmiHash.finish(hash); | |
| 9335 } | |
| 9336 } | |
| 9337 | |
| 9338 /** | |
| 9339 * RefactoringProblem | |
| 9340 * | |
| 9341 * { | |
| 9342 * "severity": RefactoringProblemSeverity | |
| 9343 * "message": String | |
| 9344 * "location": optional Location | |
| 9345 * } | |
| 9346 * | |
| 9347 * Clients may not extend, implement or mix-in this class. | |
| 9348 */ | |
| 9349 class RefactoringProblem implements HasToJson { | |
| 9350 RefactoringProblemSeverity _severity; | |
| 9351 | |
| 9352 String _message; | |
| 9353 | |
| 9354 Location _location; | |
| 9355 | |
| 9356 /** | |
| 9357 * The severity of the problem being represented. | |
| 9358 */ | |
| 9359 RefactoringProblemSeverity get severity => _severity; | |
| 9360 | |
| 9361 /** | |
| 9362 * The severity of the problem being represented. | |
| 9363 */ | |
| 9364 void set severity(RefactoringProblemSeverity value) { | |
| 9365 assert(value != null); | |
| 9366 this._severity = value; | |
| 9367 } | |
| 9368 | |
| 9369 /** | |
| 9370 * A human-readable description of the problem being represented. | |
| 9371 */ | |
| 9372 String get message => _message; | |
| 9373 | |
| 9374 /** | |
| 9375 * A human-readable description of the problem being represented. | |
| 9376 */ | |
| 9377 void set message(String value) { | |
| 9378 assert(value != null); | |
| 9379 this._message = value; | |
| 9380 } | |
| 9381 | |
| 9382 /** | |
| 9383 * The location of the problem being represented. This field is omitted | |
| 9384 * unless there is a specific location associated with the problem (such as a | |
| 9385 * location where an element being renamed will be shadowed). | |
| 9386 */ | |
| 9387 Location get location => _location; | |
| 9388 | |
| 9389 /** | |
| 9390 * The location of the problem being represented. This field is omitted | |
| 9391 * unless there is a specific location associated with the problem (such as a | |
| 9392 * location where an element being renamed will be shadowed). | |
| 9393 */ | |
| 9394 void set location(Location value) { | |
| 9395 this._location = value; | |
| 9396 } | |
| 9397 | |
| 9398 RefactoringProblem(RefactoringProblemSeverity severity, String message, {Locat
ion location}) { | |
| 9399 this.severity = severity; | |
| 9400 this.message = message; | |
| 9401 this.location = location; | |
| 9402 } | |
| 9403 | |
| 9404 factory RefactoringProblem.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 9405 if (json == null) { | |
| 9406 json = {}; | |
| 9407 } | |
| 9408 if (json is Map) { | |
| 9409 RefactoringProblemSeverity severity; | |
| 9410 if (json.containsKey("severity")) { | |
| 9411 severity = new RefactoringProblemSeverity.fromJson(jsonDecoder, jsonPath
+ ".severity", json["severity"]); | |
| 9412 } else { | |
| 9413 throw jsonDecoder.mismatch(jsonPath, "severity"); | |
| 9414 } | |
| 9415 String message; | |
| 9416 if (json.containsKey("message")) { | |
| 9417 message = jsonDecoder.decodeString(jsonPath + ".message", json["message"
]); | |
| 9418 } else { | |
| 9419 throw jsonDecoder.mismatch(jsonPath, "message"); | |
| 9420 } | |
| 9421 Location location; | |
| 9422 if (json.containsKey("location")) { | |
| 9423 location = new Location.fromJson(jsonDecoder, jsonPath + ".location", js
on["location"]); | |
| 9424 } | |
| 9425 return new RefactoringProblem(severity, message, location: location); | |
| 9426 } else { | |
| 9427 throw jsonDecoder.mismatch(jsonPath, "RefactoringProblem", json); | |
| 9428 } | |
| 9429 } | |
| 9430 | |
| 9431 @override | |
| 9432 Map<String, dynamic> toJson() { | |
| 9433 Map<String, dynamic> result = {}; | |
| 9434 result["severity"] = severity.toJson(); | |
| 9435 result["message"] = message; | |
| 9436 if (location != null) { | |
| 9437 result["location"] = location.toJson(); | |
| 9438 } | |
| 9439 return result; | |
| 9440 } | |
| 9441 | |
| 9442 @override | |
| 9443 String toString() => JSON.encode(toJson()); | |
| 9444 | |
| 9445 @override | |
| 9446 bool operator==(other) { | |
| 9447 if (other is RefactoringProblem) { | |
| 9448 return severity == other.severity && | |
| 9449 message == other.message && | |
| 9450 location == other.location; | |
| 9451 } | |
| 9452 return false; | |
| 9453 } | |
| 9454 | |
| 9455 @override | |
| 9456 int get hashCode { | |
| 9457 int hash = 0; | |
| 9458 hash = JenkinsSmiHash.combine(hash, severity.hashCode); | |
| 9459 hash = JenkinsSmiHash.combine(hash, message.hashCode); | |
| 9460 hash = JenkinsSmiHash.combine(hash, location.hashCode); | |
| 9461 return JenkinsSmiHash.finish(hash); | |
| 9462 } | |
| 9463 } | |
| 9464 | |
| 9465 /** | |
| 9466 * RefactoringProblemSeverity | |
| 9467 * | |
| 9468 * enum { | |
| 9469 * INFO | |
| 9470 * WARNING | |
| 9471 * ERROR | |
| 9472 * FATAL | |
| 9473 * } | |
| 9474 * | |
| 9475 * Clients may not extend, implement or mix-in this class. | |
| 9476 */ | |
| 9477 class RefactoringProblemSeverity implements Enum { | |
| 9478 /** | |
| 9479 * A minor code problem. No example, because it is not used yet. | |
| 9480 */ | |
| 9481 static const RefactoringProblemSeverity INFO = const RefactoringProblemSeverit
y._("INFO"); | |
| 9482 | |
| 9483 /** | |
| 9484 * A minor code problem. For example names of local variables should be camel | |
| 9485 * case and start with a lower case letter. Staring the name of a variable | |
| 9486 * with an upper case is OK from the language point of view, but it is nice | |
| 9487 * to warn the user. | |
| 9488 */ | |
| 9489 static const RefactoringProblemSeverity WARNING = const RefactoringProblemSeve
rity._("WARNING"); | |
| 9490 | |
| 9491 /** | |
| 9492 * The refactoring technically can be performed, but there is a logical | |
| 9493 * problem. For example the name of a local variable being extracted | |
| 9494 * conflicts with another name in the scope, or duplicate parameter names in | |
| 9495 * the method being extracted, or a conflict between a parameter name and a | |
| 9496 * local variable, etc. In some cases the location of the problem is also | |
| 9497 * provided, so the IDE can show user the location and the problem, and let | |
| 9498 * the user decide whether they want to perform the refactoring. For example | |
| 9499 * the name conflict might be expected, and the user wants to fix it | |
| 9500 * afterwards. | |
| 9501 */ | |
| 9502 static const RefactoringProblemSeverity ERROR = const RefactoringProblemSeveri
ty._("ERROR"); | |
| 9503 | |
| 9504 /** | |
| 9505 * A fatal error, which prevents performing the refactoring. For example the | |
| 9506 * name of a local variable being extracted is not a valid identifier, or | |
| 9507 * selection is not a valid expression. | |
| 9508 */ | |
| 9509 static const RefactoringProblemSeverity FATAL = const RefactoringProblemSeveri
ty._("FATAL"); | |
| 9510 | |
| 9511 /** | |
| 9512 * A list containing all of the enum values that are defined. | |
| 9513 */ | |
| 9514 static const List<RefactoringProblemSeverity> VALUES = const <RefactoringProbl
emSeverity>[INFO, WARNING, ERROR, FATAL]; | |
| 9515 | |
| 9516 @override | |
| 9517 final String name; | |
| 9518 | |
| 9519 const RefactoringProblemSeverity._(this.name); | |
| 9520 | |
| 9521 factory RefactoringProblemSeverity(String name) { | |
| 9522 switch (name) { | |
| 9523 case "INFO": | |
| 9524 return INFO; | |
| 9525 case "WARNING": | |
| 9526 return WARNING; | |
| 9527 case "ERROR": | |
| 9528 return ERROR; | |
| 9529 case "FATAL": | |
| 9530 return FATAL; | |
| 9531 } | |
| 9532 throw new Exception('Illegal enum value: $name'); | |
| 9533 } | |
| 9534 | |
| 9535 factory RefactoringProblemSeverity.fromJson(JsonDecoder jsonDecoder, String js
onPath, Object json) { | |
| 9536 if (json is String) { | |
| 9537 try { | |
| 9538 return new RefactoringProblemSeverity(json); | |
| 9539 } catch(_) { | |
| 9540 // Fall through | |
| 9541 } | |
| 9542 } | |
| 9543 throw jsonDecoder.mismatch(jsonPath, "RefactoringProblemSeverity", json); | |
| 9544 } | |
| 9545 | |
| 9546 /** | |
| 9547 * Returns the [RefactoringProblemSeverity] with the maximal severity. | |
| 9548 */ | |
| 9549 static RefactoringProblemSeverity max(RefactoringProblemSeverity a, Refactorin
gProblemSeverity b) => | |
| 9550 maxRefactoringProblemSeverity(a, b); | |
| 9551 | |
| 9552 @override | |
| 9553 String toString() => "RefactoringProblemSeverity.$name"; | |
| 9554 | |
| 9555 String toJson() => name; | |
| 9556 } | |
| 9557 | |
| 9558 /** | |
| 9559 * RemoveContentOverlay | |
| 9560 * | |
| 9561 * { | |
| 9562 * "type": "remove" | |
| 9563 * } | |
| 9564 * | |
| 9565 * Clients may not extend, implement or mix-in this class. | |
| 9566 */ | |
| 9567 class RemoveContentOverlay implements HasToJson { | |
| 9568 RemoveContentOverlay(); | |
| 9569 | |
| 9570 factory RemoveContentOverlay.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 9571 if (json == null) { | |
| 9572 json = {}; | |
| 9573 } | |
| 9574 if (json is Map) { | |
| 9575 if (json["type"] != "remove") { | |
| 9576 throw jsonDecoder.mismatch(jsonPath, "equal " + "remove", json); | |
| 9577 } | |
| 9578 return new RemoveContentOverlay(); | |
| 9579 } else { | |
| 9580 throw jsonDecoder.mismatch(jsonPath, "RemoveContentOverlay", json); | |
| 9581 } | |
| 9582 } | |
| 9583 | |
| 9584 @override | |
| 9585 Map<String, dynamic> toJson() { | |
| 9586 Map<String, dynamic> result = {}; | |
| 9587 result["type"] = "remove"; | |
| 9588 return result; | |
| 9589 } | |
| 9590 | |
| 9591 @override | |
| 9592 String toString() => JSON.encode(toJson()); | |
| 9593 | |
| 9594 @override | |
| 9595 bool operator==(other) { | |
| 9596 if (other is RemoveContentOverlay) { | |
| 9597 return true; | |
| 9598 } | |
| 9599 return false; | |
| 9600 } | |
| 9601 | |
| 9602 @override | |
| 9603 int get hashCode { | |
| 9604 int hash = 0; | |
| 9605 hash = JenkinsSmiHash.combine(hash, 114870849); | |
| 9606 return JenkinsSmiHash.finish(hash); | |
| 9607 } | |
| 9608 } | |
| 9609 | |
| 9610 /** | |
| 9611 * rename feedback | |
| 9612 * | |
| 9613 * { | |
| 9614 * "offset": int | |
| 9615 * "length": int | |
| 9616 * "elementKindName": String | |
| 9617 * "oldName": String | |
| 9618 * } | |
| 9619 * | |
| 9620 * Clients may not extend, implement or mix-in this class. | |
| 9621 */ | |
| 9622 class RenameFeedback extends RefactoringFeedback { | |
| 9623 int _offset; | |
| 9624 | |
| 9625 int _length; | |
| 9626 | |
| 9627 String _elementKindName; | |
| 9628 | |
| 9629 String _oldName; | |
| 9630 | |
| 9631 /** | |
| 9632 * The offset to the beginning of the name selected to be renamed. | |
| 9633 */ | |
| 9634 int get offset => _offset; | |
| 9635 | |
| 9636 /** | |
| 9637 * The offset to the beginning of the name selected to be renamed. | |
| 9638 */ | |
| 9639 void set offset(int value) { | |
| 9640 assert(value != null); | |
| 9641 this._offset = value; | |
| 9642 } | |
| 9643 | |
| 9644 /** | |
| 9645 * The length of the name selected to be renamed. | |
| 9646 */ | |
| 9647 int get length => _length; | |
| 9648 | |
| 9649 /** | |
| 9650 * The length of the name selected to be renamed. | |
| 9651 */ | |
| 9652 void set length(int value) { | |
| 9653 assert(value != null); | |
| 9654 this._length = value; | |
| 9655 } | |
| 9656 | |
| 9657 /** | |
| 9658 * The human-readable description of the kind of element being renamed (such | |
| 9659 * as “class” or “function type alias”). | |
| 9660 */ | |
| 9661 String get elementKindName => _elementKindName; | |
| 9662 | |
| 9663 /** | |
| 9664 * The human-readable description of the kind of element being renamed (such | |
| 9665 * as “class” or “function type alias”). | |
| 9666 */ | |
| 9667 void set elementKindName(String value) { | |
| 9668 assert(value != null); | |
| 9669 this._elementKindName = value; | |
| 9670 } | |
| 9671 | |
| 9672 /** | |
| 9673 * The old name of the element before the refactoring. | |
| 9674 */ | |
| 9675 String get oldName => _oldName; | |
| 9676 | |
| 9677 /** | |
| 9678 * The old name of the element before the refactoring. | |
| 9679 */ | |
| 9680 void set oldName(String value) { | |
| 9681 assert(value != null); | |
| 9682 this._oldName = value; | |
| 9683 } | |
| 9684 | |
| 9685 RenameFeedback(int offset, int length, String elementKindName, String oldName)
{ | |
| 9686 this.offset = offset; | |
| 9687 this.length = length; | |
| 9688 this.elementKindName = elementKindName; | |
| 9689 this.oldName = oldName; | |
| 9690 } | |
| 9691 | |
| 9692 factory RenameFeedback.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obje
ct json) { | |
| 9693 if (json == null) { | |
| 9694 json = {}; | |
| 9695 } | |
| 9696 if (json is Map) { | |
| 9697 int offset; | |
| 9698 if (json.containsKey("offset")) { | |
| 9699 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 9700 } else { | |
| 9701 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 9702 } | |
| 9703 int length; | |
| 9704 if (json.containsKey("length")) { | |
| 9705 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); | |
| 9706 } else { | |
| 9707 throw jsonDecoder.mismatch(jsonPath, "length"); | |
| 9708 } | |
| 9709 String elementKindName; | |
| 9710 if (json.containsKey("elementKindName")) { | |
| 9711 elementKindName = jsonDecoder.decodeString(jsonPath + ".elementKindName"
, json["elementKindName"]); | |
| 9712 } else { | |
| 9713 throw jsonDecoder.mismatch(jsonPath, "elementKindName"); | |
| 9714 } | |
| 9715 String oldName; | |
| 9716 if (json.containsKey("oldName")) { | |
| 9717 oldName = jsonDecoder.decodeString(jsonPath + ".oldName", json["oldName"
]); | |
| 9718 } else { | |
| 9719 throw jsonDecoder.mismatch(jsonPath, "oldName"); | |
| 9720 } | |
| 9721 return new RenameFeedback(offset, length, elementKindName, oldName); | |
| 9722 } else { | |
| 9723 throw jsonDecoder.mismatch(jsonPath, "rename feedback", json); | |
| 9724 } | |
| 9725 } | |
| 9726 | |
| 9727 @override | |
| 9728 Map<String, dynamic> toJson() { | |
| 9729 Map<String, dynamic> result = {}; | |
| 9730 result["offset"] = offset; | |
| 9731 result["length"] = length; | |
| 9732 result["elementKindName"] = elementKindName; | |
| 9733 result["oldName"] = oldName; | |
| 9734 return result; | |
| 9735 } | |
| 9736 | |
| 9737 @override | |
| 9738 String toString() => JSON.encode(toJson()); | |
| 9739 | |
| 9740 @override | |
| 9741 bool operator==(other) { | |
| 9742 if (other is RenameFeedback) { | |
| 9743 return offset == other.offset && | |
| 9744 length == other.length && | |
| 9745 elementKindName == other.elementKindName && | |
| 9746 oldName == other.oldName; | |
| 9747 } | |
| 9748 return false; | |
| 9749 } | |
| 9750 | |
| 9751 @override | |
| 9752 int get hashCode { | |
| 9753 int hash = 0; | |
| 9754 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 9755 hash = JenkinsSmiHash.combine(hash, length.hashCode); | |
| 9756 hash = JenkinsSmiHash.combine(hash, elementKindName.hashCode); | |
| 9757 hash = JenkinsSmiHash.combine(hash, oldName.hashCode); | |
| 9758 return JenkinsSmiHash.finish(hash); | |
| 9759 } | |
| 9760 } | |
| 9761 | |
| 9762 /** | |
| 9763 * rename options | |
| 9764 * | |
| 9765 * { | |
| 9766 * "newName": String | |
| 9767 * } | |
| 9768 * | |
| 9769 * Clients may not extend, implement or mix-in this class. | |
| 9770 */ | |
| 9771 class RenameOptions extends RefactoringOptions { | |
| 9772 String _newName; | |
| 9773 | |
| 9774 /** | |
| 9775 * The name that the element should have after the refactoring. | |
| 9776 */ | |
| 9777 String get newName => _newName; | |
| 9778 | |
| 9779 /** | |
| 9780 * The name that the element should have after the refactoring. | |
| 9781 */ | |
| 9782 void set newName(String value) { | |
| 9783 assert(value != null); | |
| 9784 this._newName = value; | |
| 9785 } | |
| 9786 | |
| 9787 RenameOptions(String newName) { | |
| 9788 this.newName = newName; | |
| 9789 } | |
| 9790 | |
| 9791 factory RenameOptions.fromJson(JsonDecoder jsonDecoder, String jsonPath, Objec
t json) { | |
| 9792 if (json == null) { | |
| 9793 json = {}; | |
| 9794 } | |
| 9795 if (json is Map) { | |
| 9796 String newName; | |
| 9797 if (json.containsKey("newName")) { | |
| 9798 newName = jsonDecoder.decodeString(jsonPath + ".newName", json["newName"
]); | |
| 9799 } else { | |
| 9800 throw jsonDecoder.mismatch(jsonPath, "newName"); | |
| 9801 } | |
| 9802 return new RenameOptions(newName); | |
| 9803 } else { | |
| 9804 throw jsonDecoder.mismatch(jsonPath, "rename options", json); | |
| 9805 } | |
| 9806 } | |
| 9807 | |
| 9808 factory RenameOptions.fromRefactoringParams(EditGetRefactoringParams refactori
ngParams, Request request) { | |
| 9809 return new RenameOptions.fromJson( | |
| 9810 new RequestDecoder(request), "options", refactoringParams.options); | |
| 9811 } | |
| 9812 | |
| 9813 @override | |
| 9814 Map<String, dynamic> toJson() { | |
| 9815 Map<String, dynamic> result = {}; | |
| 9816 result["newName"] = newName; | |
| 9817 return result; | |
| 9818 } | |
| 9819 | |
| 9820 @override | |
| 9821 String toString() => JSON.encode(toJson()); | |
| 9822 | |
| 9823 @override | |
| 9824 bool operator==(other) { | |
| 9825 if (other is RenameOptions) { | |
| 9826 return newName == other.newName; | |
| 9827 } | |
| 9828 return false; | |
| 9829 } | |
| 9830 | |
| 9831 @override | |
| 9832 int get hashCode { | |
| 9833 int hash = 0; | |
| 9834 hash = JenkinsSmiHash.combine(hash, newName.hashCode); | |
| 9835 return JenkinsSmiHash.finish(hash); | |
| 9836 } | |
| 9837 } | |
| 9838 | |
| 9839 /** | |
| 9840 * RequestError | |
| 9841 * | |
| 9842 * { | |
| 9843 * "code": RequestErrorCode | |
| 9844 * "message": String | |
| 9845 * "stackTrace": optional String | |
| 9846 * } | |
| 9847 * | |
| 9848 * Clients may not extend, implement or mix-in this class. | |
| 9849 */ | |
| 9850 class RequestError implements HasToJson { | |
| 9851 RequestErrorCode _code; | |
| 9852 | |
| 9853 String _message; | |
| 9854 | |
| 9855 String _stackTrace; | |
| 9856 | |
| 9857 /** | |
| 9858 * A code that uniquely identifies the error that occurred. | |
| 9859 */ | |
| 9860 RequestErrorCode get code => _code; | |
| 9861 | |
| 9862 /** | |
| 9863 * A code that uniquely identifies the error that occurred. | |
| 9864 */ | |
| 9865 void set code(RequestErrorCode value) { | |
| 9866 assert(value != null); | |
| 9867 this._code = value; | |
| 9868 } | |
| 9869 | |
| 9870 /** | |
| 9871 * A short description of the error. | |
| 9872 */ | |
| 9873 String get message => _message; | |
| 9874 | |
| 9875 /** | |
| 9876 * A short description of the error. | |
| 9877 */ | |
| 9878 void set message(String value) { | |
| 9879 assert(value != null); | |
| 9880 this._message = value; | |
| 9881 } | |
| 9882 | |
| 9883 /** | |
| 9884 * The stack trace associated with processing the request, used for debugging | |
| 9885 * the plugin. | |
| 9886 */ | |
| 9887 String get stackTrace => _stackTrace; | |
| 9888 | |
| 9889 /** | |
| 9890 * The stack trace associated with processing the request, used for debugging | |
| 9891 * the plugin. | |
| 9892 */ | |
| 9893 void set stackTrace(String value) { | |
| 9894 this._stackTrace = value; | |
| 9895 } | |
| 9896 | |
| 9897 RequestError(RequestErrorCode code, String message, {String stackTrace}) { | |
| 9898 this.code = code; | |
| 9899 this.message = message; | |
| 9900 this.stackTrace = stackTrace; | |
| 9901 } | |
| 9902 | |
| 9903 factory RequestError.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object
json) { | |
| 9904 if (json == null) { | |
| 9905 json = {}; | |
| 9906 } | |
| 9907 if (json is Map) { | |
| 9908 RequestErrorCode code; | |
| 9909 if (json.containsKey("code")) { | |
| 9910 code = new RequestErrorCode.fromJson(jsonDecoder, jsonPath + ".code", js
on["code"]); | |
| 9911 } else { | |
| 9912 throw jsonDecoder.mismatch(jsonPath, "code"); | |
| 9913 } | |
| 9914 String message; | |
| 9915 if (json.containsKey("message")) { | |
| 9916 message = jsonDecoder.decodeString(jsonPath + ".message", json["message"
]); | |
| 9917 } else { | |
| 9918 throw jsonDecoder.mismatch(jsonPath, "message"); | |
| 9919 } | |
| 9920 String stackTrace; | |
| 9921 if (json.containsKey("stackTrace")) { | |
| 9922 stackTrace = jsonDecoder.decodeString(jsonPath + ".stackTrace", json["st
ackTrace"]); | |
| 9923 } | |
| 9924 return new RequestError(code, message, stackTrace: stackTrace); | |
| 9925 } else { | |
| 9926 throw jsonDecoder.mismatch(jsonPath, "RequestError", json); | |
| 9927 } | |
| 9928 } | |
| 9929 | |
| 9930 @override | |
| 9931 Map<String, dynamic> toJson() { | |
| 9932 Map<String, dynamic> result = {}; | |
| 9933 result["code"] = code.toJson(); | |
| 9934 result["message"] = message; | |
| 9935 if (stackTrace != null) { | |
| 9936 result["stackTrace"] = stackTrace; | |
| 9937 } | |
| 9938 return result; | |
| 9939 } | |
| 9940 | |
| 9941 @override | |
| 9942 String toString() => JSON.encode(toJson()); | |
| 9943 | |
| 9944 @override | |
| 9945 bool operator==(other) { | |
| 9946 if (other is RequestError) { | |
| 9947 return code == other.code && | |
| 9948 message == other.message && | |
| 9949 stackTrace == other.stackTrace; | |
| 9950 } | |
| 9951 return false; | |
| 9952 } | |
| 9953 | |
| 9954 @override | |
| 9955 int get hashCode { | |
| 9956 int hash = 0; | |
| 9957 hash = JenkinsSmiHash.combine(hash, code.hashCode); | |
| 9958 hash = JenkinsSmiHash.combine(hash, message.hashCode); | |
| 9959 hash = JenkinsSmiHash.combine(hash, stackTrace.hashCode); | |
| 9960 return JenkinsSmiHash.finish(hash); | |
| 9961 } | |
| 9962 } | |
| 9963 | |
| 9964 /** | |
| 9965 * RequestErrorCode | |
| 9966 * | |
| 9967 * enum { | |
| 9968 * INVALID_OVERLAY_CHANGE | |
| 9969 * INVALID_PARAMETER | |
| 9970 * PLUGIN_ERROR | |
| 9971 * UNKNOWN_REQUEST | |
| 9972 * } | |
| 9973 * | |
| 9974 * Clients may not extend, implement or mix-in this class. | |
| 9975 */ | |
| 9976 class RequestErrorCode implements Enum { | |
| 9977 /** | |
| 9978 * An "analysis.updateContent" request contained a ChangeContentOverlay | |
| 9979 * object that can't be applied. This can happen for two reasons: | |
| 9980 * | |
| 9981 * - there was no preceding AddContentOverlay and hence no content to which | |
| 9982 * the edits could be applied, or | |
| 9983 * - one or more of the specified edits have an offset or length that is out | |
| 9984 * of range. | |
| 9985 */ | |
| 9986 static const RequestErrorCode INVALID_OVERLAY_CHANGE = const RequestErrorCode.
_("INVALID_OVERLAY_CHANGE"); | |
| 9987 | |
| 9988 /** | |
| 9989 * One of the method parameters was invalid. | |
| 9990 */ | |
| 9991 static const RequestErrorCode INVALID_PARAMETER = const RequestErrorCode._("IN
VALID_PARAMETER"); | |
| 9992 | |
| 9993 /** | |
| 9994 * An internal error occurred in the plugin while attempting to respond to a | |
| 9995 * request. Also see the plugin.error notification for errors that occur | |
| 9996 * outside of handling a request. | |
| 9997 */ | |
| 9998 static const RequestErrorCode PLUGIN_ERROR = const RequestErrorCode._("PLUGIN_
ERROR"); | |
| 9999 | |
| 10000 /** | |
| 10001 * A request was received that the plugin does not recognize, or cannot | |
| 10002 * handle in its current configuration. | |
| 10003 */ | |
| 10004 static const RequestErrorCode UNKNOWN_REQUEST = const RequestErrorCode._("UNKN
OWN_REQUEST"); | |
| 10005 | |
| 10006 /** | |
| 10007 * A list containing all of the enum values that are defined. | |
| 10008 */ | |
| 10009 static const List<RequestErrorCode> VALUES = const <RequestErrorCode>[INVALID_
OVERLAY_CHANGE, INVALID_PARAMETER, PLUGIN_ERROR, UNKNOWN_REQUEST]; | |
| 10010 | |
| 10011 @override | |
| 10012 final String name; | |
| 10013 | |
| 10014 const RequestErrorCode._(this.name); | |
| 10015 | |
| 10016 factory RequestErrorCode(String name) { | |
| 10017 switch (name) { | |
| 10018 case "INVALID_OVERLAY_CHANGE": | |
| 10019 return INVALID_OVERLAY_CHANGE; | |
| 10020 case "INVALID_PARAMETER": | |
| 10021 return INVALID_PARAMETER; | |
| 10022 case "PLUGIN_ERROR": | |
| 10023 return PLUGIN_ERROR; | |
| 10024 case "UNKNOWN_REQUEST": | |
| 10025 return UNKNOWN_REQUEST; | |
| 10026 } | |
| 10027 throw new Exception('Illegal enum value: $name'); | |
| 10028 } | |
| 10029 | |
| 10030 factory RequestErrorCode.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob
ject json) { | |
| 10031 if (json is String) { | |
| 10032 try { | |
| 10033 return new RequestErrorCode(json); | |
| 10034 } catch(_) { | |
| 10035 // Fall through | |
| 10036 } | |
| 10037 } | |
| 10038 throw jsonDecoder.mismatch(jsonPath, "RequestErrorCode", json); | |
| 10039 } | |
| 10040 | |
| 10041 @override | |
| 10042 String toString() => "RequestErrorCode.$name"; | |
| 10043 | |
| 10044 String toJson() => name; | |
| 10045 } | |
| 10046 | |
| 10047 /** | |
| 10048 * SourceChange | |
| 10049 * | |
| 10050 * { | |
| 10051 * "message": String | |
| 10052 * "edits": List<SourceFileEdit> | |
| 10053 * "linkedEditGroups": List<LinkedEditGroup> | |
| 10054 * "selection": optional Position | |
| 10055 * } | |
| 10056 * | |
| 10057 * Clients may not extend, implement or mix-in this class. | |
| 10058 */ | |
| 10059 class SourceChange implements HasToJson { | |
| 10060 String _message; | |
| 10061 | |
| 10062 List<SourceFileEdit> _edits; | |
| 10063 | |
| 10064 List<LinkedEditGroup> _linkedEditGroups; | |
| 10065 | |
| 10066 Position _selection; | |
| 10067 | |
| 10068 /** | |
| 10069 * A human-readable description of the change to be applied. | |
| 10070 */ | |
| 10071 String get message => _message; | |
| 10072 | |
| 10073 /** | |
| 10074 * A human-readable description of the change to be applied. | |
| 10075 */ | |
| 10076 void set message(String value) { | |
| 10077 assert(value != null); | |
| 10078 this._message = value; | |
| 10079 } | |
| 10080 | |
| 10081 /** | |
| 10082 * A list of the edits used to effect the change, grouped by file. | |
| 10083 */ | |
| 10084 List<SourceFileEdit> get edits => _edits; | |
| 10085 | |
| 10086 /** | |
| 10087 * A list of the edits used to effect the change, grouped by file. | |
| 10088 */ | |
| 10089 void set edits(List<SourceFileEdit> value) { | |
| 10090 assert(value != null); | |
| 10091 this._edits = value; | |
| 10092 } | |
| 10093 | |
| 10094 /** | |
| 10095 * A list of the linked editing groups used to customize the changes that | |
| 10096 * were made. | |
| 10097 */ | |
| 10098 List<LinkedEditGroup> get linkedEditGroups => _linkedEditGroups; | |
| 10099 | |
| 10100 /** | |
| 10101 * A list of the linked editing groups used to customize the changes that | |
| 10102 * were made. | |
| 10103 */ | |
| 10104 void set linkedEditGroups(List<LinkedEditGroup> value) { | |
| 10105 assert(value != null); | |
| 10106 this._linkedEditGroups = value; | |
| 10107 } | |
| 10108 | |
| 10109 /** | |
| 10110 * The position that should be selected after the edits have been applied. | |
| 10111 */ | |
| 10112 Position get selection => _selection; | |
| 10113 | |
| 10114 /** | |
| 10115 * The position that should be selected after the edits have been applied. | |
| 10116 */ | |
| 10117 void set selection(Position value) { | |
| 10118 this._selection = value; | |
| 10119 } | |
| 10120 | |
| 10121 SourceChange(String message, {List<SourceFileEdit> edits, List<LinkedEditGroup
> linkedEditGroups, Position selection}) { | |
| 10122 this.message = message; | |
| 10123 if (edits == null) { | |
| 10124 this.edits = <SourceFileEdit>[]; | |
| 10125 } else { | |
| 10126 this.edits = edits; | |
| 10127 } | |
| 10128 if (linkedEditGroups == null) { | |
| 10129 this.linkedEditGroups = <LinkedEditGroup>[]; | |
| 10130 } else { | |
| 10131 this.linkedEditGroups = linkedEditGroups; | |
| 10132 } | |
| 10133 this.selection = selection; | |
| 10134 } | |
| 10135 | |
| 10136 factory SourceChange.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object
json) { | |
| 10137 if (json == null) { | |
| 10138 json = {}; | |
| 10139 } | |
| 10140 if (json is Map) { | |
| 10141 String message; | |
| 10142 if (json.containsKey("message")) { | |
| 10143 message = jsonDecoder.decodeString(jsonPath + ".message", json["message"
]); | |
| 10144 } else { | |
| 10145 throw jsonDecoder.mismatch(jsonPath, "message"); | |
| 10146 } | |
| 10147 List<SourceFileEdit> edits; | |
| 10148 if (json.containsKey("edits")) { | |
| 10149 edits = jsonDecoder.decodeList(jsonPath + ".edits", json["edits"], (Stri
ng jsonPath, Object json) => new SourceFileEdit.fromJson(jsonDecoder, jsonPath,
json)); | |
| 10150 } else { | |
| 10151 throw jsonDecoder.mismatch(jsonPath, "edits"); | |
| 10152 } | |
| 10153 List<LinkedEditGroup> linkedEditGroups; | |
| 10154 if (json.containsKey("linkedEditGroups")) { | |
| 10155 linkedEditGroups = jsonDecoder.decodeList(jsonPath + ".linkedEditGroups"
, json["linkedEditGroups"], (String jsonPath, Object json) => new LinkedEditGrou
p.fromJson(jsonDecoder, jsonPath, json)); | |
| 10156 } else { | |
| 10157 throw jsonDecoder.mismatch(jsonPath, "linkedEditGroups"); | |
| 10158 } | |
| 10159 Position selection; | |
| 10160 if (json.containsKey("selection")) { | |
| 10161 selection = new Position.fromJson(jsonDecoder, jsonPath + ".selection",
json["selection"]); | |
| 10162 } | |
| 10163 return new SourceChange(message, edits: edits, linkedEditGroups: linkedEdi
tGroups, selection: selection); | |
| 10164 } else { | |
| 10165 throw jsonDecoder.mismatch(jsonPath, "SourceChange", json); | |
| 10166 } | |
| 10167 } | |
| 10168 | |
| 10169 @override | |
| 10170 Map<String, dynamic> toJson() { | |
| 10171 Map<String, dynamic> result = {}; | |
| 10172 result["message"] = message; | |
| 10173 result["edits"] = edits.map((SourceFileEdit value) => value.toJson()).toList
(); | |
| 10174 result["linkedEditGroups"] = linkedEditGroups.map((LinkedEditGroup value) =>
value.toJson()).toList(); | |
| 10175 if (selection != null) { | |
| 10176 result["selection"] = selection.toJson(); | |
| 10177 } | |
| 10178 return result; | |
| 10179 } | |
| 10180 | |
| 10181 /** | |
| 10182 * Adds [edit] to the [FileEdit] for the given [file]. | |
| 10183 */ | |
| 10184 void addEdit(String file, int fileStamp, SourceEdit edit) => | |
| 10185 addEditToSourceChange(this, file, fileStamp, edit); | |
| 10186 | |
| 10187 /** | |
| 10188 * Adds the given [FileEdit]. | |
| 10189 */ | |
| 10190 void addFileEdit(SourceFileEdit edit) { | |
| 10191 edits.add(edit); | |
| 10192 } | |
| 10193 | |
| 10194 /** | |
| 10195 * Adds the given [LinkedEditGroup]. | |
| 10196 */ | |
| 10197 void addLinkedEditGroup(LinkedEditGroup linkedEditGroup) { | |
| 10198 linkedEditGroups.add(linkedEditGroup); | |
| 10199 } | |
| 10200 | |
| 10201 /** | |
| 10202 * Returns the [FileEdit] for the given [file], maybe `null`. | |
| 10203 */ | |
| 10204 SourceFileEdit getFileEdit(String file) => | |
| 10205 getChangeFileEdit(this, file); | |
| 10206 | |
| 10207 @override | |
| 10208 String toString() => JSON.encode(toJson()); | |
| 10209 | |
| 10210 @override | |
| 10211 bool operator==(other) { | |
| 10212 if (other is SourceChange) { | |
| 10213 return message == other.message && | |
| 10214 listEqual(edits, other.edits, (SourceFileEdit a, SourceFileEdit b) =>
a == b) && | |
| 10215 listEqual(linkedEditGroups, other.linkedEditGroups, (LinkedEditGroup a
, LinkedEditGroup b) => a == b) && | |
| 10216 selection == other.selection; | |
| 10217 } | |
| 10218 return false; | |
| 10219 } | |
| 10220 | |
| 10221 @override | |
| 10222 int get hashCode { | |
| 10223 int hash = 0; | |
| 10224 hash = JenkinsSmiHash.combine(hash, message.hashCode); | |
| 10225 hash = JenkinsSmiHash.combine(hash, edits.hashCode); | |
| 10226 hash = JenkinsSmiHash.combine(hash, linkedEditGroups.hashCode); | |
| 10227 hash = JenkinsSmiHash.combine(hash, selection.hashCode); | |
| 10228 return JenkinsSmiHash.finish(hash); | |
| 10229 } | |
| 10230 } | |
| 10231 | |
| 10232 /** | |
| 10233 * SourceEdit | |
| 10234 * | |
| 10235 * { | |
| 10236 * "offset": int | |
| 10237 * "length": int | |
| 10238 * "replacement": String | |
| 10239 * "id": optional String | |
| 10240 * } | |
| 10241 * | |
| 10242 * Clients may not extend, implement or mix-in this class. | |
| 10243 */ | |
| 10244 class SourceEdit implements HasToJson { | |
| 10245 /** | |
| 10246 * Get the result of applying a set of [edits] to the given [code]. Edits are | |
| 10247 * applied in the order they appear in [edits]. | |
| 10248 */ | |
| 10249 static String applySequence(String code, Iterable<SourceEdit> edits) => | |
| 10250 applySequenceOfEdits(code, edits); | |
| 10251 | |
| 10252 int _offset; | |
| 10253 | |
| 10254 int _length; | |
| 10255 | |
| 10256 String _replacement; | |
| 10257 | |
| 10258 String _id; | |
| 10259 | |
| 10260 /** | |
| 10261 * The offset of the region to be modified. | |
| 10262 */ | |
| 10263 int get offset => _offset; | |
| 10264 | |
| 10265 /** | |
| 10266 * The offset of the region to be modified. | |
| 10267 */ | |
| 10268 void set offset(int value) { | |
| 10269 assert(value != null); | |
| 10270 this._offset = value; | |
| 10271 } | |
| 10272 | |
| 10273 /** | |
| 10274 * The length of the region to be modified. | |
| 10275 */ | |
| 10276 int get length => _length; | |
| 10277 | |
| 10278 /** | |
| 10279 * The length of the region to be modified. | |
| 10280 */ | |
| 10281 void set length(int value) { | |
| 10282 assert(value != null); | |
| 10283 this._length = value; | |
| 10284 } | |
| 10285 | |
| 10286 /** | |
| 10287 * The code that is to replace the specified region in the original code. | |
| 10288 */ | |
| 10289 String get replacement => _replacement; | |
| 10290 | |
| 10291 /** | |
| 10292 * The code that is to replace the specified region in the original code. | |
| 10293 */ | |
| 10294 void set replacement(String value) { | |
| 10295 assert(value != null); | |
| 10296 this._replacement = value; | |
| 10297 } | |
| 10298 | |
| 10299 /** | |
| 10300 * An identifier that uniquely identifies this source edit from other edits | |
| 10301 * in the same response. This field is omitted unless a containing structure | |
| 10302 * needs to be able to identify the edit for some reason. | |
| 10303 * | |
| 10304 * For example, some refactoring operations can produce edits that might not | |
| 10305 * be appropriate (referred to as potential edits). Such edits will have an | |
| 10306 * id so that they can be referenced. Edits in the same response that do not | |
| 10307 * need to be referenced will not have an id. | |
| 10308 */ | |
| 10309 String get id => _id; | |
| 10310 | |
| 10311 /** | |
| 10312 * An identifier that uniquely identifies this source edit from other edits | |
| 10313 * in the same response. This field is omitted unless a containing structure | |
| 10314 * needs to be able to identify the edit for some reason. | |
| 10315 * | |
| 10316 * For example, some refactoring operations can produce edits that might not | |
| 10317 * be appropriate (referred to as potential edits). Such edits will have an | |
| 10318 * id so that they can be referenced. Edits in the same response that do not | |
| 10319 * need to be referenced will not have an id. | |
| 10320 */ | |
| 10321 void set id(String value) { | |
| 10322 this._id = value; | |
| 10323 } | |
| 10324 | |
| 10325 SourceEdit(int offset, int length, String replacement, {String id}) { | |
| 10326 this.offset = offset; | |
| 10327 this.length = length; | |
| 10328 this.replacement = replacement; | |
| 10329 this.id = id; | |
| 10330 } | |
| 10331 | |
| 10332 factory SourceEdit.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object j
son) { | |
| 10333 if (json == null) { | |
| 10334 json = {}; | |
| 10335 } | |
| 10336 if (json is Map) { | |
| 10337 int offset; | |
| 10338 if (json.containsKey("offset")) { | |
| 10339 offset = jsonDecoder.decodeInt(jsonPath + ".offset", json["offset"]); | |
| 10340 } else { | |
| 10341 throw jsonDecoder.mismatch(jsonPath, "offset"); | |
| 10342 } | |
| 10343 int length; | |
| 10344 if (json.containsKey("length")) { | |
| 10345 length = jsonDecoder.decodeInt(jsonPath + ".length", json["length"]); | |
| 10346 } else { | |
| 10347 throw jsonDecoder.mismatch(jsonPath, "length"); | |
| 10348 } | |
| 10349 String replacement; | |
| 10350 if (json.containsKey("replacement")) { | |
| 10351 replacement = jsonDecoder.decodeString(jsonPath + ".replacement", json["
replacement"]); | |
| 10352 } else { | |
| 10353 throw jsonDecoder.mismatch(jsonPath, "replacement"); | |
| 10354 } | |
| 10355 String id; | |
| 10356 if (json.containsKey("id")) { | |
| 10357 id = jsonDecoder.decodeString(jsonPath + ".id", json["id"]); | |
| 10358 } | |
| 10359 return new SourceEdit(offset, length, replacement, id: id); | |
| 10360 } else { | |
| 10361 throw jsonDecoder.mismatch(jsonPath, "SourceEdit", json); | |
| 10362 } | |
| 10363 } | |
| 10364 | |
| 10365 /** | |
| 10366 * The end of the region to be modified. | |
| 10367 */ | |
| 10368 int get end => offset + length; | |
| 10369 | |
| 10370 @override | |
| 10371 Map<String, dynamic> toJson() { | |
| 10372 Map<String, dynamic> result = {}; | |
| 10373 result["offset"] = offset; | |
| 10374 result["length"] = length; | |
| 10375 result["replacement"] = replacement; | |
| 10376 if (id != null) { | |
| 10377 result["id"] = id; | |
| 10378 } | |
| 10379 return result; | |
| 10380 } | |
| 10381 | |
| 10382 /** | |
| 10383 * Get the result of applying the edit to the given [code]. | |
| 10384 */ | |
| 10385 String apply(String code) => applyEdit(code, this); | |
| 10386 | |
| 10387 @override | |
| 10388 String toString() => JSON.encode(toJson()); | |
| 10389 | |
| 10390 @override | |
| 10391 bool operator==(other) { | |
| 10392 if (other is SourceEdit) { | |
| 10393 return offset == other.offset && | |
| 10394 length == other.length && | |
| 10395 replacement == other.replacement && | |
| 10396 id == other.id; | |
| 10397 } | |
| 10398 return false; | |
| 10399 } | |
| 10400 | |
| 10401 @override | |
| 10402 int get hashCode { | |
| 10403 int hash = 0; | |
| 10404 hash = JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 10405 hash = JenkinsSmiHash.combine(hash, length.hashCode); | |
| 10406 hash = JenkinsSmiHash.combine(hash, replacement.hashCode); | |
| 10407 hash = JenkinsSmiHash.combine(hash, id.hashCode); | |
| 10408 return JenkinsSmiHash.finish(hash); | |
| 10409 } | |
| 10410 } | |
| 10411 | |
| 10412 /** | |
| 10413 * SourceFileEdit | |
| 10414 * | |
| 10415 * { | |
| 10416 * "file": FilePath | |
| 10417 * "fileStamp": long | |
| 10418 * "edits": List<SourceEdit> | |
| 10419 * } | |
| 10420 * | |
| 10421 * Clients may not extend, implement or mix-in this class. | |
| 10422 */ | |
| 10423 class SourceFileEdit implements HasToJson { | |
| 10424 String _file; | |
| 10425 | |
| 10426 int _fileStamp; | |
| 10427 | |
| 10428 List<SourceEdit> _edits; | |
| 10429 | |
| 10430 /** | |
| 10431 * The file containing the code to be modified. | |
| 10432 */ | |
| 10433 String get file => _file; | |
| 10434 | |
| 10435 /** | |
| 10436 * The file containing the code to be modified. | |
| 10437 */ | |
| 10438 void set file(String value) { | |
| 10439 assert(value != null); | |
| 10440 this._file = value; | |
| 10441 } | |
| 10442 | |
| 10443 /** | |
| 10444 * The modification stamp of the file at the moment when the change was | |
| 10445 * created, in milliseconds since the "Unix epoch". Will be -1 if the file | |
| 10446 * did not exist and should be created. The client may use this field to make | |
| 10447 * sure that the file was not changed since then, so it is safe to apply the | |
| 10448 * change. | |
| 10449 */ | |
| 10450 int get fileStamp => _fileStamp; | |
| 10451 | |
| 10452 /** | |
| 10453 * The modification stamp of the file at the moment when the change was | |
| 10454 * created, in milliseconds since the "Unix epoch". Will be -1 if the file | |
| 10455 * did not exist and should be created. The client may use this field to make | |
| 10456 * sure that the file was not changed since then, so it is safe to apply the | |
| 10457 * change. | |
| 10458 */ | |
| 10459 void set fileStamp(int value) { | |
| 10460 assert(value != null); | |
| 10461 this._fileStamp = value; | |
| 10462 } | |
| 10463 | |
| 10464 /** | |
| 10465 * A list of the edits used to effect the change. | |
| 10466 */ | |
| 10467 List<SourceEdit> get edits => _edits; | |
| 10468 | |
| 10469 /** | |
| 10470 * A list of the edits used to effect the change. | |
| 10471 */ | |
| 10472 void set edits(List<SourceEdit> value) { | |
| 10473 assert(value != null); | |
| 10474 this._edits = value; | |
| 10475 } | |
| 10476 | |
| 10477 SourceFileEdit(String file, int fileStamp, {List<SourceEdit> edits}) { | |
| 10478 this.file = file; | |
| 10479 this.fileStamp = fileStamp; | |
| 10480 if (edits == null) { | |
| 10481 this.edits = <SourceEdit>[]; | |
| 10482 } else { | |
| 10483 this.edits = edits; | |
| 10484 } | |
| 10485 } | |
| 10486 | |
| 10487 factory SourceFileEdit.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obje
ct json) { | |
| 10488 if (json == null) { | |
| 10489 json = {}; | |
| 10490 } | |
| 10491 if (json is Map) { | |
| 10492 String file; | |
| 10493 if (json.containsKey("file")) { | |
| 10494 file = jsonDecoder.decodeString(jsonPath + ".file", json["file"]); | |
| 10495 } else { | |
| 10496 throw jsonDecoder.mismatch(jsonPath, "file"); | |
| 10497 } | |
| 10498 int fileStamp; | |
| 10499 if (json.containsKey("fileStamp")) { | |
| 10500 fileStamp = jsonDecoder.decodeInt(jsonPath + ".fileStamp", json["fileSta
mp"]); | |
| 10501 } else { | |
| 10502 throw jsonDecoder.mismatch(jsonPath, "fileStamp"); | |
| 10503 } | |
| 10504 List<SourceEdit> edits; | |
| 10505 if (json.containsKey("edits")) { | |
| 10506 edits = jsonDecoder.decodeList(jsonPath + ".edits", json["edits"], (Stri
ng jsonPath, Object json) => new SourceEdit.fromJson(jsonDecoder, jsonPath, json
)); | |
| 10507 } else { | |
| 10508 throw jsonDecoder.mismatch(jsonPath, "edits"); | |
| 10509 } | |
| 10510 return new SourceFileEdit(file, fileStamp, edits: edits); | |
| 10511 } else { | |
| 10512 throw jsonDecoder.mismatch(jsonPath, "SourceFileEdit", json); | |
| 10513 } | |
| 10514 } | |
| 10515 | |
| 10516 @override | |
| 10517 Map<String, dynamic> toJson() { | |
| 10518 Map<String, dynamic> result = {}; | |
| 10519 result["file"] = file; | |
| 10520 result["fileStamp"] = fileStamp; | |
| 10521 result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList(); | |
| 10522 return result; | |
| 10523 } | |
| 10524 | |
| 10525 /** | |
| 10526 * Adds the given [Edit] to the list. | |
| 10527 */ | |
| 10528 void add(SourceEdit edit) => addEditForSource(this, edit); | |
| 10529 | |
| 10530 /** | |
| 10531 * Adds the given [Edit]s. | |
| 10532 */ | |
| 10533 void addAll(Iterable<SourceEdit> edits) => | |
| 10534 addAllEditsForSource(this, edits); | |
| 10535 | |
| 10536 @override | |
| 10537 String toString() => JSON.encode(toJson()); | |
| 10538 | |
| 10539 @override | |
| 10540 bool operator==(other) { | |
| 10541 if (other is SourceFileEdit) { | |
| 10542 return file == other.file && | |
| 10543 fileStamp == other.fileStamp && | |
| 10544 listEqual(edits, other.edits, (SourceEdit a, SourceEdit b) => a == b); | |
| 10545 } | |
| 10546 return false; | |
| 10547 } | |
| 10548 | |
| 10549 @override | |
| 10550 int get hashCode { | |
| 10551 int hash = 0; | |
| 10552 hash = JenkinsSmiHash.combine(hash, file.hashCode); | |
| 10553 hash = JenkinsSmiHash.combine(hash, fileStamp.hashCode); | |
| 10554 hash = JenkinsSmiHash.combine(hash, edits.hashCode); | |
| 10555 return JenkinsSmiHash.finish(hash); | |
| 10556 } | |
| 10557 } | |
| 10558 | |
| 10559 /** | |
| 10560 * WatchEvent | |
| 10561 * | |
| 10562 * { | |
| 10563 * "type": WatchEventType | |
| 10564 * "path": String | |
| 10565 * } | |
| 10566 * | |
| 10567 * Clients may not extend, implement or mix-in this class. | |
| 10568 */ | |
| 10569 class WatchEvent implements HasToJson { | |
| 10570 WatchEventType _type; | |
| 10571 | |
| 10572 String _path; | |
| 10573 | |
| 10574 /** | |
| 10575 * The type of change represented by this event. | |
| 10576 */ | |
| 10577 WatchEventType get type => _type; | |
| 10578 | |
| 10579 /** | |
| 10580 * The type of change represented by this event. | |
| 10581 */ | |
| 10582 void set type(WatchEventType value) { | |
| 10583 assert(value != null); | |
| 10584 this._type = value; | |
| 10585 } | |
| 10586 | |
| 10587 /** | |
| 10588 * The absolute path of the file or directory that changed. | |
| 10589 */ | |
| 10590 String get path => _path; | |
| 10591 | |
| 10592 /** | |
| 10593 * The absolute path of the file or directory that changed. | |
| 10594 */ | |
| 10595 void set path(String value) { | |
| 10596 assert(value != null); | |
| 10597 this._path = value; | |
| 10598 } | |
| 10599 | |
| 10600 WatchEvent(WatchEventType type, String path) { | |
| 10601 this.type = type; | |
| 10602 this.path = path; | |
| 10603 } | |
| 10604 | |
| 10605 factory WatchEvent.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object j
son) { | |
| 10606 if (json == null) { | |
| 10607 json = {}; | |
| 10608 } | |
| 10609 if (json is Map) { | |
| 10610 WatchEventType type; | |
| 10611 if (json.containsKey("type")) { | |
| 10612 type = new WatchEventType.fromJson(jsonDecoder, jsonPath + ".type", json
["type"]); | |
| 10613 } else { | |
| 10614 throw jsonDecoder.mismatch(jsonPath, "type"); | |
| 10615 } | |
| 10616 String path; | |
| 10617 if (json.containsKey("path")) { | |
| 10618 path = jsonDecoder.decodeString(jsonPath + ".path", json["path"]); | |
| 10619 } else { | |
| 10620 throw jsonDecoder.mismatch(jsonPath, "path"); | |
| 10621 } | |
| 10622 return new WatchEvent(type, path); | |
| 10623 } else { | |
| 10624 throw jsonDecoder.mismatch(jsonPath, "WatchEvent", json); | |
| 10625 } | |
| 10626 } | |
| 10627 | |
| 10628 @override | |
| 10629 Map<String, dynamic> toJson() { | |
| 10630 Map<String, dynamic> result = {}; | |
| 10631 result["type"] = type.toJson(); | |
| 10632 result["path"] = path; | |
| 10633 return result; | |
| 10634 } | |
| 10635 | |
| 10636 @override | |
| 10637 String toString() => JSON.encode(toJson()); | |
| 10638 | |
| 10639 @override | |
| 10640 bool operator==(other) { | |
| 10641 if (other is WatchEvent) { | |
| 10642 return type == other.type && | |
| 10643 path == other.path; | |
| 10644 } | |
| 10645 return false; | |
| 10646 } | |
| 10647 | |
| 10648 @override | |
| 10649 int get hashCode { | |
| 10650 int hash = 0; | |
| 10651 hash = JenkinsSmiHash.combine(hash, type.hashCode); | |
| 10652 hash = JenkinsSmiHash.combine(hash, path.hashCode); | |
| 10653 return JenkinsSmiHash.finish(hash); | |
| 10654 } | |
| 10655 } | |
| 10656 | |
| 10657 /** | |
| 10658 * WatchEventType | |
| 10659 * | |
| 10660 * enum { | |
| 10661 * ADD | |
| 10662 * MODIFY | |
| 10663 * REMOVE | |
| 10664 * } | |
| 10665 * | |
| 10666 * Clients may not extend, implement or mix-in this class. | |
| 10667 */ | |
| 10668 class WatchEventType implements Enum { | |
| 10669 /** | |
| 10670 * An indication that the file or directory was added. | |
| 10671 */ | |
| 10672 static const WatchEventType ADD = const WatchEventType._("ADD"); | |
| 10673 | |
| 10674 /** | |
| 10675 * An indication that the file was modified. | |
| 10676 */ | |
| 10677 static const WatchEventType MODIFY = const WatchEventType._("MODIFY"); | |
| 10678 | |
| 10679 /** | |
| 10680 * An indication that the file or directory was removed. | |
| 10681 */ | |
| 10682 static const WatchEventType REMOVE = const WatchEventType._("REMOVE"); | |
| 10683 | |
| 10684 /** | |
| 10685 * A list containing all of the enum values that are defined. | |
| 10686 */ | |
| 10687 static const List<WatchEventType> VALUES = const <WatchEventType>[ADD, MODIFY,
REMOVE]; | |
| 10688 | |
| 10689 @override | |
| 10690 final String name; | |
| 10691 | |
| 10692 const WatchEventType._(this.name); | |
| 10693 | |
| 10694 factory WatchEventType(String name) { | |
| 10695 switch (name) { | |
| 10696 case "ADD": | |
| 10697 return ADD; | |
| 10698 case "MODIFY": | |
| 10699 return MODIFY; | |
| 10700 case "REMOVE": | |
| 10701 return REMOVE; | |
| 10702 } | |
| 10703 throw new Exception('Illegal enum value: $name'); | |
| 10704 } | |
| 10705 | |
| 10706 factory WatchEventType.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obje
ct json) { | |
| 10707 if (json is String) { | |
| 10708 try { | |
| 10709 return new WatchEventType(json); | |
| 10710 } catch(_) { | |
| 10711 // Fall through | |
| 10712 } | |
| 10713 } | |
| 10714 throw jsonDecoder.mismatch(jsonPath, "WatchEventType", json); | |
| 10715 } | |
| 10716 | |
| 10717 @override | |
| 10718 String toString() => "WatchEventType.$name"; | |
| 10719 | |
| 10720 String toJson() => name; | |
| 10721 } | |
| OLD | NEW |