| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 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 part of protocol; | |
| 10 /** | |
| 11 * server.getVersion params | |
| 12 */ | |
| 13 class ServerGetVersionParams { | |
| 14 Request toRequest(String id) { | |
| 15 return new Request(id, "server.getVersion", null); | |
| 16 } | |
| 17 | |
| 18 @override | |
| 19 bool operator==(other) { | |
| 20 if (other is ServerGetVersionParams) { | |
| 21 return true; | |
| 22 } | |
| 23 return false; | |
| 24 } | |
| 25 | |
| 26 @override | |
| 27 int get hashCode { | |
| 28 return 55877452; | |
| 29 } | |
| 30 } | |
| 31 | |
| 32 /** | |
| 33 * server.getVersion result | |
| 34 * | |
| 35 * { | |
| 36 * "version": String | |
| 37 * } | |
| 38 */ | |
| 39 class ServerGetVersionResult implements HasToJson { | |
| 40 /** | |
| 41 * The version number of the analysis server. | |
| 42 */ | |
| 43 String version; | |
| 44 | |
| 45 ServerGetVersionResult(this.version); | |
| 46 | |
| 47 factory ServerGetVersionResult.fromJson(JsonDecoder jsonDecoder, String jsonPa
th, Object json) { | |
| 48 if (json == null) { | |
| 49 json = {}; | |
| 50 } | |
| 51 if (json is Map) { | |
| 52 String version; | |
| 53 if (json.containsKey("version")) { | |
| 54 version = jsonDecoder._decodeString(jsonPath + ".version", json["version
"]); | |
| 55 } else { | |
| 56 throw jsonDecoder.missingKey(jsonPath, "version"); | |
| 57 } | |
| 58 return new ServerGetVersionResult(version); | |
| 59 } else { | |
| 60 throw jsonDecoder.mismatch(jsonPath, "server.getVersion result"); | |
| 61 } | |
| 62 } | |
| 63 | |
| 64 factory ServerGetVersionResult.fromResponse(Response response) { | |
| 65 return new ServerGetVersionResult.fromJson( | |
| 66 new ResponseDecoder(response), "result", response._result); | |
| 67 } | |
| 68 | |
| 69 Map<String, dynamic> toJson() { | |
| 70 Map<String, dynamic> result = {}; | |
| 71 result["version"] = version; | |
| 72 return result; | |
| 73 } | |
| 74 | |
| 75 Response toResponse(String id) { | |
| 76 return new Response(id, result: toJson()); | |
| 77 } | |
| 78 | |
| 79 @override | |
| 80 String toString() => JSON.encode(toJson()); | |
| 81 | |
| 82 @override | |
| 83 bool operator==(other) { | |
| 84 if (other is ServerGetVersionResult) { | |
| 85 return version == other.version; | |
| 86 } | |
| 87 return false; | |
| 88 } | |
| 89 | |
| 90 @override | |
| 91 int get hashCode { | |
| 92 int hash = 0; | |
| 93 hash = _JenkinsSmiHash.combine(hash, version.hashCode); | |
| 94 return _JenkinsSmiHash.finish(hash); | |
| 95 } | |
| 96 } | |
| 97 /** | |
| 98 * server.shutdown params | |
| 99 */ | |
| 100 class ServerShutdownParams { | |
| 101 Request toRequest(String id) { | |
| 102 return new Request(id, "server.shutdown", null); | |
| 103 } | |
| 104 | |
| 105 @override | |
| 106 bool operator==(other) { | |
| 107 if (other is ServerShutdownParams) { | |
| 108 return true; | |
| 109 } | |
| 110 return false; | |
| 111 } | |
| 112 | |
| 113 @override | |
| 114 int get hashCode { | |
| 115 return 366630911; | |
| 116 } | |
| 117 } | |
| 118 /** | |
| 119 * server.shutdown result | |
| 120 */ | |
| 121 class ServerShutdownResult { | |
| 122 Response toResponse(String id) { | |
| 123 return new Response(id, result: null); | |
| 124 } | |
| 125 | |
| 126 @override | |
| 127 bool operator==(other) { | |
| 128 if (other is ServerShutdownResult) { | |
| 129 return true; | |
| 130 } | |
| 131 return false; | |
| 132 } | |
| 133 | |
| 134 @override | |
| 135 int get hashCode { | |
| 136 return 193626532; | |
| 137 } | |
| 138 } | |
| 139 | |
| 140 /** | |
| 141 * server.setSubscriptions params | |
| 142 * | |
| 143 * { | |
| 144 * "subscriptions": List<ServerService> | |
| 145 * } | |
| 146 */ | |
| 147 class ServerSetSubscriptionsParams implements HasToJson { | |
| 148 /** | |
| 149 * A list of the services being subscribed to. | |
| 150 */ | |
| 151 List<ServerService> subscriptions; | |
| 152 | |
| 153 ServerSetSubscriptionsParams(this.subscriptions); | |
| 154 | |
| 155 factory ServerSetSubscriptionsParams.fromJson(JsonDecoder jsonDecoder, String
jsonPath, Object json) { | |
| 156 if (json == null) { | |
| 157 json = {}; | |
| 158 } | |
| 159 if (json is Map) { | |
| 160 List<ServerService> subscriptions; | |
| 161 if (json.containsKey("subscriptions")) { | |
| 162 subscriptions = jsonDecoder._decodeList(jsonPath + ".subscriptions", jso
n["subscriptions"], (String jsonPath, Object json) => new ServerService.fromJson
(jsonDecoder, jsonPath, json)); | |
| 163 } else { | |
| 164 throw jsonDecoder.missingKey(jsonPath, "subscriptions"); | |
| 165 } | |
| 166 return new ServerSetSubscriptionsParams(subscriptions); | |
| 167 } else { | |
| 168 throw jsonDecoder.mismatch(jsonPath, "server.setSubscriptions params"); | |
| 169 } | |
| 170 } | |
| 171 | |
| 172 factory ServerSetSubscriptionsParams.fromRequest(Request request) { | |
| 173 return new ServerSetSubscriptionsParams.fromJson( | |
| 174 new RequestDecoder(request), "params", request._params); | |
| 175 } | |
| 176 | |
| 177 Map<String, dynamic> toJson() { | |
| 178 Map<String, dynamic> result = {}; | |
| 179 result["subscriptions"] = subscriptions.map((ServerService value) => value.t
oJson()).toList(); | |
| 180 return result; | |
| 181 } | |
| 182 | |
| 183 Request toRequest(String id) { | |
| 184 return new Request(id, "server.setSubscriptions", toJson()); | |
| 185 } | |
| 186 | |
| 187 @override | |
| 188 String toString() => JSON.encode(toJson()); | |
| 189 | |
| 190 @override | |
| 191 bool operator==(other) { | |
| 192 if (other is ServerSetSubscriptionsParams) { | |
| 193 return _listEqual(subscriptions, other.subscriptions, (ServerService a, Se
rverService b) => a == b); | |
| 194 } | |
| 195 return false; | |
| 196 } | |
| 197 | |
| 198 @override | |
| 199 int get hashCode { | |
| 200 int hash = 0; | |
| 201 hash = _JenkinsSmiHash.combine(hash, subscriptions.hashCode); | |
| 202 return _JenkinsSmiHash.finish(hash); | |
| 203 } | |
| 204 } | |
| 205 /** | |
| 206 * server.setSubscriptions result | |
| 207 */ | |
| 208 class ServerSetSubscriptionsResult { | |
| 209 Response toResponse(String id) { | |
| 210 return new Response(id, result: null); | |
| 211 } | |
| 212 | |
| 213 @override | |
| 214 bool operator==(other) { | |
| 215 if (other is ServerSetSubscriptionsResult) { | |
| 216 return true; | |
| 217 } | |
| 218 return false; | |
| 219 } | |
| 220 | |
| 221 @override | |
| 222 int get hashCode { | |
| 223 return 748820900; | |
| 224 } | |
| 225 } | |
| 226 /** | |
| 227 * server.connected params | |
| 228 */ | |
| 229 class ServerConnectedParams { | |
| 230 Notification toNotification() { | |
| 231 return new Notification("server.connected", null); | |
| 232 } | |
| 233 | |
| 234 @override | |
| 235 bool operator==(other) { | |
| 236 if (other is ServerConnectedParams) { | |
| 237 return true; | |
| 238 } | |
| 239 return false; | |
| 240 } | |
| 241 | |
| 242 @override | |
| 243 int get hashCode { | |
| 244 return 509239412; | |
| 245 } | |
| 246 } | |
| 247 | |
| 248 /** | |
| 249 * server.error params | |
| 250 * | |
| 251 * { | |
| 252 * "isFatal": bool | |
| 253 * "message": String | |
| 254 * "stackTrace": String | |
| 255 * } | |
| 256 */ | |
| 257 class ServerErrorParams implements HasToJson { | |
| 258 /** | |
| 259 * True if the error is a fatal error, meaning that the server will shutdown | |
| 260 * automatically after sending this notification. | |
| 261 */ | |
| 262 bool isFatal; | |
| 263 | |
| 264 /** | |
| 265 * The error message indicating what kind of error was encountered. | |
| 266 */ | |
| 267 String message; | |
| 268 | |
| 269 /** | |
| 270 * The stack trace associated with the generation of the error, used for | |
| 271 * debugging the server. | |
| 272 */ | |
| 273 String stackTrace; | |
| 274 | |
| 275 ServerErrorParams(this.isFatal, this.message, this.stackTrace); | |
| 276 | |
| 277 factory ServerErrorParams.fromJson(JsonDecoder jsonDecoder, String jsonPath, O
bject json) { | |
| 278 if (json == null) { | |
| 279 json = {}; | |
| 280 } | |
| 281 if (json is Map) { | |
| 282 bool isFatal; | |
| 283 if (json.containsKey("isFatal")) { | |
| 284 isFatal = jsonDecoder._decodeBool(jsonPath + ".isFatal", json["isFatal"]
); | |
| 285 } else { | |
| 286 throw jsonDecoder.missingKey(jsonPath, "isFatal"); | |
| 287 } | |
| 288 String message; | |
| 289 if (json.containsKey("message")) { | |
| 290 message = jsonDecoder._decodeString(jsonPath + ".message", json["message
"]); | |
| 291 } else { | |
| 292 throw jsonDecoder.missingKey(jsonPath, "message"); | |
| 293 } | |
| 294 String stackTrace; | |
| 295 if (json.containsKey("stackTrace")) { | |
| 296 stackTrace = jsonDecoder._decodeString(jsonPath + ".stackTrace", json["s
tackTrace"]); | |
| 297 } else { | |
| 298 throw jsonDecoder.missingKey(jsonPath, "stackTrace"); | |
| 299 } | |
| 300 return new ServerErrorParams(isFatal, message, stackTrace); | |
| 301 } else { | |
| 302 throw jsonDecoder.mismatch(jsonPath, "server.error params"); | |
| 303 } | |
| 304 } | |
| 305 | |
| 306 factory ServerErrorParams.fromNotification(Notification notification) { | |
| 307 return new ServerErrorParams.fromJson( | |
| 308 new ResponseDecoder(null), "params", notification._params); | |
| 309 } | |
| 310 | |
| 311 Map<String, dynamic> toJson() { | |
| 312 Map<String, dynamic> result = {}; | |
| 313 result["isFatal"] = isFatal; | |
| 314 result["message"] = message; | |
| 315 result["stackTrace"] = stackTrace; | |
| 316 return result; | |
| 317 } | |
| 318 | |
| 319 Notification toNotification() { | |
| 320 return new Notification("server.error", toJson()); | |
| 321 } | |
| 322 | |
| 323 @override | |
| 324 String toString() => JSON.encode(toJson()); | |
| 325 | |
| 326 @override | |
| 327 bool operator==(other) { | |
| 328 if (other is ServerErrorParams) { | |
| 329 return isFatal == other.isFatal && | |
| 330 message == other.message && | |
| 331 stackTrace == other.stackTrace; | |
| 332 } | |
| 333 return false; | |
| 334 } | |
| 335 | |
| 336 @override | |
| 337 int get hashCode { | |
| 338 int hash = 0; | |
| 339 hash = _JenkinsSmiHash.combine(hash, isFatal.hashCode); | |
| 340 hash = _JenkinsSmiHash.combine(hash, message.hashCode); | |
| 341 hash = _JenkinsSmiHash.combine(hash, stackTrace.hashCode); | |
| 342 return _JenkinsSmiHash.finish(hash); | |
| 343 } | |
| 344 } | |
| 345 | |
| 346 /** | |
| 347 * server.status params | |
| 348 * | |
| 349 * { | |
| 350 * "analysis": optional AnalysisStatus | |
| 351 * } | |
| 352 */ | |
| 353 class ServerStatusParams implements HasToJson { | |
| 354 /** | |
| 355 * The current status of analysis, including whether analysis is being | |
| 356 * performed and if so what is being analyzed. | |
| 357 */ | |
| 358 AnalysisStatus analysis; | |
| 359 | |
| 360 ServerStatusParams({this.analysis}); | |
| 361 | |
| 362 factory ServerStatusParams.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 363 if (json == null) { | |
| 364 json = {}; | |
| 365 } | |
| 366 if (json is Map) { | |
| 367 AnalysisStatus analysis; | |
| 368 if (json.containsKey("analysis")) { | |
| 369 analysis = new AnalysisStatus.fromJson(jsonDecoder, jsonPath + ".analysi
s", json["analysis"]); | |
| 370 } | |
| 371 return new ServerStatusParams(analysis: analysis); | |
| 372 } else { | |
| 373 throw jsonDecoder.mismatch(jsonPath, "server.status params"); | |
| 374 } | |
| 375 } | |
| 376 | |
| 377 factory ServerStatusParams.fromNotification(Notification notification) { | |
| 378 return new ServerStatusParams.fromJson( | |
| 379 new ResponseDecoder(null), "params", notification._params); | |
| 380 } | |
| 381 | |
| 382 Map<String, dynamic> toJson() { | |
| 383 Map<String, dynamic> result = {}; | |
| 384 if (analysis != null) { | |
| 385 result["analysis"] = analysis.toJson(); | |
| 386 } | |
| 387 return result; | |
| 388 } | |
| 389 | |
| 390 Notification toNotification() { | |
| 391 return new Notification("server.status", toJson()); | |
| 392 } | |
| 393 | |
| 394 @override | |
| 395 String toString() => JSON.encode(toJson()); | |
| 396 | |
| 397 @override | |
| 398 bool operator==(other) { | |
| 399 if (other is ServerStatusParams) { | |
| 400 return analysis == other.analysis; | |
| 401 } | |
| 402 return false; | |
| 403 } | |
| 404 | |
| 405 @override | |
| 406 int get hashCode { | |
| 407 int hash = 0; | |
| 408 hash = _JenkinsSmiHash.combine(hash, analysis.hashCode); | |
| 409 return _JenkinsSmiHash.finish(hash); | |
| 410 } | |
| 411 } | |
| 412 | |
| 413 /** | |
| 414 * analysis.getErrors params | |
| 415 * | |
| 416 * { | |
| 417 * "file": FilePath | |
| 418 * } | |
| 419 */ | |
| 420 class AnalysisGetErrorsParams implements HasToJson { | |
| 421 /** | |
| 422 * The file for which errors are being requested. | |
| 423 */ | |
| 424 String file; | |
| 425 | |
| 426 AnalysisGetErrorsParams(this.file); | |
| 427 | |
| 428 factory AnalysisGetErrorsParams.fromJson(JsonDecoder jsonDecoder, String jsonP
ath, Object json) { | |
| 429 if (json == null) { | |
| 430 json = {}; | |
| 431 } | |
| 432 if (json is Map) { | |
| 433 String file; | |
| 434 if (json.containsKey("file")) { | |
| 435 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 436 } else { | |
| 437 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 438 } | |
| 439 return new AnalysisGetErrorsParams(file); | |
| 440 } else { | |
| 441 throw jsonDecoder.mismatch(jsonPath, "analysis.getErrors params"); | |
| 442 } | |
| 443 } | |
| 444 | |
| 445 factory AnalysisGetErrorsParams.fromRequest(Request request) { | |
| 446 return new AnalysisGetErrorsParams.fromJson( | |
| 447 new RequestDecoder(request), "params", request._params); | |
| 448 } | |
| 449 | |
| 450 Map<String, dynamic> toJson() { | |
| 451 Map<String, dynamic> result = {}; | |
| 452 result["file"] = file; | |
| 453 return result; | |
| 454 } | |
| 455 | |
| 456 Request toRequest(String id) { | |
| 457 return new Request(id, "analysis.getErrors", toJson()); | |
| 458 } | |
| 459 | |
| 460 @override | |
| 461 String toString() => JSON.encode(toJson()); | |
| 462 | |
| 463 @override | |
| 464 bool operator==(other) { | |
| 465 if (other is AnalysisGetErrorsParams) { | |
| 466 return file == other.file; | |
| 467 } | |
| 468 return false; | |
| 469 } | |
| 470 | |
| 471 @override | |
| 472 int get hashCode { | |
| 473 int hash = 0; | |
| 474 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 475 return _JenkinsSmiHash.finish(hash); | |
| 476 } | |
| 477 } | |
| 478 | |
| 479 /** | |
| 480 * analysis.getErrors result | |
| 481 * | |
| 482 * { | |
| 483 * "errors": List<AnalysisError> | |
| 484 * } | |
| 485 */ | |
| 486 class AnalysisGetErrorsResult implements HasToJson { | |
| 487 /** | |
| 488 * The errors associated with the file. | |
| 489 */ | |
| 490 List<AnalysisError> errors; | |
| 491 | |
| 492 AnalysisGetErrorsResult(this.errors); | |
| 493 | |
| 494 factory AnalysisGetErrorsResult.fromJson(JsonDecoder jsonDecoder, String jsonP
ath, Object json) { | |
| 495 if (json == null) { | |
| 496 json = {}; | |
| 497 } | |
| 498 if (json is Map) { | |
| 499 List<AnalysisError> errors; | |
| 500 if (json.containsKey("errors")) { | |
| 501 errors = jsonDecoder._decodeList(jsonPath + ".errors", json["errors"], (
String jsonPath, Object json) => new AnalysisError.fromJson(jsonDecoder, jsonPat
h, json)); | |
| 502 } else { | |
| 503 throw jsonDecoder.missingKey(jsonPath, "errors"); | |
| 504 } | |
| 505 return new AnalysisGetErrorsResult(errors); | |
| 506 } else { | |
| 507 throw jsonDecoder.mismatch(jsonPath, "analysis.getErrors result"); | |
| 508 } | |
| 509 } | |
| 510 | |
| 511 factory AnalysisGetErrorsResult.fromResponse(Response response) { | |
| 512 return new AnalysisGetErrorsResult.fromJson( | |
| 513 new ResponseDecoder(response), "result", response._result); | |
| 514 } | |
| 515 | |
| 516 Map<String, dynamic> toJson() { | |
| 517 Map<String, dynamic> result = {}; | |
| 518 result["errors"] = errors.map((AnalysisError value) => value.toJson()).toLis
t(); | |
| 519 return result; | |
| 520 } | |
| 521 | |
| 522 Response toResponse(String id) { | |
| 523 return new Response(id, result: toJson()); | |
| 524 } | |
| 525 | |
| 526 @override | |
| 527 String toString() => JSON.encode(toJson()); | |
| 528 | |
| 529 @override | |
| 530 bool operator==(other) { | |
| 531 if (other is AnalysisGetErrorsResult) { | |
| 532 return _listEqual(errors, other.errors, (AnalysisError a, AnalysisError b)
=> a == b); | |
| 533 } | |
| 534 return false; | |
| 535 } | |
| 536 | |
| 537 @override | |
| 538 int get hashCode { | |
| 539 int hash = 0; | |
| 540 hash = _JenkinsSmiHash.combine(hash, errors.hashCode); | |
| 541 return _JenkinsSmiHash.finish(hash); | |
| 542 } | |
| 543 } | |
| 544 | |
| 545 /** | |
| 546 * analysis.getHover params | |
| 547 * | |
| 548 * { | |
| 549 * "file": FilePath | |
| 550 * "offset": int | |
| 551 * } | |
| 552 */ | |
| 553 class AnalysisGetHoverParams implements HasToJson { | |
| 554 /** | |
| 555 * The file in which hover information is being requested. | |
| 556 */ | |
| 557 String file; | |
| 558 | |
| 559 /** | |
| 560 * The offset for which hover information is being requested. | |
| 561 */ | |
| 562 int offset; | |
| 563 | |
| 564 AnalysisGetHoverParams(this.file, this.offset); | |
| 565 | |
| 566 factory AnalysisGetHoverParams.fromJson(JsonDecoder jsonDecoder, String jsonPa
th, Object json) { | |
| 567 if (json == null) { | |
| 568 json = {}; | |
| 569 } | |
| 570 if (json is Map) { | |
| 571 String file; | |
| 572 if (json.containsKey("file")) { | |
| 573 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 574 } else { | |
| 575 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 576 } | |
| 577 int offset; | |
| 578 if (json.containsKey("offset")) { | |
| 579 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 580 } else { | |
| 581 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 582 } | |
| 583 return new AnalysisGetHoverParams(file, offset); | |
| 584 } else { | |
| 585 throw jsonDecoder.mismatch(jsonPath, "analysis.getHover params"); | |
| 586 } | |
| 587 } | |
| 588 | |
| 589 factory AnalysisGetHoverParams.fromRequest(Request request) { | |
| 590 return new AnalysisGetHoverParams.fromJson( | |
| 591 new RequestDecoder(request), "params", request._params); | |
| 592 } | |
| 593 | |
| 594 Map<String, dynamic> toJson() { | |
| 595 Map<String, dynamic> result = {}; | |
| 596 result["file"] = file; | |
| 597 result["offset"] = offset; | |
| 598 return result; | |
| 599 } | |
| 600 | |
| 601 Request toRequest(String id) { | |
| 602 return new Request(id, "analysis.getHover", toJson()); | |
| 603 } | |
| 604 | |
| 605 @override | |
| 606 String toString() => JSON.encode(toJson()); | |
| 607 | |
| 608 @override | |
| 609 bool operator==(other) { | |
| 610 if (other is AnalysisGetHoverParams) { | |
| 611 return file == other.file && | |
| 612 offset == other.offset; | |
| 613 } | |
| 614 return false; | |
| 615 } | |
| 616 | |
| 617 @override | |
| 618 int get hashCode { | |
| 619 int hash = 0; | |
| 620 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 621 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 622 return _JenkinsSmiHash.finish(hash); | |
| 623 } | |
| 624 } | |
| 625 | |
| 626 /** | |
| 627 * analysis.getHover result | |
| 628 * | |
| 629 * { | |
| 630 * "hovers": List<HoverInformation> | |
| 631 * } | |
| 632 */ | |
| 633 class AnalysisGetHoverResult implements HasToJson { | |
| 634 /** | |
| 635 * The hover information associated with the location. The list will be empty | |
| 636 * if no information could be determined for the location. The list can | |
| 637 * contain multiple items if the file is being analyzed in multiple contexts | |
| 638 * in conflicting ways (such as a part that is included in multiple | |
| 639 * libraries). | |
| 640 */ | |
| 641 List<HoverInformation> hovers; | |
| 642 | |
| 643 AnalysisGetHoverResult(this.hovers); | |
| 644 | |
| 645 factory AnalysisGetHoverResult.fromJson(JsonDecoder jsonDecoder, String jsonPa
th, Object json) { | |
| 646 if (json == null) { | |
| 647 json = {}; | |
| 648 } | |
| 649 if (json is Map) { | |
| 650 List<HoverInformation> hovers; | |
| 651 if (json.containsKey("hovers")) { | |
| 652 hovers = jsonDecoder._decodeList(jsonPath + ".hovers", json["hovers"], (
String jsonPath, Object json) => new HoverInformation.fromJson(jsonDecoder, json
Path, json)); | |
| 653 } else { | |
| 654 throw jsonDecoder.missingKey(jsonPath, "hovers"); | |
| 655 } | |
| 656 return new AnalysisGetHoverResult(hovers); | |
| 657 } else { | |
| 658 throw jsonDecoder.mismatch(jsonPath, "analysis.getHover result"); | |
| 659 } | |
| 660 } | |
| 661 | |
| 662 factory AnalysisGetHoverResult.fromResponse(Response response) { | |
| 663 return new AnalysisGetHoverResult.fromJson( | |
| 664 new ResponseDecoder(response), "result", response._result); | |
| 665 } | |
| 666 | |
| 667 Map<String, dynamic> toJson() { | |
| 668 Map<String, dynamic> result = {}; | |
| 669 result["hovers"] = hovers.map((HoverInformation value) => value.toJson()).to
List(); | |
| 670 return result; | |
| 671 } | |
| 672 | |
| 673 Response toResponse(String id) { | |
| 674 return new Response(id, result: toJson()); | |
| 675 } | |
| 676 | |
| 677 @override | |
| 678 String toString() => JSON.encode(toJson()); | |
| 679 | |
| 680 @override | |
| 681 bool operator==(other) { | |
| 682 if (other is AnalysisGetHoverResult) { | |
| 683 return _listEqual(hovers, other.hovers, (HoverInformation a, HoverInformat
ion b) => a == b); | |
| 684 } | |
| 685 return false; | |
| 686 } | |
| 687 | |
| 688 @override | |
| 689 int get hashCode { | |
| 690 int hash = 0; | |
| 691 hash = _JenkinsSmiHash.combine(hash, hovers.hashCode); | |
| 692 return _JenkinsSmiHash.finish(hash); | |
| 693 } | |
| 694 } | |
| 695 /** | |
| 696 * analysis.reanalyze params | |
| 697 */ | |
| 698 class AnalysisReanalyzeParams { | |
| 699 Request toRequest(String id) { | |
| 700 return new Request(id, "analysis.reanalyze", null); | |
| 701 } | |
| 702 | |
| 703 @override | |
| 704 bool operator==(other) { | |
| 705 if (other is AnalysisReanalyzeParams) { | |
| 706 return true; | |
| 707 } | |
| 708 return false; | |
| 709 } | |
| 710 | |
| 711 @override | |
| 712 int get hashCode { | |
| 713 return 613039876; | |
| 714 } | |
| 715 } | |
| 716 /** | |
| 717 * analysis.reanalyze result | |
| 718 */ | |
| 719 class AnalysisReanalyzeResult { | |
| 720 Response toResponse(String id) { | |
| 721 return new Response(id, result: null); | |
| 722 } | |
| 723 | |
| 724 @override | |
| 725 bool operator==(other) { | |
| 726 if (other is AnalysisReanalyzeResult) { | |
| 727 return true; | |
| 728 } | |
| 729 return false; | |
| 730 } | |
| 731 | |
| 732 @override | |
| 733 int get hashCode { | |
| 734 return 846803925; | |
| 735 } | |
| 736 } | |
| 737 | |
| 738 /** | |
| 739 * analysis.setAnalysisRoots params | |
| 740 * | |
| 741 * { | |
| 742 * "included": List<FilePath> | |
| 743 * "excluded": List<FilePath> | |
| 744 * } | |
| 745 */ | |
| 746 class AnalysisSetAnalysisRootsParams implements HasToJson { | |
| 747 /** | |
| 748 * A list of the files and directories that should be analyzed. | |
| 749 */ | |
| 750 List<String> included; | |
| 751 | |
| 752 /** | |
| 753 * A list of the files and directories within the included directories that | |
| 754 * should not be analyzed. | |
| 755 */ | |
| 756 List<String> excluded; | |
| 757 | |
| 758 AnalysisSetAnalysisRootsParams(this.included, this.excluded); | |
| 759 | |
| 760 factory AnalysisSetAnalysisRootsParams.fromJson(JsonDecoder jsonDecoder, Strin
g jsonPath, Object json) { | |
| 761 if (json == null) { | |
| 762 json = {}; | |
| 763 } | |
| 764 if (json is Map) { | |
| 765 List<String> included; | |
| 766 if (json.containsKey("included")) { | |
| 767 included = jsonDecoder._decodeList(jsonPath + ".included", json["include
d"], jsonDecoder._decodeString); | |
| 768 } else { | |
| 769 throw jsonDecoder.missingKey(jsonPath, "included"); | |
| 770 } | |
| 771 List<String> excluded; | |
| 772 if (json.containsKey("excluded")) { | |
| 773 excluded = jsonDecoder._decodeList(jsonPath + ".excluded", json["exclude
d"], jsonDecoder._decodeString); | |
| 774 } else { | |
| 775 throw jsonDecoder.missingKey(jsonPath, "excluded"); | |
| 776 } | |
| 777 return new AnalysisSetAnalysisRootsParams(included, excluded); | |
| 778 } else { | |
| 779 throw jsonDecoder.mismatch(jsonPath, "analysis.setAnalysisRoots params"); | |
| 780 } | |
| 781 } | |
| 782 | |
| 783 factory AnalysisSetAnalysisRootsParams.fromRequest(Request request) { | |
| 784 return new AnalysisSetAnalysisRootsParams.fromJson( | |
| 785 new RequestDecoder(request), "params", request._params); | |
| 786 } | |
| 787 | |
| 788 Map<String, dynamic> toJson() { | |
| 789 Map<String, dynamic> result = {}; | |
| 790 result["included"] = included; | |
| 791 result["excluded"] = excluded; | |
| 792 return result; | |
| 793 } | |
| 794 | |
| 795 Request toRequest(String id) { | |
| 796 return new Request(id, "analysis.setAnalysisRoots", toJson()); | |
| 797 } | |
| 798 | |
| 799 @override | |
| 800 String toString() => JSON.encode(toJson()); | |
| 801 | |
| 802 @override | |
| 803 bool operator==(other) { | |
| 804 if (other is AnalysisSetAnalysisRootsParams) { | |
| 805 return _listEqual(included, other.included, (String a, String b) => a == b
) && | |
| 806 _listEqual(excluded, other.excluded, (String a, String b) => a == b); | |
| 807 } | |
| 808 return false; | |
| 809 } | |
| 810 | |
| 811 @override | |
| 812 int get hashCode { | |
| 813 int hash = 0; | |
| 814 hash = _JenkinsSmiHash.combine(hash, included.hashCode); | |
| 815 hash = _JenkinsSmiHash.combine(hash, excluded.hashCode); | |
| 816 return _JenkinsSmiHash.finish(hash); | |
| 817 } | |
| 818 } | |
| 819 /** | |
| 820 * analysis.setAnalysisRoots result | |
| 821 */ | |
| 822 class AnalysisSetAnalysisRootsResult { | |
| 823 Response toResponse(String id) { | |
| 824 return new Response(id, result: null); | |
| 825 } | |
| 826 | |
| 827 @override | |
| 828 bool operator==(other) { | |
| 829 if (other is AnalysisSetAnalysisRootsResult) { | |
| 830 return true; | |
| 831 } | |
| 832 return false; | |
| 833 } | |
| 834 | |
| 835 @override | |
| 836 int get hashCode { | |
| 837 return 866004753; | |
| 838 } | |
| 839 } | |
| 840 | |
| 841 /** | |
| 842 * analysis.setPriorityFiles params | |
| 843 * | |
| 844 * { | |
| 845 * "files": List<FilePath> | |
| 846 * } | |
| 847 */ | |
| 848 class AnalysisSetPriorityFilesParams implements HasToJson { | |
| 849 /** | |
| 850 * The files that are to be a priority for analysis. | |
| 851 */ | |
| 852 List<String> files; | |
| 853 | |
| 854 AnalysisSetPriorityFilesParams(this.files); | |
| 855 | |
| 856 factory AnalysisSetPriorityFilesParams.fromJson(JsonDecoder jsonDecoder, Strin
g jsonPath, Object json) { | |
| 857 if (json == null) { | |
| 858 json = {}; | |
| 859 } | |
| 860 if (json is Map) { | |
| 861 List<String> files; | |
| 862 if (json.containsKey("files")) { | |
| 863 files = jsonDecoder._decodeList(jsonPath + ".files", json["files"], json
Decoder._decodeString); | |
| 864 } else { | |
| 865 throw jsonDecoder.missingKey(jsonPath, "files"); | |
| 866 } | |
| 867 return new AnalysisSetPriorityFilesParams(files); | |
| 868 } else { | |
| 869 throw jsonDecoder.mismatch(jsonPath, "analysis.setPriorityFiles params"); | |
| 870 } | |
| 871 } | |
| 872 | |
| 873 factory AnalysisSetPriorityFilesParams.fromRequest(Request request) { | |
| 874 return new AnalysisSetPriorityFilesParams.fromJson( | |
| 875 new RequestDecoder(request), "params", request._params); | |
| 876 } | |
| 877 | |
| 878 Map<String, dynamic> toJson() { | |
| 879 Map<String, dynamic> result = {}; | |
| 880 result["files"] = files; | |
| 881 return result; | |
| 882 } | |
| 883 | |
| 884 Request toRequest(String id) { | |
| 885 return new Request(id, "analysis.setPriorityFiles", toJson()); | |
| 886 } | |
| 887 | |
| 888 @override | |
| 889 String toString() => JSON.encode(toJson()); | |
| 890 | |
| 891 @override | |
| 892 bool operator==(other) { | |
| 893 if (other is AnalysisSetPriorityFilesParams) { | |
| 894 return _listEqual(files, other.files, (String a, String b) => a == b); | |
| 895 } | |
| 896 return false; | |
| 897 } | |
| 898 | |
| 899 @override | |
| 900 int get hashCode { | |
| 901 int hash = 0; | |
| 902 hash = _JenkinsSmiHash.combine(hash, files.hashCode); | |
| 903 return _JenkinsSmiHash.finish(hash); | |
| 904 } | |
| 905 } | |
| 906 /** | |
| 907 * analysis.setPriorityFiles result | |
| 908 */ | |
| 909 class AnalysisSetPriorityFilesResult { | |
| 910 Response toResponse(String id) { | |
| 911 return new Response(id, result: null); | |
| 912 } | |
| 913 | |
| 914 @override | |
| 915 bool operator==(other) { | |
| 916 if (other is AnalysisSetPriorityFilesResult) { | |
| 917 return true; | |
| 918 } | |
| 919 return false; | |
| 920 } | |
| 921 | |
| 922 @override | |
| 923 int get hashCode { | |
| 924 return 330050055; | |
| 925 } | |
| 926 } | |
| 927 | |
| 928 /** | |
| 929 * analysis.setSubscriptions params | |
| 930 * | |
| 931 * { | |
| 932 * "subscriptions": Map<AnalysisService, List<FilePath>> | |
| 933 * } | |
| 934 */ | |
| 935 class AnalysisSetSubscriptionsParams implements HasToJson { | |
| 936 /** | |
| 937 * A table mapping services to a list of the files being subscribed to the | |
| 938 * service. | |
| 939 */ | |
| 940 Map<AnalysisService, List<String>> subscriptions; | |
| 941 | |
| 942 AnalysisSetSubscriptionsParams(this.subscriptions); | |
| 943 | |
| 944 factory AnalysisSetSubscriptionsParams.fromJson(JsonDecoder jsonDecoder, Strin
g jsonPath, Object json) { | |
| 945 if (json == null) { | |
| 946 json = {}; | |
| 947 } | |
| 948 if (json is Map) { | |
| 949 Map<AnalysisService, List<String>> subscriptions; | |
| 950 if (json.containsKey("subscriptions")) { | |
| 951 subscriptions = jsonDecoder._decodeMap(jsonPath + ".subscriptions", json
["subscriptions"], keyDecoder: (String jsonPath, Object json) => new AnalysisSer
vice.fromJson(jsonDecoder, jsonPath, json), valueDecoder: (String jsonPath, Obje
ct json) => jsonDecoder._decodeList(jsonPath, json, jsonDecoder._decodeString)); | |
| 952 } else { | |
| 953 throw jsonDecoder.missingKey(jsonPath, "subscriptions"); | |
| 954 } | |
| 955 return new AnalysisSetSubscriptionsParams(subscriptions); | |
| 956 } else { | |
| 957 throw jsonDecoder.mismatch(jsonPath, "analysis.setSubscriptions params"); | |
| 958 } | |
| 959 } | |
| 960 | |
| 961 factory AnalysisSetSubscriptionsParams.fromRequest(Request request) { | |
| 962 return new AnalysisSetSubscriptionsParams.fromJson( | |
| 963 new RequestDecoder(request), "params", request._params); | |
| 964 } | |
| 965 | |
| 966 Map<String, dynamic> toJson() { | |
| 967 Map<String, dynamic> result = {}; | |
| 968 result["subscriptions"] = mapMap(subscriptions, keyCallback: (AnalysisServic
e value) => value.toJson()); | |
| 969 return result; | |
| 970 } | |
| 971 | |
| 972 Request toRequest(String id) { | |
| 973 return new Request(id, "analysis.setSubscriptions", toJson()); | |
| 974 } | |
| 975 | |
| 976 @override | |
| 977 String toString() => JSON.encode(toJson()); | |
| 978 | |
| 979 @override | |
| 980 bool operator==(other) { | |
| 981 if (other is AnalysisSetSubscriptionsParams) { | |
| 982 return _mapEqual(subscriptions, other.subscriptions, (List<String> a, List
<String> b) => _listEqual(a, b, (String a, String b) => a == b)); | |
| 983 } | |
| 984 return false; | |
| 985 } | |
| 986 | |
| 987 @override | |
| 988 int get hashCode { | |
| 989 int hash = 0; | |
| 990 hash = _JenkinsSmiHash.combine(hash, subscriptions.hashCode); | |
| 991 return _JenkinsSmiHash.finish(hash); | |
| 992 } | |
| 993 } | |
| 994 /** | |
| 995 * analysis.setSubscriptions result | |
| 996 */ | |
| 997 class AnalysisSetSubscriptionsResult { | |
| 998 Response toResponse(String id) { | |
| 999 return new Response(id, result: null); | |
| 1000 } | |
| 1001 | |
| 1002 @override | |
| 1003 bool operator==(other) { | |
| 1004 if (other is AnalysisSetSubscriptionsResult) { | |
| 1005 return true; | |
| 1006 } | |
| 1007 return false; | |
| 1008 } | |
| 1009 | |
| 1010 @override | |
| 1011 int get hashCode { | |
| 1012 return 218088493; | |
| 1013 } | |
| 1014 } | |
| 1015 | |
| 1016 /** | |
| 1017 * analysis.updateContent params | |
| 1018 * | |
| 1019 * { | |
| 1020 * "files": Map<FilePath, AddContentOverlay | ChangeContentOverlay | RemoveCon
tentOverlay> | |
| 1021 * } | |
| 1022 */ | |
| 1023 class AnalysisUpdateContentParams implements HasToJson { | |
| 1024 /** | |
| 1025 * A table mapping the files whose content has changed to a description of | |
| 1026 * the content change. | |
| 1027 */ | |
| 1028 Map<String, dynamic> files; | |
| 1029 | |
| 1030 AnalysisUpdateContentParams(this.files); | |
| 1031 | |
| 1032 factory AnalysisUpdateContentParams.fromJson(JsonDecoder jsonDecoder, String j
sonPath, Object json) { | |
| 1033 if (json == null) { | |
| 1034 json = {}; | |
| 1035 } | |
| 1036 if (json is Map) { | |
| 1037 Map<String, dynamic> files; | |
| 1038 if (json.containsKey("files")) { | |
| 1039 files = jsonDecoder._decodeMap(jsonPath + ".files", json["files"], value
Decoder: (String jsonPath, Object json) => jsonDecoder._decodeUnion(jsonPath, js
on, "type", {"add": (String jsonPath, Object json) => new AddContentOverlay.from
Json(jsonDecoder, jsonPath, json), "change": (String jsonPath, Object json) => n
ew ChangeContentOverlay.fromJson(jsonDecoder, jsonPath, json), "remove": (String
jsonPath, Object json) => new RemoveContentOverlay.fromJson(jsonDecoder, jsonPa
th, json)})); | |
| 1040 } else { | |
| 1041 throw jsonDecoder.missingKey(jsonPath, "files"); | |
| 1042 } | |
| 1043 return new AnalysisUpdateContentParams(files); | |
| 1044 } else { | |
| 1045 throw jsonDecoder.mismatch(jsonPath, "analysis.updateContent params"); | |
| 1046 } | |
| 1047 } | |
| 1048 | |
| 1049 factory AnalysisUpdateContentParams.fromRequest(Request request) { | |
| 1050 return new AnalysisUpdateContentParams.fromJson( | |
| 1051 new RequestDecoder(request), "params", request._params); | |
| 1052 } | |
| 1053 | |
| 1054 Map<String, dynamic> toJson() { | |
| 1055 Map<String, dynamic> result = {}; | |
| 1056 result["files"] = mapMap(files, valueCallback: (dynamic value) => value.toJs
on()); | |
| 1057 return result; | |
| 1058 } | |
| 1059 | |
| 1060 Request toRequest(String id) { | |
| 1061 return new Request(id, "analysis.updateContent", toJson()); | |
| 1062 } | |
| 1063 | |
| 1064 @override | |
| 1065 String toString() => JSON.encode(toJson()); | |
| 1066 | |
| 1067 @override | |
| 1068 bool operator==(other) { | |
| 1069 if (other is AnalysisUpdateContentParams) { | |
| 1070 return _mapEqual(files, other.files, (dynamic a, dynamic b) => a == b); | |
| 1071 } | |
| 1072 return false; | |
| 1073 } | |
| 1074 | |
| 1075 @override | |
| 1076 int get hashCode { | |
| 1077 int hash = 0; | |
| 1078 hash = _JenkinsSmiHash.combine(hash, files.hashCode); | |
| 1079 return _JenkinsSmiHash.finish(hash); | |
| 1080 } | |
| 1081 } | |
| 1082 /** | |
| 1083 * analysis.updateContent result | |
| 1084 */ | |
| 1085 class AnalysisUpdateContentResult { | |
| 1086 Response toResponse(String id) { | |
| 1087 return new Response(id, result: null); | |
| 1088 } | |
| 1089 | |
| 1090 @override | |
| 1091 bool operator==(other) { | |
| 1092 if (other is AnalysisUpdateContentResult) { | |
| 1093 return true; | |
| 1094 } | |
| 1095 return false; | |
| 1096 } | |
| 1097 | |
| 1098 @override | |
| 1099 int get hashCode { | |
| 1100 return 468798730; | |
| 1101 } | |
| 1102 } | |
| 1103 | |
| 1104 /** | |
| 1105 * analysis.updateOptions params | |
| 1106 * | |
| 1107 * { | |
| 1108 * "options": AnalysisOptions | |
| 1109 * } | |
| 1110 */ | |
| 1111 class AnalysisUpdateOptionsParams implements HasToJson { | |
| 1112 /** | |
| 1113 * The options that are to be used to control analysis. | |
| 1114 */ | |
| 1115 AnalysisOptions options; | |
| 1116 | |
| 1117 AnalysisUpdateOptionsParams(this.options); | |
| 1118 | |
| 1119 factory AnalysisUpdateOptionsParams.fromJson(JsonDecoder jsonDecoder, String j
sonPath, Object json) { | |
| 1120 if (json == null) { | |
| 1121 json = {}; | |
| 1122 } | |
| 1123 if (json is Map) { | |
| 1124 AnalysisOptions options; | |
| 1125 if (json.containsKey("options")) { | |
| 1126 options = new AnalysisOptions.fromJson(jsonDecoder, jsonPath + ".options
", json["options"]); | |
| 1127 } else { | |
| 1128 throw jsonDecoder.missingKey(jsonPath, "options"); | |
| 1129 } | |
| 1130 return new AnalysisUpdateOptionsParams(options); | |
| 1131 } else { | |
| 1132 throw jsonDecoder.mismatch(jsonPath, "analysis.updateOptions params"); | |
| 1133 } | |
| 1134 } | |
| 1135 | |
| 1136 factory AnalysisUpdateOptionsParams.fromRequest(Request request) { | |
| 1137 return new AnalysisUpdateOptionsParams.fromJson( | |
| 1138 new RequestDecoder(request), "params", request._params); | |
| 1139 } | |
| 1140 | |
| 1141 Map<String, dynamic> toJson() { | |
| 1142 Map<String, dynamic> result = {}; | |
| 1143 result["options"] = options.toJson(); | |
| 1144 return result; | |
| 1145 } | |
| 1146 | |
| 1147 Request toRequest(String id) { | |
| 1148 return new Request(id, "analysis.updateOptions", toJson()); | |
| 1149 } | |
| 1150 | |
| 1151 @override | |
| 1152 String toString() => JSON.encode(toJson()); | |
| 1153 | |
| 1154 @override | |
| 1155 bool operator==(other) { | |
| 1156 if (other is AnalysisUpdateOptionsParams) { | |
| 1157 return options == other.options; | |
| 1158 } | |
| 1159 return false; | |
| 1160 } | |
| 1161 | |
| 1162 @override | |
| 1163 int get hashCode { | |
| 1164 int hash = 0; | |
| 1165 hash = _JenkinsSmiHash.combine(hash, options.hashCode); | |
| 1166 return _JenkinsSmiHash.finish(hash); | |
| 1167 } | |
| 1168 } | |
| 1169 /** | |
| 1170 * analysis.updateOptions result | |
| 1171 */ | |
| 1172 class AnalysisUpdateOptionsResult { | |
| 1173 Response toResponse(String id) { | |
| 1174 return new Response(id, result: null); | |
| 1175 } | |
| 1176 | |
| 1177 @override | |
| 1178 bool operator==(other) { | |
| 1179 if (other is AnalysisUpdateOptionsResult) { | |
| 1180 return true; | |
| 1181 } | |
| 1182 return false; | |
| 1183 } | |
| 1184 | |
| 1185 @override | |
| 1186 int get hashCode { | |
| 1187 return 179689467; | |
| 1188 } | |
| 1189 } | |
| 1190 | |
| 1191 /** | |
| 1192 * analysis.errors params | |
| 1193 * | |
| 1194 * { | |
| 1195 * "file": FilePath | |
| 1196 * "errors": List<AnalysisError> | |
| 1197 * } | |
| 1198 */ | |
| 1199 class AnalysisErrorsParams implements HasToJson { | |
| 1200 /** | |
| 1201 * The file containing the errors. | |
| 1202 */ | |
| 1203 String file; | |
| 1204 | |
| 1205 /** | |
| 1206 * The errors contained in the file. | |
| 1207 */ | |
| 1208 List<AnalysisError> errors; | |
| 1209 | |
| 1210 AnalysisErrorsParams(this.file, this.errors); | |
| 1211 | |
| 1212 factory AnalysisErrorsParams.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 1213 if (json == null) { | |
| 1214 json = {}; | |
| 1215 } | |
| 1216 if (json is Map) { | |
| 1217 String file; | |
| 1218 if (json.containsKey("file")) { | |
| 1219 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 1220 } else { | |
| 1221 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 1222 } | |
| 1223 List<AnalysisError> errors; | |
| 1224 if (json.containsKey("errors")) { | |
| 1225 errors = jsonDecoder._decodeList(jsonPath + ".errors", json["errors"], (
String jsonPath, Object json) => new AnalysisError.fromJson(jsonDecoder, jsonPat
h, json)); | |
| 1226 } else { | |
| 1227 throw jsonDecoder.missingKey(jsonPath, "errors"); | |
| 1228 } | |
| 1229 return new AnalysisErrorsParams(file, errors); | |
| 1230 } else { | |
| 1231 throw jsonDecoder.mismatch(jsonPath, "analysis.errors params"); | |
| 1232 } | |
| 1233 } | |
| 1234 | |
| 1235 factory AnalysisErrorsParams.fromNotification(Notification notification) { | |
| 1236 return new AnalysisErrorsParams.fromJson( | |
| 1237 new ResponseDecoder(null), "params", notification._params); | |
| 1238 } | |
| 1239 | |
| 1240 Map<String, dynamic> toJson() { | |
| 1241 Map<String, dynamic> result = {}; | |
| 1242 result["file"] = file; | |
| 1243 result["errors"] = errors.map((AnalysisError value) => value.toJson()).toLis
t(); | |
| 1244 return result; | |
| 1245 } | |
| 1246 | |
| 1247 Notification toNotification() { | |
| 1248 return new Notification("analysis.errors", toJson()); | |
| 1249 } | |
| 1250 | |
| 1251 @override | |
| 1252 String toString() => JSON.encode(toJson()); | |
| 1253 | |
| 1254 @override | |
| 1255 bool operator==(other) { | |
| 1256 if (other is AnalysisErrorsParams) { | |
| 1257 return file == other.file && | |
| 1258 _listEqual(errors, other.errors, (AnalysisError a, AnalysisError b) =>
a == b); | |
| 1259 } | |
| 1260 return false; | |
| 1261 } | |
| 1262 | |
| 1263 @override | |
| 1264 int get hashCode { | |
| 1265 int hash = 0; | |
| 1266 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 1267 hash = _JenkinsSmiHash.combine(hash, errors.hashCode); | |
| 1268 return _JenkinsSmiHash.finish(hash); | |
| 1269 } | |
| 1270 } | |
| 1271 | |
| 1272 /** | |
| 1273 * analysis.flushResults params | |
| 1274 * | |
| 1275 * { | |
| 1276 * "files": List<FilePath> | |
| 1277 * } | |
| 1278 */ | |
| 1279 class AnalysisFlushResultsParams implements HasToJson { | |
| 1280 /** | |
| 1281 * The files that are no longer being analyzed. | |
| 1282 */ | |
| 1283 List<String> files; | |
| 1284 | |
| 1285 AnalysisFlushResultsParams(this.files); | |
| 1286 | |
| 1287 factory AnalysisFlushResultsParams.fromJson(JsonDecoder jsonDecoder, String js
onPath, Object json) { | |
| 1288 if (json == null) { | |
| 1289 json = {}; | |
| 1290 } | |
| 1291 if (json is Map) { | |
| 1292 List<String> files; | |
| 1293 if (json.containsKey("files")) { | |
| 1294 files = jsonDecoder._decodeList(jsonPath + ".files", json["files"], json
Decoder._decodeString); | |
| 1295 } else { | |
| 1296 throw jsonDecoder.missingKey(jsonPath, "files"); | |
| 1297 } | |
| 1298 return new AnalysisFlushResultsParams(files); | |
| 1299 } else { | |
| 1300 throw jsonDecoder.mismatch(jsonPath, "analysis.flushResults params"); | |
| 1301 } | |
| 1302 } | |
| 1303 | |
| 1304 factory AnalysisFlushResultsParams.fromNotification(Notification notification)
{ | |
| 1305 return new AnalysisFlushResultsParams.fromJson( | |
| 1306 new ResponseDecoder(null), "params", notification._params); | |
| 1307 } | |
| 1308 | |
| 1309 Map<String, dynamic> toJson() { | |
| 1310 Map<String, dynamic> result = {}; | |
| 1311 result["files"] = files; | |
| 1312 return result; | |
| 1313 } | |
| 1314 | |
| 1315 Notification toNotification() { | |
| 1316 return new Notification("analysis.flushResults", toJson()); | |
| 1317 } | |
| 1318 | |
| 1319 @override | |
| 1320 String toString() => JSON.encode(toJson()); | |
| 1321 | |
| 1322 @override | |
| 1323 bool operator==(other) { | |
| 1324 if (other is AnalysisFlushResultsParams) { | |
| 1325 return _listEqual(files, other.files, (String a, String b) => a == b); | |
| 1326 } | |
| 1327 return false; | |
| 1328 } | |
| 1329 | |
| 1330 @override | |
| 1331 int get hashCode { | |
| 1332 int hash = 0; | |
| 1333 hash = _JenkinsSmiHash.combine(hash, files.hashCode); | |
| 1334 return _JenkinsSmiHash.finish(hash); | |
| 1335 } | |
| 1336 } | |
| 1337 | |
| 1338 /** | |
| 1339 * analysis.folding params | |
| 1340 * | |
| 1341 * { | |
| 1342 * "file": FilePath | |
| 1343 * "regions": List<FoldingRegion> | |
| 1344 * } | |
| 1345 */ | |
| 1346 class AnalysisFoldingParams implements HasToJson { | |
| 1347 /** | |
| 1348 * The file containing the folding regions. | |
| 1349 */ | |
| 1350 String file; | |
| 1351 | |
| 1352 /** | |
| 1353 * The folding regions contained in the file. | |
| 1354 */ | |
| 1355 List<FoldingRegion> regions; | |
| 1356 | |
| 1357 AnalysisFoldingParams(this.file, this.regions); | |
| 1358 | |
| 1359 factory AnalysisFoldingParams.fromJson(JsonDecoder jsonDecoder, String jsonPat
h, Object json) { | |
| 1360 if (json == null) { | |
| 1361 json = {}; | |
| 1362 } | |
| 1363 if (json is Map) { | |
| 1364 String file; | |
| 1365 if (json.containsKey("file")) { | |
| 1366 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 1367 } else { | |
| 1368 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 1369 } | |
| 1370 List<FoldingRegion> regions; | |
| 1371 if (json.containsKey("regions")) { | |
| 1372 regions = jsonDecoder._decodeList(jsonPath + ".regions", json["regions"]
, (String jsonPath, Object json) => new FoldingRegion.fromJson(jsonDecoder, json
Path, json)); | |
| 1373 } else { | |
| 1374 throw jsonDecoder.missingKey(jsonPath, "regions"); | |
| 1375 } | |
| 1376 return new AnalysisFoldingParams(file, regions); | |
| 1377 } else { | |
| 1378 throw jsonDecoder.mismatch(jsonPath, "analysis.folding params"); | |
| 1379 } | |
| 1380 } | |
| 1381 | |
| 1382 factory AnalysisFoldingParams.fromNotification(Notification notification) { | |
| 1383 return new AnalysisFoldingParams.fromJson( | |
| 1384 new ResponseDecoder(null), "params", notification._params); | |
| 1385 } | |
| 1386 | |
| 1387 Map<String, dynamic> toJson() { | |
| 1388 Map<String, dynamic> result = {}; | |
| 1389 result["file"] = file; | |
| 1390 result["regions"] = regions.map((FoldingRegion value) => value.toJson()).toL
ist(); | |
| 1391 return result; | |
| 1392 } | |
| 1393 | |
| 1394 Notification toNotification() { | |
| 1395 return new Notification("analysis.folding", toJson()); | |
| 1396 } | |
| 1397 | |
| 1398 @override | |
| 1399 String toString() => JSON.encode(toJson()); | |
| 1400 | |
| 1401 @override | |
| 1402 bool operator==(other) { | |
| 1403 if (other is AnalysisFoldingParams) { | |
| 1404 return file == other.file && | |
| 1405 _listEqual(regions, other.regions, (FoldingRegion a, FoldingRegion b)
=> a == b); | |
| 1406 } | |
| 1407 return false; | |
| 1408 } | |
| 1409 | |
| 1410 @override | |
| 1411 int get hashCode { | |
| 1412 int hash = 0; | |
| 1413 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 1414 hash = _JenkinsSmiHash.combine(hash, regions.hashCode); | |
| 1415 return _JenkinsSmiHash.finish(hash); | |
| 1416 } | |
| 1417 } | |
| 1418 | |
| 1419 /** | |
| 1420 * analysis.highlights params | |
| 1421 * | |
| 1422 * { | |
| 1423 * "file": FilePath | |
| 1424 * "regions": List<HighlightRegion> | |
| 1425 * } | |
| 1426 */ | |
| 1427 class AnalysisHighlightsParams implements HasToJson { | |
| 1428 /** | |
| 1429 * The file containing the highlight regions. | |
| 1430 */ | |
| 1431 String file; | |
| 1432 | |
| 1433 /** | |
| 1434 * The highlight regions contained in the file. Each highlight region | |
| 1435 * represents a particular syntactic or semantic meaning associated with some | |
| 1436 * range. Note that the highlight regions that are returned can overlap other | |
| 1437 * highlight regions if there is more than one meaning associated with a | |
| 1438 * particular region. | |
| 1439 */ | |
| 1440 List<HighlightRegion> regions; | |
| 1441 | |
| 1442 AnalysisHighlightsParams(this.file, this.regions); | |
| 1443 | |
| 1444 factory AnalysisHighlightsParams.fromJson(JsonDecoder jsonDecoder, String json
Path, Object json) { | |
| 1445 if (json == null) { | |
| 1446 json = {}; | |
| 1447 } | |
| 1448 if (json is Map) { | |
| 1449 String file; | |
| 1450 if (json.containsKey("file")) { | |
| 1451 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 1452 } else { | |
| 1453 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 1454 } | |
| 1455 List<HighlightRegion> regions; | |
| 1456 if (json.containsKey("regions")) { | |
| 1457 regions = jsonDecoder._decodeList(jsonPath + ".regions", json["regions"]
, (String jsonPath, Object json) => new HighlightRegion.fromJson(jsonDecoder, js
onPath, json)); | |
| 1458 } else { | |
| 1459 throw jsonDecoder.missingKey(jsonPath, "regions"); | |
| 1460 } | |
| 1461 return new AnalysisHighlightsParams(file, regions); | |
| 1462 } else { | |
| 1463 throw jsonDecoder.mismatch(jsonPath, "analysis.highlights params"); | |
| 1464 } | |
| 1465 } | |
| 1466 | |
| 1467 factory AnalysisHighlightsParams.fromNotification(Notification notification) { | |
| 1468 return new AnalysisHighlightsParams.fromJson( | |
| 1469 new ResponseDecoder(null), "params", notification._params); | |
| 1470 } | |
| 1471 | |
| 1472 Map<String, dynamic> toJson() { | |
| 1473 Map<String, dynamic> result = {}; | |
| 1474 result["file"] = file; | |
| 1475 result["regions"] = regions.map((HighlightRegion value) => value.toJson()).t
oList(); | |
| 1476 return result; | |
| 1477 } | |
| 1478 | |
| 1479 Notification toNotification() { | |
| 1480 return new Notification("analysis.highlights", toJson()); | |
| 1481 } | |
| 1482 | |
| 1483 @override | |
| 1484 String toString() => JSON.encode(toJson()); | |
| 1485 | |
| 1486 @override | |
| 1487 bool operator==(other) { | |
| 1488 if (other is AnalysisHighlightsParams) { | |
| 1489 return file == other.file && | |
| 1490 _listEqual(regions, other.regions, (HighlightRegion a, HighlightRegion
b) => a == b); | |
| 1491 } | |
| 1492 return false; | |
| 1493 } | |
| 1494 | |
| 1495 @override | |
| 1496 int get hashCode { | |
| 1497 int hash = 0; | |
| 1498 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 1499 hash = _JenkinsSmiHash.combine(hash, regions.hashCode); | |
| 1500 return _JenkinsSmiHash.finish(hash); | |
| 1501 } | |
| 1502 } | |
| 1503 | |
| 1504 /** | |
| 1505 * analysis.navigation params | |
| 1506 * | |
| 1507 * { | |
| 1508 * "file": FilePath | |
| 1509 * "regions": List<NavigationRegion> | |
| 1510 * } | |
| 1511 */ | |
| 1512 class AnalysisNavigationParams implements HasToJson { | |
| 1513 /** | |
| 1514 * The file containing the navigation regions. | |
| 1515 */ | |
| 1516 String file; | |
| 1517 | |
| 1518 /** | |
| 1519 * The navigation regions contained in the file. Each navigation region | |
| 1520 * represents a list of targets associated with some range. The lists will | |
| 1521 * usually contain a single target, but can contain more in the case of a | |
| 1522 * part that is included in multiple libraries or in Dart code that is | |
| 1523 * compiled against multiple versions of a package. Note that the navigation | |
| 1524 * regions that are returned do not overlap other navigation regions. | |
| 1525 */ | |
| 1526 List<NavigationRegion> regions; | |
| 1527 | |
| 1528 AnalysisNavigationParams(this.file, this.regions); | |
| 1529 | |
| 1530 factory AnalysisNavigationParams.fromJson(JsonDecoder jsonDecoder, String json
Path, Object json) { | |
| 1531 if (json == null) { | |
| 1532 json = {}; | |
| 1533 } | |
| 1534 if (json is Map) { | |
| 1535 String file; | |
| 1536 if (json.containsKey("file")) { | |
| 1537 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 1538 } else { | |
| 1539 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 1540 } | |
| 1541 List<NavigationRegion> regions; | |
| 1542 if (json.containsKey("regions")) { | |
| 1543 regions = jsonDecoder._decodeList(jsonPath + ".regions", json["regions"]
, (String jsonPath, Object json) => new NavigationRegion.fromJson(jsonDecoder, j
sonPath, json)); | |
| 1544 } else { | |
| 1545 throw jsonDecoder.missingKey(jsonPath, "regions"); | |
| 1546 } | |
| 1547 return new AnalysisNavigationParams(file, regions); | |
| 1548 } else { | |
| 1549 throw jsonDecoder.mismatch(jsonPath, "analysis.navigation params"); | |
| 1550 } | |
| 1551 } | |
| 1552 | |
| 1553 factory AnalysisNavigationParams.fromNotification(Notification notification) { | |
| 1554 return new AnalysisNavigationParams.fromJson( | |
| 1555 new ResponseDecoder(null), "params", notification._params); | |
| 1556 } | |
| 1557 | |
| 1558 Map<String, dynamic> toJson() { | |
| 1559 Map<String, dynamic> result = {}; | |
| 1560 result["file"] = file; | |
| 1561 result["regions"] = regions.map((NavigationRegion value) => value.toJson()).
toList(); | |
| 1562 return result; | |
| 1563 } | |
| 1564 | |
| 1565 Notification toNotification() { | |
| 1566 return new Notification("analysis.navigation", toJson()); | |
| 1567 } | |
| 1568 | |
| 1569 @override | |
| 1570 String toString() => JSON.encode(toJson()); | |
| 1571 | |
| 1572 @override | |
| 1573 bool operator==(other) { | |
| 1574 if (other is AnalysisNavigationParams) { | |
| 1575 return file == other.file && | |
| 1576 _listEqual(regions, other.regions, (NavigationRegion a, NavigationRegi
on b) => a == b); | |
| 1577 } | |
| 1578 return false; | |
| 1579 } | |
| 1580 | |
| 1581 @override | |
| 1582 int get hashCode { | |
| 1583 int hash = 0; | |
| 1584 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 1585 hash = _JenkinsSmiHash.combine(hash, regions.hashCode); | |
| 1586 return _JenkinsSmiHash.finish(hash); | |
| 1587 } | |
| 1588 } | |
| 1589 | |
| 1590 /** | |
| 1591 * analysis.occurrences params | |
| 1592 * | |
| 1593 * { | |
| 1594 * "file": FilePath | |
| 1595 * "occurrences": List<Occurrences> | |
| 1596 * } | |
| 1597 */ | |
| 1598 class AnalysisOccurrencesParams implements HasToJson { | |
| 1599 /** | |
| 1600 * The file in which the references occur. | |
| 1601 */ | |
| 1602 String file; | |
| 1603 | |
| 1604 /** | |
| 1605 * The occurrences of references to elements within the file. | |
| 1606 */ | |
| 1607 List<Occurrences> occurrences; | |
| 1608 | |
| 1609 AnalysisOccurrencesParams(this.file, this.occurrences); | |
| 1610 | |
| 1611 factory AnalysisOccurrencesParams.fromJson(JsonDecoder jsonDecoder, String jso
nPath, Object json) { | |
| 1612 if (json == null) { | |
| 1613 json = {}; | |
| 1614 } | |
| 1615 if (json is Map) { | |
| 1616 String file; | |
| 1617 if (json.containsKey("file")) { | |
| 1618 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 1619 } else { | |
| 1620 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 1621 } | |
| 1622 List<Occurrences> occurrences; | |
| 1623 if (json.containsKey("occurrences")) { | |
| 1624 occurrences = jsonDecoder._decodeList(jsonPath + ".occurrences", json["o
ccurrences"], (String jsonPath, Object json) => new Occurrences.fromJson(jsonDec
oder, jsonPath, json)); | |
| 1625 } else { | |
| 1626 throw jsonDecoder.missingKey(jsonPath, "occurrences"); | |
| 1627 } | |
| 1628 return new AnalysisOccurrencesParams(file, occurrences); | |
| 1629 } else { | |
| 1630 throw jsonDecoder.mismatch(jsonPath, "analysis.occurrences params"); | |
| 1631 } | |
| 1632 } | |
| 1633 | |
| 1634 factory AnalysisOccurrencesParams.fromNotification(Notification notification)
{ | |
| 1635 return new AnalysisOccurrencesParams.fromJson( | |
| 1636 new ResponseDecoder(null), "params", notification._params); | |
| 1637 } | |
| 1638 | |
| 1639 Map<String, dynamic> toJson() { | |
| 1640 Map<String, dynamic> result = {}; | |
| 1641 result["file"] = file; | |
| 1642 result["occurrences"] = occurrences.map((Occurrences value) => value.toJson(
)).toList(); | |
| 1643 return result; | |
| 1644 } | |
| 1645 | |
| 1646 Notification toNotification() { | |
| 1647 return new Notification("analysis.occurrences", toJson()); | |
| 1648 } | |
| 1649 | |
| 1650 @override | |
| 1651 String toString() => JSON.encode(toJson()); | |
| 1652 | |
| 1653 @override | |
| 1654 bool operator==(other) { | |
| 1655 if (other is AnalysisOccurrencesParams) { | |
| 1656 return file == other.file && | |
| 1657 _listEqual(occurrences, other.occurrences, (Occurrences a, Occurrences
b) => a == b); | |
| 1658 } | |
| 1659 return false; | |
| 1660 } | |
| 1661 | |
| 1662 @override | |
| 1663 int get hashCode { | |
| 1664 int hash = 0; | |
| 1665 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 1666 hash = _JenkinsSmiHash.combine(hash, occurrences.hashCode); | |
| 1667 return _JenkinsSmiHash.finish(hash); | |
| 1668 } | |
| 1669 } | |
| 1670 | |
| 1671 /** | |
| 1672 * analysis.outline params | |
| 1673 * | |
| 1674 * { | |
| 1675 * "file": FilePath | |
| 1676 * "outline": Outline | |
| 1677 * } | |
| 1678 */ | |
| 1679 class AnalysisOutlineParams implements HasToJson { | |
| 1680 /** | |
| 1681 * The file with which the outline is associated. | |
| 1682 */ | |
| 1683 String file; | |
| 1684 | |
| 1685 /** | |
| 1686 * The outline associated with the file. | |
| 1687 */ | |
| 1688 Outline outline; | |
| 1689 | |
| 1690 AnalysisOutlineParams(this.file, this.outline); | |
| 1691 | |
| 1692 factory AnalysisOutlineParams.fromJson(JsonDecoder jsonDecoder, String jsonPat
h, Object json) { | |
| 1693 if (json == null) { | |
| 1694 json = {}; | |
| 1695 } | |
| 1696 if (json is Map) { | |
| 1697 String file; | |
| 1698 if (json.containsKey("file")) { | |
| 1699 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 1700 } else { | |
| 1701 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 1702 } | |
| 1703 Outline outline; | |
| 1704 if (json.containsKey("outline")) { | |
| 1705 outline = new Outline.fromJson(jsonDecoder, jsonPath + ".outline", json[
"outline"]); | |
| 1706 } else { | |
| 1707 throw jsonDecoder.missingKey(jsonPath, "outline"); | |
| 1708 } | |
| 1709 return new AnalysisOutlineParams(file, outline); | |
| 1710 } else { | |
| 1711 throw jsonDecoder.mismatch(jsonPath, "analysis.outline params"); | |
| 1712 } | |
| 1713 } | |
| 1714 | |
| 1715 factory AnalysisOutlineParams.fromNotification(Notification notification) { | |
| 1716 return new AnalysisOutlineParams.fromJson( | |
| 1717 new ResponseDecoder(null), "params", notification._params); | |
| 1718 } | |
| 1719 | |
| 1720 Map<String, dynamic> toJson() { | |
| 1721 Map<String, dynamic> result = {}; | |
| 1722 result["file"] = file; | |
| 1723 result["outline"] = outline.toJson(); | |
| 1724 return result; | |
| 1725 } | |
| 1726 | |
| 1727 Notification toNotification() { | |
| 1728 return new Notification("analysis.outline", toJson()); | |
| 1729 } | |
| 1730 | |
| 1731 @override | |
| 1732 String toString() => JSON.encode(toJson()); | |
| 1733 | |
| 1734 @override | |
| 1735 bool operator==(other) { | |
| 1736 if (other is AnalysisOutlineParams) { | |
| 1737 return file == other.file && | |
| 1738 outline == other.outline; | |
| 1739 } | |
| 1740 return false; | |
| 1741 } | |
| 1742 | |
| 1743 @override | |
| 1744 int get hashCode { | |
| 1745 int hash = 0; | |
| 1746 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 1747 hash = _JenkinsSmiHash.combine(hash, outline.hashCode); | |
| 1748 return _JenkinsSmiHash.finish(hash); | |
| 1749 } | |
| 1750 } | |
| 1751 | |
| 1752 /** | |
| 1753 * analysis.overrides params | |
| 1754 * | |
| 1755 * { | |
| 1756 * "file": FilePath | |
| 1757 * "overrides": List<Override> | |
| 1758 * } | |
| 1759 */ | |
| 1760 class AnalysisOverridesParams implements HasToJson { | |
| 1761 /** | |
| 1762 * The file with which the overrides are associated. | |
| 1763 */ | |
| 1764 String file; | |
| 1765 | |
| 1766 /** | |
| 1767 * The overrides associated with the file. | |
| 1768 */ | |
| 1769 List<Override> overrides; | |
| 1770 | |
| 1771 AnalysisOverridesParams(this.file, this.overrides); | |
| 1772 | |
| 1773 factory AnalysisOverridesParams.fromJson(JsonDecoder jsonDecoder, String jsonP
ath, Object json) { | |
| 1774 if (json == null) { | |
| 1775 json = {}; | |
| 1776 } | |
| 1777 if (json is Map) { | |
| 1778 String file; | |
| 1779 if (json.containsKey("file")) { | |
| 1780 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 1781 } else { | |
| 1782 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 1783 } | |
| 1784 List<Override> overrides; | |
| 1785 if (json.containsKey("overrides")) { | |
| 1786 overrides = jsonDecoder._decodeList(jsonPath + ".overrides", json["overr
ides"], (String jsonPath, Object json) => new Override.fromJson(jsonDecoder, jso
nPath, json)); | |
| 1787 } else { | |
| 1788 throw jsonDecoder.missingKey(jsonPath, "overrides"); | |
| 1789 } | |
| 1790 return new AnalysisOverridesParams(file, overrides); | |
| 1791 } else { | |
| 1792 throw jsonDecoder.mismatch(jsonPath, "analysis.overrides params"); | |
| 1793 } | |
| 1794 } | |
| 1795 | |
| 1796 factory AnalysisOverridesParams.fromNotification(Notification notification) { | |
| 1797 return new AnalysisOverridesParams.fromJson( | |
| 1798 new ResponseDecoder(null), "params", notification._params); | |
| 1799 } | |
| 1800 | |
| 1801 Map<String, dynamic> toJson() { | |
| 1802 Map<String, dynamic> result = {}; | |
| 1803 result["file"] = file; | |
| 1804 result["overrides"] = overrides.map((Override value) => value.toJson()).toLi
st(); | |
| 1805 return result; | |
| 1806 } | |
| 1807 | |
| 1808 Notification toNotification() { | |
| 1809 return new Notification("analysis.overrides", toJson()); | |
| 1810 } | |
| 1811 | |
| 1812 @override | |
| 1813 String toString() => JSON.encode(toJson()); | |
| 1814 | |
| 1815 @override | |
| 1816 bool operator==(other) { | |
| 1817 if (other is AnalysisOverridesParams) { | |
| 1818 return file == other.file && | |
| 1819 _listEqual(overrides, other.overrides, (Override a, Override b) => a =
= b); | |
| 1820 } | |
| 1821 return false; | |
| 1822 } | |
| 1823 | |
| 1824 @override | |
| 1825 int get hashCode { | |
| 1826 int hash = 0; | |
| 1827 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 1828 hash = _JenkinsSmiHash.combine(hash, overrides.hashCode); | |
| 1829 return _JenkinsSmiHash.finish(hash); | |
| 1830 } | |
| 1831 } | |
| 1832 | |
| 1833 /** | |
| 1834 * completion.getSuggestions params | |
| 1835 * | |
| 1836 * { | |
| 1837 * "file": FilePath | |
| 1838 * "offset": int | |
| 1839 * } | |
| 1840 */ | |
| 1841 class CompletionGetSuggestionsParams implements HasToJson { | |
| 1842 /** | |
| 1843 * The file containing the point at which suggestions are to be made. | |
| 1844 */ | |
| 1845 String file; | |
| 1846 | |
| 1847 /** | |
| 1848 * The offset within the file at which suggestions are to be made. | |
| 1849 */ | |
| 1850 int offset; | |
| 1851 | |
| 1852 CompletionGetSuggestionsParams(this.file, this.offset); | |
| 1853 | |
| 1854 factory CompletionGetSuggestionsParams.fromJson(JsonDecoder jsonDecoder, Strin
g jsonPath, Object json) { | |
| 1855 if (json == null) { | |
| 1856 json = {}; | |
| 1857 } | |
| 1858 if (json is Map) { | |
| 1859 String file; | |
| 1860 if (json.containsKey("file")) { | |
| 1861 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 1862 } else { | |
| 1863 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 1864 } | |
| 1865 int offset; | |
| 1866 if (json.containsKey("offset")) { | |
| 1867 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 1868 } else { | |
| 1869 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 1870 } | |
| 1871 return new CompletionGetSuggestionsParams(file, offset); | |
| 1872 } else { | |
| 1873 throw jsonDecoder.mismatch(jsonPath, "completion.getSuggestions params"); | |
| 1874 } | |
| 1875 } | |
| 1876 | |
| 1877 factory CompletionGetSuggestionsParams.fromRequest(Request request) { | |
| 1878 return new CompletionGetSuggestionsParams.fromJson( | |
| 1879 new RequestDecoder(request), "params", request._params); | |
| 1880 } | |
| 1881 | |
| 1882 Map<String, dynamic> toJson() { | |
| 1883 Map<String, dynamic> result = {}; | |
| 1884 result["file"] = file; | |
| 1885 result["offset"] = offset; | |
| 1886 return result; | |
| 1887 } | |
| 1888 | |
| 1889 Request toRequest(String id) { | |
| 1890 return new Request(id, "completion.getSuggestions", toJson()); | |
| 1891 } | |
| 1892 | |
| 1893 @override | |
| 1894 String toString() => JSON.encode(toJson()); | |
| 1895 | |
| 1896 @override | |
| 1897 bool operator==(other) { | |
| 1898 if (other is CompletionGetSuggestionsParams) { | |
| 1899 return file == other.file && | |
| 1900 offset == other.offset; | |
| 1901 } | |
| 1902 return false; | |
| 1903 } | |
| 1904 | |
| 1905 @override | |
| 1906 int get hashCode { | |
| 1907 int hash = 0; | |
| 1908 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 1909 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 1910 return _JenkinsSmiHash.finish(hash); | |
| 1911 } | |
| 1912 } | |
| 1913 | |
| 1914 /** | |
| 1915 * completion.getSuggestions result | |
| 1916 * | |
| 1917 * { | |
| 1918 * "id": CompletionId | |
| 1919 * } | |
| 1920 */ | |
| 1921 class CompletionGetSuggestionsResult implements HasToJson { | |
| 1922 /** | |
| 1923 * The identifier used to associate results with this completion request. | |
| 1924 */ | |
| 1925 String id; | |
| 1926 | |
| 1927 CompletionGetSuggestionsResult(this.id); | |
| 1928 | |
| 1929 factory CompletionGetSuggestionsResult.fromJson(JsonDecoder jsonDecoder, Strin
g jsonPath, Object json) { | |
| 1930 if (json == null) { | |
| 1931 json = {}; | |
| 1932 } | |
| 1933 if (json is Map) { | |
| 1934 String id; | |
| 1935 if (json.containsKey("id")) { | |
| 1936 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); | |
| 1937 } else { | |
| 1938 throw jsonDecoder.missingKey(jsonPath, "id"); | |
| 1939 } | |
| 1940 return new CompletionGetSuggestionsResult(id); | |
| 1941 } else { | |
| 1942 throw jsonDecoder.mismatch(jsonPath, "completion.getSuggestions result"); | |
| 1943 } | |
| 1944 } | |
| 1945 | |
| 1946 factory CompletionGetSuggestionsResult.fromResponse(Response response) { | |
| 1947 return new CompletionGetSuggestionsResult.fromJson( | |
| 1948 new ResponseDecoder(response), "result", response._result); | |
| 1949 } | |
| 1950 | |
| 1951 Map<String, dynamic> toJson() { | |
| 1952 Map<String, dynamic> result = {}; | |
| 1953 result["id"] = id; | |
| 1954 return result; | |
| 1955 } | |
| 1956 | |
| 1957 Response toResponse(String id) { | |
| 1958 return new Response(id, result: toJson()); | |
| 1959 } | |
| 1960 | |
| 1961 @override | |
| 1962 String toString() => JSON.encode(toJson()); | |
| 1963 | |
| 1964 @override | |
| 1965 bool operator==(other) { | |
| 1966 if (other is CompletionGetSuggestionsResult) { | |
| 1967 return id == other.id; | |
| 1968 } | |
| 1969 return false; | |
| 1970 } | |
| 1971 | |
| 1972 @override | |
| 1973 int get hashCode { | |
| 1974 int hash = 0; | |
| 1975 hash = _JenkinsSmiHash.combine(hash, id.hashCode); | |
| 1976 return _JenkinsSmiHash.finish(hash); | |
| 1977 } | |
| 1978 } | |
| 1979 | |
| 1980 /** | |
| 1981 * completion.results params | |
| 1982 * | |
| 1983 * { | |
| 1984 * "id": CompletionId | |
| 1985 * "replacementOffset": int | |
| 1986 * "replacementLength": int | |
| 1987 * "results": List<CompletionSuggestion> | |
| 1988 * "isLast": bool | |
| 1989 * } | |
| 1990 */ | |
| 1991 class CompletionResultsParams implements HasToJson { | |
| 1992 /** | |
| 1993 * The id associated with the completion. | |
| 1994 */ | |
| 1995 String id; | |
| 1996 | |
| 1997 /** | |
| 1998 * The offset of the start of the text to be replaced. This will be different | |
| 1999 * than the offset used to request the completion suggestions if there was a | |
| 2000 * portion of an identifier before the original offset. In particular, the | |
| 2001 * replacementOffset will be the offset of the beginning of said identifier. | |
| 2002 */ | |
| 2003 int replacementOffset; | |
| 2004 | |
| 2005 /** | |
| 2006 * The length of the text to be replaced if the remainder of the identifier | |
| 2007 * containing the cursor is to be replaced when the suggestion is applied | |
| 2008 * (that is, the number of characters in the existing identifier). | |
| 2009 */ | |
| 2010 int replacementLength; | |
| 2011 | |
| 2012 /** | |
| 2013 * The completion suggestions being reported. The notification contains all | |
| 2014 * possible completions at the requested cursor position, even those that do | |
| 2015 * not match the characters the user has already typed. This allows the | |
| 2016 * client to respond to further keystrokes from the user without having to | |
| 2017 * make additional requests. | |
| 2018 */ | |
| 2019 List<CompletionSuggestion> results; | |
| 2020 | |
| 2021 /** | |
| 2022 * True if this is that last set of results that will be returned for the | |
| 2023 * indicated completion. | |
| 2024 */ | |
| 2025 bool isLast; | |
| 2026 | |
| 2027 CompletionResultsParams(this.id, this.replacementOffset, this.replacementLengt
h, this.results, this.isLast); | |
| 2028 | |
| 2029 factory CompletionResultsParams.fromJson(JsonDecoder jsonDecoder, String jsonP
ath, Object json) { | |
| 2030 if (json == null) { | |
| 2031 json = {}; | |
| 2032 } | |
| 2033 if (json is Map) { | |
| 2034 String id; | |
| 2035 if (json.containsKey("id")) { | |
| 2036 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); | |
| 2037 } else { | |
| 2038 throw jsonDecoder.missingKey(jsonPath, "id"); | |
| 2039 } | |
| 2040 int replacementOffset; | |
| 2041 if (json.containsKey("replacementOffset")) { | |
| 2042 replacementOffset = jsonDecoder._decodeInt(jsonPath + ".replacementOffse
t", json["replacementOffset"]); | |
| 2043 } else { | |
| 2044 throw jsonDecoder.missingKey(jsonPath, "replacementOffset"); | |
| 2045 } | |
| 2046 int replacementLength; | |
| 2047 if (json.containsKey("replacementLength")) { | |
| 2048 replacementLength = jsonDecoder._decodeInt(jsonPath + ".replacementLengt
h", json["replacementLength"]); | |
| 2049 } else { | |
| 2050 throw jsonDecoder.missingKey(jsonPath, "replacementLength"); | |
| 2051 } | |
| 2052 List<CompletionSuggestion> results; | |
| 2053 if (json.containsKey("results")) { | |
| 2054 results = jsonDecoder._decodeList(jsonPath + ".results", json["results"]
, (String jsonPath, Object json) => new CompletionSuggestion.fromJson(jsonDecode
r, jsonPath, json)); | |
| 2055 } else { | |
| 2056 throw jsonDecoder.missingKey(jsonPath, "results"); | |
| 2057 } | |
| 2058 bool isLast; | |
| 2059 if (json.containsKey("isLast")) { | |
| 2060 isLast = jsonDecoder._decodeBool(jsonPath + ".isLast", json["isLast"]); | |
| 2061 } else { | |
| 2062 throw jsonDecoder.missingKey(jsonPath, "isLast"); | |
| 2063 } | |
| 2064 return new CompletionResultsParams(id, replacementOffset, replacementLengt
h, results, isLast); | |
| 2065 } else { | |
| 2066 throw jsonDecoder.mismatch(jsonPath, "completion.results params"); | |
| 2067 } | |
| 2068 } | |
| 2069 | |
| 2070 factory CompletionResultsParams.fromNotification(Notification notification) { | |
| 2071 return new CompletionResultsParams.fromJson( | |
| 2072 new ResponseDecoder(null), "params", notification._params); | |
| 2073 } | |
| 2074 | |
| 2075 Map<String, dynamic> toJson() { | |
| 2076 Map<String, dynamic> result = {}; | |
| 2077 result["id"] = id; | |
| 2078 result["replacementOffset"] = replacementOffset; | |
| 2079 result["replacementLength"] = replacementLength; | |
| 2080 result["results"] = results.map((CompletionSuggestion value) => value.toJson
()).toList(); | |
| 2081 result["isLast"] = isLast; | |
| 2082 return result; | |
| 2083 } | |
| 2084 | |
| 2085 Notification toNotification() { | |
| 2086 return new Notification("completion.results", toJson()); | |
| 2087 } | |
| 2088 | |
| 2089 @override | |
| 2090 String toString() => JSON.encode(toJson()); | |
| 2091 | |
| 2092 @override | |
| 2093 bool operator==(other) { | |
| 2094 if (other is CompletionResultsParams) { | |
| 2095 return id == other.id && | |
| 2096 replacementOffset == other.replacementOffset && | |
| 2097 replacementLength == other.replacementLength && | |
| 2098 _listEqual(results, other.results, (CompletionSuggestion a, Completion
Suggestion b) => a == b) && | |
| 2099 isLast == other.isLast; | |
| 2100 } | |
| 2101 return false; | |
| 2102 } | |
| 2103 | |
| 2104 @override | |
| 2105 int get hashCode { | |
| 2106 int hash = 0; | |
| 2107 hash = _JenkinsSmiHash.combine(hash, id.hashCode); | |
| 2108 hash = _JenkinsSmiHash.combine(hash, replacementOffset.hashCode); | |
| 2109 hash = _JenkinsSmiHash.combine(hash, replacementLength.hashCode); | |
| 2110 hash = _JenkinsSmiHash.combine(hash, results.hashCode); | |
| 2111 hash = _JenkinsSmiHash.combine(hash, isLast.hashCode); | |
| 2112 return _JenkinsSmiHash.finish(hash); | |
| 2113 } | |
| 2114 } | |
| 2115 | |
| 2116 /** | |
| 2117 * search.findElementReferences params | |
| 2118 * | |
| 2119 * { | |
| 2120 * "file": FilePath | |
| 2121 * "offset": int | |
| 2122 * "includePotential": bool | |
| 2123 * } | |
| 2124 */ | |
| 2125 class SearchFindElementReferencesParams implements HasToJson { | |
| 2126 /** | |
| 2127 * The file containing the declaration of or reference to the element used to | |
| 2128 * define the search. | |
| 2129 */ | |
| 2130 String file; | |
| 2131 | |
| 2132 /** | |
| 2133 * The offset within the file of the declaration of or reference to the | |
| 2134 * element. | |
| 2135 */ | |
| 2136 int offset; | |
| 2137 | |
| 2138 /** | |
| 2139 * True if potential matches are to be included in the results. | |
| 2140 */ | |
| 2141 bool includePotential; | |
| 2142 | |
| 2143 SearchFindElementReferencesParams(this.file, this.offset, this.includePotentia
l); | |
| 2144 | |
| 2145 factory SearchFindElementReferencesParams.fromJson(JsonDecoder jsonDecoder, St
ring jsonPath, Object json) { | |
| 2146 if (json == null) { | |
| 2147 json = {}; | |
| 2148 } | |
| 2149 if (json is Map) { | |
| 2150 String file; | |
| 2151 if (json.containsKey("file")) { | |
| 2152 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 2153 } else { | |
| 2154 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 2155 } | |
| 2156 int offset; | |
| 2157 if (json.containsKey("offset")) { | |
| 2158 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 2159 } else { | |
| 2160 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 2161 } | |
| 2162 bool includePotential; | |
| 2163 if (json.containsKey("includePotential")) { | |
| 2164 includePotential = jsonDecoder._decodeBool(jsonPath + ".includePotential
", json["includePotential"]); | |
| 2165 } else { | |
| 2166 throw jsonDecoder.missingKey(jsonPath, "includePotential"); | |
| 2167 } | |
| 2168 return new SearchFindElementReferencesParams(file, offset, includePotentia
l); | |
| 2169 } else { | |
| 2170 throw jsonDecoder.mismatch(jsonPath, "search.findElementReferences params"
); | |
| 2171 } | |
| 2172 } | |
| 2173 | |
| 2174 factory SearchFindElementReferencesParams.fromRequest(Request request) { | |
| 2175 return new SearchFindElementReferencesParams.fromJson( | |
| 2176 new RequestDecoder(request), "params", request._params); | |
| 2177 } | |
| 2178 | |
| 2179 Map<String, dynamic> toJson() { | |
| 2180 Map<String, dynamic> result = {}; | |
| 2181 result["file"] = file; | |
| 2182 result["offset"] = offset; | |
| 2183 result["includePotential"] = includePotential; | |
| 2184 return result; | |
| 2185 } | |
| 2186 | |
| 2187 Request toRequest(String id) { | |
| 2188 return new Request(id, "search.findElementReferences", toJson()); | |
| 2189 } | |
| 2190 | |
| 2191 @override | |
| 2192 String toString() => JSON.encode(toJson()); | |
| 2193 | |
| 2194 @override | |
| 2195 bool operator==(other) { | |
| 2196 if (other is SearchFindElementReferencesParams) { | |
| 2197 return file == other.file && | |
| 2198 offset == other.offset && | |
| 2199 includePotential == other.includePotential; | |
| 2200 } | |
| 2201 return false; | |
| 2202 } | |
| 2203 | |
| 2204 @override | |
| 2205 int get hashCode { | |
| 2206 int hash = 0; | |
| 2207 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 2208 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 2209 hash = _JenkinsSmiHash.combine(hash, includePotential.hashCode); | |
| 2210 return _JenkinsSmiHash.finish(hash); | |
| 2211 } | |
| 2212 } | |
| 2213 | |
| 2214 /** | |
| 2215 * search.findElementReferences result | |
| 2216 * | |
| 2217 * { | |
| 2218 * "id": optional SearchId | |
| 2219 * "element": optional Element | |
| 2220 * } | |
| 2221 */ | |
| 2222 class SearchFindElementReferencesResult implements HasToJson { | |
| 2223 /** | |
| 2224 * The identifier used to associate results with this search request. | |
| 2225 * | |
| 2226 * If no element was found at the given location, this field will be absent, | |
| 2227 * and no results will be reported via the search.results notification. | |
| 2228 */ | |
| 2229 String id; | |
| 2230 | |
| 2231 /** | |
| 2232 * The element referenced or defined at the given offset and whose references | |
| 2233 * will be returned in the search results. | |
| 2234 * | |
| 2235 * If no element was found at the given location, this field will be absent. | |
| 2236 */ | |
| 2237 Element element; | |
| 2238 | |
| 2239 SearchFindElementReferencesResult({this.id, this.element}); | |
| 2240 | |
| 2241 factory SearchFindElementReferencesResult.fromJson(JsonDecoder jsonDecoder, St
ring jsonPath, Object json) { | |
| 2242 if (json == null) { | |
| 2243 json = {}; | |
| 2244 } | |
| 2245 if (json is Map) { | |
| 2246 String id; | |
| 2247 if (json.containsKey("id")) { | |
| 2248 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); | |
| 2249 } | |
| 2250 Element element; | |
| 2251 if (json.containsKey("element")) { | |
| 2252 element = new Element.fromJson(jsonDecoder, jsonPath + ".element", json[
"element"]); | |
| 2253 } | |
| 2254 return new SearchFindElementReferencesResult(id: id, element: element); | |
| 2255 } else { | |
| 2256 throw jsonDecoder.mismatch(jsonPath, "search.findElementReferences result"
); | |
| 2257 } | |
| 2258 } | |
| 2259 | |
| 2260 factory SearchFindElementReferencesResult.fromResponse(Response response) { | |
| 2261 return new SearchFindElementReferencesResult.fromJson( | |
| 2262 new ResponseDecoder(response), "result", response._result); | |
| 2263 } | |
| 2264 | |
| 2265 Map<String, dynamic> toJson() { | |
| 2266 Map<String, dynamic> result = {}; | |
| 2267 if (id != null) { | |
| 2268 result["id"] = id; | |
| 2269 } | |
| 2270 if (element != null) { | |
| 2271 result["element"] = element.toJson(); | |
| 2272 } | |
| 2273 return result; | |
| 2274 } | |
| 2275 | |
| 2276 Response toResponse(String id) { | |
| 2277 return new Response(id, result: toJson()); | |
| 2278 } | |
| 2279 | |
| 2280 @override | |
| 2281 String toString() => JSON.encode(toJson()); | |
| 2282 | |
| 2283 @override | |
| 2284 bool operator==(other) { | |
| 2285 if (other is SearchFindElementReferencesResult) { | |
| 2286 return id == other.id && | |
| 2287 element == other.element; | |
| 2288 } | |
| 2289 return false; | |
| 2290 } | |
| 2291 | |
| 2292 @override | |
| 2293 int get hashCode { | |
| 2294 int hash = 0; | |
| 2295 hash = _JenkinsSmiHash.combine(hash, id.hashCode); | |
| 2296 hash = _JenkinsSmiHash.combine(hash, element.hashCode); | |
| 2297 return _JenkinsSmiHash.finish(hash); | |
| 2298 } | |
| 2299 } | |
| 2300 | |
| 2301 /** | |
| 2302 * search.findMemberDeclarations params | |
| 2303 * | |
| 2304 * { | |
| 2305 * "name": String | |
| 2306 * } | |
| 2307 */ | |
| 2308 class SearchFindMemberDeclarationsParams implements HasToJson { | |
| 2309 /** | |
| 2310 * The name of the declarations to be found. | |
| 2311 */ | |
| 2312 String name; | |
| 2313 | |
| 2314 SearchFindMemberDeclarationsParams(this.name); | |
| 2315 | |
| 2316 factory SearchFindMemberDeclarationsParams.fromJson(JsonDecoder jsonDecoder, S
tring jsonPath, Object json) { | |
| 2317 if (json == null) { | |
| 2318 json = {}; | |
| 2319 } | |
| 2320 if (json is Map) { | |
| 2321 String name; | |
| 2322 if (json.containsKey("name")) { | |
| 2323 name = jsonDecoder._decodeString(jsonPath + ".name", json["name"]); | |
| 2324 } else { | |
| 2325 throw jsonDecoder.missingKey(jsonPath, "name"); | |
| 2326 } | |
| 2327 return new SearchFindMemberDeclarationsParams(name); | |
| 2328 } else { | |
| 2329 throw jsonDecoder.mismatch(jsonPath, "search.findMemberDeclarations params
"); | |
| 2330 } | |
| 2331 } | |
| 2332 | |
| 2333 factory SearchFindMemberDeclarationsParams.fromRequest(Request request) { | |
| 2334 return new SearchFindMemberDeclarationsParams.fromJson( | |
| 2335 new RequestDecoder(request), "params", request._params); | |
| 2336 } | |
| 2337 | |
| 2338 Map<String, dynamic> toJson() { | |
| 2339 Map<String, dynamic> result = {}; | |
| 2340 result["name"] = name; | |
| 2341 return result; | |
| 2342 } | |
| 2343 | |
| 2344 Request toRequest(String id) { | |
| 2345 return new Request(id, "search.findMemberDeclarations", toJson()); | |
| 2346 } | |
| 2347 | |
| 2348 @override | |
| 2349 String toString() => JSON.encode(toJson()); | |
| 2350 | |
| 2351 @override | |
| 2352 bool operator==(other) { | |
| 2353 if (other is SearchFindMemberDeclarationsParams) { | |
| 2354 return name == other.name; | |
| 2355 } | |
| 2356 return false; | |
| 2357 } | |
| 2358 | |
| 2359 @override | |
| 2360 int get hashCode { | |
| 2361 int hash = 0; | |
| 2362 hash = _JenkinsSmiHash.combine(hash, name.hashCode); | |
| 2363 return _JenkinsSmiHash.finish(hash); | |
| 2364 } | |
| 2365 } | |
| 2366 | |
| 2367 /** | |
| 2368 * search.findMemberDeclarations result | |
| 2369 * | |
| 2370 * { | |
| 2371 * "id": SearchId | |
| 2372 * } | |
| 2373 */ | |
| 2374 class SearchFindMemberDeclarationsResult implements HasToJson { | |
| 2375 /** | |
| 2376 * The identifier used to associate results with this search request. | |
| 2377 */ | |
| 2378 String id; | |
| 2379 | |
| 2380 SearchFindMemberDeclarationsResult(this.id); | |
| 2381 | |
| 2382 factory SearchFindMemberDeclarationsResult.fromJson(JsonDecoder jsonDecoder, S
tring jsonPath, Object json) { | |
| 2383 if (json == null) { | |
| 2384 json = {}; | |
| 2385 } | |
| 2386 if (json is Map) { | |
| 2387 String id; | |
| 2388 if (json.containsKey("id")) { | |
| 2389 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); | |
| 2390 } else { | |
| 2391 throw jsonDecoder.missingKey(jsonPath, "id"); | |
| 2392 } | |
| 2393 return new SearchFindMemberDeclarationsResult(id); | |
| 2394 } else { | |
| 2395 throw jsonDecoder.mismatch(jsonPath, "search.findMemberDeclarations result
"); | |
| 2396 } | |
| 2397 } | |
| 2398 | |
| 2399 factory SearchFindMemberDeclarationsResult.fromResponse(Response response) { | |
| 2400 return new SearchFindMemberDeclarationsResult.fromJson( | |
| 2401 new ResponseDecoder(response), "result", response._result); | |
| 2402 } | |
| 2403 | |
| 2404 Map<String, dynamic> toJson() { | |
| 2405 Map<String, dynamic> result = {}; | |
| 2406 result["id"] = id; | |
| 2407 return result; | |
| 2408 } | |
| 2409 | |
| 2410 Response toResponse(String id) { | |
| 2411 return new Response(id, result: toJson()); | |
| 2412 } | |
| 2413 | |
| 2414 @override | |
| 2415 String toString() => JSON.encode(toJson()); | |
| 2416 | |
| 2417 @override | |
| 2418 bool operator==(other) { | |
| 2419 if (other is SearchFindMemberDeclarationsResult) { | |
| 2420 return id == other.id; | |
| 2421 } | |
| 2422 return false; | |
| 2423 } | |
| 2424 | |
| 2425 @override | |
| 2426 int get hashCode { | |
| 2427 int hash = 0; | |
| 2428 hash = _JenkinsSmiHash.combine(hash, id.hashCode); | |
| 2429 return _JenkinsSmiHash.finish(hash); | |
| 2430 } | |
| 2431 } | |
| 2432 | |
| 2433 /** | |
| 2434 * search.findMemberReferences params | |
| 2435 * | |
| 2436 * { | |
| 2437 * "name": String | |
| 2438 * } | |
| 2439 */ | |
| 2440 class SearchFindMemberReferencesParams implements HasToJson { | |
| 2441 /** | |
| 2442 * The name of the references to be found. | |
| 2443 */ | |
| 2444 String name; | |
| 2445 | |
| 2446 SearchFindMemberReferencesParams(this.name); | |
| 2447 | |
| 2448 factory SearchFindMemberReferencesParams.fromJson(JsonDecoder jsonDecoder, Str
ing jsonPath, Object json) { | |
| 2449 if (json == null) { | |
| 2450 json = {}; | |
| 2451 } | |
| 2452 if (json is Map) { | |
| 2453 String name; | |
| 2454 if (json.containsKey("name")) { | |
| 2455 name = jsonDecoder._decodeString(jsonPath + ".name", json["name"]); | |
| 2456 } else { | |
| 2457 throw jsonDecoder.missingKey(jsonPath, "name"); | |
| 2458 } | |
| 2459 return new SearchFindMemberReferencesParams(name); | |
| 2460 } else { | |
| 2461 throw jsonDecoder.mismatch(jsonPath, "search.findMemberReferences params")
; | |
| 2462 } | |
| 2463 } | |
| 2464 | |
| 2465 factory SearchFindMemberReferencesParams.fromRequest(Request request) { | |
| 2466 return new SearchFindMemberReferencesParams.fromJson( | |
| 2467 new RequestDecoder(request), "params", request._params); | |
| 2468 } | |
| 2469 | |
| 2470 Map<String, dynamic> toJson() { | |
| 2471 Map<String, dynamic> result = {}; | |
| 2472 result["name"] = name; | |
| 2473 return result; | |
| 2474 } | |
| 2475 | |
| 2476 Request toRequest(String id) { | |
| 2477 return new Request(id, "search.findMemberReferences", toJson()); | |
| 2478 } | |
| 2479 | |
| 2480 @override | |
| 2481 String toString() => JSON.encode(toJson()); | |
| 2482 | |
| 2483 @override | |
| 2484 bool operator==(other) { | |
| 2485 if (other is SearchFindMemberReferencesParams) { | |
| 2486 return name == other.name; | |
| 2487 } | |
| 2488 return false; | |
| 2489 } | |
| 2490 | |
| 2491 @override | |
| 2492 int get hashCode { | |
| 2493 int hash = 0; | |
| 2494 hash = _JenkinsSmiHash.combine(hash, name.hashCode); | |
| 2495 return _JenkinsSmiHash.finish(hash); | |
| 2496 } | |
| 2497 } | |
| 2498 | |
| 2499 /** | |
| 2500 * search.findMemberReferences result | |
| 2501 * | |
| 2502 * { | |
| 2503 * "id": SearchId | |
| 2504 * } | |
| 2505 */ | |
| 2506 class SearchFindMemberReferencesResult implements HasToJson { | |
| 2507 /** | |
| 2508 * The identifier used to associate results with this search request. | |
| 2509 */ | |
| 2510 String id; | |
| 2511 | |
| 2512 SearchFindMemberReferencesResult(this.id); | |
| 2513 | |
| 2514 factory SearchFindMemberReferencesResult.fromJson(JsonDecoder jsonDecoder, Str
ing jsonPath, Object json) { | |
| 2515 if (json == null) { | |
| 2516 json = {}; | |
| 2517 } | |
| 2518 if (json is Map) { | |
| 2519 String id; | |
| 2520 if (json.containsKey("id")) { | |
| 2521 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); | |
| 2522 } else { | |
| 2523 throw jsonDecoder.missingKey(jsonPath, "id"); | |
| 2524 } | |
| 2525 return new SearchFindMemberReferencesResult(id); | |
| 2526 } else { | |
| 2527 throw jsonDecoder.mismatch(jsonPath, "search.findMemberReferences result")
; | |
| 2528 } | |
| 2529 } | |
| 2530 | |
| 2531 factory SearchFindMemberReferencesResult.fromResponse(Response response) { | |
| 2532 return new SearchFindMemberReferencesResult.fromJson( | |
| 2533 new ResponseDecoder(response), "result", response._result); | |
| 2534 } | |
| 2535 | |
| 2536 Map<String, dynamic> toJson() { | |
| 2537 Map<String, dynamic> result = {}; | |
| 2538 result["id"] = id; | |
| 2539 return result; | |
| 2540 } | |
| 2541 | |
| 2542 Response toResponse(String id) { | |
| 2543 return new Response(id, result: toJson()); | |
| 2544 } | |
| 2545 | |
| 2546 @override | |
| 2547 String toString() => JSON.encode(toJson()); | |
| 2548 | |
| 2549 @override | |
| 2550 bool operator==(other) { | |
| 2551 if (other is SearchFindMemberReferencesResult) { | |
| 2552 return id == other.id; | |
| 2553 } | |
| 2554 return false; | |
| 2555 } | |
| 2556 | |
| 2557 @override | |
| 2558 int get hashCode { | |
| 2559 int hash = 0; | |
| 2560 hash = _JenkinsSmiHash.combine(hash, id.hashCode); | |
| 2561 return _JenkinsSmiHash.finish(hash); | |
| 2562 } | |
| 2563 } | |
| 2564 | |
| 2565 /** | |
| 2566 * search.findTopLevelDeclarations params | |
| 2567 * | |
| 2568 * { | |
| 2569 * "pattern": String | |
| 2570 * } | |
| 2571 */ | |
| 2572 class SearchFindTopLevelDeclarationsParams implements HasToJson { | |
| 2573 /** | |
| 2574 * The regular expression used to match the names of the declarations to be | |
| 2575 * found. | |
| 2576 */ | |
| 2577 String pattern; | |
| 2578 | |
| 2579 SearchFindTopLevelDeclarationsParams(this.pattern); | |
| 2580 | |
| 2581 factory SearchFindTopLevelDeclarationsParams.fromJson(JsonDecoder jsonDecoder,
String jsonPath, Object json) { | |
| 2582 if (json == null) { | |
| 2583 json = {}; | |
| 2584 } | |
| 2585 if (json is Map) { | |
| 2586 String pattern; | |
| 2587 if (json.containsKey("pattern")) { | |
| 2588 pattern = jsonDecoder._decodeString(jsonPath + ".pattern", json["pattern
"]); | |
| 2589 } else { | |
| 2590 throw jsonDecoder.missingKey(jsonPath, "pattern"); | |
| 2591 } | |
| 2592 return new SearchFindTopLevelDeclarationsParams(pattern); | |
| 2593 } else { | |
| 2594 throw jsonDecoder.mismatch(jsonPath, "search.findTopLevelDeclarations para
ms"); | |
| 2595 } | |
| 2596 } | |
| 2597 | |
| 2598 factory SearchFindTopLevelDeclarationsParams.fromRequest(Request request) { | |
| 2599 return new SearchFindTopLevelDeclarationsParams.fromJson( | |
| 2600 new RequestDecoder(request), "params", request._params); | |
| 2601 } | |
| 2602 | |
| 2603 Map<String, dynamic> toJson() { | |
| 2604 Map<String, dynamic> result = {}; | |
| 2605 result["pattern"] = pattern; | |
| 2606 return result; | |
| 2607 } | |
| 2608 | |
| 2609 Request toRequest(String id) { | |
| 2610 return new Request(id, "search.findTopLevelDeclarations", toJson()); | |
| 2611 } | |
| 2612 | |
| 2613 @override | |
| 2614 String toString() => JSON.encode(toJson()); | |
| 2615 | |
| 2616 @override | |
| 2617 bool operator==(other) { | |
| 2618 if (other is SearchFindTopLevelDeclarationsParams) { | |
| 2619 return pattern == other.pattern; | |
| 2620 } | |
| 2621 return false; | |
| 2622 } | |
| 2623 | |
| 2624 @override | |
| 2625 int get hashCode { | |
| 2626 int hash = 0; | |
| 2627 hash = _JenkinsSmiHash.combine(hash, pattern.hashCode); | |
| 2628 return _JenkinsSmiHash.finish(hash); | |
| 2629 } | |
| 2630 } | |
| 2631 | |
| 2632 /** | |
| 2633 * search.findTopLevelDeclarations result | |
| 2634 * | |
| 2635 * { | |
| 2636 * "id": SearchId | |
| 2637 * } | |
| 2638 */ | |
| 2639 class SearchFindTopLevelDeclarationsResult implements HasToJson { | |
| 2640 /** | |
| 2641 * The identifier used to associate results with this search request. | |
| 2642 */ | |
| 2643 String id; | |
| 2644 | |
| 2645 SearchFindTopLevelDeclarationsResult(this.id); | |
| 2646 | |
| 2647 factory SearchFindTopLevelDeclarationsResult.fromJson(JsonDecoder jsonDecoder,
String jsonPath, Object json) { | |
| 2648 if (json == null) { | |
| 2649 json = {}; | |
| 2650 } | |
| 2651 if (json is Map) { | |
| 2652 String id; | |
| 2653 if (json.containsKey("id")) { | |
| 2654 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); | |
| 2655 } else { | |
| 2656 throw jsonDecoder.missingKey(jsonPath, "id"); | |
| 2657 } | |
| 2658 return new SearchFindTopLevelDeclarationsResult(id); | |
| 2659 } else { | |
| 2660 throw jsonDecoder.mismatch(jsonPath, "search.findTopLevelDeclarations resu
lt"); | |
| 2661 } | |
| 2662 } | |
| 2663 | |
| 2664 factory SearchFindTopLevelDeclarationsResult.fromResponse(Response response) { | |
| 2665 return new SearchFindTopLevelDeclarationsResult.fromJson( | |
| 2666 new ResponseDecoder(response), "result", response._result); | |
| 2667 } | |
| 2668 | |
| 2669 Map<String, dynamic> toJson() { | |
| 2670 Map<String, dynamic> result = {}; | |
| 2671 result["id"] = id; | |
| 2672 return result; | |
| 2673 } | |
| 2674 | |
| 2675 Response toResponse(String id) { | |
| 2676 return new Response(id, result: toJson()); | |
| 2677 } | |
| 2678 | |
| 2679 @override | |
| 2680 String toString() => JSON.encode(toJson()); | |
| 2681 | |
| 2682 @override | |
| 2683 bool operator==(other) { | |
| 2684 if (other is SearchFindTopLevelDeclarationsResult) { | |
| 2685 return id == other.id; | |
| 2686 } | |
| 2687 return false; | |
| 2688 } | |
| 2689 | |
| 2690 @override | |
| 2691 int get hashCode { | |
| 2692 int hash = 0; | |
| 2693 hash = _JenkinsSmiHash.combine(hash, id.hashCode); | |
| 2694 return _JenkinsSmiHash.finish(hash); | |
| 2695 } | |
| 2696 } | |
| 2697 | |
| 2698 /** | |
| 2699 * search.getTypeHierarchy params | |
| 2700 * | |
| 2701 * { | |
| 2702 * "file": FilePath | |
| 2703 * "offset": int | |
| 2704 * } | |
| 2705 */ | |
| 2706 class SearchGetTypeHierarchyParams implements HasToJson { | |
| 2707 /** | |
| 2708 * The file containing the declaration or reference to the type for which a | |
| 2709 * hierarchy is being requested. | |
| 2710 */ | |
| 2711 String file; | |
| 2712 | |
| 2713 /** | |
| 2714 * The offset of the name of the type within the file. | |
| 2715 */ | |
| 2716 int offset; | |
| 2717 | |
| 2718 SearchGetTypeHierarchyParams(this.file, this.offset); | |
| 2719 | |
| 2720 factory SearchGetTypeHierarchyParams.fromJson(JsonDecoder jsonDecoder, String
jsonPath, Object json) { | |
| 2721 if (json == null) { | |
| 2722 json = {}; | |
| 2723 } | |
| 2724 if (json is Map) { | |
| 2725 String file; | |
| 2726 if (json.containsKey("file")) { | |
| 2727 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 2728 } else { | |
| 2729 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 2730 } | |
| 2731 int offset; | |
| 2732 if (json.containsKey("offset")) { | |
| 2733 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 2734 } else { | |
| 2735 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 2736 } | |
| 2737 return new SearchGetTypeHierarchyParams(file, offset); | |
| 2738 } else { | |
| 2739 throw jsonDecoder.mismatch(jsonPath, "search.getTypeHierarchy params"); | |
| 2740 } | |
| 2741 } | |
| 2742 | |
| 2743 factory SearchGetTypeHierarchyParams.fromRequest(Request request) { | |
| 2744 return new SearchGetTypeHierarchyParams.fromJson( | |
| 2745 new RequestDecoder(request), "params", request._params); | |
| 2746 } | |
| 2747 | |
| 2748 Map<String, dynamic> toJson() { | |
| 2749 Map<String, dynamic> result = {}; | |
| 2750 result["file"] = file; | |
| 2751 result["offset"] = offset; | |
| 2752 return result; | |
| 2753 } | |
| 2754 | |
| 2755 Request toRequest(String id) { | |
| 2756 return new Request(id, "search.getTypeHierarchy", toJson()); | |
| 2757 } | |
| 2758 | |
| 2759 @override | |
| 2760 String toString() => JSON.encode(toJson()); | |
| 2761 | |
| 2762 @override | |
| 2763 bool operator==(other) { | |
| 2764 if (other is SearchGetTypeHierarchyParams) { | |
| 2765 return file == other.file && | |
| 2766 offset == other.offset; | |
| 2767 } | |
| 2768 return false; | |
| 2769 } | |
| 2770 | |
| 2771 @override | |
| 2772 int get hashCode { | |
| 2773 int hash = 0; | |
| 2774 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 2775 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 2776 return _JenkinsSmiHash.finish(hash); | |
| 2777 } | |
| 2778 } | |
| 2779 | |
| 2780 /** | |
| 2781 * search.getTypeHierarchy result | |
| 2782 * | |
| 2783 * { | |
| 2784 * "hierarchyItems": optional List<TypeHierarchyItem> | |
| 2785 * } | |
| 2786 */ | |
| 2787 class SearchGetTypeHierarchyResult implements HasToJson { | |
| 2788 /** | |
| 2789 * A list of the types in the requested hierarchy. The first element of the | |
| 2790 * list is the item representing the type for which the hierarchy was | |
| 2791 * requested. The index of other elements of the list is unspecified, but | |
| 2792 * correspond to the integers used to reference supertype and subtype items | |
| 2793 * within the items. | |
| 2794 * | |
| 2795 * This field will be absent if the code at the given file and offset does | |
| 2796 * not represent a type, or if the file has not been sufficiently analyzed to | |
| 2797 * allow a type hierarchy to be produced. | |
| 2798 */ | |
| 2799 List<TypeHierarchyItem> hierarchyItems; | |
| 2800 | |
| 2801 SearchGetTypeHierarchyResult({this.hierarchyItems}) { | |
| 2802 if (hierarchyItems == null) { | |
| 2803 hierarchyItems = <TypeHierarchyItem>[]; | |
| 2804 } | |
| 2805 } | |
| 2806 | |
| 2807 factory SearchGetTypeHierarchyResult.fromJson(JsonDecoder jsonDecoder, String
jsonPath, Object json) { | |
| 2808 if (json == null) { | |
| 2809 json = {}; | |
| 2810 } | |
| 2811 if (json is Map) { | |
| 2812 List<TypeHierarchyItem> hierarchyItems; | |
| 2813 if (json.containsKey("hierarchyItems")) { | |
| 2814 hierarchyItems = jsonDecoder._decodeList(jsonPath + ".hierarchyItems", j
son["hierarchyItems"], (String jsonPath, Object json) => new TypeHierarchyItem.f
romJson(jsonDecoder, jsonPath, json)); | |
| 2815 } else { | |
| 2816 hierarchyItems = <TypeHierarchyItem>[]; | |
| 2817 } | |
| 2818 return new SearchGetTypeHierarchyResult(hierarchyItems: hierarchyItems); | |
| 2819 } else { | |
| 2820 throw jsonDecoder.mismatch(jsonPath, "search.getTypeHierarchy result"); | |
| 2821 } | |
| 2822 } | |
| 2823 | |
| 2824 factory SearchGetTypeHierarchyResult.fromResponse(Response response) { | |
| 2825 return new SearchGetTypeHierarchyResult.fromJson( | |
| 2826 new ResponseDecoder(response), "result", response._result); | |
| 2827 } | |
| 2828 | |
| 2829 Map<String, dynamic> toJson() { | |
| 2830 Map<String, dynamic> result = {}; | |
| 2831 if (hierarchyItems.isNotEmpty) { | |
| 2832 result["hierarchyItems"] = hierarchyItems.map((TypeHierarchyItem value) =>
value.toJson()).toList(); | |
| 2833 } | |
| 2834 return result; | |
| 2835 } | |
| 2836 | |
| 2837 Response toResponse(String id) { | |
| 2838 return new Response(id, result: toJson()); | |
| 2839 } | |
| 2840 | |
| 2841 @override | |
| 2842 String toString() => JSON.encode(toJson()); | |
| 2843 | |
| 2844 @override | |
| 2845 bool operator==(other) { | |
| 2846 if (other is SearchGetTypeHierarchyResult) { | |
| 2847 return _listEqual(hierarchyItems, other.hierarchyItems, (TypeHierarchyItem
a, TypeHierarchyItem b) => a == b); | |
| 2848 } | |
| 2849 return false; | |
| 2850 } | |
| 2851 | |
| 2852 @override | |
| 2853 int get hashCode { | |
| 2854 int hash = 0; | |
| 2855 hash = _JenkinsSmiHash.combine(hash, hierarchyItems.hashCode); | |
| 2856 return _JenkinsSmiHash.finish(hash); | |
| 2857 } | |
| 2858 } | |
| 2859 | |
| 2860 /** | |
| 2861 * search.results params | |
| 2862 * | |
| 2863 * { | |
| 2864 * "id": SearchId | |
| 2865 * "results": List<SearchResult> | |
| 2866 * "isLast": bool | |
| 2867 * } | |
| 2868 */ | |
| 2869 class SearchResultsParams implements HasToJson { | |
| 2870 /** | |
| 2871 * The id associated with the search. | |
| 2872 */ | |
| 2873 String id; | |
| 2874 | |
| 2875 /** | |
| 2876 * The search results being reported. | |
| 2877 */ | |
| 2878 List<SearchResult> results; | |
| 2879 | |
| 2880 /** | |
| 2881 * True if this is that last set of results that will be returned for the | |
| 2882 * indicated search. | |
| 2883 */ | |
| 2884 bool isLast; | |
| 2885 | |
| 2886 SearchResultsParams(this.id, this.results, this.isLast); | |
| 2887 | |
| 2888 factory SearchResultsParams.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 2889 if (json == null) { | |
| 2890 json = {}; | |
| 2891 } | |
| 2892 if (json is Map) { | |
| 2893 String id; | |
| 2894 if (json.containsKey("id")) { | |
| 2895 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); | |
| 2896 } else { | |
| 2897 throw jsonDecoder.missingKey(jsonPath, "id"); | |
| 2898 } | |
| 2899 List<SearchResult> results; | |
| 2900 if (json.containsKey("results")) { | |
| 2901 results = jsonDecoder._decodeList(jsonPath + ".results", json["results"]
, (String jsonPath, Object json) => new SearchResult.fromJson(jsonDecoder, jsonP
ath, json)); | |
| 2902 } else { | |
| 2903 throw jsonDecoder.missingKey(jsonPath, "results"); | |
| 2904 } | |
| 2905 bool isLast; | |
| 2906 if (json.containsKey("isLast")) { | |
| 2907 isLast = jsonDecoder._decodeBool(jsonPath + ".isLast", json["isLast"]); | |
| 2908 } else { | |
| 2909 throw jsonDecoder.missingKey(jsonPath, "isLast"); | |
| 2910 } | |
| 2911 return new SearchResultsParams(id, results, isLast); | |
| 2912 } else { | |
| 2913 throw jsonDecoder.mismatch(jsonPath, "search.results params"); | |
| 2914 } | |
| 2915 } | |
| 2916 | |
| 2917 factory SearchResultsParams.fromNotification(Notification notification) { | |
| 2918 return new SearchResultsParams.fromJson( | |
| 2919 new ResponseDecoder(null), "params", notification._params); | |
| 2920 } | |
| 2921 | |
| 2922 Map<String, dynamic> toJson() { | |
| 2923 Map<String, dynamic> result = {}; | |
| 2924 result["id"] = id; | |
| 2925 result["results"] = results.map((SearchResult value) => value.toJson()).toLi
st(); | |
| 2926 result["isLast"] = isLast; | |
| 2927 return result; | |
| 2928 } | |
| 2929 | |
| 2930 Notification toNotification() { | |
| 2931 return new Notification("search.results", toJson()); | |
| 2932 } | |
| 2933 | |
| 2934 @override | |
| 2935 String toString() => JSON.encode(toJson()); | |
| 2936 | |
| 2937 @override | |
| 2938 bool operator==(other) { | |
| 2939 if (other is SearchResultsParams) { | |
| 2940 return id == other.id && | |
| 2941 _listEqual(results, other.results, (SearchResult a, SearchResult b) =>
a == b) && | |
| 2942 isLast == other.isLast; | |
| 2943 } | |
| 2944 return false; | |
| 2945 } | |
| 2946 | |
| 2947 @override | |
| 2948 int get hashCode { | |
| 2949 int hash = 0; | |
| 2950 hash = _JenkinsSmiHash.combine(hash, id.hashCode); | |
| 2951 hash = _JenkinsSmiHash.combine(hash, results.hashCode); | |
| 2952 hash = _JenkinsSmiHash.combine(hash, isLast.hashCode); | |
| 2953 return _JenkinsSmiHash.finish(hash); | |
| 2954 } | |
| 2955 } | |
| 2956 | |
| 2957 /** | |
| 2958 * edit.getAssists params | |
| 2959 * | |
| 2960 * { | |
| 2961 * "file": FilePath | |
| 2962 * "offset": int | |
| 2963 * "length": int | |
| 2964 * } | |
| 2965 */ | |
| 2966 class EditGetAssistsParams implements HasToJson { | |
| 2967 /** | |
| 2968 * The file containing the code for which assists are being requested. | |
| 2969 */ | |
| 2970 String file; | |
| 2971 | |
| 2972 /** | |
| 2973 * The offset of the code for which assists are being requested. | |
| 2974 */ | |
| 2975 int offset; | |
| 2976 | |
| 2977 /** | |
| 2978 * The length of the code for which assists are being requested. | |
| 2979 */ | |
| 2980 int length; | |
| 2981 | |
| 2982 EditGetAssistsParams(this.file, this.offset, this.length); | |
| 2983 | |
| 2984 factory EditGetAssistsParams.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 2985 if (json == null) { | |
| 2986 json = {}; | |
| 2987 } | |
| 2988 if (json is Map) { | |
| 2989 String file; | |
| 2990 if (json.containsKey("file")) { | |
| 2991 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 2992 } else { | |
| 2993 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 2994 } | |
| 2995 int offset; | |
| 2996 if (json.containsKey("offset")) { | |
| 2997 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 2998 } else { | |
| 2999 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 3000 } | |
| 3001 int length; | |
| 3002 if (json.containsKey("length")) { | |
| 3003 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 3004 } else { | |
| 3005 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 3006 } | |
| 3007 return new EditGetAssistsParams(file, offset, length); | |
| 3008 } else { | |
| 3009 throw jsonDecoder.mismatch(jsonPath, "edit.getAssists params"); | |
| 3010 } | |
| 3011 } | |
| 3012 | |
| 3013 factory EditGetAssistsParams.fromRequest(Request request) { | |
| 3014 return new EditGetAssistsParams.fromJson( | |
| 3015 new RequestDecoder(request), "params", request._params); | |
| 3016 } | |
| 3017 | |
| 3018 Map<String, dynamic> toJson() { | |
| 3019 Map<String, dynamic> result = {}; | |
| 3020 result["file"] = file; | |
| 3021 result["offset"] = offset; | |
| 3022 result["length"] = length; | |
| 3023 return result; | |
| 3024 } | |
| 3025 | |
| 3026 Request toRequest(String id) { | |
| 3027 return new Request(id, "edit.getAssists", toJson()); | |
| 3028 } | |
| 3029 | |
| 3030 @override | |
| 3031 String toString() => JSON.encode(toJson()); | |
| 3032 | |
| 3033 @override | |
| 3034 bool operator==(other) { | |
| 3035 if (other is EditGetAssistsParams) { | |
| 3036 return file == other.file && | |
| 3037 offset == other.offset && | |
| 3038 length == other.length; | |
| 3039 } | |
| 3040 return false; | |
| 3041 } | |
| 3042 | |
| 3043 @override | |
| 3044 int get hashCode { | |
| 3045 int hash = 0; | |
| 3046 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 3047 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 3048 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 3049 return _JenkinsSmiHash.finish(hash); | |
| 3050 } | |
| 3051 } | |
| 3052 | |
| 3053 /** | |
| 3054 * edit.getAssists result | |
| 3055 * | |
| 3056 * { | |
| 3057 * "assists": List<SourceChange> | |
| 3058 * } | |
| 3059 */ | |
| 3060 class EditGetAssistsResult implements HasToJson { | |
| 3061 /** | |
| 3062 * The assists that are available at the given location. | |
| 3063 */ | |
| 3064 List<SourceChange> assists; | |
| 3065 | |
| 3066 EditGetAssistsResult(this.assists); | |
| 3067 | |
| 3068 factory EditGetAssistsResult.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 3069 if (json == null) { | |
| 3070 json = {}; | |
| 3071 } | |
| 3072 if (json is Map) { | |
| 3073 List<SourceChange> assists; | |
| 3074 if (json.containsKey("assists")) { | |
| 3075 assists = jsonDecoder._decodeList(jsonPath + ".assists", json["assists"]
, (String jsonPath, Object json) => new SourceChange.fromJson(jsonDecoder, jsonP
ath, json)); | |
| 3076 } else { | |
| 3077 throw jsonDecoder.missingKey(jsonPath, "assists"); | |
| 3078 } | |
| 3079 return new EditGetAssistsResult(assists); | |
| 3080 } else { | |
| 3081 throw jsonDecoder.mismatch(jsonPath, "edit.getAssists result"); | |
| 3082 } | |
| 3083 } | |
| 3084 | |
| 3085 factory EditGetAssistsResult.fromResponse(Response response) { | |
| 3086 return new EditGetAssistsResult.fromJson( | |
| 3087 new ResponseDecoder(response), "result", response._result); | |
| 3088 } | |
| 3089 | |
| 3090 Map<String, dynamic> toJson() { | |
| 3091 Map<String, dynamic> result = {}; | |
| 3092 result["assists"] = assists.map((SourceChange value) => value.toJson()).toLi
st(); | |
| 3093 return result; | |
| 3094 } | |
| 3095 | |
| 3096 Response toResponse(String id) { | |
| 3097 return new Response(id, result: toJson()); | |
| 3098 } | |
| 3099 | |
| 3100 @override | |
| 3101 String toString() => JSON.encode(toJson()); | |
| 3102 | |
| 3103 @override | |
| 3104 bool operator==(other) { | |
| 3105 if (other is EditGetAssistsResult) { | |
| 3106 return _listEqual(assists, other.assists, (SourceChange a, SourceChange b)
=> a == b); | |
| 3107 } | |
| 3108 return false; | |
| 3109 } | |
| 3110 | |
| 3111 @override | |
| 3112 int get hashCode { | |
| 3113 int hash = 0; | |
| 3114 hash = _JenkinsSmiHash.combine(hash, assists.hashCode); | |
| 3115 return _JenkinsSmiHash.finish(hash); | |
| 3116 } | |
| 3117 } | |
| 3118 | |
| 3119 /** | |
| 3120 * edit.getAvailableRefactorings params | |
| 3121 * | |
| 3122 * { | |
| 3123 * "file": FilePath | |
| 3124 * "offset": int | |
| 3125 * "length": int | |
| 3126 * } | |
| 3127 */ | |
| 3128 class EditGetAvailableRefactoringsParams implements HasToJson { | |
| 3129 /** | |
| 3130 * The file containing the code on which the refactoring would be based. | |
| 3131 */ | |
| 3132 String file; | |
| 3133 | |
| 3134 /** | |
| 3135 * The offset of the code on which the refactoring would be based. | |
| 3136 */ | |
| 3137 int offset; | |
| 3138 | |
| 3139 /** | |
| 3140 * The length of the code on which the refactoring would be based. | |
| 3141 */ | |
| 3142 int length; | |
| 3143 | |
| 3144 EditGetAvailableRefactoringsParams(this.file, this.offset, this.length); | |
| 3145 | |
| 3146 factory EditGetAvailableRefactoringsParams.fromJson(JsonDecoder jsonDecoder, S
tring jsonPath, Object json) { | |
| 3147 if (json == null) { | |
| 3148 json = {}; | |
| 3149 } | |
| 3150 if (json is Map) { | |
| 3151 String file; | |
| 3152 if (json.containsKey("file")) { | |
| 3153 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 3154 } else { | |
| 3155 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 3156 } | |
| 3157 int offset; | |
| 3158 if (json.containsKey("offset")) { | |
| 3159 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 3160 } else { | |
| 3161 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 3162 } | |
| 3163 int length; | |
| 3164 if (json.containsKey("length")) { | |
| 3165 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 3166 } else { | |
| 3167 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 3168 } | |
| 3169 return new EditGetAvailableRefactoringsParams(file, offset, length); | |
| 3170 } else { | |
| 3171 throw jsonDecoder.mismatch(jsonPath, "edit.getAvailableRefactorings params
"); | |
| 3172 } | |
| 3173 } | |
| 3174 | |
| 3175 factory EditGetAvailableRefactoringsParams.fromRequest(Request request) { | |
| 3176 return new EditGetAvailableRefactoringsParams.fromJson( | |
| 3177 new RequestDecoder(request), "params", request._params); | |
| 3178 } | |
| 3179 | |
| 3180 Map<String, dynamic> toJson() { | |
| 3181 Map<String, dynamic> result = {}; | |
| 3182 result["file"] = file; | |
| 3183 result["offset"] = offset; | |
| 3184 result["length"] = length; | |
| 3185 return result; | |
| 3186 } | |
| 3187 | |
| 3188 Request toRequest(String id) { | |
| 3189 return new Request(id, "edit.getAvailableRefactorings", toJson()); | |
| 3190 } | |
| 3191 | |
| 3192 @override | |
| 3193 String toString() => JSON.encode(toJson()); | |
| 3194 | |
| 3195 @override | |
| 3196 bool operator==(other) { | |
| 3197 if (other is EditGetAvailableRefactoringsParams) { | |
| 3198 return file == other.file && | |
| 3199 offset == other.offset && | |
| 3200 length == other.length; | |
| 3201 } | |
| 3202 return false; | |
| 3203 } | |
| 3204 | |
| 3205 @override | |
| 3206 int get hashCode { | |
| 3207 int hash = 0; | |
| 3208 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 3209 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 3210 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 3211 return _JenkinsSmiHash.finish(hash); | |
| 3212 } | |
| 3213 } | |
| 3214 | |
| 3215 /** | |
| 3216 * edit.getAvailableRefactorings result | |
| 3217 * | |
| 3218 * { | |
| 3219 * "kinds": List<RefactoringKind> | |
| 3220 * } | |
| 3221 */ | |
| 3222 class EditGetAvailableRefactoringsResult implements HasToJson { | |
| 3223 /** | |
| 3224 * The kinds of refactorings that are valid for the given selection. | |
| 3225 */ | |
| 3226 List<RefactoringKind> kinds; | |
| 3227 | |
| 3228 EditGetAvailableRefactoringsResult(this.kinds); | |
| 3229 | |
| 3230 factory EditGetAvailableRefactoringsResult.fromJson(JsonDecoder jsonDecoder, S
tring jsonPath, Object json) { | |
| 3231 if (json == null) { | |
| 3232 json = {}; | |
| 3233 } | |
| 3234 if (json is Map) { | |
| 3235 List<RefactoringKind> kinds; | |
| 3236 if (json.containsKey("kinds")) { | |
| 3237 kinds = jsonDecoder._decodeList(jsonPath + ".kinds", json["kinds"], (Str
ing jsonPath, Object json) => new RefactoringKind.fromJson(jsonDecoder, jsonPath
, json)); | |
| 3238 } else { | |
| 3239 throw jsonDecoder.missingKey(jsonPath, "kinds"); | |
| 3240 } | |
| 3241 return new EditGetAvailableRefactoringsResult(kinds); | |
| 3242 } else { | |
| 3243 throw jsonDecoder.mismatch(jsonPath, "edit.getAvailableRefactorings result
"); | |
| 3244 } | |
| 3245 } | |
| 3246 | |
| 3247 factory EditGetAvailableRefactoringsResult.fromResponse(Response response) { | |
| 3248 return new EditGetAvailableRefactoringsResult.fromJson( | |
| 3249 new ResponseDecoder(response), "result", response._result); | |
| 3250 } | |
| 3251 | |
| 3252 Map<String, dynamic> toJson() { | |
| 3253 Map<String, dynamic> result = {}; | |
| 3254 result["kinds"] = kinds.map((RefactoringKind value) => value.toJson()).toLis
t(); | |
| 3255 return result; | |
| 3256 } | |
| 3257 | |
| 3258 Response toResponse(String id) { | |
| 3259 return new Response(id, result: toJson()); | |
| 3260 } | |
| 3261 | |
| 3262 @override | |
| 3263 String toString() => JSON.encode(toJson()); | |
| 3264 | |
| 3265 @override | |
| 3266 bool operator==(other) { | |
| 3267 if (other is EditGetAvailableRefactoringsResult) { | |
| 3268 return _listEqual(kinds, other.kinds, (RefactoringKind a, RefactoringKind
b) => a == b); | |
| 3269 } | |
| 3270 return false; | |
| 3271 } | |
| 3272 | |
| 3273 @override | |
| 3274 int get hashCode { | |
| 3275 int hash = 0; | |
| 3276 hash = _JenkinsSmiHash.combine(hash, kinds.hashCode); | |
| 3277 return _JenkinsSmiHash.finish(hash); | |
| 3278 } | |
| 3279 } | |
| 3280 | |
| 3281 /** | |
| 3282 * edit.getFixes params | |
| 3283 * | |
| 3284 * { | |
| 3285 * "file": FilePath | |
| 3286 * "offset": int | |
| 3287 * } | |
| 3288 */ | |
| 3289 class EditGetFixesParams implements HasToJson { | |
| 3290 /** | |
| 3291 * The file containing the errors for which fixes are being requested. | |
| 3292 */ | |
| 3293 String file; | |
| 3294 | |
| 3295 /** | |
| 3296 * The offset used to select the errors for which fixes will be returned. | |
| 3297 */ | |
| 3298 int offset; | |
| 3299 | |
| 3300 EditGetFixesParams(this.file, this.offset); | |
| 3301 | |
| 3302 factory EditGetFixesParams.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 3303 if (json == null) { | |
| 3304 json = {}; | |
| 3305 } | |
| 3306 if (json is Map) { | |
| 3307 String file; | |
| 3308 if (json.containsKey("file")) { | |
| 3309 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 3310 } else { | |
| 3311 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 3312 } | |
| 3313 int offset; | |
| 3314 if (json.containsKey("offset")) { | |
| 3315 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 3316 } else { | |
| 3317 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 3318 } | |
| 3319 return new EditGetFixesParams(file, offset); | |
| 3320 } else { | |
| 3321 throw jsonDecoder.mismatch(jsonPath, "edit.getFixes params"); | |
| 3322 } | |
| 3323 } | |
| 3324 | |
| 3325 factory EditGetFixesParams.fromRequest(Request request) { | |
| 3326 return new EditGetFixesParams.fromJson( | |
| 3327 new RequestDecoder(request), "params", request._params); | |
| 3328 } | |
| 3329 | |
| 3330 Map<String, dynamic> toJson() { | |
| 3331 Map<String, dynamic> result = {}; | |
| 3332 result["file"] = file; | |
| 3333 result["offset"] = offset; | |
| 3334 return result; | |
| 3335 } | |
| 3336 | |
| 3337 Request toRequest(String id) { | |
| 3338 return new Request(id, "edit.getFixes", toJson()); | |
| 3339 } | |
| 3340 | |
| 3341 @override | |
| 3342 String toString() => JSON.encode(toJson()); | |
| 3343 | |
| 3344 @override | |
| 3345 bool operator==(other) { | |
| 3346 if (other is EditGetFixesParams) { | |
| 3347 return file == other.file && | |
| 3348 offset == other.offset; | |
| 3349 } | |
| 3350 return false; | |
| 3351 } | |
| 3352 | |
| 3353 @override | |
| 3354 int get hashCode { | |
| 3355 int hash = 0; | |
| 3356 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 3357 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 3358 return _JenkinsSmiHash.finish(hash); | |
| 3359 } | |
| 3360 } | |
| 3361 | |
| 3362 /** | |
| 3363 * edit.getFixes result | |
| 3364 * | |
| 3365 * { | |
| 3366 * "fixes": List<AnalysisErrorFixes> | |
| 3367 * } | |
| 3368 */ | |
| 3369 class EditGetFixesResult implements HasToJson { | |
| 3370 /** | |
| 3371 * The fixes that are available for the errors at the given offset. | |
| 3372 */ | |
| 3373 List<AnalysisErrorFixes> fixes; | |
| 3374 | |
| 3375 EditGetFixesResult(this.fixes); | |
| 3376 | |
| 3377 factory EditGetFixesResult.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 3378 if (json == null) { | |
| 3379 json = {}; | |
| 3380 } | |
| 3381 if (json is Map) { | |
| 3382 List<AnalysisErrorFixes> fixes; | |
| 3383 if (json.containsKey("fixes")) { | |
| 3384 fixes = jsonDecoder._decodeList(jsonPath + ".fixes", json["fixes"], (Str
ing jsonPath, Object json) => new AnalysisErrorFixes.fromJson(jsonDecoder, jsonP
ath, json)); | |
| 3385 } else { | |
| 3386 throw jsonDecoder.missingKey(jsonPath, "fixes"); | |
| 3387 } | |
| 3388 return new EditGetFixesResult(fixes); | |
| 3389 } else { | |
| 3390 throw jsonDecoder.mismatch(jsonPath, "edit.getFixes result"); | |
| 3391 } | |
| 3392 } | |
| 3393 | |
| 3394 factory EditGetFixesResult.fromResponse(Response response) { | |
| 3395 return new EditGetFixesResult.fromJson( | |
| 3396 new ResponseDecoder(response), "result", response._result); | |
| 3397 } | |
| 3398 | |
| 3399 Map<String, dynamic> toJson() { | |
| 3400 Map<String, dynamic> result = {}; | |
| 3401 result["fixes"] = fixes.map((AnalysisErrorFixes value) => value.toJson()).to
List(); | |
| 3402 return result; | |
| 3403 } | |
| 3404 | |
| 3405 Response toResponse(String id) { | |
| 3406 return new Response(id, result: toJson()); | |
| 3407 } | |
| 3408 | |
| 3409 @override | |
| 3410 String toString() => JSON.encode(toJson()); | |
| 3411 | |
| 3412 @override | |
| 3413 bool operator==(other) { | |
| 3414 if (other is EditGetFixesResult) { | |
| 3415 return _listEqual(fixes, other.fixes, (AnalysisErrorFixes a, AnalysisError
Fixes b) => a == b); | |
| 3416 } | |
| 3417 return false; | |
| 3418 } | |
| 3419 | |
| 3420 @override | |
| 3421 int get hashCode { | |
| 3422 int hash = 0; | |
| 3423 hash = _JenkinsSmiHash.combine(hash, fixes.hashCode); | |
| 3424 return _JenkinsSmiHash.finish(hash); | |
| 3425 } | |
| 3426 } | |
| 3427 | |
| 3428 /** | |
| 3429 * edit.getRefactoring params | |
| 3430 * | |
| 3431 * { | |
| 3432 * "kind": RefactoringKind | |
| 3433 * "file": FilePath | |
| 3434 * "offset": int | |
| 3435 * "length": int | |
| 3436 * "validateOnly": bool | |
| 3437 * "options": optional RefactoringOptions | |
| 3438 * } | |
| 3439 */ | |
| 3440 class EditGetRefactoringParams implements HasToJson { | |
| 3441 /** | |
| 3442 * The kind of refactoring to be performed. | |
| 3443 */ | |
| 3444 RefactoringKind kind; | |
| 3445 | |
| 3446 /** | |
| 3447 * The file containing the code involved in the refactoring. | |
| 3448 */ | |
| 3449 String file; | |
| 3450 | |
| 3451 /** | |
| 3452 * The offset of the region involved in the refactoring. | |
| 3453 */ | |
| 3454 int offset; | |
| 3455 | |
| 3456 /** | |
| 3457 * The length of the region involved in the refactoring. | |
| 3458 */ | |
| 3459 int length; | |
| 3460 | |
| 3461 /** | |
| 3462 * True if the client is only requesting that the values of the options be | |
| 3463 * validated and no change be generated. | |
| 3464 */ | |
| 3465 bool validateOnly; | |
| 3466 | |
| 3467 /** | |
| 3468 * Data used to provide values provided by the user. The structure of the | |
| 3469 * data is dependent on the kind of refactoring being performed. The data | |
| 3470 * that is expected is documented in the section titled Refactorings, labeled | |
| 3471 * as “Options”. This field can be omitted if the refactoring does not | |
| 3472 * require any options or if the values of those options are not known. | |
| 3473 */ | |
| 3474 RefactoringOptions options; | |
| 3475 | |
| 3476 EditGetRefactoringParams(this.kind, this.file, this.offset, this.length, this.
validateOnly, {this.options}); | |
| 3477 | |
| 3478 factory EditGetRefactoringParams.fromJson(JsonDecoder jsonDecoder, String json
Path, Object json) { | |
| 3479 if (json == null) { | |
| 3480 json = {}; | |
| 3481 } | |
| 3482 if (json is Map) { | |
| 3483 RefactoringKind kind; | |
| 3484 if (json.containsKey("kind")) { | |
| 3485 kind = new RefactoringKind.fromJson(jsonDecoder, jsonPath + ".kind", jso
n["kind"]); | |
| 3486 } else { | |
| 3487 throw jsonDecoder.missingKey(jsonPath, "kind"); | |
| 3488 } | |
| 3489 String file; | |
| 3490 if (json.containsKey("file")) { | |
| 3491 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 3492 } else { | |
| 3493 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 3494 } | |
| 3495 int offset; | |
| 3496 if (json.containsKey("offset")) { | |
| 3497 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 3498 } else { | |
| 3499 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 3500 } | |
| 3501 int length; | |
| 3502 if (json.containsKey("length")) { | |
| 3503 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 3504 } else { | |
| 3505 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 3506 } | |
| 3507 bool validateOnly; | |
| 3508 if (json.containsKey("validateOnly")) { | |
| 3509 validateOnly = jsonDecoder._decodeBool(jsonPath + ".validateOnly", json[
"validateOnly"]); | |
| 3510 } else { | |
| 3511 throw jsonDecoder.missingKey(jsonPath, "validateOnly"); | |
| 3512 } | |
| 3513 RefactoringOptions options; | |
| 3514 if (json.containsKey("options")) { | |
| 3515 options = new RefactoringOptions.fromJson(jsonDecoder, jsonPath + ".opti
ons", json["options"], kind); | |
| 3516 } | |
| 3517 return new EditGetRefactoringParams(kind, file, offset, length, validateOn
ly, options: options); | |
| 3518 } else { | |
| 3519 throw jsonDecoder.mismatch(jsonPath, "edit.getRefactoring params"); | |
| 3520 } | |
| 3521 } | |
| 3522 | |
| 3523 factory EditGetRefactoringParams.fromRequest(Request request) { | |
| 3524 var params = new EditGetRefactoringParams.fromJson( | |
| 3525 new RequestDecoder(request), "params", request._params); | |
| 3526 REQUEST_ID_REFACTORING_KINDS[request.id] = params.kind; | |
| 3527 return params; | |
| 3528 } | |
| 3529 | |
| 3530 Map<String, dynamic> toJson() { | |
| 3531 Map<String, dynamic> result = {}; | |
| 3532 result["kind"] = kind.toJson(); | |
| 3533 result["file"] = file; | |
| 3534 result["offset"] = offset; | |
| 3535 result["length"] = length; | |
| 3536 result["validateOnly"] = validateOnly; | |
| 3537 if (options != null) { | |
| 3538 result["options"] = options.toJson(); | |
| 3539 } | |
| 3540 return result; | |
| 3541 } | |
| 3542 | |
| 3543 Request toRequest(String id) { | |
| 3544 return new Request(id, "edit.getRefactoring", toJson()); | |
| 3545 } | |
| 3546 | |
| 3547 @override | |
| 3548 String toString() => JSON.encode(toJson()); | |
| 3549 | |
| 3550 @override | |
| 3551 bool operator==(other) { | |
| 3552 if (other is EditGetRefactoringParams) { | |
| 3553 return kind == other.kind && | |
| 3554 file == other.file && | |
| 3555 offset == other.offset && | |
| 3556 length == other.length && | |
| 3557 validateOnly == other.validateOnly && | |
| 3558 options == other.options; | |
| 3559 } | |
| 3560 return false; | |
| 3561 } | |
| 3562 | |
| 3563 @override | |
| 3564 int get hashCode { | |
| 3565 int hash = 0; | |
| 3566 hash = _JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 3567 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 3568 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 3569 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 3570 hash = _JenkinsSmiHash.combine(hash, validateOnly.hashCode); | |
| 3571 hash = _JenkinsSmiHash.combine(hash, options.hashCode); | |
| 3572 return _JenkinsSmiHash.finish(hash); | |
| 3573 } | |
| 3574 } | |
| 3575 | |
| 3576 /** | |
| 3577 * edit.getRefactoring result | |
| 3578 * | |
| 3579 * { | |
| 3580 * "initialProblems": List<RefactoringProblem> | |
| 3581 * "optionsProblems": List<RefactoringProblem> | |
| 3582 * "finalProblems": List<RefactoringProblem> | |
| 3583 * "feedback": optional RefactoringFeedback | |
| 3584 * "change": optional SourceChange | |
| 3585 * "potentialEdits": optional List<String> | |
| 3586 * } | |
| 3587 */ | |
| 3588 class EditGetRefactoringResult implements HasToJson { | |
| 3589 /** | |
| 3590 * The initial status of the refactoring, i.e. problems related to the | |
| 3591 * context in which the refactoring is requested. The array will be empty if | |
| 3592 * there are no known problems. | |
| 3593 */ | |
| 3594 List<RefactoringProblem> initialProblems; | |
| 3595 | |
| 3596 /** | |
| 3597 * The options validation status, i.e. problems in the given options, such as | |
| 3598 * light-weight validation of a new name, flags compatibility, etc. The array | |
| 3599 * will be empty if there are no known problems. | |
| 3600 */ | |
| 3601 List<RefactoringProblem> optionsProblems; | |
| 3602 | |
| 3603 /** | |
| 3604 * The final status of the refactoring, i.e. problems identified in the | |
| 3605 * result of a full, potentially expensive validation and / or change | |
| 3606 * creation. The array will be empty if there are no known problems. | |
| 3607 */ | |
| 3608 List<RefactoringProblem> finalProblems; | |
| 3609 | |
| 3610 /** | |
| 3611 * Data used to provide feedback to the user. The structure of the data is | |
| 3612 * dependent on the kind of refactoring being created. The data that is | |
| 3613 * returned is documented in the section titled Refactorings, labeled as | |
| 3614 * “Feedback”. | |
| 3615 */ | |
| 3616 RefactoringFeedback feedback; | |
| 3617 | |
| 3618 /** | |
| 3619 * The changes that are to be applied to affect the refactoring. This field | |
| 3620 * will be omitted if there are problems that prevent a set of changes from | |
| 3621 * being computed, such as having no options specified for a refactoring that | |
| 3622 * requires them, or if only validation was requested. | |
| 3623 */ | |
| 3624 SourceChange change; | |
| 3625 | |
| 3626 /** | |
| 3627 * The ids of source edits that are not known to be valid. An edit is not | |
| 3628 * known to be valid if there was insufficient type information for the | |
| 3629 * server to be able to determine whether or not the code needs to be | |
| 3630 * modified, such as when a member is being renamed and there is a reference | |
| 3631 * to a member from an unknown type. This field will be omitted if the change | |
| 3632 * field is omitted or if there are no potential edits for the refactoring. | |
| 3633 */ | |
| 3634 List<String> potentialEdits; | |
| 3635 | |
| 3636 EditGetRefactoringResult(this.initialProblems, this.optionsProblems, this.fina
lProblems, {this.feedback, this.change, this.potentialEdits}) { | |
| 3637 if (potentialEdits == null) { | |
| 3638 potentialEdits = <String>[]; | |
| 3639 } | |
| 3640 } | |
| 3641 | |
| 3642 factory EditGetRefactoringResult.fromJson(JsonDecoder jsonDecoder, String json
Path, Object json) { | |
| 3643 if (json == null) { | |
| 3644 json = {}; | |
| 3645 } | |
| 3646 if (json is Map) { | |
| 3647 List<RefactoringProblem> initialProblems; | |
| 3648 if (json.containsKey("initialProblems")) { | |
| 3649 initialProblems = jsonDecoder._decodeList(jsonPath + ".initialProblems",
json["initialProblems"], (String jsonPath, Object json) => new RefactoringProbl
em.fromJson(jsonDecoder, jsonPath, json)); | |
| 3650 } else { | |
| 3651 throw jsonDecoder.missingKey(jsonPath, "initialProblems"); | |
| 3652 } | |
| 3653 List<RefactoringProblem> optionsProblems; | |
| 3654 if (json.containsKey("optionsProblems")) { | |
| 3655 optionsProblems = jsonDecoder._decodeList(jsonPath + ".optionsProblems",
json["optionsProblems"], (String jsonPath, Object json) => new RefactoringProbl
em.fromJson(jsonDecoder, jsonPath, json)); | |
| 3656 } else { | |
| 3657 throw jsonDecoder.missingKey(jsonPath, "optionsProblems"); | |
| 3658 } | |
| 3659 List<RefactoringProblem> finalProblems; | |
| 3660 if (json.containsKey("finalProblems")) { | |
| 3661 finalProblems = jsonDecoder._decodeList(jsonPath + ".finalProblems", jso
n["finalProblems"], (String jsonPath, Object json) => new RefactoringProblem.fro
mJson(jsonDecoder, jsonPath, json)); | |
| 3662 } else { | |
| 3663 throw jsonDecoder.missingKey(jsonPath, "finalProblems"); | |
| 3664 } | |
| 3665 RefactoringFeedback feedback; | |
| 3666 if (json.containsKey("feedback")) { | |
| 3667 feedback = new RefactoringFeedback.fromJson(jsonDecoder, jsonPath + ".fe
edback", json["feedback"], json); | |
| 3668 } | |
| 3669 SourceChange change; | |
| 3670 if (json.containsKey("change")) { | |
| 3671 change = new SourceChange.fromJson(jsonDecoder, jsonPath + ".change", js
on["change"]); | |
| 3672 } | |
| 3673 List<String> potentialEdits; | |
| 3674 if (json.containsKey("potentialEdits")) { | |
| 3675 potentialEdits = jsonDecoder._decodeList(jsonPath + ".potentialEdits", j
son["potentialEdits"], jsonDecoder._decodeString); | |
| 3676 } else { | |
| 3677 potentialEdits = <String>[]; | |
| 3678 } | |
| 3679 return new EditGetRefactoringResult(initialProblems, optionsProblems, fina
lProblems, feedback: feedback, change: change, potentialEdits: potentialEdits); | |
| 3680 } else { | |
| 3681 throw jsonDecoder.mismatch(jsonPath, "edit.getRefactoring result"); | |
| 3682 } | |
| 3683 } | |
| 3684 | |
| 3685 factory EditGetRefactoringResult.fromResponse(Response response) { | |
| 3686 return new EditGetRefactoringResult.fromJson( | |
| 3687 new ResponseDecoder(response), "result", response._result); | |
| 3688 } | |
| 3689 | |
| 3690 Map<String, dynamic> toJson() { | |
| 3691 Map<String, dynamic> result = {}; | |
| 3692 result["initialProblems"] = initialProblems.map((RefactoringProblem value) =
> value.toJson()).toList(); | |
| 3693 result["optionsProblems"] = optionsProblems.map((RefactoringProblem value) =
> value.toJson()).toList(); | |
| 3694 result["finalProblems"] = finalProblems.map((RefactoringProblem value) => va
lue.toJson()).toList(); | |
| 3695 if (feedback != null) { | |
| 3696 result["feedback"] = feedback.toJson(); | |
| 3697 } | |
| 3698 if (change != null) { | |
| 3699 result["change"] = change.toJson(); | |
| 3700 } | |
| 3701 if (potentialEdits.isNotEmpty) { | |
| 3702 result["potentialEdits"] = potentialEdits; | |
| 3703 } | |
| 3704 return result; | |
| 3705 } | |
| 3706 | |
| 3707 Response toResponse(String id) { | |
| 3708 return new Response(id, result: toJson()); | |
| 3709 } | |
| 3710 | |
| 3711 @override | |
| 3712 String toString() => JSON.encode(toJson()); | |
| 3713 | |
| 3714 @override | |
| 3715 bool operator==(other) { | |
| 3716 if (other is EditGetRefactoringResult) { | |
| 3717 return _listEqual(initialProblems, other.initialProblems, (RefactoringProb
lem a, RefactoringProblem b) => a == b) && | |
| 3718 _listEqual(optionsProblems, other.optionsProblems, (RefactoringProblem
a, RefactoringProblem b) => a == b) && | |
| 3719 _listEqual(finalProblems, other.finalProblems, (RefactoringProblem a,
RefactoringProblem b) => a == b) && | |
| 3720 feedback == other.feedback && | |
| 3721 change == other.change && | |
| 3722 _listEqual(potentialEdits, other.potentialEdits, (String a, String b)
=> a == b); | |
| 3723 } | |
| 3724 return false; | |
| 3725 } | |
| 3726 | |
| 3727 @override | |
| 3728 int get hashCode { | |
| 3729 int hash = 0; | |
| 3730 hash = _JenkinsSmiHash.combine(hash, initialProblems.hashCode); | |
| 3731 hash = _JenkinsSmiHash.combine(hash, optionsProblems.hashCode); | |
| 3732 hash = _JenkinsSmiHash.combine(hash, finalProblems.hashCode); | |
| 3733 hash = _JenkinsSmiHash.combine(hash, feedback.hashCode); | |
| 3734 hash = _JenkinsSmiHash.combine(hash, change.hashCode); | |
| 3735 hash = _JenkinsSmiHash.combine(hash, potentialEdits.hashCode); | |
| 3736 return _JenkinsSmiHash.finish(hash); | |
| 3737 } | |
| 3738 } | |
| 3739 | |
| 3740 /** | |
| 3741 * execution.createContext params | |
| 3742 * | |
| 3743 * { | |
| 3744 * "contextRoot": FilePath | |
| 3745 * } | |
| 3746 */ | |
| 3747 class ExecutionCreateContextParams implements HasToJson { | |
| 3748 /** | |
| 3749 * The path of the Dart or HTML file that will be launched. | |
| 3750 */ | |
| 3751 String contextRoot; | |
| 3752 | |
| 3753 ExecutionCreateContextParams(this.contextRoot); | |
| 3754 | |
| 3755 factory ExecutionCreateContextParams.fromJson(JsonDecoder jsonDecoder, String
jsonPath, Object json) { | |
| 3756 if (json == null) { | |
| 3757 json = {}; | |
| 3758 } | |
| 3759 if (json is Map) { | |
| 3760 String contextRoot; | |
| 3761 if (json.containsKey("contextRoot")) { | |
| 3762 contextRoot = jsonDecoder._decodeString(jsonPath + ".contextRoot", json[
"contextRoot"]); | |
| 3763 } else { | |
| 3764 throw jsonDecoder.missingKey(jsonPath, "contextRoot"); | |
| 3765 } | |
| 3766 return new ExecutionCreateContextParams(contextRoot); | |
| 3767 } else { | |
| 3768 throw jsonDecoder.mismatch(jsonPath, "execution.createContext params"); | |
| 3769 } | |
| 3770 } | |
| 3771 | |
| 3772 factory ExecutionCreateContextParams.fromRequest(Request request) { | |
| 3773 return new ExecutionCreateContextParams.fromJson( | |
| 3774 new RequestDecoder(request), "params", request._params); | |
| 3775 } | |
| 3776 | |
| 3777 Map<String, dynamic> toJson() { | |
| 3778 Map<String, dynamic> result = {}; | |
| 3779 result["contextRoot"] = contextRoot; | |
| 3780 return result; | |
| 3781 } | |
| 3782 | |
| 3783 Request toRequest(String id) { | |
| 3784 return new Request(id, "execution.createContext", toJson()); | |
| 3785 } | |
| 3786 | |
| 3787 @override | |
| 3788 String toString() => JSON.encode(toJson()); | |
| 3789 | |
| 3790 @override | |
| 3791 bool operator==(other) { | |
| 3792 if (other is ExecutionCreateContextParams) { | |
| 3793 return contextRoot == other.contextRoot; | |
| 3794 } | |
| 3795 return false; | |
| 3796 } | |
| 3797 | |
| 3798 @override | |
| 3799 int get hashCode { | |
| 3800 int hash = 0; | |
| 3801 hash = _JenkinsSmiHash.combine(hash, contextRoot.hashCode); | |
| 3802 return _JenkinsSmiHash.finish(hash); | |
| 3803 } | |
| 3804 } | |
| 3805 | |
| 3806 /** | |
| 3807 * execution.createContext result | |
| 3808 * | |
| 3809 * { | |
| 3810 * "id": ExecutionContextId | |
| 3811 * } | |
| 3812 */ | |
| 3813 class ExecutionCreateContextResult implements HasToJson { | |
| 3814 /** | |
| 3815 * The identifier used to refer to the execution context that was created. | |
| 3816 */ | |
| 3817 String id; | |
| 3818 | |
| 3819 ExecutionCreateContextResult(this.id); | |
| 3820 | |
| 3821 factory ExecutionCreateContextResult.fromJson(JsonDecoder jsonDecoder, String
jsonPath, Object json) { | |
| 3822 if (json == null) { | |
| 3823 json = {}; | |
| 3824 } | |
| 3825 if (json is Map) { | |
| 3826 String id; | |
| 3827 if (json.containsKey("id")) { | |
| 3828 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); | |
| 3829 } else { | |
| 3830 throw jsonDecoder.missingKey(jsonPath, "id"); | |
| 3831 } | |
| 3832 return new ExecutionCreateContextResult(id); | |
| 3833 } else { | |
| 3834 throw jsonDecoder.mismatch(jsonPath, "execution.createContext result"); | |
| 3835 } | |
| 3836 } | |
| 3837 | |
| 3838 factory ExecutionCreateContextResult.fromResponse(Response response) { | |
| 3839 return new ExecutionCreateContextResult.fromJson( | |
| 3840 new ResponseDecoder(response), "result", response._result); | |
| 3841 } | |
| 3842 | |
| 3843 Map<String, dynamic> toJson() { | |
| 3844 Map<String, dynamic> result = {}; | |
| 3845 result["id"] = id; | |
| 3846 return result; | |
| 3847 } | |
| 3848 | |
| 3849 Response toResponse(String id) { | |
| 3850 return new Response(id, result: toJson()); | |
| 3851 } | |
| 3852 | |
| 3853 @override | |
| 3854 String toString() => JSON.encode(toJson()); | |
| 3855 | |
| 3856 @override | |
| 3857 bool operator==(other) { | |
| 3858 if (other is ExecutionCreateContextResult) { | |
| 3859 return id == other.id; | |
| 3860 } | |
| 3861 return false; | |
| 3862 } | |
| 3863 | |
| 3864 @override | |
| 3865 int get hashCode { | |
| 3866 int hash = 0; | |
| 3867 hash = _JenkinsSmiHash.combine(hash, id.hashCode); | |
| 3868 return _JenkinsSmiHash.finish(hash); | |
| 3869 } | |
| 3870 } | |
| 3871 | |
| 3872 /** | |
| 3873 * execution.deleteContext params | |
| 3874 * | |
| 3875 * { | |
| 3876 * "id": ExecutionContextId | |
| 3877 * } | |
| 3878 */ | |
| 3879 class ExecutionDeleteContextParams implements HasToJson { | |
| 3880 /** | |
| 3881 * The identifier of the execution context that is to be deleted. | |
| 3882 */ | |
| 3883 String id; | |
| 3884 | |
| 3885 ExecutionDeleteContextParams(this.id); | |
| 3886 | |
| 3887 factory ExecutionDeleteContextParams.fromJson(JsonDecoder jsonDecoder, String
jsonPath, Object json) { | |
| 3888 if (json == null) { | |
| 3889 json = {}; | |
| 3890 } | |
| 3891 if (json is Map) { | |
| 3892 String id; | |
| 3893 if (json.containsKey("id")) { | |
| 3894 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); | |
| 3895 } else { | |
| 3896 throw jsonDecoder.missingKey(jsonPath, "id"); | |
| 3897 } | |
| 3898 return new ExecutionDeleteContextParams(id); | |
| 3899 } else { | |
| 3900 throw jsonDecoder.mismatch(jsonPath, "execution.deleteContext params"); | |
| 3901 } | |
| 3902 } | |
| 3903 | |
| 3904 factory ExecutionDeleteContextParams.fromRequest(Request request) { | |
| 3905 return new ExecutionDeleteContextParams.fromJson( | |
| 3906 new RequestDecoder(request), "params", request._params); | |
| 3907 } | |
| 3908 | |
| 3909 Map<String, dynamic> toJson() { | |
| 3910 Map<String, dynamic> result = {}; | |
| 3911 result["id"] = id; | |
| 3912 return result; | |
| 3913 } | |
| 3914 | |
| 3915 Request toRequest(String id) { | |
| 3916 return new Request(id, "execution.deleteContext", toJson()); | |
| 3917 } | |
| 3918 | |
| 3919 @override | |
| 3920 String toString() => JSON.encode(toJson()); | |
| 3921 | |
| 3922 @override | |
| 3923 bool operator==(other) { | |
| 3924 if (other is ExecutionDeleteContextParams) { | |
| 3925 return id == other.id; | |
| 3926 } | |
| 3927 return false; | |
| 3928 } | |
| 3929 | |
| 3930 @override | |
| 3931 int get hashCode { | |
| 3932 int hash = 0; | |
| 3933 hash = _JenkinsSmiHash.combine(hash, id.hashCode); | |
| 3934 return _JenkinsSmiHash.finish(hash); | |
| 3935 } | |
| 3936 } | |
| 3937 /** | |
| 3938 * execution.deleteContext result | |
| 3939 */ | |
| 3940 class ExecutionDeleteContextResult { | |
| 3941 Response toResponse(String id) { | |
| 3942 return new Response(id, result: null); | |
| 3943 } | |
| 3944 | |
| 3945 @override | |
| 3946 bool operator==(other) { | |
| 3947 if (other is ExecutionDeleteContextResult) { | |
| 3948 return true; | |
| 3949 } | |
| 3950 return false; | |
| 3951 } | |
| 3952 | |
| 3953 @override | |
| 3954 int get hashCode { | |
| 3955 return 479954425; | |
| 3956 } | |
| 3957 } | |
| 3958 | |
| 3959 /** | |
| 3960 * execution.mapUri params | |
| 3961 * | |
| 3962 * { | |
| 3963 * "id": ExecutionContextId | |
| 3964 * "file": optional FilePath | |
| 3965 * "uri": optional String | |
| 3966 * } | |
| 3967 */ | |
| 3968 class ExecutionMapUriParams implements HasToJson { | |
| 3969 /** | |
| 3970 * The identifier of the execution context in which the URI is to be mapped. | |
| 3971 */ | |
| 3972 String id; | |
| 3973 | |
| 3974 /** | |
| 3975 * The path of the file to be mapped into a URI. | |
| 3976 */ | |
| 3977 String file; | |
| 3978 | |
| 3979 /** | |
| 3980 * The URI to be mapped into a file path. | |
| 3981 */ | |
| 3982 String uri; | |
| 3983 | |
| 3984 ExecutionMapUriParams(this.id, {this.file, this.uri}); | |
| 3985 | |
| 3986 factory ExecutionMapUriParams.fromJson(JsonDecoder jsonDecoder, String jsonPat
h, Object json) { | |
| 3987 if (json == null) { | |
| 3988 json = {}; | |
| 3989 } | |
| 3990 if (json is Map) { | |
| 3991 String id; | |
| 3992 if (json.containsKey("id")) { | |
| 3993 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); | |
| 3994 } else { | |
| 3995 throw jsonDecoder.missingKey(jsonPath, "id"); | |
| 3996 } | |
| 3997 String file; | |
| 3998 if (json.containsKey("file")) { | |
| 3999 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 4000 } | |
| 4001 String uri; | |
| 4002 if (json.containsKey("uri")) { | |
| 4003 uri = jsonDecoder._decodeString(jsonPath + ".uri", json["uri"]); | |
| 4004 } | |
| 4005 return new ExecutionMapUriParams(id, file: file, uri: uri); | |
| 4006 } else { | |
| 4007 throw jsonDecoder.mismatch(jsonPath, "execution.mapUri params"); | |
| 4008 } | |
| 4009 } | |
| 4010 | |
| 4011 factory ExecutionMapUriParams.fromRequest(Request request) { | |
| 4012 return new ExecutionMapUriParams.fromJson( | |
| 4013 new RequestDecoder(request), "params", request._params); | |
| 4014 } | |
| 4015 | |
| 4016 Map<String, dynamic> toJson() { | |
| 4017 Map<String, dynamic> result = {}; | |
| 4018 result["id"] = id; | |
| 4019 if (file != null) { | |
| 4020 result["file"] = file; | |
| 4021 } | |
| 4022 if (uri != null) { | |
| 4023 result["uri"] = uri; | |
| 4024 } | |
| 4025 return result; | |
| 4026 } | |
| 4027 | |
| 4028 Request toRequest(String id) { | |
| 4029 return new Request(id, "execution.mapUri", toJson()); | |
| 4030 } | |
| 4031 | |
| 4032 @override | |
| 4033 String toString() => JSON.encode(toJson()); | |
| 4034 | |
| 4035 @override | |
| 4036 bool operator==(other) { | |
| 4037 if (other is ExecutionMapUriParams) { | |
| 4038 return id == other.id && | |
| 4039 file == other.file && | |
| 4040 uri == other.uri; | |
| 4041 } | |
| 4042 return false; | |
| 4043 } | |
| 4044 | |
| 4045 @override | |
| 4046 int get hashCode { | |
| 4047 int hash = 0; | |
| 4048 hash = _JenkinsSmiHash.combine(hash, id.hashCode); | |
| 4049 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 4050 hash = _JenkinsSmiHash.combine(hash, uri.hashCode); | |
| 4051 return _JenkinsSmiHash.finish(hash); | |
| 4052 } | |
| 4053 } | |
| 4054 | |
| 4055 /** | |
| 4056 * execution.mapUri result | |
| 4057 * | |
| 4058 * { | |
| 4059 * "file": optional FilePath | |
| 4060 * "uri": optional String | |
| 4061 * } | |
| 4062 */ | |
| 4063 class ExecutionMapUriResult implements HasToJson { | |
| 4064 /** | |
| 4065 * The file to which the URI was mapped. This field is omitted if the uri | |
| 4066 * field was not given in the request. | |
| 4067 */ | |
| 4068 String file; | |
| 4069 | |
| 4070 /** | |
| 4071 * The URI to which the file path was mapped. This field is omitted if the | |
| 4072 * file field was not given in the request. | |
| 4073 */ | |
| 4074 String uri; | |
| 4075 | |
| 4076 ExecutionMapUriResult({this.file, this.uri}); | |
| 4077 | |
| 4078 factory ExecutionMapUriResult.fromJson(JsonDecoder jsonDecoder, String jsonPat
h, Object json) { | |
| 4079 if (json == null) { | |
| 4080 json = {}; | |
| 4081 } | |
| 4082 if (json is Map) { | |
| 4083 String file; | |
| 4084 if (json.containsKey("file")) { | |
| 4085 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 4086 } | |
| 4087 String uri; | |
| 4088 if (json.containsKey("uri")) { | |
| 4089 uri = jsonDecoder._decodeString(jsonPath + ".uri", json["uri"]); | |
| 4090 } | |
| 4091 return new ExecutionMapUriResult(file: file, uri: uri); | |
| 4092 } else { | |
| 4093 throw jsonDecoder.mismatch(jsonPath, "execution.mapUri result"); | |
| 4094 } | |
| 4095 } | |
| 4096 | |
| 4097 factory ExecutionMapUriResult.fromResponse(Response response) { | |
| 4098 return new ExecutionMapUriResult.fromJson( | |
| 4099 new ResponseDecoder(response), "result", response._result); | |
| 4100 } | |
| 4101 | |
| 4102 Map<String, dynamic> toJson() { | |
| 4103 Map<String, dynamic> result = {}; | |
| 4104 if (file != null) { | |
| 4105 result["file"] = file; | |
| 4106 } | |
| 4107 if (uri != null) { | |
| 4108 result["uri"] = uri; | |
| 4109 } | |
| 4110 return result; | |
| 4111 } | |
| 4112 | |
| 4113 Response toResponse(String id) { | |
| 4114 return new Response(id, result: toJson()); | |
| 4115 } | |
| 4116 | |
| 4117 @override | |
| 4118 String toString() => JSON.encode(toJson()); | |
| 4119 | |
| 4120 @override | |
| 4121 bool operator==(other) { | |
| 4122 if (other is ExecutionMapUriResult) { | |
| 4123 return file == other.file && | |
| 4124 uri == other.uri; | |
| 4125 } | |
| 4126 return false; | |
| 4127 } | |
| 4128 | |
| 4129 @override | |
| 4130 int get hashCode { | |
| 4131 int hash = 0; | |
| 4132 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 4133 hash = _JenkinsSmiHash.combine(hash, uri.hashCode); | |
| 4134 return _JenkinsSmiHash.finish(hash); | |
| 4135 } | |
| 4136 } | |
| 4137 | |
| 4138 /** | |
| 4139 * execution.setSubscriptions params | |
| 4140 * | |
| 4141 * { | |
| 4142 * "subscriptions": List<ExecutionService> | |
| 4143 * } | |
| 4144 */ | |
| 4145 class ExecutionSetSubscriptionsParams implements HasToJson { | |
| 4146 /** | |
| 4147 * A list of the services being subscribed to. | |
| 4148 */ | |
| 4149 List<ExecutionService> subscriptions; | |
| 4150 | |
| 4151 ExecutionSetSubscriptionsParams(this.subscriptions); | |
| 4152 | |
| 4153 factory ExecutionSetSubscriptionsParams.fromJson(JsonDecoder jsonDecoder, Stri
ng jsonPath, Object json) { | |
| 4154 if (json == null) { | |
| 4155 json = {}; | |
| 4156 } | |
| 4157 if (json is Map) { | |
| 4158 List<ExecutionService> subscriptions; | |
| 4159 if (json.containsKey("subscriptions")) { | |
| 4160 subscriptions = jsonDecoder._decodeList(jsonPath + ".subscriptions", jso
n["subscriptions"], (String jsonPath, Object json) => new ExecutionService.fromJ
son(jsonDecoder, jsonPath, json)); | |
| 4161 } else { | |
| 4162 throw jsonDecoder.missingKey(jsonPath, "subscriptions"); | |
| 4163 } | |
| 4164 return new ExecutionSetSubscriptionsParams(subscriptions); | |
| 4165 } else { | |
| 4166 throw jsonDecoder.mismatch(jsonPath, "execution.setSubscriptions params"); | |
| 4167 } | |
| 4168 } | |
| 4169 | |
| 4170 factory ExecutionSetSubscriptionsParams.fromRequest(Request request) { | |
| 4171 return new ExecutionSetSubscriptionsParams.fromJson( | |
| 4172 new RequestDecoder(request), "params", request._params); | |
| 4173 } | |
| 4174 | |
| 4175 Map<String, dynamic> toJson() { | |
| 4176 Map<String, dynamic> result = {}; | |
| 4177 result["subscriptions"] = subscriptions.map((ExecutionService value) => valu
e.toJson()).toList(); | |
| 4178 return result; | |
| 4179 } | |
| 4180 | |
| 4181 Request toRequest(String id) { | |
| 4182 return new Request(id, "execution.setSubscriptions", toJson()); | |
| 4183 } | |
| 4184 | |
| 4185 @override | |
| 4186 String toString() => JSON.encode(toJson()); | |
| 4187 | |
| 4188 @override | |
| 4189 bool operator==(other) { | |
| 4190 if (other is ExecutionSetSubscriptionsParams) { | |
| 4191 return _listEqual(subscriptions, other.subscriptions, (ExecutionService a,
ExecutionService b) => a == b); | |
| 4192 } | |
| 4193 return false; | |
| 4194 } | |
| 4195 | |
| 4196 @override | |
| 4197 int get hashCode { | |
| 4198 int hash = 0; | |
| 4199 hash = _JenkinsSmiHash.combine(hash, subscriptions.hashCode); | |
| 4200 return _JenkinsSmiHash.finish(hash); | |
| 4201 } | |
| 4202 } | |
| 4203 /** | |
| 4204 * execution.setSubscriptions result | |
| 4205 */ | |
| 4206 class ExecutionSetSubscriptionsResult { | |
| 4207 Response toResponse(String id) { | |
| 4208 return new Response(id, result: null); | |
| 4209 } | |
| 4210 | |
| 4211 @override | |
| 4212 bool operator==(other) { | |
| 4213 if (other is ExecutionSetSubscriptionsResult) { | |
| 4214 return true; | |
| 4215 } | |
| 4216 return false; | |
| 4217 } | |
| 4218 | |
| 4219 @override | |
| 4220 int get hashCode { | |
| 4221 return 287678780; | |
| 4222 } | |
| 4223 } | |
| 4224 | |
| 4225 /** | |
| 4226 * execution.launchData params | |
| 4227 * | |
| 4228 * { | |
| 4229 * "executables": List<ExecutableFile> | |
| 4230 * "dartToHtml": Map<FilePath, List<FilePath>> | |
| 4231 * "htmlToDart": Map<FilePath, List<FilePath>> | |
| 4232 * } | |
| 4233 */ | |
| 4234 class ExecutionLaunchDataParams implements HasToJson { | |
| 4235 /** | |
| 4236 * A list of the files that are executable. This list replaces any previous | |
| 4237 * list provided. | |
| 4238 */ | |
| 4239 List<ExecutableFile> executables; | |
| 4240 | |
| 4241 /** | |
| 4242 * A mapping from the paths of Dart files that are referenced by HTML files | |
| 4243 * to a list of the HTML files that reference the Dart files. | |
| 4244 */ | |
| 4245 Map<String, List<String>> dartToHtml; | |
| 4246 | |
| 4247 /** | |
| 4248 * A mapping from the paths of HTML files that reference Dart files to a list | |
| 4249 * of the Dart files they reference. | |
| 4250 */ | |
| 4251 Map<String, List<String>> htmlToDart; | |
| 4252 | |
| 4253 ExecutionLaunchDataParams(this.executables, this.dartToHtml, this.htmlToDart); | |
| 4254 | |
| 4255 factory ExecutionLaunchDataParams.fromJson(JsonDecoder jsonDecoder, String jso
nPath, Object json) { | |
| 4256 if (json == null) { | |
| 4257 json = {}; | |
| 4258 } | |
| 4259 if (json is Map) { | |
| 4260 List<ExecutableFile> executables; | |
| 4261 if (json.containsKey("executables")) { | |
| 4262 executables = jsonDecoder._decodeList(jsonPath + ".executables", json["e
xecutables"], (String jsonPath, Object json) => new ExecutableFile.fromJson(json
Decoder, jsonPath, json)); | |
| 4263 } else { | |
| 4264 throw jsonDecoder.missingKey(jsonPath, "executables"); | |
| 4265 } | |
| 4266 Map<String, List<String>> dartToHtml; | |
| 4267 if (json.containsKey("dartToHtml")) { | |
| 4268 dartToHtml = jsonDecoder._decodeMap(jsonPath + ".dartToHtml", json["dart
ToHtml"], valueDecoder: (String jsonPath, Object json) => jsonDecoder._decodeLis
t(jsonPath, json, jsonDecoder._decodeString)); | |
| 4269 } else { | |
| 4270 throw jsonDecoder.missingKey(jsonPath, "dartToHtml"); | |
| 4271 } | |
| 4272 Map<String, List<String>> htmlToDart; | |
| 4273 if (json.containsKey("htmlToDart")) { | |
| 4274 htmlToDart = jsonDecoder._decodeMap(jsonPath + ".htmlToDart", json["html
ToDart"], valueDecoder: (String jsonPath, Object json) => jsonDecoder._decodeLis
t(jsonPath, json, jsonDecoder._decodeString)); | |
| 4275 } else { | |
| 4276 throw jsonDecoder.missingKey(jsonPath, "htmlToDart"); | |
| 4277 } | |
| 4278 return new ExecutionLaunchDataParams(executables, dartToHtml, htmlToDart); | |
| 4279 } else { | |
| 4280 throw jsonDecoder.mismatch(jsonPath, "execution.launchData params"); | |
| 4281 } | |
| 4282 } | |
| 4283 | |
| 4284 factory ExecutionLaunchDataParams.fromNotification(Notification notification)
{ | |
| 4285 return new ExecutionLaunchDataParams.fromJson( | |
| 4286 new ResponseDecoder(null), "params", notification._params); | |
| 4287 } | |
| 4288 | |
| 4289 Map<String, dynamic> toJson() { | |
| 4290 Map<String, dynamic> result = {}; | |
| 4291 result["executables"] = executables.map((ExecutableFile value) => value.toJs
on()).toList(); | |
| 4292 result["dartToHtml"] = dartToHtml; | |
| 4293 result["htmlToDart"] = htmlToDart; | |
| 4294 return result; | |
| 4295 } | |
| 4296 | |
| 4297 Notification toNotification() { | |
| 4298 return new Notification("execution.launchData", toJson()); | |
| 4299 } | |
| 4300 | |
| 4301 @override | |
| 4302 String toString() => JSON.encode(toJson()); | |
| 4303 | |
| 4304 @override | |
| 4305 bool operator==(other) { | |
| 4306 if (other is ExecutionLaunchDataParams) { | |
| 4307 return _listEqual(executables, other.executables, (ExecutableFile a, Execu
tableFile b) => a == b) && | |
| 4308 _mapEqual(dartToHtml, other.dartToHtml, (List<String> a, List<String>
b) => _listEqual(a, b, (String a, String b) => a == b)) && | |
| 4309 _mapEqual(htmlToDart, other.htmlToDart, (List<String> a, List<String>
b) => _listEqual(a, b, (String a, String b) => a == b)); | |
| 4310 } | |
| 4311 return false; | |
| 4312 } | |
| 4313 | |
| 4314 @override | |
| 4315 int get hashCode { | |
| 4316 int hash = 0; | |
| 4317 hash = _JenkinsSmiHash.combine(hash, executables.hashCode); | |
| 4318 hash = _JenkinsSmiHash.combine(hash, dartToHtml.hashCode); | |
| 4319 hash = _JenkinsSmiHash.combine(hash, htmlToDart.hashCode); | |
| 4320 return _JenkinsSmiHash.finish(hash); | |
| 4321 } | |
| 4322 } | |
| 4323 | |
| 4324 /** | |
| 4325 * AddContentOverlay | |
| 4326 * | |
| 4327 * { | |
| 4328 * "type": "add" | |
| 4329 * "content": String | |
| 4330 * } | |
| 4331 */ | |
| 4332 class AddContentOverlay implements HasToJson { | |
| 4333 /** | |
| 4334 * The new content of the file. | |
| 4335 */ | |
| 4336 String content; | |
| 4337 | |
| 4338 AddContentOverlay(this.content); | |
| 4339 | |
| 4340 factory AddContentOverlay.fromJson(JsonDecoder jsonDecoder, String jsonPath, O
bject json) { | |
| 4341 if (json == null) { | |
| 4342 json = {}; | |
| 4343 } | |
| 4344 if (json is Map) { | |
| 4345 if (json["type"] != "add") { | |
| 4346 throw jsonDecoder.mismatch(jsonPath, "equal " + "add"); | |
| 4347 } | |
| 4348 String content; | |
| 4349 if (json.containsKey("content")) { | |
| 4350 content = jsonDecoder._decodeString(jsonPath + ".content", json["content
"]); | |
| 4351 } else { | |
| 4352 throw jsonDecoder.missingKey(jsonPath, "content"); | |
| 4353 } | |
| 4354 return new AddContentOverlay(content); | |
| 4355 } else { | |
| 4356 throw jsonDecoder.mismatch(jsonPath, "AddContentOverlay"); | |
| 4357 } | |
| 4358 } | |
| 4359 | |
| 4360 Map<String, dynamic> toJson() { | |
| 4361 Map<String, dynamic> result = {}; | |
| 4362 result["type"] = "add"; | |
| 4363 result["content"] = content; | |
| 4364 return result; | |
| 4365 } | |
| 4366 | |
| 4367 @override | |
| 4368 String toString() => JSON.encode(toJson()); | |
| 4369 | |
| 4370 @override | |
| 4371 bool operator==(other) { | |
| 4372 if (other is AddContentOverlay) { | |
| 4373 return content == other.content; | |
| 4374 } | |
| 4375 return false; | |
| 4376 } | |
| 4377 | |
| 4378 @override | |
| 4379 int get hashCode { | |
| 4380 int hash = 0; | |
| 4381 hash = _JenkinsSmiHash.combine(hash, 704418402); | |
| 4382 hash = _JenkinsSmiHash.combine(hash, content.hashCode); | |
| 4383 return _JenkinsSmiHash.finish(hash); | |
| 4384 } | |
| 4385 } | |
| 4386 | |
| 4387 /** | |
| 4388 * AnalysisError | |
| 4389 * | |
| 4390 * { | |
| 4391 * "severity": AnalysisErrorSeverity | |
| 4392 * "type": AnalysisErrorType | |
| 4393 * "location": Location | |
| 4394 * "message": String | |
| 4395 * "correction": optional String | |
| 4396 * } | |
| 4397 */ | |
| 4398 class AnalysisError implements HasToJson { | |
| 4399 | |
| 4400 /** | |
| 4401 * The severity of the error. | |
| 4402 */ | |
| 4403 AnalysisErrorSeverity severity; | |
| 4404 | |
| 4405 /** | |
| 4406 * The type of the error. | |
| 4407 */ | |
| 4408 AnalysisErrorType type; | |
| 4409 | |
| 4410 /** | |
| 4411 * The location associated with the error. | |
| 4412 */ | |
| 4413 Location location; | |
| 4414 | |
| 4415 /** | |
| 4416 * The message to be displayed for this error. The message should indicate | |
| 4417 * what is wrong with the code and why it is wrong. | |
| 4418 */ | |
| 4419 String message; | |
| 4420 | |
| 4421 /** | |
| 4422 * The correction message to be displayed for this error. The correction | |
| 4423 * message should indicate how the user can fix the error. The field is | |
| 4424 * omitted if there is no correction message associated with the error code. | |
| 4425 */ | |
| 4426 String correction; | |
| 4427 | |
| 4428 AnalysisError(this.severity, this.type, this.location, this.message, {this.cor
rection}); | |
| 4429 | |
| 4430 factory AnalysisError.fromJson(JsonDecoder jsonDecoder, String jsonPath, Objec
t json) { | |
| 4431 if (json == null) { | |
| 4432 json = {}; | |
| 4433 } | |
| 4434 if (json is Map) { | |
| 4435 AnalysisErrorSeverity severity; | |
| 4436 if (json.containsKey("severity")) { | |
| 4437 severity = new AnalysisErrorSeverity.fromJson(jsonDecoder, jsonPath + ".
severity", json["severity"]); | |
| 4438 } else { | |
| 4439 throw jsonDecoder.missingKey(jsonPath, "severity"); | |
| 4440 } | |
| 4441 AnalysisErrorType type; | |
| 4442 if (json.containsKey("type")) { | |
| 4443 type = new AnalysisErrorType.fromJson(jsonDecoder, jsonPath + ".type", j
son["type"]); | |
| 4444 } else { | |
| 4445 throw jsonDecoder.missingKey(jsonPath, "type"); | |
| 4446 } | |
| 4447 Location location; | |
| 4448 if (json.containsKey("location")) { | |
| 4449 location = new Location.fromJson(jsonDecoder, jsonPath + ".location", js
on["location"]); | |
| 4450 } else { | |
| 4451 throw jsonDecoder.missingKey(jsonPath, "location"); | |
| 4452 } | |
| 4453 String message; | |
| 4454 if (json.containsKey("message")) { | |
| 4455 message = jsonDecoder._decodeString(jsonPath + ".message", json["message
"]); | |
| 4456 } else { | |
| 4457 throw jsonDecoder.missingKey(jsonPath, "message"); | |
| 4458 } | |
| 4459 String correction; | |
| 4460 if (json.containsKey("correction")) { | |
| 4461 correction = jsonDecoder._decodeString(jsonPath + ".correction", json["c
orrection"]); | |
| 4462 } | |
| 4463 return new AnalysisError(severity, type, location, message, correction: co
rrection); | |
| 4464 } else { | |
| 4465 throw jsonDecoder.mismatch(jsonPath, "AnalysisError"); | |
| 4466 } | |
| 4467 } | |
| 4468 | |
| 4469 Map<String, dynamic> toJson() { | |
| 4470 Map<String, dynamic> result = {}; | |
| 4471 result["severity"] = severity.toJson(); | |
| 4472 result["type"] = type.toJson(); | |
| 4473 result["location"] = location.toJson(); | |
| 4474 result["message"] = message; | |
| 4475 if (correction != null) { | |
| 4476 result["correction"] = correction; | |
| 4477 } | |
| 4478 return result; | |
| 4479 } | |
| 4480 | |
| 4481 @override | |
| 4482 String toString() => JSON.encode(toJson()); | |
| 4483 | |
| 4484 @override | |
| 4485 bool operator==(other) { | |
| 4486 if (other is AnalysisError) { | |
| 4487 return severity == other.severity && | |
| 4488 type == other.type && | |
| 4489 location == other.location && | |
| 4490 message == other.message && | |
| 4491 correction == other.correction; | |
| 4492 } | |
| 4493 return false; | |
| 4494 } | |
| 4495 | |
| 4496 @override | |
| 4497 int get hashCode { | |
| 4498 int hash = 0; | |
| 4499 hash = _JenkinsSmiHash.combine(hash, severity.hashCode); | |
| 4500 hash = _JenkinsSmiHash.combine(hash, type.hashCode); | |
| 4501 hash = _JenkinsSmiHash.combine(hash, location.hashCode); | |
| 4502 hash = _JenkinsSmiHash.combine(hash, message.hashCode); | |
| 4503 hash = _JenkinsSmiHash.combine(hash, correction.hashCode); | |
| 4504 return _JenkinsSmiHash.finish(hash); | |
| 4505 } | |
| 4506 } | |
| 4507 | |
| 4508 /** | |
| 4509 * AnalysisErrorFixes | |
| 4510 * | |
| 4511 * { | |
| 4512 * "error": AnalysisError | |
| 4513 * "fixes": List<SourceChange> | |
| 4514 * } | |
| 4515 */ | |
| 4516 class AnalysisErrorFixes implements HasToJson { | |
| 4517 /** | |
| 4518 * The error with which the fixes are associated. | |
| 4519 */ | |
| 4520 AnalysisError error; | |
| 4521 | |
| 4522 /** | |
| 4523 * The fixes associated with the error. | |
| 4524 */ | |
| 4525 List<SourceChange> fixes; | |
| 4526 | |
| 4527 AnalysisErrorFixes(this.error, {this.fixes}) { | |
| 4528 if (fixes == null) { | |
| 4529 fixes = <SourceChange>[]; | |
| 4530 } | |
| 4531 } | |
| 4532 | |
| 4533 factory AnalysisErrorFixes.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 4534 if (json == null) { | |
| 4535 json = {}; | |
| 4536 } | |
| 4537 if (json is Map) { | |
| 4538 AnalysisError error; | |
| 4539 if (json.containsKey("error")) { | |
| 4540 error = new AnalysisError.fromJson(jsonDecoder, jsonPath + ".error", jso
n["error"]); | |
| 4541 } else { | |
| 4542 throw jsonDecoder.missingKey(jsonPath, "error"); | |
| 4543 } | |
| 4544 List<SourceChange> fixes; | |
| 4545 if (json.containsKey("fixes")) { | |
| 4546 fixes = jsonDecoder._decodeList(jsonPath + ".fixes", json["fixes"], (Str
ing jsonPath, Object json) => new SourceChange.fromJson(jsonDecoder, jsonPath, j
son)); | |
| 4547 } else { | |
| 4548 throw jsonDecoder.missingKey(jsonPath, "fixes"); | |
| 4549 } | |
| 4550 return new AnalysisErrorFixes(error, fixes: fixes); | |
| 4551 } else { | |
| 4552 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorFixes"); | |
| 4553 } | |
| 4554 } | |
| 4555 | |
| 4556 Map<String, dynamic> toJson() { | |
| 4557 Map<String, dynamic> result = {}; | |
| 4558 result["error"] = error.toJson(); | |
| 4559 result["fixes"] = fixes.map((SourceChange value) => value.toJson()).toList()
; | |
| 4560 return result; | |
| 4561 } | |
| 4562 | |
| 4563 @override | |
| 4564 String toString() => JSON.encode(toJson()); | |
| 4565 | |
| 4566 @override | |
| 4567 bool operator==(other) { | |
| 4568 if (other is AnalysisErrorFixes) { | |
| 4569 return error == other.error && | |
| 4570 _listEqual(fixes, other.fixes, (SourceChange a, SourceChange b) => a =
= b); | |
| 4571 } | |
| 4572 return false; | |
| 4573 } | |
| 4574 | |
| 4575 @override | |
| 4576 int get hashCode { | |
| 4577 int hash = 0; | |
| 4578 hash = _JenkinsSmiHash.combine(hash, error.hashCode); | |
| 4579 hash = _JenkinsSmiHash.combine(hash, fixes.hashCode); | |
| 4580 return _JenkinsSmiHash.finish(hash); | |
| 4581 } | |
| 4582 } | |
| 4583 | |
| 4584 /** | |
| 4585 * AnalysisErrorSeverity | |
| 4586 * | |
| 4587 * enum { | |
| 4588 * INFO | |
| 4589 * WARNING | |
| 4590 * ERROR | |
| 4591 * } | |
| 4592 */ | |
| 4593 class AnalysisErrorSeverity { | |
| 4594 static const INFO = const AnalysisErrorSeverity._("INFO"); | |
| 4595 | |
| 4596 static const WARNING = const AnalysisErrorSeverity._("WARNING"); | |
| 4597 | |
| 4598 static const ERROR = const AnalysisErrorSeverity._("ERROR"); | |
| 4599 | |
| 4600 final String name; | |
| 4601 | |
| 4602 const AnalysisErrorSeverity._(this.name); | |
| 4603 | |
| 4604 factory AnalysisErrorSeverity(String name) { | |
| 4605 switch (name) { | |
| 4606 case "INFO": | |
| 4607 return INFO; | |
| 4608 case "WARNING": | |
| 4609 return WARNING; | |
| 4610 case "ERROR": | |
| 4611 return ERROR; | |
| 4612 } | |
| 4613 throw new Exception('Illegal enum value: $name'); | |
| 4614 } | |
| 4615 | |
| 4616 factory AnalysisErrorSeverity.fromJson(JsonDecoder jsonDecoder, String jsonPat
h, Object json) { | |
| 4617 if (json is String) { | |
| 4618 try { | |
| 4619 return new AnalysisErrorSeverity(json); | |
| 4620 } catch(_) { | |
| 4621 // Fall through | |
| 4622 } | |
| 4623 } | |
| 4624 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorSeverity"); | |
| 4625 } | |
| 4626 | |
| 4627 @override | |
| 4628 String toString() => "AnalysisErrorSeverity.$name"; | |
| 4629 | |
| 4630 String toJson() => name; | |
| 4631 } | |
| 4632 | |
| 4633 /** | |
| 4634 * AnalysisErrorType | |
| 4635 * | |
| 4636 * enum { | |
| 4637 * ANGULAR | |
| 4638 * COMPILE_TIME_ERROR | |
| 4639 * HINT | |
| 4640 * POLYMER | |
| 4641 * STATIC_TYPE_WARNING | |
| 4642 * STATIC_WARNING | |
| 4643 * SYNTACTIC_ERROR | |
| 4644 * TODO | |
| 4645 * } | |
| 4646 */ | |
| 4647 class AnalysisErrorType { | |
| 4648 static const ANGULAR = const AnalysisErrorType._("ANGULAR"); | |
| 4649 | |
| 4650 static const COMPILE_TIME_ERROR = const AnalysisErrorType._("COMPILE_TIME_ERRO
R"); | |
| 4651 | |
| 4652 static const HINT = const AnalysisErrorType._("HINT"); | |
| 4653 | |
| 4654 static const POLYMER = const AnalysisErrorType._("POLYMER"); | |
| 4655 | |
| 4656 static const STATIC_TYPE_WARNING = const AnalysisErrorType._("STATIC_TYPE_WARN
ING"); | |
| 4657 | |
| 4658 static const STATIC_WARNING = const AnalysisErrorType._("STATIC_WARNING"); | |
| 4659 | |
| 4660 static const SYNTACTIC_ERROR = const AnalysisErrorType._("SYNTACTIC_ERROR"); | |
| 4661 | |
| 4662 static const TODO = const AnalysisErrorType._("TODO"); | |
| 4663 | |
| 4664 final String name; | |
| 4665 | |
| 4666 const AnalysisErrorType._(this.name); | |
| 4667 | |
| 4668 factory AnalysisErrorType(String name) { | |
| 4669 switch (name) { | |
| 4670 case "ANGULAR": | |
| 4671 return ANGULAR; | |
| 4672 case "COMPILE_TIME_ERROR": | |
| 4673 return COMPILE_TIME_ERROR; | |
| 4674 case "HINT": | |
| 4675 return HINT; | |
| 4676 case "POLYMER": | |
| 4677 return POLYMER; | |
| 4678 case "STATIC_TYPE_WARNING": | |
| 4679 return STATIC_TYPE_WARNING; | |
| 4680 case "STATIC_WARNING": | |
| 4681 return STATIC_WARNING; | |
| 4682 case "SYNTACTIC_ERROR": | |
| 4683 return SYNTACTIC_ERROR; | |
| 4684 case "TODO": | |
| 4685 return TODO; | |
| 4686 } | |
| 4687 throw new Exception('Illegal enum value: $name'); | |
| 4688 } | |
| 4689 | |
| 4690 factory AnalysisErrorType.fromJson(JsonDecoder jsonDecoder, String jsonPath, O
bject json) { | |
| 4691 if (json is String) { | |
| 4692 try { | |
| 4693 return new AnalysisErrorType(json); | |
| 4694 } catch(_) { | |
| 4695 // Fall through | |
| 4696 } | |
| 4697 } | |
| 4698 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorType"); | |
| 4699 } | |
| 4700 | |
| 4701 @override | |
| 4702 String toString() => "AnalysisErrorType.$name"; | |
| 4703 | |
| 4704 String toJson() => name; | |
| 4705 } | |
| 4706 | |
| 4707 /** | |
| 4708 * AnalysisOptions | |
| 4709 * | |
| 4710 * { | |
| 4711 * "enableAsync": optional bool | |
| 4712 * "enableDeferredLoading": optional bool | |
| 4713 * "enableEnums": optional bool | |
| 4714 * "generateDart2jsHints": optional bool | |
| 4715 * "generateHints": optional bool | |
| 4716 * } | |
| 4717 */ | |
| 4718 class AnalysisOptions implements HasToJson { | |
| 4719 /** | |
| 4720 * True if the client wants to enable support for the proposed async feature. | |
| 4721 */ | |
| 4722 bool enableAsync; | |
| 4723 | |
| 4724 /** | |
| 4725 * True if the client wants to enable support for the proposed deferred | |
| 4726 * loading feature. | |
| 4727 */ | |
| 4728 bool enableDeferredLoading; | |
| 4729 | |
| 4730 /** | |
| 4731 * True if the client wants to enable support for the proposed enum feature. | |
| 4732 */ | |
| 4733 bool enableEnums; | |
| 4734 | |
| 4735 /** | |
| 4736 * True if hints that are specific to dart2js should be generated. This | |
| 4737 * option is ignored if generateHints is false. | |
| 4738 */ | |
| 4739 bool generateDart2jsHints; | |
| 4740 | |
| 4741 /** | |
| 4742 * True is hints should be generated as part of generating errors and | |
| 4743 * warnings. | |
| 4744 */ | |
| 4745 bool generateHints; | |
| 4746 | |
| 4747 AnalysisOptions({this.enableAsync, this.enableDeferredLoading, this.enableEnum
s, this.generateDart2jsHints, this.generateHints}); | |
| 4748 | |
| 4749 factory AnalysisOptions.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obj
ect json) { | |
| 4750 if (json == null) { | |
| 4751 json = {}; | |
| 4752 } | |
| 4753 if (json is Map) { | |
| 4754 bool enableAsync; | |
| 4755 if (json.containsKey("enableAsync")) { | |
| 4756 enableAsync = jsonDecoder._decodeBool(jsonPath + ".enableAsync", json["e
nableAsync"]); | |
| 4757 } | |
| 4758 bool enableDeferredLoading; | |
| 4759 if (json.containsKey("enableDeferredLoading")) { | |
| 4760 enableDeferredLoading = jsonDecoder._decodeBool(jsonPath + ".enableDefer
redLoading", json["enableDeferredLoading"]); | |
| 4761 } | |
| 4762 bool enableEnums; | |
| 4763 if (json.containsKey("enableEnums")) { | |
| 4764 enableEnums = jsonDecoder._decodeBool(jsonPath + ".enableEnums", json["e
nableEnums"]); | |
| 4765 } | |
| 4766 bool generateDart2jsHints; | |
| 4767 if (json.containsKey("generateDart2jsHints")) { | |
| 4768 generateDart2jsHints = jsonDecoder._decodeBool(jsonPath + ".generateDart
2jsHints", json["generateDart2jsHints"]); | |
| 4769 } | |
| 4770 bool generateHints; | |
| 4771 if (json.containsKey("generateHints")) { | |
| 4772 generateHints = jsonDecoder._decodeBool(jsonPath + ".generateHints", jso
n["generateHints"]); | |
| 4773 } | |
| 4774 return new AnalysisOptions(enableAsync: enableAsync, enableDeferredLoading
: enableDeferredLoading, enableEnums: enableEnums, generateDart2jsHints: generat
eDart2jsHints, generateHints: generateHints); | |
| 4775 } else { | |
| 4776 throw jsonDecoder.mismatch(jsonPath, "AnalysisOptions"); | |
| 4777 } | |
| 4778 } | |
| 4779 | |
| 4780 Map<String, dynamic> toJson() { | |
| 4781 Map<String, dynamic> result = {}; | |
| 4782 if (enableAsync != null) { | |
| 4783 result["enableAsync"] = enableAsync; | |
| 4784 } | |
| 4785 if (enableDeferredLoading != null) { | |
| 4786 result["enableDeferredLoading"] = enableDeferredLoading; | |
| 4787 } | |
| 4788 if (enableEnums != null) { | |
| 4789 result["enableEnums"] = enableEnums; | |
| 4790 } | |
| 4791 if (generateDart2jsHints != null) { | |
| 4792 result["generateDart2jsHints"] = generateDart2jsHints; | |
| 4793 } | |
| 4794 if (generateHints != null) { | |
| 4795 result["generateHints"] = generateHints; | |
| 4796 } | |
| 4797 return result; | |
| 4798 } | |
| 4799 | |
| 4800 @override | |
| 4801 String toString() => JSON.encode(toJson()); | |
| 4802 | |
| 4803 @override | |
| 4804 bool operator==(other) { | |
| 4805 if (other is AnalysisOptions) { | |
| 4806 return enableAsync == other.enableAsync && | |
| 4807 enableDeferredLoading == other.enableDeferredLoading && | |
| 4808 enableEnums == other.enableEnums && | |
| 4809 generateDart2jsHints == other.generateDart2jsHints && | |
| 4810 generateHints == other.generateHints; | |
| 4811 } | |
| 4812 return false; | |
| 4813 } | |
| 4814 | |
| 4815 @override | |
| 4816 int get hashCode { | |
| 4817 int hash = 0; | |
| 4818 hash = _JenkinsSmiHash.combine(hash, enableAsync.hashCode); | |
| 4819 hash = _JenkinsSmiHash.combine(hash, enableDeferredLoading.hashCode); | |
| 4820 hash = _JenkinsSmiHash.combine(hash, enableEnums.hashCode); | |
| 4821 hash = _JenkinsSmiHash.combine(hash, generateDart2jsHints.hashCode); | |
| 4822 hash = _JenkinsSmiHash.combine(hash, generateHints.hashCode); | |
| 4823 return _JenkinsSmiHash.finish(hash); | |
| 4824 } | |
| 4825 } | |
| 4826 | |
| 4827 /** | |
| 4828 * AnalysisService | |
| 4829 * | |
| 4830 * enum { | |
| 4831 * FOLDING | |
| 4832 * HIGHLIGHTS | |
| 4833 * NAVIGATION | |
| 4834 * OCCURRENCES | |
| 4835 * OUTLINE | |
| 4836 * OVERRIDES | |
| 4837 * } | |
| 4838 */ | |
| 4839 class AnalysisService { | |
| 4840 static const FOLDING = const AnalysisService._("FOLDING"); | |
| 4841 | |
| 4842 static const HIGHLIGHTS = const AnalysisService._("HIGHLIGHTS"); | |
| 4843 | |
| 4844 static const NAVIGATION = const AnalysisService._("NAVIGATION"); | |
| 4845 | |
| 4846 static const OCCURRENCES = const AnalysisService._("OCCURRENCES"); | |
| 4847 | |
| 4848 static const OUTLINE = const AnalysisService._("OUTLINE"); | |
| 4849 | |
| 4850 static const OVERRIDES = const AnalysisService._("OVERRIDES"); | |
| 4851 | |
| 4852 final String name; | |
| 4853 | |
| 4854 const AnalysisService._(this.name); | |
| 4855 | |
| 4856 factory AnalysisService(String name) { | |
| 4857 switch (name) { | |
| 4858 case "FOLDING": | |
| 4859 return FOLDING; | |
| 4860 case "HIGHLIGHTS": | |
| 4861 return HIGHLIGHTS; | |
| 4862 case "NAVIGATION": | |
| 4863 return NAVIGATION; | |
| 4864 case "OCCURRENCES": | |
| 4865 return OCCURRENCES; | |
| 4866 case "OUTLINE": | |
| 4867 return OUTLINE; | |
| 4868 case "OVERRIDES": | |
| 4869 return OVERRIDES; | |
| 4870 } | |
| 4871 throw new Exception('Illegal enum value: $name'); | |
| 4872 } | |
| 4873 | |
| 4874 factory AnalysisService.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obj
ect json) { | |
| 4875 if (json is String) { | |
| 4876 try { | |
| 4877 return new AnalysisService(json); | |
| 4878 } catch(_) { | |
| 4879 // Fall through | |
| 4880 } | |
| 4881 } | |
| 4882 throw jsonDecoder.mismatch(jsonPath, "AnalysisService"); | |
| 4883 } | |
| 4884 | |
| 4885 @override | |
| 4886 String toString() => "AnalysisService.$name"; | |
| 4887 | |
| 4888 String toJson() => name; | |
| 4889 } | |
| 4890 | |
| 4891 /** | |
| 4892 * AnalysisStatus | |
| 4893 * | |
| 4894 * { | |
| 4895 * "isAnalyzing": bool | |
| 4896 * "analysisTarget": optional String | |
| 4897 * } | |
| 4898 */ | |
| 4899 class AnalysisStatus implements HasToJson { | |
| 4900 /** | |
| 4901 * True if analysis is currently being performed. | |
| 4902 */ | |
| 4903 bool isAnalyzing; | |
| 4904 | |
| 4905 /** | |
| 4906 * The name of the current target of analysis. This field is omitted if | |
| 4907 * analyzing is false. | |
| 4908 */ | |
| 4909 String analysisTarget; | |
| 4910 | |
| 4911 AnalysisStatus(this.isAnalyzing, {this.analysisTarget}); | |
| 4912 | |
| 4913 factory AnalysisStatus.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obje
ct json) { | |
| 4914 if (json == null) { | |
| 4915 json = {}; | |
| 4916 } | |
| 4917 if (json is Map) { | |
| 4918 bool isAnalyzing; | |
| 4919 if (json.containsKey("isAnalyzing")) { | |
| 4920 isAnalyzing = jsonDecoder._decodeBool(jsonPath + ".isAnalyzing", json["i
sAnalyzing"]); | |
| 4921 } else { | |
| 4922 throw jsonDecoder.missingKey(jsonPath, "isAnalyzing"); | |
| 4923 } | |
| 4924 String analysisTarget; | |
| 4925 if (json.containsKey("analysisTarget")) { | |
| 4926 analysisTarget = jsonDecoder._decodeString(jsonPath + ".analysisTarget",
json["analysisTarget"]); | |
| 4927 } | |
| 4928 return new AnalysisStatus(isAnalyzing, analysisTarget: analysisTarget); | |
| 4929 } else { | |
| 4930 throw jsonDecoder.mismatch(jsonPath, "AnalysisStatus"); | |
| 4931 } | |
| 4932 } | |
| 4933 | |
| 4934 Map<String, dynamic> toJson() { | |
| 4935 Map<String, dynamic> result = {}; | |
| 4936 result["isAnalyzing"] = isAnalyzing; | |
| 4937 if (analysisTarget != null) { | |
| 4938 result["analysisTarget"] = analysisTarget; | |
| 4939 } | |
| 4940 return result; | |
| 4941 } | |
| 4942 | |
| 4943 @override | |
| 4944 String toString() => JSON.encode(toJson()); | |
| 4945 | |
| 4946 @override | |
| 4947 bool operator==(other) { | |
| 4948 if (other is AnalysisStatus) { | |
| 4949 return isAnalyzing == other.isAnalyzing && | |
| 4950 analysisTarget == other.analysisTarget; | |
| 4951 } | |
| 4952 return false; | |
| 4953 } | |
| 4954 | |
| 4955 @override | |
| 4956 int get hashCode { | |
| 4957 int hash = 0; | |
| 4958 hash = _JenkinsSmiHash.combine(hash, isAnalyzing.hashCode); | |
| 4959 hash = _JenkinsSmiHash.combine(hash, analysisTarget.hashCode); | |
| 4960 return _JenkinsSmiHash.finish(hash); | |
| 4961 } | |
| 4962 } | |
| 4963 | |
| 4964 /** | |
| 4965 * ChangeContentOverlay | |
| 4966 * | |
| 4967 * { | |
| 4968 * "type": "change" | |
| 4969 * "edits": List<SourceEdit> | |
| 4970 * } | |
| 4971 */ | |
| 4972 class ChangeContentOverlay implements HasToJson { | |
| 4973 /** | |
| 4974 * The edits to be applied to the file. | |
| 4975 */ | |
| 4976 List<SourceEdit> edits; | |
| 4977 | |
| 4978 ChangeContentOverlay(this.edits); | |
| 4979 | |
| 4980 factory ChangeContentOverlay.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 4981 if (json == null) { | |
| 4982 json = {}; | |
| 4983 } | |
| 4984 if (json is Map) { | |
| 4985 if (json["type"] != "change") { | |
| 4986 throw jsonDecoder.mismatch(jsonPath, "equal " + "change"); | |
| 4987 } | |
| 4988 List<SourceEdit> edits; | |
| 4989 if (json.containsKey("edits")) { | |
| 4990 edits = jsonDecoder._decodeList(jsonPath + ".edits", json["edits"], (Str
ing jsonPath, Object json) => new SourceEdit.fromJson(jsonDecoder, jsonPath, jso
n)); | |
| 4991 } else { | |
| 4992 throw jsonDecoder.missingKey(jsonPath, "edits"); | |
| 4993 } | |
| 4994 return new ChangeContentOverlay(edits); | |
| 4995 } else { | |
| 4996 throw jsonDecoder.mismatch(jsonPath, "ChangeContentOverlay"); | |
| 4997 } | |
| 4998 } | |
| 4999 | |
| 5000 Map<String, dynamic> toJson() { | |
| 5001 Map<String, dynamic> result = {}; | |
| 5002 result["type"] = "change"; | |
| 5003 result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList(); | |
| 5004 return result; | |
| 5005 } | |
| 5006 | |
| 5007 @override | |
| 5008 String toString() => JSON.encode(toJson()); | |
| 5009 | |
| 5010 @override | |
| 5011 bool operator==(other) { | |
| 5012 if (other is ChangeContentOverlay) { | |
| 5013 return _listEqual(edits, other.edits, (SourceEdit a, SourceEdit b) => a ==
b); | |
| 5014 } | |
| 5015 return false; | |
| 5016 } | |
| 5017 | |
| 5018 @override | |
| 5019 int get hashCode { | |
| 5020 int hash = 0; | |
| 5021 hash = _JenkinsSmiHash.combine(hash, 873118866); | |
| 5022 hash = _JenkinsSmiHash.combine(hash, edits.hashCode); | |
| 5023 return _JenkinsSmiHash.finish(hash); | |
| 5024 } | |
| 5025 } | |
| 5026 | |
| 5027 /** | |
| 5028 * CompletionRelevance | |
| 5029 * | |
| 5030 * enum { | |
| 5031 * LOW | |
| 5032 * DEFAULT | |
| 5033 * HIGH | |
| 5034 * } | |
| 5035 */ | |
| 5036 class CompletionRelevance { | |
| 5037 static const LOW = const CompletionRelevance._("LOW"); | |
| 5038 | |
| 5039 static const DEFAULT = const CompletionRelevance._("DEFAULT"); | |
| 5040 | |
| 5041 static const HIGH = const CompletionRelevance._("HIGH"); | |
| 5042 | |
| 5043 final String name; | |
| 5044 | |
| 5045 const CompletionRelevance._(this.name); | |
| 5046 | |
| 5047 factory CompletionRelevance(String name) { | |
| 5048 switch (name) { | |
| 5049 case "LOW": | |
| 5050 return LOW; | |
| 5051 case "DEFAULT": | |
| 5052 return DEFAULT; | |
| 5053 case "HIGH": | |
| 5054 return HIGH; | |
| 5055 } | |
| 5056 throw new Exception('Illegal enum value: $name'); | |
| 5057 } | |
| 5058 | |
| 5059 factory CompletionRelevance.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 5060 if (json is String) { | |
| 5061 try { | |
| 5062 return new CompletionRelevance(json); | |
| 5063 } catch(_) { | |
| 5064 // Fall through | |
| 5065 } | |
| 5066 } | |
| 5067 throw jsonDecoder.mismatch(jsonPath, "CompletionRelevance"); | |
| 5068 } | |
| 5069 | |
| 5070 @override | |
| 5071 String toString() => "CompletionRelevance.$name"; | |
| 5072 | |
| 5073 String toJson() => name; | |
| 5074 } | |
| 5075 | |
| 5076 /** | |
| 5077 * CompletionSuggestion | |
| 5078 * | |
| 5079 * { | |
| 5080 * "kind": CompletionSuggestionKind | |
| 5081 * "relevance": CompletionRelevance | |
| 5082 * "completion": String | |
| 5083 * "selectionOffset": int | |
| 5084 * "selectionLength": int | |
| 5085 * "isDeprecated": bool | |
| 5086 * "isPotential": bool | |
| 5087 * "docSummary": optional String | |
| 5088 * "docComplete": optional String | |
| 5089 * "declaringType": optional String | |
| 5090 * "element": optional Element | |
| 5091 * "returnType": optional String | |
| 5092 * "parameterNames": optional List<String> | |
| 5093 * "parameterTypes": optional List<String> | |
| 5094 * "requiredParameterCount": optional int | |
| 5095 * "positionalParameterCount": optional int | |
| 5096 * "parameterName": optional String | |
| 5097 * "parameterType": optional String | |
| 5098 * } | |
| 5099 */ | |
| 5100 class CompletionSuggestion implements HasToJson { | |
| 5101 /** | |
| 5102 * The kind of element being suggested. | |
| 5103 */ | |
| 5104 CompletionSuggestionKind kind; | |
| 5105 | |
| 5106 /** | |
| 5107 * The relevance of this completion suggestion. | |
| 5108 */ | |
| 5109 CompletionRelevance relevance; | |
| 5110 | |
| 5111 /** | |
| 5112 * The identifier to be inserted if the suggestion is selected. If the | |
| 5113 * suggestion is for a method or function, the client might want to | |
| 5114 * additionally insert a template for the parameters. The information | |
| 5115 * required in order to do so is contained in other fields. | |
| 5116 */ | |
| 5117 String completion; | |
| 5118 | |
| 5119 /** | |
| 5120 * The offset, relative to the beginning of the completion, of where the | |
| 5121 * selection should be placed after insertion. | |
| 5122 */ | |
| 5123 int selectionOffset; | |
| 5124 | |
| 5125 /** | |
| 5126 * The number of characters that should be selected after insertion. | |
| 5127 */ | |
| 5128 int selectionLength; | |
| 5129 | |
| 5130 /** | |
| 5131 * True if the suggested element is deprecated. | |
| 5132 */ | |
| 5133 bool isDeprecated; | |
| 5134 | |
| 5135 /** | |
| 5136 * True if the element is not known to be valid for the target. This happens | |
| 5137 * if the type of the target is dynamic. | |
| 5138 */ | |
| 5139 bool isPotential; | |
| 5140 | |
| 5141 /** | |
| 5142 * An abbreviated version of the Dartdoc associated with the element being | |
| 5143 * suggested, This field is omitted if there is no Dartdoc associated with | |
| 5144 * the element. | |
| 5145 */ | |
| 5146 String docSummary; | |
| 5147 | |
| 5148 /** | |
| 5149 * The Dartdoc associated with the element being suggested, This field is | |
| 5150 * omitted if there is no Dartdoc associated with the element. | |
| 5151 */ | |
| 5152 String docComplete; | |
| 5153 | |
| 5154 /** | |
| 5155 * The class that declares the element being suggested. This field is omitted | |
| 5156 * if the suggested element is not a member of a class. | |
| 5157 */ | |
| 5158 String declaringType; | |
| 5159 | |
| 5160 /** | |
| 5161 * Information about the element reference being suggested. | |
| 5162 */ | |
| 5163 Element element; | |
| 5164 | |
| 5165 /** | |
| 5166 * The return type of the getter, function or method being suggested. This | |
| 5167 * field is omitted if the suggested element is not a getter, function or | |
| 5168 * method. | |
| 5169 */ | |
| 5170 String returnType; | |
| 5171 | |
| 5172 /** | |
| 5173 * The names of the parameters of the function or method being suggested. | |
| 5174 * This field is omitted if the suggested element is not a setter, function | |
| 5175 * or method. | |
| 5176 */ | |
| 5177 List<String> parameterNames; | |
| 5178 | |
| 5179 /** | |
| 5180 * The types of the parameters of the function or method being suggested. | |
| 5181 * This field is omitted if the parameterNames field is omitted. | |
| 5182 */ | |
| 5183 List<String> parameterTypes; | |
| 5184 | |
| 5185 /** | |
| 5186 * The number of required parameters for the function or method being | |
| 5187 * suggested. This field is omitted if the parameterNames field is omitted. | |
| 5188 */ | |
| 5189 int requiredParameterCount; | |
| 5190 | |
| 5191 /** | |
| 5192 * The number of positional parameters for the function or method being | |
| 5193 * suggested. This field is omitted if the parameterNames field is omitted. | |
| 5194 */ | |
| 5195 int positionalParameterCount; | |
| 5196 | |
| 5197 /** | |
| 5198 * The name of the optional parameter being suggested. This field is omitted | |
| 5199 * if the suggestion is not the addition of an optional argument within an | |
| 5200 * argument list. | |
| 5201 */ | |
| 5202 String parameterName; | |
| 5203 | |
| 5204 /** | |
| 5205 * The type of the options parameter being suggested. This field is omitted | |
| 5206 * if the parameterName field is omitted. | |
| 5207 */ | |
| 5208 String parameterType; | |
| 5209 | |
| 5210 CompletionSuggestion(this.kind, this.relevance, this.completion, this.selectio
nOffset, this.selectionLength, this.isDeprecated, this.isPotential, {this.docSum
mary, this.docComplete, this.declaringType, this.element, this.returnType, this.
parameterNames, this.parameterTypes, this.requiredParameterCount, this.positiona
lParameterCount, this.parameterName, this.parameterType}) { | |
| 5211 if (parameterNames == null) { | |
| 5212 parameterNames = <String>[]; | |
| 5213 } | |
| 5214 if (parameterTypes == null) { | |
| 5215 parameterTypes = <String>[]; | |
| 5216 } | |
| 5217 } | |
| 5218 | |
| 5219 factory CompletionSuggestion.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 5220 if (json == null) { | |
| 5221 json = {}; | |
| 5222 } | |
| 5223 if (json is Map) { | |
| 5224 CompletionSuggestionKind kind; | |
| 5225 if (json.containsKey("kind")) { | |
| 5226 kind = new CompletionSuggestionKind.fromJson(jsonDecoder, jsonPath + ".k
ind", json["kind"]); | |
| 5227 } else { | |
| 5228 throw jsonDecoder.missingKey(jsonPath, "kind"); | |
| 5229 } | |
| 5230 CompletionRelevance relevance; | |
| 5231 if (json.containsKey("relevance")) { | |
| 5232 relevance = new CompletionRelevance.fromJson(jsonDecoder, jsonPath + ".r
elevance", json["relevance"]); | |
| 5233 } else { | |
| 5234 throw jsonDecoder.missingKey(jsonPath, "relevance"); | |
| 5235 } | |
| 5236 String completion; | |
| 5237 if (json.containsKey("completion")) { | |
| 5238 completion = jsonDecoder._decodeString(jsonPath + ".completion", json["c
ompletion"]); | |
| 5239 } else { | |
| 5240 throw jsonDecoder.missingKey(jsonPath, "completion"); | |
| 5241 } | |
| 5242 int selectionOffset; | |
| 5243 if (json.containsKey("selectionOffset")) { | |
| 5244 selectionOffset = jsonDecoder._decodeInt(jsonPath + ".selectionOffset",
json["selectionOffset"]); | |
| 5245 } else { | |
| 5246 throw jsonDecoder.missingKey(jsonPath, "selectionOffset"); | |
| 5247 } | |
| 5248 int selectionLength; | |
| 5249 if (json.containsKey("selectionLength")) { | |
| 5250 selectionLength = jsonDecoder._decodeInt(jsonPath + ".selectionLength",
json["selectionLength"]); | |
| 5251 } else { | |
| 5252 throw jsonDecoder.missingKey(jsonPath, "selectionLength"); | |
| 5253 } | |
| 5254 bool isDeprecated; | |
| 5255 if (json.containsKey("isDeprecated")) { | |
| 5256 isDeprecated = jsonDecoder._decodeBool(jsonPath + ".isDeprecated", json[
"isDeprecated"]); | |
| 5257 } else { | |
| 5258 throw jsonDecoder.missingKey(jsonPath, "isDeprecated"); | |
| 5259 } | |
| 5260 bool isPotential; | |
| 5261 if (json.containsKey("isPotential")) { | |
| 5262 isPotential = jsonDecoder._decodeBool(jsonPath + ".isPotential", json["i
sPotential"]); | |
| 5263 } else { | |
| 5264 throw jsonDecoder.missingKey(jsonPath, "isPotential"); | |
| 5265 } | |
| 5266 String docSummary; | |
| 5267 if (json.containsKey("docSummary")) { | |
| 5268 docSummary = jsonDecoder._decodeString(jsonPath + ".docSummary", json["d
ocSummary"]); | |
| 5269 } | |
| 5270 String docComplete; | |
| 5271 if (json.containsKey("docComplete")) { | |
| 5272 docComplete = jsonDecoder._decodeString(jsonPath + ".docComplete", json[
"docComplete"]); | |
| 5273 } | |
| 5274 String declaringType; | |
| 5275 if (json.containsKey("declaringType")) { | |
| 5276 declaringType = jsonDecoder._decodeString(jsonPath + ".declaringType", j
son["declaringType"]); | |
| 5277 } | |
| 5278 Element element; | |
| 5279 if (json.containsKey("element")) { | |
| 5280 element = new Element.fromJson(jsonDecoder, jsonPath + ".element", json[
"element"]); | |
| 5281 } | |
| 5282 String returnType; | |
| 5283 if (json.containsKey("returnType")) { | |
| 5284 returnType = jsonDecoder._decodeString(jsonPath + ".returnType", json["r
eturnType"]); | |
| 5285 } | |
| 5286 List<String> parameterNames; | |
| 5287 if (json.containsKey("parameterNames")) { | |
| 5288 parameterNames = jsonDecoder._decodeList(jsonPath + ".parameterNames", j
son["parameterNames"], jsonDecoder._decodeString); | |
| 5289 } else { | |
| 5290 parameterNames = <String>[]; | |
| 5291 } | |
| 5292 List<String> parameterTypes; | |
| 5293 if (json.containsKey("parameterTypes")) { | |
| 5294 parameterTypes = jsonDecoder._decodeList(jsonPath + ".parameterTypes", j
son["parameterTypes"], jsonDecoder._decodeString); | |
| 5295 } else { | |
| 5296 parameterTypes = <String>[]; | |
| 5297 } | |
| 5298 int requiredParameterCount; | |
| 5299 if (json.containsKey("requiredParameterCount")) { | |
| 5300 requiredParameterCount = jsonDecoder._decodeInt(jsonPath + ".requiredPar
ameterCount", json["requiredParameterCount"]); | |
| 5301 } | |
| 5302 int positionalParameterCount; | |
| 5303 if (json.containsKey("positionalParameterCount")) { | |
| 5304 positionalParameterCount = jsonDecoder._decodeInt(jsonPath + ".positiona
lParameterCount", json["positionalParameterCount"]); | |
| 5305 } | |
| 5306 String parameterName; | |
| 5307 if (json.containsKey("parameterName")) { | |
| 5308 parameterName = jsonDecoder._decodeString(jsonPath + ".parameterName", j
son["parameterName"]); | |
| 5309 } | |
| 5310 String parameterType; | |
| 5311 if (json.containsKey("parameterType")) { | |
| 5312 parameterType = jsonDecoder._decodeString(jsonPath + ".parameterType", j
son["parameterType"]); | |
| 5313 } | |
| 5314 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, positionalParameterCount: positionalPa
rameterCount, parameterName: parameterName, parameterType: parameterType); | |
| 5315 } else { | |
| 5316 throw jsonDecoder.mismatch(jsonPath, "CompletionSuggestion"); | |
| 5317 } | |
| 5318 } | |
| 5319 | |
| 5320 Map<String, dynamic> toJson() { | |
| 5321 Map<String, dynamic> result = {}; | |
| 5322 result["kind"] = kind.toJson(); | |
| 5323 result["relevance"] = relevance.toJson(); | |
| 5324 result["completion"] = completion; | |
| 5325 result["selectionOffset"] = selectionOffset; | |
| 5326 result["selectionLength"] = selectionLength; | |
| 5327 result["isDeprecated"] = isDeprecated; | |
| 5328 result["isPotential"] = isPotential; | |
| 5329 if (docSummary != null) { | |
| 5330 result["docSummary"] = docSummary; | |
| 5331 } | |
| 5332 if (docComplete != null) { | |
| 5333 result["docComplete"] = docComplete; | |
| 5334 } | |
| 5335 if (declaringType != null) { | |
| 5336 result["declaringType"] = declaringType; | |
| 5337 } | |
| 5338 if (element != null) { | |
| 5339 result["element"] = element.toJson(); | |
| 5340 } | |
| 5341 if (returnType != null) { | |
| 5342 result["returnType"] = returnType; | |
| 5343 } | |
| 5344 if (parameterNames.isNotEmpty) { | |
| 5345 result["parameterNames"] = parameterNames; | |
| 5346 } | |
| 5347 if (parameterTypes.isNotEmpty) { | |
| 5348 result["parameterTypes"] = parameterTypes; | |
| 5349 } | |
| 5350 if (requiredParameterCount != null) { | |
| 5351 result["requiredParameterCount"] = requiredParameterCount; | |
| 5352 } | |
| 5353 if (positionalParameterCount != null) { | |
| 5354 result["positionalParameterCount"] = positionalParameterCount; | |
| 5355 } | |
| 5356 if (parameterName != null) { | |
| 5357 result["parameterName"] = parameterName; | |
| 5358 } | |
| 5359 if (parameterType != null) { | |
| 5360 result["parameterType"] = parameterType; | |
| 5361 } | |
| 5362 return result; | |
| 5363 } | |
| 5364 | |
| 5365 @override | |
| 5366 String toString() => JSON.encode(toJson()); | |
| 5367 | |
| 5368 @override | |
| 5369 bool operator==(other) { | |
| 5370 if (other is CompletionSuggestion) { | |
| 5371 return kind == other.kind && | |
| 5372 relevance == other.relevance && | |
| 5373 completion == other.completion && | |
| 5374 selectionOffset == other.selectionOffset && | |
| 5375 selectionLength == other.selectionLength && | |
| 5376 isDeprecated == other.isDeprecated && | |
| 5377 isPotential == other.isPotential && | |
| 5378 docSummary == other.docSummary && | |
| 5379 docComplete == other.docComplete && | |
| 5380 declaringType == other.declaringType && | |
| 5381 element == other.element && | |
| 5382 returnType == other.returnType && | |
| 5383 _listEqual(parameterNames, other.parameterNames, (String a, String b)
=> a == b) && | |
| 5384 _listEqual(parameterTypes, other.parameterTypes, (String a, String b)
=> a == b) && | |
| 5385 requiredParameterCount == other.requiredParameterCount && | |
| 5386 positionalParameterCount == other.positionalParameterCount && | |
| 5387 parameterName == other.parameterName && | |
| 5388 parameterType == other.parameterType; | |
| 5389 } | |
| 5390 return false; | |
| 5391 } | |
| 5392 | |
| 5393 @override | |
| 5394 int get hashCode { | |
| 5395 int hash = 0; | |
| 5396 hash = _JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 5397 hash = _JenkinsSmiHash.combine(hash, relevance.hashCode); | |
| 5398 hash = _JenkinsSmiHash.combine(hash, completion.hashCode); | |
| 5399 hash = _JenkinsSmiHash.combine(hash, selectionOffset.hashCode); | |
| 5400 hash = _JenkinsSmiHash.combine(hash, selectionLength.hashCode); | |
| 5401 hash = _JenkinsSmiHash.combine(hash, isDeprecated.hashCode); | |
| 5402 hash = _JenkinsSmiHash.combine(hash, isPotential.hashCode); | |
| 5403 hash = _JenkinsSmiHash.combine(hash, docSummary.hashCode); | |
| 5404 hash = _JenkinsSmiHash.combine(hash, docComplete.hashCode); | |
| 5405 hash = _JenkinsSmiHash.combine(hash, declaringType.hashCode); | |
| 5406 hash = _JenkinsSmiHash.combine(hash, element.hashCode); | |
| 5407 hash = _JenkinsSmiHash.combine(hash, returnType.hashCode); | |
| 5408 hash = _JenkinsSmiHash.combine(hash, parameterNames.hashCode); | |
| 5409 hash = _JenkinsSmiHash.combine(hash, parameterTypes.hashCode); | |
| 5410 hash = _JenkinsSmiHash.combine(hash, requiredParameterCount.hashCode); | |
| 5411 hash = _JenkinsSmiHash.combine(hash, positionalParameterCount.hashCode); | |
| 5412 hash = _JenkinsSmiHash.combine(hash, parameterName.hashCode); | |
| 5413 hash = _JenkinsSmiHash.combine(hash, parameterType.hashCode); | |
| 5414 return _JenkinsSmiHash.finish(hash); | |
| 5415 } | |
| 5416 } | |
| 5417 | |
| 5418 /** | |
| 5419 * CompletionSuggestionKind | |
| 5420 * | |
| 5421 * enum { | |
| 5422 * ARGUMENT_LIST | |
| 5423 * CLASS | |
| 5424 * CLASS_ALIAS | |
| 5425 * CONSTRUCTOR | |
| 5426 * FIELD | |
| 5427 * FUNCTION | |
| 5428 * FUNCTION_TYPE_ALIAS | |
| 5429 * GETTER | |
| 5430 * IMPORT | |
| 5431 * KEYWORD | |
| 5432 * LABEL | |
| 5433 * LIBRARY_PREFIX | |
| 5434 * LOCAL_VARIABLE | |
| 5435 * METHOD | |
| 5436 * METHOD_NAME | |
| 5437 * NAMED_ARGUMENT | |
| 5438 * OPTIONAL_ARGUMENT | |
| 5439 * PARAMETER | |
| 5440 * SETTER | |
| 5441 * TOP_LEVEL_VARIABLE | |
| 5442 * TYPE_PARAMETER | |
| 5443 * } | |
| 5444 */ | |
| 5445 class CompletionSuggestionKind { | |
| 5446 static const ARGUMENT_LIST = const CompletionSuggestionKind._("ARGUMENT_LIST")
; | |
| 5447 | |
| 5448 static const CLASS = const CompletionSuggestionKind._("CLASS"); | |
| 5449 | |
| 5450 static const CLASS_ALIAS = const CompletionSuggestionKind._("CLASS_ALIAS"); | |
| 5451 | |
| 5452 static const CONSTRUCTOR = const CompletionSuggestionKind._("CONSTRUCTOR"); | |
| 5453 | |
| 5454 static const FIELD = const CompletionSuggestionKind._("FIELD"); | |
| 5455 | |
| 5456 static const FUNCTION = const CompletionSuggestionKind._("FUNCTION"); | |
| 5457 | |
| 5458 static const FUNCTION_TYPE_ALIAS = const CompletionSuggestionKind._("FUNCTION_
TYPE_ALIAS"); | |
| 5459 | |
| 5460 static const GETTER = const CompletionSuggestionKind._("GETTER"); | |
| 5461 | |
| 5462 static const IMPORT = const CompletionSuggestionKind._("IMPORT"); | |
| 5463 | |
| 5464 static const KEYWORD = const CompletionSuggestionKind._("KEYWORD"); | |
| 5465 | |
| 5466 static const LABEL = const CompletionSuggestionKind._("LABEL"); | |
| 5467 | |
| 5468 static const LIBRARY_PREFIX = const CompletionSuggestionKind._("LIBRARY_PREFIX
"); | |
| 5469 | |
| 5470 static const LOCAL_VARIABLE = const CompletionSuggestionKind._("LOCAL_VARIABLE
"); | |
| 5471 | |
| 5472 static const METHOD = const CompletionSuggestionKind._("METHOD"); | |
| 5473 | |
| 5474 static const METHOD_NAME = const CompletionSuggestionKind._("METHOD_NAME"); | |
| 5475 | |
| 5476 static const NAMED_ARGUMENT = const CompletionSuggestionKind._("NAMED_ARGUMENT
"); | |
| 5477 | |
| 5478 static const OPTIONAL_ARGUMENT = const CompletionSuggestionKind._("OPTIONAL_AR
GUMENT"); | |
| 5479 | |
| 5480 static const PARAMETER = const CompletionSuggestionKind._("PARAMETER"); | |
| 5481 | |
| 5482 static const SETTER = const CompletionSuggestionKind._("SETTER"); | |
| 5483 | |
| 5484 static const TOP_LEVEL_VARIABLE = const CompletionSuggestionKind._("TOP_LEVEL_
VARIABLE"); | |
| 5485 | |
| 5486 static const TYPE_PARAMETER = const CompletionSuggestionKind._("TYPE_PARAMETER
"); | |
| 5487 | |
| 5488 final String name; | |
| 5489 | |
| 5490 const CompletionSuggestionKind._(this.name); | |
| 5491 | |
| 5492 factory CompletionSuggestionKind(String name) { | |
| 5493 switch (name) { | |
| 5494 case "ARGUMENT_LIST": | |
| 5495 return ARGUMENT_LIST; | |
| 5496 case "CLASS": | |
| 5497 return CLASS; | |
| 5498 case "CLASS_ALIAS": | |
| 5499 return CLASS_ALIAS; | |
| 5500 case "CONSTRUCTOR": | |
| 5501 return CONSTRUCTOR; | |
| 5502 case "FIELD": | |
| 5503 return FIELD; | |
| 5504 case "FUNCTION": | |
| 5505 return FUNCTION; | |
| 5506 case "FUNCTION_TYPE_ALIAS": | |
| 5507 return FUNCTION_TYPE_ALIAS; | |
| 5508 case "GETTER": | |
| 5509 return GETTER; | |
| 5510 case "IMPORT": | |
| 5511 return IMPORT; | |
| 5512 case "KEYWORD": | |
| 5513 return KEYWORD; | |
| 5514 case "LABEL": | |
| 5515 return LABEL; | |
| 5516 case "LIBRARY_PREFIX": | |
| 5517 return LIBRARY_PREFIX; | |
| 5518 case "LOCAL_VARIABLE": | |
| 5519 return LOCAL_VARIABLE; | |
| 5520 case "METHOD": | |
| 5521 return METHOD; | |
| 5522 case "METHOD_NAME": | |
| 5523 return METHOD_NAME; | |
| 5524 case "NAMED_ARGUMENT": | |
| 5525 return NAMED_ARGUMENT; | |
| 5526 case "OPTIONAL_ARGUMENT": | |
| 5527 return OPTIONAL_ARGUMENT; | |
| 5528 case "PARAMETER": | |
| 5529 return PARAMETER; | |
| 5530 case "SETTER": | |
| 5531 return SETTER; | |
| 5532 case "TOP_LEVEL_VARIABLE": | |
| 5533 return TOP_LEVEL_VARIABLE; | |
| 5534 case "TYPE_PARAMETER": | |
| 5535 return TYPE_PARAMETER; | |
| 5536 } | |
| 5537 throw new Exception('Illegal enum value: $name'); | |
| 5538 } | |
| 5539 | |
| 5540 factory CompletionSuggestionKind.fromJson(JsonDecoder jsonDecoder, String json
Path, Object json) { | |
| 5541 if (json is String) { | |
| 5542 try { | |
| 5543 return new CompletionSuggestionKind(json); | |
| 5544 } catch(_) { | |
| 5545 // Fall through | |
| 5546 } | |
| 5547 } | |
| 5548 throw jsonDecoder.mismatch(jsonPath, "CompletionSuggestionKind"); | |
| 5549 } | |
| 5550 | |
| 5551 @override | |
| 5552 String toString() => "CompletionSuggestionKind.$name"; | |
| 5553 | |
| 5554 String toJson() => name; | |
| 5555 } | |
| 5556 | |
| 5557 /** | |
| 5558 * Element | |
| 5559 * | |
| 5560 * { | |
| 5561 * "kind": ElementKind | |
| 5562 * "name": String | |
| 5563 * "location": optional Location | |
| 5564 * "flags": int | |
| 5565 * "parameters": optional String | |
| 5566 * "returnType": optional String | |
| 5567 * } | |
| 5568 */ | |
| 5569 class Element implements HasToJson { | |
| 5570 static const int FLAG_ABSTRACT = 0x01; | |
| 5571 static const int FLAG_CONST = 0x02; | |
| 5572 static const int FLAG_FINAL = 0x04; | |
| 5573 static const int FLAG_STATIC = 0x08; | |
| 5574 static const int FLAG_PRIVATE = 0x10; | |
| 5575 static const int FLAG_DEPRECATED = 0x20; | |
| 5576 | |
| 5577 static int makeFlags({isAbstract: false, isConst: false, isFinal: false, isSta
tic: false, isPrivate: false, isDeprecated: false}) { | |
| 5578 int flags = 0; | |
| 5579 if (isAbstract) flags |= FLAG_ABSTRACT; | |
| 5580 if (isConst) flags |= FLAG_CONST; | |
| 5581 if (isFinal) flags |= FLAG_FINAL; | |
| 5582 if (isStatic) flags |= FLAG_STATIC; | |
| 5583 if (isPrivate) flags |= FLAG_PRIVATE; | |
| 5584 if (isDeprecated) flags |= FLAG_DEPRECATED; | |
| 5585 return flags; | |
| 5586 } | |
| 5587 | |
| 5588 /** | |
| 5589 * The kind of the element. | |
| 5590 */ | |
| 5591 ElementKind kind; | |
| 5592 | |
| 5593 /** | |
| 5594 * The name of the element. This is typically used as the label in the | |
| 5595 * outline. | |
| 5596 */ | |
| 5597 String name; | |
| 5598 | |
| 5599 /** | |
| 5600 * The location of the name in the declaration of the element. | |
| 5601 */ | |
| 5602 Location location; | |
| 5603 | |
| 5604 /** | |
| 5605 * A bit-map containing the following flags: | |
| 5606 * | |
| 5607 * - 0x01 - set if the element is explicitly or implicitly abstract | |
| 5608 * - 0x02 - set if the element was declared to be ‘const’ | |
| 5609 * - 0x04 - set if the element was declared to be ‘final’ | |
| 5610 * - 0x08 - set if the element is a static member of a class or is a | |
| 5611 * top-level function or field | |
| 5612 * - 0x10 - set if the element is private | |
| 5613 * - 0x20 - set if the element is deprecated | |
| 5614 */ | |
| 5615 int flags; | |
| 5616 | |
| 5617 /** | |
| 5618 * The parameter list for the element. If the element is not a method or | |
| 5619 * function this field will not be defined. If the element has zero | |
| 5620 * parameters, this field will have a value of "()". | |
| 5621 */ | |
| 5622 String parameters; | |
| 5623 | |
| 5624 /** | |
| 5625 * The return type of the element. If the element is not a method or function | |
| 5626 * this field will not be defined. If the element does not have a declared | |
| 5627 * return type, this field will contain an empty string. | |
| 5628 */ | |
| 5629 String returnType; | |
| 5630 | |
| 5631 Element(this.kind, this.name, this.flags, {this.location, this.parameters, thi
s.returnType}); | |
| 5632 | |
| 5633 factory Element.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json
) { | |
| 5634 if (json == null) { | |
| 5635 json = {}; | |
| 5636 } | |
| 5637 if (json is Map) { | |
| 5638 ElementKind kind; | |
| 5639 if (json.containsKey("kind")) { | |
| 5640 kind = new ElementKind.fromJson(jsonDecoder, jsonPath + ".kind", json["k
ind"]); | |
| 5641 } else { | |
| 5642 throw jsonDecoder.missingKey(jsonPath, "kind"); | |
| 5643 } | |
| 5644 String name; | |
| 5645 if (json.containsKey("name")) { | |
| 5646 name = jsonDecoder._decodeString(jsonPath + ".name", json["name"]); | |
| 5647 } else { | |
| 5648 throw jsonDecoder.missingKey(jsonPath, "name"); | |
| 5649 } | |
| 5650 Location location; | |
| 5651 if (json.containsKey("location")) { | |
| 5652 location = new Location.fromJson(jsonDecoder, jsonPath + ".location", js
on["location"]); | |
| 5653 } | |
| 5654 int flags; | |
| 5655 if (json.containsKey("flags")) { | |
| 5656 flags = jsonDecoder._decodeInt(jsonPath + ".flags", json["flags"]); | |
| 5657 } else { | |
| 5658 throw jsonDecoder.missingKey(jsonPath, "flags"); | |
| 5659 } | |
| 5660 String parameters; | |
| 5661 if (json.containsKey("parameters")) { | |
| 5662 parameters = jsonDecoder._decodeString(jsonPath + ".parameters", json["p
arameters"]); | |
| 5663 } | |
| 5664 String returnType; | |
| 5665 if (json.containsKey("returnType")) { | |
| 5666 returnType = jsonDecoder._decodeString(jsonPath + ".returnType", json["r
eturnType"]); | |
| 5667 } | |
| 5668 return new Element(kind, name, flags, location: location, parameters: para
meters, returnType: returnType); | |
| 5669 } else { | |
| 5670 throw jsonDecoder.mismatch(jsonPath, "Element"); | |
| 5671 } | |
| 5672 } | |
| 5673 | |
| 5674 bool get isAbstract => (flags & FLAG_ABSTRACT) != 0; | |
| 5675 bool get isConst => (flags & FLAG_CONST) != 0; | |
| 5676 bool get isFinal => (flags & FLAG_FINAL) != 0; | |
| 5677 bool get isStatic => (flags & FLAG_STATIC) != 0; | |
| 5678 bool get isPrivate => (flags & FLAG_PRIVATE) != 0; | |
| 5679 bool get isDeprecated => (flags & FLAG_DEPRECATED) != 0; | |
| 5680 | |
| 5681 Map<String, dynamic> toJson() { | |
| 5682 Map<String, dynamic> result = {}; | |
| 5683 result["kind"] = kind.toJson(); | |
| 5684 result["name"] = name; | |
| 5685 if (location != null) { | |
| 5686 result["location"] = location.toJson(); | |
| 5687 } | |
| 5688 result["flags"] = flags; | |
| 5689 if (parameters != null) { | |
| 5690 result["parameters"] = parameters; | |
| 5691 } | |
| 5692 if (returnType != null) { | |
| 5693 result["returnType"] = returnType; | |
| 5694 } | |
| 5695 return result; | |
| 5696 } | |
| 5697 | |
| 5698 @override | |
| 5699 String toString() => JSON.encode(toJson()); | |
| 5700 | |
| 5701 @override | |
| 5702 bool operator==(other) { | |
| 5703 if (other is Element) { | |
| 5704 return kind == other.kind && | |
| 5705 name == other.name && | |
| 5706 location == other.location && | |
| 5707 flags == other.flags && | |
| 5708 parameters == other.parameters && | |
| 5709 returnType == other.returnType; | |
| 5710 } | |
| 5711 return false; | |
| 5712 } | |
| 5713 | |
| 5714 @override | |
| 5715 int get hashCode { | |
| 5716 int hash = 0; | |
| 5717 hash = _JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 5718 hash = _JenkinsSmiHash.combine(hash, name.hashCode); | |
| 5719 hash = _JenkinsSmiHash.combine(hash, location.hashCode); | |
| 5720 hash = _JenkinsSmiHash.combine(hash, flags.hashCode); | |
| 5721 hash = _JenkinsSmiHash.combine(hash, parameters.hashCode); | |
| 5722 hash = _JenkinsSmiHash.combine(hash, returnType.hashCode); | |
| 5723 return _JenkinsSmiHash.finish(hash); | |
| 5724 } | |
| 5725 } | |
| 5726 | |
| 5727 /** | |
| 5728 * ElementKind | |
| 5729 * | |
| 5730 * enum { | |
| 5731 * CLASS | |
| 5732 * CLASS_TYPE_ALIAS | |
| 5733 * COMPILATION_UNIT | |
| 5734 * CONSTRUCTOR | |
| 5735 * FIELD | |
| 5736 * FUNCTION | |
| 5737 * FUNCTION_TYPE_ALIAS | |
| 5738 * GETTER | |
| 5739 * LABEL | |
| 5740 * LIBRARY | |
| 5741 * LOCAL_VARIABLE | |
| 5742 * METHOD | |
| 5743 * PARAMETER | |
| 5744 * SETTER | |
| 5745 * TOP_LEVEL_VARIABLE | |
| 5746 * TYPE_PARAMETER | |
| 5747 * UNIT_TEST_GROUP | |
| 5748 * UNIT_TEST_TEST | |
| 5749 * UNKNOWN | |
| 5750 * } | |
| 5751 */ | |
| 5752 class ElementKind { | |
| 5753 static const CLASS = const ElementKind._("CLASS"); | |
| 5754 | |
| 5755 static const CLASS_TYPE_ALIAS = const ElementKind._("CLASS_TYPE_ALIAS"); | |
| 5756 | |
| 5757 static const COMPILATION_UNIT = const ElementKind._("COMPILATION_UNIT"); | |
| 5758 | |
| 5759 static const CONSTRUCTOR = const ElementKind._("CONSTRUCTOR"); | |
| 5760 | |
| 5761 static const FIELD = const ElementKind._("FIELD"); | |
| 5762 | |
| 5763 static const FUNCTION = const ElementKind._("FUNCTION"); | |
| 5764 | |
| 5765 static const FUNCTION_TYPE_ALIAS = const ElementKind._("FUNCTION_TYPE_ALIAS"); | |
| 5766 | |
| 5767 static const GETTER = const ElementKind._("GETTER"); | |
| 5768 | |
| 5769 static const LABEL = const ElementKind._("LABEL"); | |
| 5770 | |
| 5771 static const LIBRARY = const ElementKind._("LIBRARY"); | |
| 5772 | |
| 5773 static const LOCAL_VARIABLE = const ElementKind._("LOCAL_VARIABLE"); | |
| 5774 | |
| 5775 static const METHOD = const ElementKind._("METHOD"); | |
| 5776 | |
| 5777 static const PARAMETER = const ElementKind._("PARAMETER"); | |
| 5778 | |
| 5779 static const SETTER = const ElementKind._("SETTER"); | |
| 5780 | |
| 5781 static const TOP_LEVEL_VARIABLE = const ElementKind._("TOP_LEVEL_VARIABLE"); | |
| 5782 | |
| 5783 static const TYPE_PARAMETER = const ElementKind._("TYPE_PARAMETER"); | |
| 5784 | |
| 5785 static const UNIT_TEST_GROUP = const ElementKind._("UNIT_TEST_GROUP"); | |
| 5786 | |
| 5787 static const UNIT_TEST_TEST = const ElementKind._("UNIT_TEST_TEST"); | |
| 5788 | |
| 5789 static const UNKNOWN = const ElementKind._("UNKNOWN"); | |
| 5790 | |
| 5791 final String name; | |
| 5792 | |
| 5793 const ElementKind._(this.name); | |
| 5794 | |
| 5795 factory ElementKind(String name) { | |
| 5796 switch (name) { | |
| 5797 case "CLASS": | |
| 5798 return CLASS; | |
| 5799 case "CLASS_TYPE_ALIAS": | |
| 5800 return CLASS_TYPE_ALIAS; | |
| 5801 case "COMPILATION_UNIT": | |
| 5802 return COMPILATION_UNIT; | |
| 5803 case "CONSTRUCTOR": | |
| 5804 return CONSTRUCTOR; | |
| 5805 case "FIELD": | |
| 5806 return FIELD; | |
| 5807 case "FUNCTION": | |
| 5808 return FUNCTION; | |
| 5809 case "FUNCTION_TYPE_ALIAS": | |
| 5810 return FUNCTION_TYPE_ALIAS; | |
| 5811 case "GETTER": | |
| 5812 return GETTER; | |
| 5813 case "LABEL": | |
| 5814 return LABEL; | |
| 5815 case "LIBRARY": | |
| 5816 return LIBRARY; | |
| 5817 case "LOCAL_VARIABLE": | |
| 5818 return LOCAL_VARIABLE; | |
| 5819 case "METHOD": | |
| 5820 return METHOD; | |
| 5821 case "PARAMETER": | |
| 5822 return PARAMETER; | |
| 5823 case "SETTER": | |
| 5824 return SETTER; | |
| 5825 case "TOP_LEVEL_VARIABLE": | |
| 5826 return TOP_LEVEL_VARIABLE; | |
| 5827 case "TYPE_PARAMETER": | |
| 5828 return TYPE_PARAMETER; | |
| 5829 case "UNIT_TEST_GROUP": | |
| 5830 return UNIT_TEST_GROUP; | |
| 5831 case "UNIT_TEST_TEST": | |
| 5832 return UNIT_TEST_TEST; | |
| 5833 case "UNKNOWN": | |
| 5834 return UNKNOWN; | |
| 5835 } | |
| 5836 throw new Exception('Illegal enum value: $name'); | |
| 5837 } | |
| 5838 | |
| 5839 factory ElementKind.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object
json) { | |
| 5840 if (json is String) { | |
| 5841 try { | |
| 5842 return new ElementKind(json); | |
| 5843 } catch(_) { | |
| 5844 // Fall through | |
| 5845 } | |
| 5846 } | |
| 5847 throw jsonDecoder.mismatch(jsonPath, "ElementKind"); | |
| 5848 } | |
| 5849 | |
| 5850 @override | |
| 5851 String toString() => "ElementKind.$name"; | |
| 5852 | |
| 5853 String toJson() => name; | |
| 5854 } | |
| 5855 | |
| 5856 /** | |
| 5857 * ExecutableFile | |
| 5858 * | |
| 5859 * { | |
| 5860 * "file": FilePath | |
| 5861 * "kind": ExecutableKind | |
| 5862 * } | |
| 5863 */ | |
| 5864 class ExecutableFile implements HasToJson { | |
| 5865 /** | |
| 5866 * The path of the executable file. | |
| 5867 */ | |
| 5868 String file; | |
| 5869 | |
| 5870 /** | |
| 5871 * The kind of the executable file. | |
| 5872 */ | |
| 5873 ExecutableKind kind; | |
| 5874 | |
| 5875 ExecutableFile(this.file, this.kind); | |
| 5876 | |
| 5877 factory ExecutableFile.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obje
ct json) { | |
| 5878 if (json == null) { | |
| 5879 json = {}; | |
| 5880 } | |
| 5881 if (json is Map) { | |
| 5882 String file; | |
| 5883 if (json.containsKey("file")) { | |
| 5884 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 5885 } else { | |
| 5886 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 5887 } | |
| 5888 ExecutableKind kind; | |
| 5889 if (json.containsKey("kind")) { | |
| 5890 kind = new ExecutableKind.fromJson(jsonDecoder, jsonPath + ".kind", json
["kind"]); | |
| 5891 } else { | |
| 5892 throw jsonDecoder.missingKey(jsonPath, "kind"); | |
| 5893 } | |
| 5894 return new ExecutableFile(file, kind); | |
| 5895 } else { | |
| 5896 throw jsonDecoder.mismatch(jsonPath, "ExecutableFile"); | |
| 5897 } | |
| 5898 } | |
| 5899 | |
| 5900 Map<String, dynamic> toJson() { | |
| 5901 Map<String, dynamic> result = {}; | |
| 5902 result["file"] = file; | |
| 5903 result["kind"] = kind.toJson(); | |
| 5904 return result; | |
| 5905 } | |
| 5906 | |
| 5907 @override | |
| 5908 String toString() => JSON.encode(toJson()); | |
| 5909 | |
| 5910 @override | |
| 5911 bool operator==(other) { | |
| 5912 if (other is ExecutableFile) { | |
| 5913 return file == other.file && | |
| 5914 kind == other.kind; | |
| 5915 } | |
| 5916 return false; | |
| 5917 } | |
| 5918 | |
| 5919 @override | |
| 5920 int get hashCode { | |
| 5921 int hash = 0; | |
| 5922 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 5923 hash = _JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 5924 return _JenkinsSmiHash.finish(hash); | |
| 5925 } | |
| 5926 } | |
| 5927 | |
| 5928 /** | |
| 5929 * ExecutableKind | |
| 5930 * | |
| 5931 * enum { | |
| 5932 * CLIENT | |
| 5933 * EITHER | |
| 5934 * SERVER | |
| 5935 * } | |
| 5936 */ | |
| 5937 class ExecutableKind { | |
| 5938 static const CLIENT = const ExecutableKind._("CLIENT"); | |
| 5939 | |
| 5940 static const EITHER = const ExecutableKind._("EITHER"); | |
| 5941 | |
| 5942 static const SERVER = const ExecutableKind._("SERVER"); | |
| 5943 | |
| 5944 final String name; | |
| 5945 | |
| 5946 const ExecutableKind._(this.name); | |
| 5947 | |
| 5948 factory ExecutableKind(String name) { | |
| 5949 switch (name) { | |
| 5950 case "CLIENT": | |
| 5951 return CLIENT; | |
| 5952 case "EITHER": | |
| 5953 return EITHER; | |
| 5954 case "SERVER": | |
| 5955 return SERVER; | |
| 5956 } | |
| 5957 throw new Exception('Illegal enum value: $name'); | |
| 5958 } | |
| 5959 | |
| 5960 factory ExecutableKind.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obje
ct json) { | |
| 5961 if (json is String) { | |
| 5962 try { | |
| 5963 return new ExecutableKind(json); | |
| 5964 } catch(_) { | |
| 5965 // Fall through | |
| 5966 } | |
| 5967 } | |
| 5968 throw jsonDecoder.mismatch(jsonPath, "ExecutableKind"); | |
| 5969 } | |
| 5970 | |
| 5971 @override | |
| 5972 String toString() => "ExecutableKind.$name"; | |
| 5973 | |
| 5974 String toJson() => name; | |
| 5975 } | |
| 5976 | |
| 5977 /** | |
| 5978 * ExecutionService | |
| 5979 * | |
| 5980 * enum { | |
| 5981 * LAUNCH_DATA | |
| 5982 * } | |
| 5983 */ | |
| 5984 class ExecutionService { | |
| 5985 static const LAUNCH_DATA = const ExecutionService._("LAUNCH_DATA"); | |
| 5986 | |
| 5987 final String name; | |
| 5988 | |
| 5989 const ExecutionService._(this.name); | |
| 5990 | |
| 5991 factory ExecutionService(String name) { | |
| 5992 switch (name) { | |
| 5993 case "LAUNCH_DATA": | |
| 5994 return LAUNCH_DATA; | |
| 5995 } | |
| 5996 throw new Exception('Illegal enum value: $name'); | |
| 5997 } | |
| 5998 | |
| 5999 factory ExecutionService.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob
ject json) { | |
| 6000 if (json is String) { | |
| 6001 try { | |
| 6002 return new ExecutionService(json); | |
| 6003 } catch(_) { | |
| 6004 // Fall through | |
| 6005 } | |
| 6006 } | |
| 6007 throw jsonDecoder.mismatch(jsonPath, "ExecutionService"); | |
| 6008 } | |
| 6009 | |
| 6010 @override | |
| 6011 String toString() => "ExecutionService.$name"; | |
| 6012 | |
| 6013 String toJson() => name; | |
| 6014 } | |
| 6015 | |
| 6016 /** | |
| 6017 * FoldingKind | |
| 6018 * | |
| 6019 * enum { | |
| 6020 * COMMENT | |
| 6021 * CLASS_MEMBER | |
| 6022 * DIRECTIVES | |
| 6023 * DOCUMENTATION_COMMENT | |
| 6024 * TOP_LEVEL_DECLARATION | |
| 6025 * } | |
| 6026 */ | |
| 6027 class FoldingKind { | |
| 6028 static const COMMENT = const FoldingKind._("COMMENT"); | |
| 6029 | |
| 6030 static const CLASS_MEMBER = const FoldingKind._("CLASS_MEMBER"); | |
| 6031 | |
| 6032 static const DIRECTIVES = const FoldingKind._("DIRECTIVES"); | |
| 6033 | |
| 6034 static const DOCUMENTATION_COMMENT = const FoldingKind._("DOCUMENTATION_COMMEN
T"); | |
| 6035 | |
| 6036 static const TOP_LEVEL_DECLARATION = const FoldingKind._("TOP_LEVEL_DECLARATIO
N"); | |
| 6037 | |
| 6038 final String name; | |
| 6039 | |
| 6040 const FoldingKind._(this.name); | |
| 6041 | |
| 6042 factory FoldingKind(String name) { | |
| 6043 switch (name) { | |
| 6044 case "COMMENT": | |
| 6045 return COMMENT; | |
| 6046 case "CLASS_MEMBER": | |
| 6047 return CLASS_MEMBER; | |
| 6048 case "DIRECTIVES": | |
| 6049 return DIRECTIVES; | |
| 6050 case "DOCUMENTATION_COMMENT": | |
| 6051 return DOCUMENTATION_COMMENT; | |
| 6052 case "TOP_LEVEL_DECLARATION": | |
| 6053 return TOP_LEVEL_DECLARATION; | |
| 6054 } | |
| 6055 throw new Exception('Illegal enum value: $name'); | |
| 6056 } | |
| 6057 | |
| 6058 factory FoldingKind.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object
json) { | |
| 6059 if (json is String) { | |
| 6060 try { | |
| 6061 return new FoldingKind(json); | |
| 6062 } catch(_) { | |
| 6063 // Fall through | |
| 6064 } | |
| 6065 } | |
| 6066 throw jsonDecoder.mismatch(jsonPath, "FoldingKind"); | |
| 6067 } | |
| 6068 | |
| 6069 @override | |
| 6070 String toString() => "FoldingKind.$name"; | |
| 6071 | |
| 6072 String toJson() => name; | |
| 6073 } | |
| 6074 | |
| 6075 /** | |
| 6076 * FoldingRegion | |
| 6077 * | |
| 6078 * { | |
| 6079 * "kind": FoldingKind | |
| 6080 * "offset": int | |
| 6081 * "length": int | |
| 6082 * } | |
| 6083 */ | |
| 6084 class FoldingRegion implements HasToJson { | |
| 6085 /** | |
| 6086 * The kind of the region. | |
| 6087 */ | |
| 6088 FoldingKind kind; | |
| 6089 | |
| 6090 /** | |
| 6091 * The offset of the region to be folded. | |
| 6092 */ | |
| 6093 int offset; | |
| 6094 | |
| 6095 /** | |
| 6096 * The length of the region to be folded. | |
| 6097 */ | |
| 6098 int length; | |
| 6099 | |
| 6100 FoldingRegion(this.kind, this.offset, this.length); | |
| 6101 | |
| 6102 factory FoldingRegion.fromJson(JsonDecoder jsonDecoder, String jsonPath, Objec
t json) { | |
| 6103 if (json == null) { | |
| 6104 json = {}; | |
| 6105 } | |
| 6106 if (json is Map) { | |
| 6107 FoldingKind kind; | |
| 6108 if (json.containsKey("kind")) { | |
| 6109 kind = new FoldingKind.fromJson(jsonDecoder, jsonPath + ".kind", json["k
ind"]); | |
| 6110 } else { | |
| 6111 throw jsonDecoder.missingKey(jsonPath, "kind"); | |
| 6112 } | |
| 6113 int offset; | |
| 6114 if (json.containsKey("offset")) { | |
| 6115 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 6116 } else { | |
| 6117 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 6118 } | |
| 6119 int length; | |
| 6120 if (json.containsKey("length")) { | |
| 6121 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 6122 } else { | |
| 6123 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 6124 } | |
| 6125 return new FoldingRegion(kind, offset, length); | |
| 6126 } else { | |
| 6127 throw jsonDecoder.mismatch(jsonPath, "FoldingRegion"); | |
| 6128 } | |
| 6129 } | |
| 6130 | |
| 6131 Map<String, dynamic> toJson() { | |
| 6132 Map<String, dynamic> result = {}; | |
| 6133 result["kind"] = kind.toJson(); | |
| 6134 result["offset"] = offset; | |
| 6135 result["length"] = length; | |
| 6136 return result; | |
| 6137 } | |
| 6138 | |
| 6139 @override | |
| 6140 String toString() => JSON.encode(toJson()); | |
| 6141 | |
| 6142 @override | |
| 6143 bool operator==(other) { | |
| 6144 if (other is FoldingRegion) { | |
| 6145 return kind == other.kind && | |
| 6146 offset == other.offset && | |
| 6147 length == other.length; | |
| 6148 } | |
| 6149 return false; | |
| 6150 } | |
| 6151 | |
| 6152 @override | |
| 6153 int get hashCode { | |
| 6154 int hash = 0; | |
| 6155 hash = _JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 6156 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 6157 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 6158 return _JenkinsSmiHash.finish(hash); | |
| 6159 } | |
| 6160 } | |
| 6161 | |
| 6162 /** | |
| 6163 * HighlightRegion | |
| 6164 * | |
| 6165 * { | |
| 6166 * "type": HighlightRegionType | |
| 6167 * "offset": int | |
| 6168 * "length": int | |
| 6169 * } | |
| 6170 */ | |
| 6171 class HighlightRegion implements HasToJson { | |
| 6172 /** | |
| 6173 * The type of highlight associated with the region. | |
| 6174 */ | |
| 6175 HighlightRegionType type; | |
| 6176 | |
| 6177 /** | |
| 6178 * The offset of the region to be highlighted. | |
| 6179 */ | |
| 6180 int offset; | |
| 6181 | |
| 6182 /** | |
| 6183 * The length of the region to be highlighted. | |
| 6184 */ | |
| 6185 int length; | |
| 6186 | |
| 6187 HighlightRegion(this.type, this.offset, this.length); | |
| 6188 | |
| 6189 factory HighlightRegion.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obj
ect json) { | |
| 6190 if (json == null) { | |
| 6191 json = {}; | |
| 6192 } | |
| 6193 if (json is Map) { | |
| 6194 HighlightRegionType type; | |
| 6195 if (json.containsKey("type")) { | |
| 6196 type = new HighlightRegionType.fromJson(jsonDecoder, jsonPath + ".type",
json["type"]); | |
| 6197 } else { | |
| 6198 throw jsonDecoder.missingKey(jsonPath, "type"); | |
| 6199 } | |
| 6200 int offset; | |
| 6201 if (json.containsKey("offset")) { | |
| 6202 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 6203 } else { | |
| 6204 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 6205 } | |
| 6206 int length; | |
| 6207 if (json.containsKey("length")) { | |
| 6208 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 6209 } else { | |
| 6210 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 6211 } | |
| 6212 return new HighlightRegion(type, offset, length); | |
| 6213 } else { | |
| 6214 throw jsonDecoder.mismatch(jsonPath, "HighlightRegion"); | |
| 6215 } | |
| 6216 } | |
| 6217 | |
| 6218 Map<String, dynamic> toJson() { | |
| 6219 Map<String, dynamic> result = {}; | |
| 6220 result["type"] = type.toJson(); | |
| 6221 result["offset"] = offset; | |
| 6222 result["length"] = length; | |
| 6223 return result; | |
| 6224 } | |
| 6225 | |
| 6226 @override | |
| 6227 String toString() => JSON.encode(toJson()); | |
| 6228 | |
| 6229 @override | |
| 6230 bool operator==(other) { | |
| 6231 if (other is HighlightRegion) { | |
| 6232 return type == other.type && | |
| 6233 offset == other.offset && | |
| 6234 length == other.length; | |
| 6235 } | |
| 6236 return false; | |
| 6237 } | |
| 6238 | |
| 6239 @override | |
| 6240 int get hashCode { | |
| 6241 int hash = 0; | |
| 6242 hash = _JenkinsSmiHash.combine(hash, type.hashCode); | |
| 6243 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 6244 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 6245 return _JenkinsSmiHash.finish(hash); | |
| 6246 } | |
| 6247 } | |
| 6248 | |
| 6249 /** | |
| 6250 * HighlightRegionType | |
| 6251 * | |
| 6252 * enum { | |
| 6253 * ANNOTATION | |
| 6254 * BUILT_IN | |
| 6255 * CLASS | |
| 6256 * COMMENT_BLOCK | |
| 6257 * COMMENT_DOCUMENTATION | |
| 6258 * COMMENT_END_OF_LINE | |
| 6259 * CONSTRUCTOR | |
| 6260 * DIRECTIVE | |
| 6261 * DYNAMIC_TYPE | |
| 6262 * FIELD | |
| 6263 * FIELD_STATIC | |
| 6264 * FUNCTION | |
| 6265 * FUNCTION_DECLARATION | |
| 6266 * FUNCTION_TYPE_ALIAS | |
| 6267 * GETTER_DECLARATION | |
| 6268 * IDENTIFIER_DEFAULT | |
| 6269 * IMPORT_PREFIX | |
| 6270 * KEYWORD | |
| 6271 * LABEL | |
| 6272 * LITERAL_BOOLEAN | |
| 6273 * LITERAL_DOUBLE | |
| 6274 * LITERAL_INTEGER | |
| 6275 * LITERAL_LIST | |
| 6276 * LITERAL_MAP | |
| 6277 * LITERAL_STRING | |
| 6278 * LOCAL_VARIABLE | |
| 6279 * LOCAL_VARIABLE_DECLARATION | |
| 6280 * METHOD | |
| 6281 * METHOD_DECLARATION | |
| 6282 * METHOD_DECLARATION_STATIC | |
| 6283 * METHOD_STATIC | |
| 6284 * PARAMETER | |
| 6285 * SETTER_DECLARATION | |
| 6286 * TOP_LEVEL_VARIABLE | |
| 6287 * TYPE_NAME_DYNAMIC | |
| 6288 * TYPE_PARAMETER | |
| 6289 * } | |
| 6290 */ | |
| 6291 class HighlightRegionType { | |
| 6292 static const ANNOTATION = const HighlightRegionType._("ANNOTATION"); | |
| 6293 | |
| 6294 static const BUILT_IN = const HighlightRegionType._("BUILT_IN"); | |
| 6295 | |
| 6296 static const CLASS = const HighlightRegionType._("CLASS"); | |
| 6297 | |
| 6298 static const COMMENT_BLOCK = const HighlightRegionType._("COMMENT_BLOCK"); | |
| 6299 | |
| 6300 static const COMMENT_DOCUMENTATION = const HighlightRegionType._("COMMENT_DOCU
MENTATION"); | |
| 6301 | |
| 6302 static const COMMENT_END_OF_LINE = const HighlightRegionType._("COMMENT_END_OF
_LINE"); | |
| 6303 | |
| 6304 static const CONSTRUCTOR = const HighlightRegionType._("CONSTRUCTOR"); | |
| 6305 | |
| 6306 static const DIRECTIVE = const HighlightRegionType._("DIRECTIVE"); | |
| 6307 | |
| 6308 static const DYNAMIC_TYPE = const HighlightRegionType._("DYNAMIC_TYPE"); | |
| 6309 | |
| 6310 static const FIELD = const HighlightRegionType._("FIELD"); | |
| 6311 | |
| 6312 static const FIELD_STATIC = const HighlightRegionType._("FIELD_STATIC"); | |
| 6313 | |
| 6314 static const FUNCTION = const HighlightRegionType._("FUNCTION"); | |
| 6315 | |
| 6316 static const FUNCTION_DECLARATION = const HighlightRegionType._("FUNCTION_DECL
ARATION"); | |
| 6317 | |
| 6318 static const FUNCTION_TYPE_ALIAS = const HighlightRegionType._("FUNCTION_TYPE_
ALIAS"); | |
| 6319 | |
| 6320 static const GETTER_DECLARATION = const HighlightRegionType._("GETTER_DECLARAT
ION"); | |
| 6321 | |
| 6322 static const IDENTIFIER_DEFAULT = const HighlightRegionType._("IDENTIFIER_DEFA
ULT"); | |
| 6323 | |
| 6324 static const IMPORT_PREFIX = const HighlightRegionType._("IMPORT_PREFIX"); | |
| 6325 | |
| 6326 static const KEYWORD = const HighlightRegionType._("KEYWORD"); | |
| 6327 | |
| 6328 static const LABEL = const HighlightRegionType._("LABEL"); | |
| 6329 | |
| 6330 static const LITERAL_BOOLEAN = const HighlightRegionType._("LITERAL_BOOLEAN"); | |
| 6331 | |
| 6332 static const LITERAL_DOUBLE = const HighlightRegionType._("LITERAL_DOUBLE"); | |
| 6333 | |
| 6334 static const LITERAL_INTEGER = const HighlightRegionType._("LITERAL_INTEGER"); | |
| 6335 | |
| 6336 static const LITERAL_LIST = const HighlightRegionType._("LITERAL_LIST"); | |
| 6337 | |
| 6338 static const LITERAL_MAP = const HighlightRegionType._("LITERAL_MAP"); | |
| 6339 | |
| 6340 static const LITERAL_STRING = const HighlightRegionType._("LITERAL_STRING"); | |
| 6341 | |
| 6342 static const LOCAL_VARIABLE = const HighlightRegionType._("LOCAL_VARIABLE"); | |
| 6343 | |
| 6344 static const LOCAL_VARIABLE_DECLARATION = const HighlightRegionType._("LOCAL_V
ARIABLE_DECLARATION"); | |
| 6345 | |
| 6346 static const METHOD = const HighlightRegionType._("METHOD"); | |
| 6347 | |
| 6348 static const METHOD_DECLARATION = const HighlightRegionType._("METHOD_DECLARAT
ION"); | |
| 6349 | |
| 6350 static const METHOD_DECLARATION_STATIC = const HighlightRegionType._("METHOD_D
ECLARATION_STATIC"); | |
| 6351 | |
| 6352 static const METHOD_STATIC = const HighlightRegionType._("METHOD_STATIC"); | |
| 6353 | |
| 6354 static const PARAMETER = const HighlightRegionType._("PARAMETER"); | |
| 6355 | |
| 6356 static const SETTER_DECLARATION = const HighlightRegionType._("SETTER_DECLARAT
ION"); | |
| 6357 | |
| 6358 static const TOP_LEVEL_VARIABLE = const HighlightRegionType._("TOP_LEVEL_VARIA
BLE"); | |
| 6359 | |
| 6360 static const TYPE_NAME_DYNAMIC = const HighlightRegionType._("TYPE_NAME_DYNAMI
C"); | |
| 6361 | |
| 6362 static const TYPE_PARAMETER = const HighlightRegionType._("TYPE_PARAMETER"); | |
| 6363 | |
| 6364 final String name; | |
| 6365 | |
| 6366 const HighlightRegionType._(this.name); | |
| 6367 | |
| 6368 factory HighlightRegionType(String name) { | |
| 6369 switch (name) { | |
| 6370 case "ANNOTATION": | |
| 6371 return ANNOTATION; | |
| 6372 case "BUILT_IN": | |
| 6373 return BUILT_IN; | |
| 6374 case "CLASS": | |
| 6375 return CLASS; | |
| 6376 case "COMMENT_BLOCK": | |
| 6377 return COMMENT_BLOCK; | |
| 6378 case "COMMENT_DOCUMENTATION": | |
| 6379 return COMMENT_DOCUMENTATION; | |
| 6380 case "COMMENT_END_OF_LINE": | |
| 6381 return COMMENT_END_OF_LINE; | |
| 6382 case "CONSTRUCTOR": | |
| 6383 return CONSTRUCTOR; | |
| 6384 case "DIRECTIVE": | |
| 6385 return DIRECTIVE; | |
| 6386 case "DYNAMIC_TYPE": | |
| 6387 return DYNAMIC_TYPE; | |
| 6388 case "FIELD": | |
| 6389 return FIELD; | |
| 6390 case "FIELD_STATIC": | |
| 6391 return FIELD_STATIC; | |
| 6392 case "FUNCTION": | |
| 6393 return FUNCTION; | |
| 6394 case "FUNCTION_DECLARATION": | |
| 6395 return FUNCTION_DECLARATION; | |
| 6396 case "FUNCTION_TYPE_ALIAS": | |
| 6397 return FUNCTION_TYPE_ALIAS; | |
| 6398 case "GETTER_DECLARATION": | |
| 6399 return GETTER_DECLARATION; | |
| 6400 case "IDENTIFIER_DEFAULT": | |
| 6401 return IDENTIFIER_DEFAULT; | |
| 6402 case "IMPORT_PREFIX": | |
| 6403 return IMPORT_PREFIX; | |
| 6404 case "KEYWORD": | |
| 6405 return KEYWORD; | |
| 6406 case "LABEL": | |
| 6407 return LABEL; | |
| 6408 case "LITERAL_BOOLEAN": | |
| 6409 return LITERAL_BOOLEAN; | |
| 6410 case "LITERAL_DOUBLE": | |
| 6411 return LITERAL_DOUBLE; | |
| 6412 case "LITERAL_INTEGER": | |
| 6413 return LITERAL_INTEGER; | |
| 6414 case "LITERAL_LIST": | |
| 6415 return LITERAL_LIST; | |
| 6416 case "LITERAL_MAP": | |
| 6417 return LITERAL_MAP; | |
| 6418 case "LITERAL_STRING": | |
| 6419 return LITERAL_STRING; | |
| 6420 case "LOCAL_VARIABLE": | |
| 6421 return LOCAL_VARIABLE; | |
| 6422 case "LOCAL_VARIABLE_DECLARATION": | |
| 6423 return LOCAL_VARIABLE_DECLARATION; | |
| 6424 case "METHOD": | |
| 6425 return METHOD; | |
| 6426 case "METHOD_DECLARATION": | |
| 6427 return METHOD_DECLARATION; | |
| 6428 case "METHOD_DECLARATION_STATIC": | |
| 6429 return METHOD_DECLARATION_STATIC; | |
| 6430 case "METHOD_STATIC": | |
| 6431 return METHOD_STATIC; | |
| 6432 case "PARAMETER": | |
| 6433 return PARAMETER; | |
| 6434 case "SETTER_DECLARATION": | |
| 6435 return SETTER_DECLARATION; | |
| 6436 case "TOP_LEVEL_VARIABLE": | |
| 6437 return TOP_LEVEL_VARIABLE; | |
| 6438 case "TYPE_NAME_DYNAMIC": | |
| 6439 return TYPE_NAME_DYNAMIC; | |
| 6440 case "TYPE_PARAMETER": | |
| 6441 return TYPE_PARAMETER; | |
| 6442 } | |
| 6443 throw new Exception('Illegal enum value: $name'); | |
| 6444 } | |
| 6445 | |
| 6446 factory HighlightRegionType.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 6447 if (json is String) { | |
| 6448 try { | |
| 6449 return new HighlightRegionType(json); | |
| 6450 } catch(_) { | |
| 6451 // Fall through | |
| 6452 } | |
| 6453 } | |
| 6454 throw jsonDecoder.mismatch(jsonPath, "HighlightRegionType"); | |
| 6455 } | |
| 6456 | |
| 6457 @override | |
| 6458 String toString() => "HighlightRegionType.$name"; | |
| 6459 | |
| 6460 String toJson() => name; | |
| 6461 } | |
| 6462 | |
| 6463 /** | |
| 6464 * HoverInformation | |
| 6465 * | |
| 6466 * { | |
| 6467 * "offset": int | |
| 6468 * "length": int | |
| 6469 * "containingLibraryPath": optional String | |
| 6470 * "containingLibraryName": optional String | |
| 6471 * "dartdoc": optional String | |
| 6472 * "elementDescription": optional String | |
| 6473 * "elementKind": optional String | |
| 6474 * "parameter": optional String | |
| 6475 * "propagatedType": optional String | |
| 6476 * "staticType": optional String | |
| 6477 * } | |
| 6478 */ | |
| 6479 class HoverInformation implements HasToJson { | |
| 6480 /** | |
| 6481 * The offset of the range of characters that encompases the cursor position | |
| 6482 * and has the same hover information as the cursor position. | |
| 6483 */ | |
| 6484 int offset; | |
| 6485 | |
| 6486 /** | |
| 6487 * The length of the range of characters that encompases the cursor position | |
| 6488 * and has the same hover information as the cursor position. | |
| 6489 */ | |
| 6490 int length; | |
| 6491 | |
| 6492 /** | |
| 6493 * The path to the defining compilation unit of the library in which the | |
| 6494 * referenced element is declared. This data is omitted if there is no | |
| 6495 * referenced element, or if the element is declared inside an HTML file. | |
| 6496 */ | |
| 6497 String containingLibraryPath; | |
| 6498 | |
| 6499 /** | |
| 6500 * The name of the library in which the referenced element is declared. This | |
| 6501 * data is omitted if there is no referenced element, or if the element is | |
| 6502 * declared inside an HTML file. | |
| 6503 */ | |
| 6504 String containingLibraryName; | |
| 6505 | |
| 6506 /** | |
| 6507 * The dartdoc associated with the referenced element. Other than the removal | |
| 6508 * of the comment delimiters, including leading asterisks in the case of a | |
| 6509 * block comment, the dartdoc is unprocessed markdown. This data is omitted | |
| 6510 * if there is no referenced element, or if the element has no dartdoc. | |
| 6511 */ | |
| 6512 String dartdoc; | |
| 6513 | |
| 6514 /** | |
| 6515 * A human-readable description of the element being referenced. This data is | |
| 6516 * omitted if there is no referenced element. | |
| 6517 */ | |
| 6518 String elementDescription; | |
| 6519 | |
| 6520 /** | |
| 6521 * A human-readable description of the kind of element being referenced (such | |
| 6522 * as “class” or “function type alias”). This data is omitted if there is no | |
| 6523 * referenced element. | |
| 6524 */ | |
| 6525 String elementKind; | |
| 6526 | |
| 6527 /** | |
| 6528 * A human-readable description of the parameter corresponding to the | |
| 6529 * expression being hovered over. This data is omitted if the location is not | |
| 6530 * in an argument to a function. | |
| 6531 */ | |
| 6532 String parameter; | |
| 6533 | |
| 6534 /** | |
| 6535 * The name of the propagated type of the expression. This data is omitted if | |
| 6536 * the location does not correspond to an expression or if there is no | |
| 6537 * propagated type information. | |
| 6538 */ | |
| 6539 String propagatedType; | |
| 6540 | |
| 6541 /** | |
| 6542 * The name of the static type of the expression. This data is omitted if the | |
| 6543 * location does not correspond to an expression. | |
| 6544 */ | |
| 6545 String staticType; | |
| 6546 | |
| 6547 HoverInformation(this.offset, this.length, {this.containingLibraryPath, this.c
ontainingLibraryName, this.dartdoc, this.elementDescription, this.elementKind, t
his.parameter, this.propagatedType, this.staticType}); | |
| 6548 | |
| 6549 factory HoverInformation.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob
ject json) { | |
| 6550 if (json == null) { | |
| 6551 json = {}; | |
| 6552 } | |
| 6553 if (json is Map) { | |
| 6554 int offset; | |
| 6555 if (json.containsKey("offset")) { | |
| 6556 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 6557 } else { | |
| 6558 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 6559 } | |
| 6560 int length; | |
| 6561 if (json.containsKey("length")) { | |
| 6562 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 6563 } else { | |
| 6564 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 6565 } | |
| 6566 String containingLibraryPath; | |
| 6567 if (json.containsKey("containingLibraryPath")) { | |
| 6568 containingLibraryPath = jsonDecoder._decodeString(jsonPath + ".containin
gLibraryPath", json["containingLibraryPath"]); | |
| 6569 } | |
| 6570 String containingLibraryName; | |
| 6571 if (json.containsKey("containingLibraryName")) { | |
| 6572 containingLibraryName = jsonDecoder._decodeString(jsonPath + ".containin
gLibraryName", json["containingLibraryName"]); | |
| 6573 } | |
| 6574 String dartdoc; | |
| 6575 if (json.containsKey("dartdoc")) { | |
| 6576 dartdoc = jsonDecoder._decodeString(jsonPath + ".dartdoc", json["dartdoc
"]); | |
| 6577 } | |
| 6578 String elementDescription; | |
| 6579 if (json.containsKey("elementDescription")) { | |
| 6580 elementDescription = jsonDecoder._decodeString(jsonPath + ".elementDescr
iption", json["elementDescription"]); | |
| 6581 } | |
| 6582 String elementKind; | |
| 6583 if (json.containsKey("elementKind")) { | |
| 6584 elementKind = jsonDecoder._decodeString(jsonPath + ".elementKind", json[
"elementKind"]); | |
| 6585 } | |
| 6586 String parameter; | |
| 6587 if (json.containsKey("parameter")) { | |
| 6588 parameter = jsonDecoder._decodeString(jsonPath + ".parameter", json["par
ameter"]); | |
| 6589 } | |
| 6590 String propagatedType; | |
| 6591 if (json.containsKey("propagatedType")) { | |
| 6592 propagatedType = jsonDecoder._decodeString(jsonPath + ".propagatedType",
json["propagatedType"]); | |
| 6593 } | |
| 6594 String staticType; | |
| 6595 if (json.containsKey("staticType")) { | |
| 6596 staticType = jsonDecoder._decodeString(jsonPath + ".staticType", json["s
taticType"]); | |
| 6597 } | |
| 6598 return new HoverInformation(offset, length, containingLibraryPath: contain
ingLibraryPath, containingLibraryName: containingLibraryName, dartdoc: dartdoc,
elementDescription: elementDescription, elementKind: elementKind, parameter: par
ameter, propagatedType: propagatedType, staticType: staticType); | |
| 6599 } else { | |
| 6600 throw jsonDecoder.mismatch(jsonPath, "HoverInformation"); | |
| 6601 } | |
| 6602 } | |
| 6603 | |
| 6604 Map<String, dynamic> toJson() { | |
| 6605 Map<String, dynamic> result = {}; | |
| 6606 result["offset"] = offset; | |
| 6607 result["length"] = length; | |
| 6608 if (containingLibraryPath != null) { | |
| 6609 result["containingLibraryPath"] = containingLibraryPath; | |
| 6610 } | |
| 6611 if (containingLibraryName != null) { | |
| 6612 result["containingLibraryName"] = containingLibraryName; | |
| 6613 } | |
| 6614 if (dartdoc != null) { | |
| 6615 result["dartdoc"] = dartdoc; | |
| 6616 } | |
| 6617 if (elementDescription != null) { | |
| 6618 result["elementDescription"] = elementDescription; | |
| 6619 } | |
| 6620 if (elementKind != null) { | |
| 6621 result["elementKind"] = elementKind; | |
| 6622 } | |
| 6623 if (parameter != null) { | |
| 6624 result["parameter"] = parameter; | |
| 6625 } | |
| 6626 if (propagatedType != null) { | |
| 6627 result["propagatedType"] = propagatedType; | |
| 6628 } | |
| 6629 if (staticType != null) { | |
| 6630 result["staticType"] = staticType; | |
| 6631 } | |
| 6632 return result; | |
| 6633 } | |
| 6634 | |
| 6635 @override | |
| 6636 String toString() => JSON.encode(toJson()); | |
| 6637 | |
| 6638 @override | |
| 6639 bool operator==(other) { | |
| 6640 if (other is HoverInformation) { | |
| 6641 return offset == other.offset && | |
| 6642 length == other.length && | |
| 6643 containingLibraryPath == other.containingLibraryPath && | |
| 6644 containingLibraryName == other.containingLibraryName && | |
| 6645 dartdoc == other.dartdoc && | |
| 6646 elementDescription == other.elementDescription && | |
| 6647 elementKind == other.elementKind && | |
| 6648 parameter == other.parameter && | |
| 6649 propagatedType == other.propagatedType && | |
| 6650 staticType == other.staticType; | |
| 6651 } | |
| 6652 return false; | |
| 6653 } | |
| 6654 | |
| 6655 @override | |
| 6656 int get hashCode { | |
| 6657 int hash = 0; | |
| 6658 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 6659 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 6660 hash = _JenkinsSmiHash.combine(hash, containingLibraryPath.hashCode); | |
| 6661 hash = _JenkinsSmiHash.combine(hash, containingLibraryName.hashCode); | |
| 6662 hash = _JenkinsSmiHash.combine(hash, dartdoc.hashCode); | |
| 6663 hash = _JenkinsSmiHash.combine(hash, elementDescription.hashCode); | |
| 6664 hash = _JenkinsSmiHash.combine(hash, elementKind.hashCode); | |
| 6665 hash = _JenkinsSmiHash.combine(hash, parameter.hashCode); | |
| 6666 hash = _JenkinsSmiHash.combine(hash, propagatedType.hashCode); | |
| 6667 hash = _JenkinsSmiHash.combine(hash, staticType.hashCode); | |
| 6668 return _JenkinsSmiHash.finish(hash); | |
| 6669 } | |
| 6670 } | |
| 6671 | |
| 6672 /** | |
| 6673 * LinkedEditGroup | |
| 6674 * | |
| 6675 * { | |
| 6676 * "positions": List<Position> | |
| 6677 * "length": int | |
| 6678 * "suggestions": List<LinkedEditSuggestion> | |
| 6679 * } | |
| 6680 */ | |
| 6681 class LinkedEditGroup implements HasToJson { | |
| 6682 /** | |
| 6683 * The positions of the regions that should be edited simultaneously. | |
| 6684 */ | |
| 6685 List<Position> positions; | |
| 6686 | |
| 6687 /** | |
| 6688 * The length of the regions that should be edited simultaneously. | |
| 6689 */ | |
| 6690 int length; | |
| 6691 | |
| 6692 /** | |
| 6693 * Pre-computed suggestions for what every region might want to be changed | |
| 6694 * to. | |
| 6695 */ | |
| 6696 List<LinkedEditSuggestion> suggestions; | |
| 6697 | |
| 6698 LinkedEditGroup(this.positions, this.length, this.suggestions); | |
| 6699 | |
| 6700 factory LinkedEditGroup.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obj
ect json) { | |
| 6701 if (json == null) { | |
| 6702 json = {}; | |
| 6703 } | |
| 6704 if (json is Map) { | |
| 6705 List<Position> positions; | |
| 6706 if (json.containsKey("positions")) { | |
| 6707 positions = jsonDecoder._decodeList(jsonPath + ".positions", json["posit
ions"], (String jsonPath, Object json) => new Position.fromJson(jsonDecoder, jso
nPath, json)); | |
| 6708 } else { | |
| 6709 throw jsonDecoder.missingKey(jsonPath, "positions"); | |
| 6710 } | |
| 6711 int length; | |
| 6712 if (json.containsKey("length")) { | |
| 6713 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 6714 } else { | |
| 6715 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 6716 } | |
| 6717 List<LinkedEditSuggestion> suggestions; | |
| 6718 if (json.containsKey("suggestions")) { | |
| 6719 suggestions = jsonDecoder._decodeList(jsonPath + ".suggestions", json["s
uggestions"], (String jsonPath, Object json) => new LinkedEditSuggestion.fromJso
n(jsonDecoder, jsonPath, json)); | |
| 6720 } else { | |
| 6721 throw jsonDecoder.missingKey(jsonPath, "suggestions"); | |
| 6722 } | |
| 6723 return new LinkedEditGroup(positions, length, suggestions); | |
| 6724 } else { | |
| 6725 throw jsonDecoder.mismatch(jsonPath, "LinkedEditGroup"); | |
| 6726 } | |
| 6727 } | |
| 6728 | |
| 6729 /** | |
| 6730 * Construct an empty LinkedEditGroup. | |
| 6731 */ | |
| 6732 LinkedEditGroup.empty() : this(<Position>[], 0, <LinkedEditSuggestion>[]); | |
| 6733 | |
| 6734 Map<String, dynamic> toJson() { | |
| 6735 Map<String, dynamic> result = {}; | |
| 6736 result["positions"] = positions.map((Position value) => value.toJson()).toLi
st(); | |
| 6737 result["length"] = length; | |
| 6738 result["suggestions"] = suggestions.map((LinkedEditSuggestion value) => valu
e.toJson()).toList(); | |
| 6739 return result; | |
| 6740 } | |
| 6741 | |
| 6742 /** | |
| 6743 * Add a new position and change the length. | |
| 6744 */ | |
| 6745 void addPosition(Position position, int length) { | |
| 6746 positions.add(position); | |
| 6747 this.length = length; | |
| 6748 } | |
| 6749 | |
| 6750 /** | |
| 6751 * Add a new suggestion. | |
| 6752 */ | |
| 6753 void addSuggestion(LinkedEditSuggestion suggestion) { | |
| 6754 suggestions.add(suggestion); | |
| 6755 } | |
| 6756 | |
| 6757 @override | |
| 6758 String toString() => JSON.encode(toJson()); | |
| 6759 | |
| 6760 @override | |
| 6761 bool operator==(other) { | |
| 6762 if (other is LinkedEditGroup) { | |
| 6763 return _listEqual(positions, other.positions, (Position a, Position b) =>
a == b) && | |
| 6764 length == other.length && | |
| 6765 _listEqual(suggestions, other.suggestions, (LinkedEditSuggestion a, Li
nkedEditSuggestion b) => a == b); | |
| 6766 } | |
| 6767 return false; | |
| 6768 } | |
| 6769 | |
| 6770 @override | |
| 6771 int get hashCode { | |
| 6772 int hash = 0; | |
| 6773 hash = _JenkinsSmiHash.combine(hash, positions.hashCode); | |
| 6774 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 6775 hash = _JenkinsSmiHash.combine(hash, suggestions.hashCode); | |
| 6776 return _JenkinsSmiHash.finish(hash); | |
| 6777 } | |
| 6778 } | |
| 6779 | |
| 6780 /** | |
| 6781 * LinkedEditSuggestion | |
| 6782 * | |
| 6783 * { | |
| 6784 * "value": String | |
| 6785 * "kind": LinkedEditSuggestionKind | |
| 6786 * } | |
| 6787 */ | |
| 6788 class LinkedEditSuggestion implements HasToJson { | |
| 6789 /** | |
| 6790 * The value that could be used to replace all of the linked edit regions. | |
| 6791 */ | |
| 6792 String value; | |
| 6793 | |
| 6794 /** | |
| 6795 * The kind of value being proposed. | |
| 6796 */ | |
| 6797 LinkedEditSuggestionKind kind; | |
| 6798 | |
| 6799 LinkedEditSuggestion(this.value, this.kind); | |
| 6800 | |
| 6801 factory LinkedEditSuggestion.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 6802 if (json == null) { | |
| 6803 json = {}; | |
| 6804 } | |
| 6805 if (json is Map) { | |
| 6806 String value; | |
| 6807 if (json.containsKey("value")) { | |
| 6808 value = jsonDecoder._decodeString(jsonPath + ".value", json["value"]); | |
| 6809 } else { | |
| 6810 throw jsonDecoder.missingKey(jsonPath, "value"); | |
| 6811 } | |
| 6812 LinkedEditSuggestionKind kind; | |
| 6813 if (json.containsKey("kind")) { | |
| 6814 kind = new LinkedEditSuggestionKind.fromJson(jsonDecoder, jsonPath + ".k
ind", json["kind"]); | |
| 6815 } else { | |
| 6816 throw jsonDecoder.missingKey(jsonPath, "kind"); | |
| 6817 } | |
| 6818 return new LinkedEditSuggestion(value, kind); | |
| 6819 } else { | |
| 6820 throw jsonDecoder.mismatch(jsonPath, "LinkedEditSuggestion"); | |
| 6821 } | |
| 6822 } | |
| 6823 | |
| 6824 Map<String, dynamic> toJson() { | |
| 6825 Map<String, dynamic> result = {}; | |
| 6826 result["value"] = value; | |
| 6827 result["kind"] = kind.toJson(); | |
| 6828 return result; | |
| 6829 } | |
| 6830 | |
| 6831 @override | |
| 6832 String toString() => JSON.encode(toJson()); | |
| 6833 | |
| 6834 @override | |
| 6835 bool operator==(other) { | |
| 6836 if (other is LinkedEditSuggestion) { | |
| 6837 return value == other.value && | |
| 6838 kind == other.kind; | |
| 6839 } | |
| 6840 return false; | |
| 6841 } | |
| 6842 | |
| 6843 @override | |
| 6844 int get hashCode { | |
| 6845 int hash = 0; | |
| 6846 hash = _JenkinsSmiHash.combine(hash, value.hashCode); | |
| 6847 hash = _JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 6848 return _JenkinsSmiHash.finish(hash); | |
| 6849 } | |
| 6850 } | |
| 6851 | |
| 6852 /** | |
| 6853 * LinkedEditSuggestionKind | |
| 6854 * | |
| 6855 * enum { | |
| 6856 * METHOD | |
| 6857 * PARAMETER | |
| 6858 * TYPE | |
| 6859 * VARIABLE | |
| 6860 * } | |
| 6861 */ | |
| 6862 class LinkedEditSuggestionKind { | |
| 6863 static const METHOD = const LinkedEditSuggestionKind._("METHOD"); | |
| 6864 | |
| 6865 static const PARAMETER = const LinkedEditSuggestionKind._("PARAMETER"); | |
| 6866 | |
| 6867 static const TYPE = const LinkedEditSuggestionKind._("TYPE"); | |
| 6868 | |
| 6869 static const VARIABLE = const LinkedEditSuggestionKind._("VARIABLE"); | |
| 6870 | |
| 6871 final String name; | |
| 6872 | |
| 6873 const LinkedEditSuggestionKind._(this.name); | |
| 6874 | |
| 6875 factory LinkedEditSuggestionKind(String name) { | |
| 6876 switch (name) { | |
| 6877 case "METHOD": | |
| 6878 return METHOD; | |
| 6879 case "PARAMETER": | |
| 6880 return PARAMETER; | |
| 6881 case "TYPE": | |
| 6882 return TYPE; | |
| 6883 case "VARIABLE": | |
| 6884 return VARIABLE; | |
| 6885 } | |
| 6886 throw new Exception('Illegal enum value: $name'); | |
| 6887 } | |
| 6888 | |
| 6889 factory LinkedEditSuggestionKind.fromJson(JsonDecoder jsonDecoder, String json
Path, Object json) { | |
| 6890 if (json is String) { | |
| 6891 try { | |
| 6892 return new LinkedEditSuggestionKind(json); | |
| 6893 } catch(_) { | |
| 6894 // Fall through | |
| 6895 } | |
| 6896 } | |
| 6897 throw jsonDecoder.mismatch(jsonPath, "LinkedEditSuggestionKind"); | |
| 6898 } | |
| 6899 | |
| 6900 @override | |
| 6901 String toString() => "LinkedEditSuggestionKind.$name"; | |
| 6902 | |
| 6903 String toJson() => name; | |
| 6904 } | |
| 6905 | |
| 6906 /** | |
| 6907 * Location | |
| 6908 * | |
| 6909 * { | |
| 6910 * "file": FilePath | |
| 6911 * "offset": int | |
| 6912 * "length": int | |
| 6913 * "startLine": int | |
| 6914 * "startColumn": int | |
| 6915 * } | |
| 6916 */ | |
| 6917 class Location implements HasToJson { | |
| 6918 /** | |
| 6919 * The file containing the range. | |
| 6920 */ | |
| 6921 String file; | |
| 6922 | |
| 6923 /** | |
| 6924 * The offset of the range. | |
| 6925 */ | |
| 6926 int offset; | |
| 6927 | |
| 6928 /** | |
| 6929 * The length of the range. | |
| 6930 */ | |
| 6931 int length; | |
| 6932 | |
| 6933 /** | |
| 6934 * The one-based index of the line containing the first character of the | |
| 6935 * range. | |
| 6936 */ | |
| 6937 int startLine; | |
| 6938 | |
| 6939 /** | |
| 6940 * The one-based index of the column containing the first character of the | |
| 6941 * range. | |
| 6942 */ | |
| 6943 int startColumn; | |
| 6944 | |
| 6945 Location(this.file, this.offset, this.length, this.startLine, this.startColumn
); | |
| 6946 | |
| 6947 factory Location.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object jso
n) { | |
| 6948 if (json == null) { | |
| 6949 json = {}; | |
| 6950 } | |
| 6951 if (json is Map) { | |
| 6952 String file; | |
| 6953 if (json.containsKey("file")) { | |
| 6954 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 6955 } else { | |
| 6956 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 6957 } | |
| 6958 int offset; | |
| 6959 if (json.containsKey("offset")) { | |
| 6960 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 6961 } else { | |
| 6962 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 6963 } | |
| 6964 int length; | |
| 6965 if (json.containsKey("length")) { | |
| 6966 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 6967 } else { | |
| 6968 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 6969 } | |
| 6970 int startLine; | |
| 6971 if (json.containsKey("startLine")) { | |
| 6972 startLine = jsonDecoder._decodeInt(jsonPath + ".startLine", json["startL
ine"]); | |
| 6973 } else { | |
| 6974 throw jsonDecoder.missingKey(jsonPath, "startLine"); | |
| 6975 } | |
| 6976 int startColumn; | |
| 6977 if (json.containsKey("startColumn")) { | |
| 6978 startColumn = jsonDecoder._decodeInt(jsonPath + ".startColumn", json["st
artColumn"]); | |
| 6979 } else { | |
| 6980 throw jsonDecoder.missingKey(jsonPath, "startColumn"); | |
| 6981 } | |
| 6982 return new Location(file, offset, length, startLine, startColumn); | |
| 6983 } else { | |
| 6984 throw jsonDecoder.mismatch(jsonPath, "Location"); | |
| 6985 } | |
| 6986 } | |
| 6987 | |
| 6988 Map<String, dynamic> toJson() { | |
| 6989 Map<String, dynamic> result = {}; | |
| 6990 result["file"] = file; | |
| 6991 result["offset"] = offset; | |
| 6992 result["length"] = length; | |
| 6993 result["startLine"] = startLine; | |
| 6994 result["startColumn"] = startColumn; | |
| 6995 return result; | |
| 6996 } | |
| 6997 | |
| 6998 @override | |
| 6999 String toString() => JSON.encode(toJson()); | |
| 7000 | |
| 7001 @override | |
| 7002 bool operator==(other) { | |
| 7003 if (other is Location) { | |
| 7004 return file == other.file && | |
| 7005 offset == other.offset && | |
| 7006 length == other.length && | |
| 7007 startLine == other.startLine && | |
| 7008 startColumn == other.startColumn; | |
| 7009 } | |
| 7010 return false; | |
| 7011 } | |
| 7012 | |
| 7013 @override | |
| 7014 int get hashCode { | |
| 7015 int hash = 0; | |
| 7016 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 7017 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 7018 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 7019 hash = _JenkinsSmiHash.combine(hash, startLine.hashCode); | |
| 7020 hash = _JenkinsSmiHash.combine(hash, startColumn.hashCode); | |
| 7021 return _JenkinsSmiHash.finish(hash); | |
| 7022 } | |
| 7023 } | |
| 7024 | |
| 7025 /** | |
| 7026 * NavigationRegion | |
| 7027 * | |
| 7028 * { | |
| 7029 * "offset": int | |
| 7030 * "length": int | |
| 7031 * "targets": List<Element> | |
| 7032 * } | |
| 7033 */ | |
| 7034 class NavigationRegion implements HasToJson { | |
| 7035 /** | |
| 7036 * The offset of the region from which the user can navigate. | |
| 7037 */ | |
| 7038 int offset; | |
| 7039 | |
| 7040 /** | |
| 7041 * The length of the region from which the user can navigate. | |
| 7042 */ | |
| 7043 int length; | |
| 7044 | |
| 7045 /** | |
| 7046 * The elements to which the given region is bound. By opening the | |
| 7047 * declaration of the elements, clients can implement one form of navigation. | |
| 7048 */ | |
| 7049 List<Element> targets; | |
| 7050 | |
| 7051 NavigationRegion(this.offset, this.length, this.targets); | |
| 7052 | |
| 7053 factory NavigationRegion.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob
ject json) { | |
| 7054 if (json == null) { | |
| 7055 json = {}; | |
| 7056 } | |
| 7057 if (json is Map) { | |
| 7058 int offset; | |
| 7059 if (json.containsKey("offset")) { | |
| 7060 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 7061 } else { | |
| 7062 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 7063 } | |
| 7064 int length; | |
| 7065 if (json.containsKey("length")) { | |
| 7066 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 7067 } else { | |
| 7068 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 7069 } | |
| 7070 List<Element> targets; | |
| 7071 if (json.containsKey("targets")) { | |
| 7072 targets = jsonDecoder._decodeList(jsonPath + ".targets", json["targets"]
, (String jsonPath, Object json) => new Element.fromJson(jsonDecoder, jsonPath,
json)); | |
| 7073 } else { | |
| 7074 throw jsonDecoder.missingKey(jsonPath, "targets"); | |
| 7075 } | |
| 7076 return new NavigationRegion(offset, length, targets); | |
| 7077 } else { | |
| 7078 throw jsonDecoder.mismatch(jsonPath, "NavigationRegion"); | |
| 7079 } | |
| 7080 } | |
| 7081 | |
| 7082 Map<String, dynamic> toJson() { | |
| 7083 Map<String, dynamic> result = {}; | |
| 7084 result["offset"] = offset; | |
| 7085 result["length"] = length; | |
| 7086 result["targets"] = targets.map((Element value) => value.toJson()).toList(); | |
| 7087 return result; | |
| 7088 } | |
| 7089 | |
| 7090 @override | |
| 7091 String toString() => JSON.encode(toJson()); | |
| 7092 | |
| 7093 @override | |
| 7094 bool operator==(other) { | |
| 7095 if (other is NavigationRegion) { | |
| 7096 return offset == other.offset && | |
| 7097 length == other.length && | |
| 7098 _listEqual(targets, other.targets, (Element a, Element b) => a == b); | |
| 7099 } | |
| 7100 return false; | |
| 7101 } | |
| 7102 | |
| 7103 @override | |
| 7104 int get hashCode { | |
| 7105 int hash = 0; | |
| 7106 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 7107 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 7108 hash = _JenkinsSmiHash.combine(hash, targets.hashCode); | |
| 7109 return _JenkinsSmiHash.finish(hash); | |
| 7110 } | |
| 7111 } | |
| 7112 | |
| 7113 /** | |
| 7114 * Occurrences | |
| 7115 * | |
| 7116 * { | |
| 7117 * "element": Element | |
| 7118 * "offsets": List<int> | |
| 7119 * "length": int | |
| 7120 * } | |
| 7121 */ | |
| 7122 class Occurrences implements HasToJson { | |
| 7123 /** | |
| 7124 * The element that was referenced. | |
| 7125 */ | |
| 7126 Element element; | |
| 7127 | |
| 7128 /** | |
| 7129 * The offsets of the name of the referenced element within the file. | |
| 7130 */ | |
| 7131 List<int> offsets; | |
| 7132 | |
| 7133 /** | |
| 7134 * The length of the name of the referenced element. | |
| 7135 */ | |
| 7136 int length; | |
| 7137 | |
| 7138 Occurrences(this.element, this.offsets, this.length); | |
| 7139 | |
| 7140 factory Occurrences.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object
json) { | |
| 7141 if (json == null) { | |
| 7142 json = {}; | |
| 7143 } | |
| 7144 if (json is Map) { | |
| 7145 Element element; | |
| 7146 if (json.containsKey("element")) { | |
| 7147 element = new Element.fromJson(jsonDecoder, jsonPath + ".element", json[
"element"]); | |
| 7148 } else { | |
| 7149 throw jsonDecoder.missingKey(jsonPath, "element"); | |
| 7150 } | |
| 7151 List<int> offsets; | |
| 7152 if (json.containsKey("offsets")) { | |
| 7153 offsets = jsonDecoder._decodeList(jsonPath + ".offsets", json["offsets"]
, jsonDecoder._decodeInt); | |
| 7154 } else { | |
| 7155 throw jsonDecoder.missingKey(jsonPath, "offsets"); | |
| 7156 } | |
| 7157 int length; | |
| 7158 if (json.containsKey("length")) { | |
| 7159 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 7160 } else { | |
| 7161 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 7162 } | |
| 7163 return new Occurrences(element, offsets, length); | |
| 7164 } else { | |
| 7165 throw jsonDecoder.mismatch(jsonPath, "Occurrences"); | |
| 7166 } | |
| 7167 } | |
| 7168 | |
| 7169 Map<String, dynamic> toJson() { | |
| 7170 Map<String, dynamic> result = {}; | |
| 7171 result["element"] = element.toJson(); | |
| 7172 result["offsets"] = offsets; | |
| 7173 result["length"] = length; | |
| 7174 return result; | |
| 7175 } | |
| 7176 | |
| 7177 @override | |
| 7178 String toString() => JSON.encode(toJson()); | |
| 7179 | |
| 7180 @override | |
| 7181 bool operator==(other) { | |
| 7182 if (other is Occurrences) { | |
| 7183 return element == other.element && | |
| 7184 _listEqual(offsets, other.offsets, (int a, int b) => a == b) && | |
| 7185 length == other.length; | |
| 7186 } | |
| 7187 return false; | |
| 7188 } | |
| 7189 | |
| 7190 @override | |
| 7191 int get hashCode { | |
| 7192 int hash = 0; | |
| 7193 hash = _JenkinsSmiHash.combine(hash, element.hashCode); | |
| 7194 hash = _JenkinsSmiHash.combine(hash, offsets.hashCode); | |
| 7195 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 7196 return _JenkinsSmiHash.finish(hash); | |
| 7197 } | |
| 7198 } | |
| 7199 | |
| 7200 /** | |
| 7201 * Outline | |
| 7202 * | |
| 7203 * { | |
| 7204 * "element": Element | |
| 7205 * "offset": int | |
| 7206 * "length": int | |
| 7207 * "children": optional List<Outline> | |
| 7208 * } | |
| 7209 */ | |
| 7210 class Outline implements HasToJson { | |
| 7211 /** | |
| 7212 * A description of the element represented by this node. | |
| 7213 */ | |
| 7214 Element element; | |
| 7215 | |
| 7216 /** | |
| 7217 * The offset of the first character of the element. This is different than | |
| 7218 * the offset in the Element, which if the offset of the name of the element. | |
| 7219 * It can be used, for example, to map locations in the file back to an | |
| 7220 * outline. | |
| 7221 */ | |
| 7222 int offset; | |
| 7223 | |
| 7224 /** | |
| 7225 * The length of the element. | |
| 7226 */ | |
| 7227 int length; | |
| 7228 | |
| 7229 /** | |
| 7230 * The children of the node. The field will be omitted if the node has no | |
| 7231 * children. | |
| 7232 */ | |
| 7233 List<Outline> children; | |
| 7234 | |
| 7235 Outline(this.element, this.offset, this.length, {this.children}) { | |
| 7236 if (children == null) { | |
| 7237 children = <Outline>[]; | |
| 7238 } | |
| 7239 } | |
| 7240 | |
| 7241 factory Outline.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object json
) { | |
| 7242 if (json == null) { | |
| 7243 json = {}; | |
| 7244 } | |
| 7245 if (json is Map) { | |
| 7246 Element element; | |
| 7247 if (json.containsKey("element")) { | |
| 7248 element = new Element.fromJson(jsonDecoder, jsonPath + ".element", json[
"element"]); | |
| 7249 } else { | |
| 7250 throw jsonDecoder.missingKey(jsonPath, "element"); | |
| 7251 } | |
| 7252 int offset; | |
| 7253 if (json.containsKey("offset")) { | |
| 7254 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 7255 } else { | |
| 7256 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 7257 } | |
| 7258 int length; | |
| 7259 if (json.containsKey("length")) { | |
| 7260 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 7261 } else { | |
| 7262 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 7263 } | |
| 7264 List<Outline> children; | |
| 7265 if (json.containsKey("children")) { | |
| 7266 children = jsonDecoder._decodeList(jsonPath + ".children", json["childre
n"], (String jsonPath, Object json) => new Outline.fromJson(jsonDecoder, jsonPat
h, json)); | |
| 7267 } else { | |
| 7268 children = <Outline>[]; | |
| 7269 } | |
| 7270 return new Outline(element, offset, length, children: children); | |
| 7271 } else { | |
| 7272 throw jsonDecoder.mismatch(jsonPath, "Outline"); | |
| 7273 } | |
| 7274 } | |
| 7275 | |
| 7276 Map<String, dynamic> toJson() { | |
| 7277 Map<String, dynamic> result = {}; | |
| 7278 result["element"] = element.toJson(); | |
| 7279 result["offset"] = offset; | |
| 7280 result["length"] = length; | |
| 7281 if (children.isNotEmpty) { | |
| 7282 result["children"] = children.map((Outline value) => value.toJson()).toLis
t(); | |
| 7283 } | |
| 7284 return result; | |
| 7285 } | |
| 7286 | |
| 7287 @override | |
| 7288 String toString() => JSON.encode(toJson()); | |
| 7289 | |
| 7290 @override | |
| 7291 bool operator==(other) { | |
| 7292 if (other is Outline) { | |
| 7293 return element == other.element && | |
| 7294 offset == other.offset && | |
| 7295 length == other.length && | |
| 7296 _listEqual(children, other.children, (Outline a, Outline b) => a == b)
; | |
| 7297 } | |
| 7298 return false; | |
| 7299 } | |
| 7300 | |
| 7301 @override | |
| 7302 int get hashCode { | |
| 7303 int hash = 0; | |
| 7304 hash = _JenkinsSmiHash.combine(hash, element.hashCode); | |
| 7305 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 7306 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 7307 hash = _JenkinsSmiHash.combine(hash, children.hashCode); | |
| 7308 return _JenkinsSmiHash.finish(hash); | |
| 7309 } | |
| 7310 } | |
| 7311 | |
| 7312 /** | |
| 7313 * Override | |
| 7314 * | |
| 7315 * { | |
| 7316 * "offset": int | |
| 7317 * "length": int | |
| 7318 * "superclassMember": optional OverriddenMember | |
| 7319 * "interfaceMembers": optional List<OverriddenMember> | |
| 7320 * } | |
| 7321 */ | |
| 7322 class Override implements HasToJson { | |
| 7323 /** | |
| 7324 * The offset of the name of the overriding member. | |
| 7325 */ | |
| 7326 int offset; | |
| 7327 | |
| 7328 /** | |
| 7329 * The length of the name of the overriding member. | |
| 7330 */ | |
| 7331 int length; | |
| 7332 | |
| 7333 /** | |
| 7334 * The member inherited from a superclass that is overridden by the | |
| 7335 * overriding member. The field is omitted if there is no superclass member, | |
| 7336 * in which case there must be at least one interface member. | |
| 7337 */ | |
| 7338 OverriddenMember superclassMember; | |
| 7339 | |
| 7340 /** | |
| 7341 * The members inherited from interfaces that are overridden by the | |
| 7342 * overriding member. The field is omitted if there are no interface members, | |
| 7343 * in which case there must be a superclass member. | |
| 7344 */ | |
| 7345 List<OverriddenMember> interfaceMembers; | |
| 7346 | |
| 7347 Override(this.offset, this.length, {this.superclassMember, this.interfaceMembe
rs}) { | |
| 7348 if (interfaceMembers == null) { | |
| 7349 interfaceMembers = <OverriddenMember>[]; | |
| 7350 } | |
| 7351 } | |
| 7352 | |
| 7353 factory Override.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object jso
n) { | |
| 7354 if (json == null) { | |
| 7355 json = {}; | |
| 7356 } | |
| 7357 if (json is Map) { | |
| 7358 int offset; | |
| 7359 if (json.containsKey("offset")) { | |
| 7360 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 7361 } else { | |
| 7362 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 7363 } | |
| 7364 int length; | |
| 7365 if (json.containsKey("length")) { | |
| 7366 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 7367 } else { | |
| 7368 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 7369 } | |
| 7370 OverriddenMember superclassMember; | |
| 7371 if (json.containsKey("superclassMember")) { | |
| 7372 superclassMember = new OverriddenMember.fromJson(jsonDecoder, jsonPath +
".superclassMember", json["superclassMember"]); | |
| 7373 } | |
| 7374 List<OverriddenMember> interfaceMembers; | |
| 7375 if (json.containsKey("interfaceMembers")) { | |
| 7376 interfaceMembers = jsonDecoder._decodeList(jsonPath + ".interfaceMembers
", json["interfaceMembers"], (String jsonPath, Object json) => new OverriddenMem
ber.fromJson(jsonDecoder, jsonPath, json)); | |
| 7377 } else { | |
| 7378 interfaceMembers = <OverriddenMember>[]; | |
| 7379 } | |
| 7380 return new Override(offset, length, superclassMember: superclassMember, in
terfaceMembers: interfaceMembers); | |
| 7381 } else { | |
| 7382 throw jsonDecoder.mismatch(jsonPath, "Override"); | |
| 7383 } | |
| 7384 } | |
| 7385 | |
| 7386 Map<String, dynamic> toJson() { | |
| 7387 Map<String, dynamic> result = {}; | |
| 7388 result["offset"] = offset; | |
| 7389 result["length"] = length; | |
| 7390 if (superclassMember != null) { | |
| 7391 result["superclassMember"] = superclassMember.toJson(); | |
| 7392 } | |
| 7393 if (interfaceMembers.isNotEmpty) { | |
| 7394 result["interfaceMembers"] = interfaceMembers.map((OverriddenMember value)
=> value.toJson()).toList(); | |
| 7395 } | |
| 7396 return result; | |
| 7397 } | |
| 7398 | |
| 7399 @override | |
| 7400 String toString() => JSON.encode(toJson()); | |
| 7401 | |
| 7402 @override | |
| 7403 bool operator==(other) { | |
| 7404 if (other is Override) { | |
| 7405 return offset == other.offset && | |
| 7406 length == other.length && | |
| 7407 superclassMember == other.superclassMember && | |
| 7408 _listEqual(interfaceMembers, other.interfaceMembers, (OverriddenMember
a, OverriddenMember b) => a == b); | |
| 7409 } | |
| 7410 return false; | |
| 7411 } | |
| 7412 | |
| 7413 @override | |
| 7414 int get hashCode { | |
| 7415 int hash = 0; | |
| 7416 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 7417 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 7418 hash = _JenkinsSmiHash.combine(hash, superclassMember.hashCode); | |
| 7419 hash = _JenkinsSmiHash.combine(hash, interfaceMembers.hashCode); | |
| 7420 return _JenkinsSmiHash.finish(hash); | |
| 7421 } | |
| 7422 } | |
| 7423 | |
| 7424 /** | |
| 7425 * OverriddenMember | |
| 7426 * | |
| 7427 * { | |
| 7428 * "element": Element | |
| 7429 * "className": String | |
| 7430 * } | |
| 7431 */ | |
| 7432 class OverriddenMember implements HasToJson { | |
| 7433 /** | |
| 7434 * The element that is being overridden. | |
| 7435 */ | |
| 7436 Element element; | |
| 7437 | |
| 7438 /** | |
| 7439 * The name of the class in which the member is defined. | |
| 7440 */ | |
| 7441 String className; | |
| 7442 | |
| 7443 OverriddenMember(this.element, this.className); | |
| 7444 | |
| 7445 factory OverriddenMember.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob
ject json) { | |
| 7446 if (json == null) { | |
| 7447 json = {}; | |
| 7448 } | |
| 7449 if (json is Map) { | |
| 7450 Element element; | |
| 7451 if (json.containsKey("element")) { | |
| 7452 element = new Element.fromJson(jsonDecoder, jsonPath + ".element", json[
"element"]); | |
| 7453 } else { | |
| 7454 throw jsonDecoder.missingKey(jsonPath, "element"); | |
| 7455 } | |
| 7456 String className; | |
| 7457 if (json.containsKey("className")) { | |
| 7458 className = jsonDecoder._decodeString(jsonPath + ".className", json["cla
ssName"]); | |
| 7459 } else { | |
| 7460 throw jsonDecoder.missingKey(jsonPath, "className"); | |
| 7461 } | |
| 7462 return new OverriddenMember(element, className); | |
| 7463 } else { | |
| 7464 throw jsonDecoder.mismatch(jsonPath, "OverriddenMember"); | |
| 7465 } | |
| 7466 } | |
| 7467 | |
| 7468 Map<String, dynamic> toJson() { | |
| 7469 Map<String, dynamic> result = {}; | |
| 7470 result["element"] = element.toJson(); | |
| 7471 result["className"] = className; | |
| 7472 return result; | |
| 7473 } | |
| 7474 | |
| 7475 @override | |
| 7476 String toString() => JSON.encode(toJson()); | |
| 7477 | |
| 7478 @override | |
| 7479 bool operator==(other) { | |
| 7480 if (other is OverriddenMember) { | |
| 7481 return element == other.element && | |
| 7482 className == other.className; | |
| 7483 } | |
| 7484 return false; | |
| 7485 } | |
| 7486 | |
| 7487 @override | |
| 7488 int get hashCode { | |
| 7489 int hash = 0; | |
| 7490 hash = _JenkinsSmiHash.combine(hash, element.hashCode); | |
| 7491 hash = _JenkinsSmiHash.combine(hash, className.hashCode); | |
| 7492 return _JenkinsSmiHash.finish(hash); | |
| 7493 } | |
| 7494 } | |
| 7495 | |
| 7496 /** | |
| 7497 * Position | |
| 7498 * | |
| 7499 * { | |
| 7500 * "file": FilePath | |
| 7501 * "offset": int | |
| 7502 * } | |
| 7503 */ | |
| 7504 class Position implements HasToJson { | |
| 7505 /** | |
| 7506 * The file containing the position. | |
| 7507 */ | |
| 7508 String file; | |
| 7509 | |
| 7510 /** | |
| 7511 * The offset of the position. | |
| 7512 */ | |
| 7513 int offset; | |
| 7514 | |
| 7515 Position(this.file, this.offset); | |
| 7516 | |
| 7517 factory Position.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object jso
n) { | |
| 7518 if (json == null) { | |
| 7519 json = {}; | |
| 7520 } | |
| 7521 if (json is Map) { | |
| 7522 String file; | |
| 7523 if (json.containsKey("file")) { | |
| 7524 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 7525 } else { | |
| 7526 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 7527 } | |
| 7528 int offset; | |
| 7529 if (json.containsKey("offset")) { | |
| 7530 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 7531 } else { | |
| 7532 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 7533 } | |
| 7534 return new Position(file, offset); | |
| 7535 } else { | |
| 7536 throw jsonDecoder.mismatch(jsonPath, "Position"); | |
| 7537 } | |
| 7538 } | |
| 7539 | |
| 7540 Map<String, dynamic> toJson() { | |
| 7541 Map<String, dynamic> result = {}; | |
| 7542 result["file"] = file; | |
| 7543 result["offset"] = offset; | |
| 7544 return result; | |
| 7545 } | |
| 7546 | |
| 7547 @override | |
| 7548 String toString() => JSON.encode(toJson()); | |
| 7549 | |
| 7550 @override | |
| 7551 bool operator==(other) { | |
| 7552 if (other is Position) { | |
| 7553 return file == other.file && | |
| 7554 offset == other.offset; | |
| 7555 } | |
| 7556 return false; | |
| 7557 } | |
| 7558 | |
| 7559 @override | |
| 7560 int get hashCode { | |
| 7561 int hash = 0; | |
| 7562 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 7563 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 7564 return _JenkinsSmiHash.finish(hash); | |
| 7565 } | |
| 7566 } | |
| 7567 | |
| 7568 /** | |
| 7569 * RefactoringKind | |
| 7570 * | |
| 7571 * enum { | |
| 7572 * CONVERT_GETTER_TO_METHOD | |
| 7573 * CONVERT_METHOD_TO_GETTER | |
| 7574 * EXTRACT_LOCAL_VARIABLE | |
| 7575 * EXTRACT_METHOD | |
| 7576 * INLINE_LOCAL_VARIABLE | |
| 7577 * INLINE_METHOD | |
| 7578 * RENAME | |
| 7579 * } | |
| 7580 */ | |
| 7581 class RefactoringKind { | |
| 7582 static const CONVERT_GETTER_TO_METHOD = const RefactoringKind._("CONVERT_GETTE
R_TO_METHOD"); | |
| 7583 | |
| 7584 static const CONVERT_METHOD_TO_GETTER = const RefactoringKind._("CONVERT_METHO
D_TO_GETTER"); | |
| 7585 | |
| 7586 static const EXTRACT_LOCAL_VARIABLE = const RefactoringKind._("EXTRACT_LOCAL_V
ARIABLE"); | |
| 7587 | |
| 7588 static const EXTRACT_METHOD = const RefactoringKind._("EXTRACT_METHOD"); | |
| 7589 | |
| 7590 static const INLINE_LOCAL_VARIABLE = const RefactoringKind._("INLINE_LOCAL_VAR
IABLE"); | |
| 7591 | |
| 7592 static const INLINE_METHOD = const RefactoringKind._("INLINE_METHOD"); | |
| 7593 | |
| 7594 static const RENAME = const RefactoringKind._("RENAME"); | |
| 7595 | |
| 7596 final String name; | |
| 7597 | |
| 7598 const RefactoringKind._(this.name); | |
| 7599 | |
| 7600 factory RefactoringKind(String name) { | |
| 7601 switch (name) { | |
| 7602 case "CONVERT_GETTER_TO_METHOD": | |
| 7603 return CONVERT_GETTER_TO_METHOD; | |
| 7604 case "CONVERT_METHOD_TO_GETTER": | |
| 7605 return CONVERT_METHOD_TO_GETTER; | |
| 7606 case "EXTRACT_LOCAL_VARIABLE": | |
| 7607 return EXTRACT_LOCAL_VARIABLE; | |
| 7608 case "EXTRACT_METHOD": | |
| 7609 return EXTRACT_METHOD; | |
| 7610 case "INLINE_LOCAL_VARIABLE": | |
| 7611 return INLINE_LOCAL_VARIABLE; | |
| 7612 case "INLINE_METHOD": | |
| 7613 return INLINE_METHOD; | |
| 7614 case "RENAME": | |
| 7615 return RENAME; | |
| 7616 } | |
| 7617 throw new Exception('Illegal enum value: $name'); | |
| 7618 } | |
| 7619 | |
| 7620 factory RefactoringKind.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obj
ect json) { | |
| 7621 if (json is String) { | |
| 7622 try { | |
| 7623 return new RefactoringKind(json); | |
| 7624 } catch(_) { | |
| 7625 // Fall through | |
| 7626 } | |
| 7627 } | |
| 7628 throw jsonDecoder.mismatch(jsonPath, "RefactoringKind"); | |
| 7629 } | |
| 7630 | |
| 7631 @override | |
| 7632 String toString() => "RefactoringKind.$name"; | |
| 7633 | |
| 7634 String toJson() => name; | |
| 7635 } | |
| 7636 | |
| 7637 /** | |
| 7638 * RefactoringMethodParameter | |
| 7639 * | |
| 7640 * { | |
| 7641 * "id": optional String | |
| 7642 * "kind": RefactoringMethodParameterKind | |
| 7643 * "type": String | |
| 7644 * "name": String | |
| 7645 * "parameters": optional String | |
| 7646 * } | |
| 7647 */ | |
| 7648 class RefactoringMethodParameter implements HasToJson { | |
| 7649 /** | |
| 7650 * The unique identifier of the parameter. Clients may omit this field for | |
| 7651 * the parameters they want to add. | |
| 7652 */ | |
| 7653 String id; | |
| 7654 | |
| 7655 /** | |
| 7656 * The kind of the parameter. | |
| 7657 */ | |
| 7658 RefactoringMethodParameterKind kind; | |
| 7659 | |
| 7660 /** | |
| 7661 * The type that should be given to the parameter, or the return type of the | |
| 7662 * parameter's function type. | |
| 7663 */ | |
| 7664 String type; | |
| 7665 | |
| 7666 /** | |
| 7667 * The name that should be given to the parameter. | |
| 7668 */ | |
| 7669 String name; | |
| 7670 | |
| 7671 /** | |
| 7672 * The parameter list of the parameter's function type. If the parameter is | |
| 7673 * not of a function type, this field will not be defined. If the function | |
| 7674 * type has zero parameters, this field will have a value of "()". | |
| 7675 */ | |
| 7676 String parameters; | |
| 7677 | |
| 7678 RefactoringMethodParameter(this.kind, this.type, this.name, {this.id, this.par
ameters}); | |
| 7679 | |
| 7680 factory RefactoringMethodParameter.fromJson(JsonDecoder jsonDecoder, String js
onPath, Object json) { | |
| 7681 if (json == null) { | |
| 7682 json = {}; | |
| 7683 } | |
| 7684 if (json is Map) { | |
| 7685 String id; | |
| 7686 if (json.containsKey("id")) { | |
| 7687 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); | |
| 7688 } | |
| 7689 RefactoringMethodParameterKind kind; | |
| 7690 if (json.containsKey("kind")) { | |
| 7691 kind = new RefactoringMethodParameterKind.fromJson(jsonDecoder, jsonPath
+ ".kind", json["kind"]); | |
| 7692 } else { | |
| 7693 throw jsonDecoder.missingKey(jsonPath, "kind"); | |
| 7694 } | |
| 7695 String type; | |
| 7696 if (json.containsKey("type")) { | |
| 7697 type = jsonDecoder._decodeString(jsonPath + ".type", json["type"]); | |
| 7698 } else { | |
| 7699 throw jsonDecoder.missingKey(jsonPath, "type"); | |
| 7700 } | |
| 7701 String name; | |
| 7702 if (json.containsKey("name")) { | |
| 7703 name = jsonDecoder._decodeString(jsonPath + ".name", json["name"]); | |
| 7704 } else { | |
| 7705 throw jsonDecoder.missingKey(jsonPath, "name"); | |
| 7706 } | |
| 7707 String parameters; | |
| 7708 if (json.containsKey("parameters")) { | |
| 7709 parameters = jsonDecoder._decodeString(jsonPath + ".parameters", json["p
arameters"]); | |
| 7710 } | |
| 7711 return new RefactoringMethodParameter(kind, type, name, id: id, parameters
: parameters); | |
| 7712 } else { | |
| 7713 throw jsonDecoder.mismatch(jsonPath, "RefactoringMethodParameter"); | |
| 7714 } | |
| 7715 } | |
| 7716 | |
| 7717 Map<String, dynamic> toJson() { | |
| 7718 Map<String, dynamic> result = {}; | |
| 7719 if (id != null) { | |
| 7720 result["id"] = id; | |
| 7721 } | |
| 7722 result["kind"] = kind.toJson(); | |
| 7723 result["type"] = type; | |
| 7724 result["name"] = name; | |
| 7725 if (parameters != null) { | |
| 7726 result["parameters"] = parameters; | |
| 7727 } | |
| 7728 return result; | |
| 7729 } | |
| 7730 | |
| 7731 @override | |
| 7732 String toString() => JSON.encode(toJson()); | |
| 7733 | |
| 7734 @override | |
| 7735 bool operator==(other) { | |
| 7736 if (other is RefactoringMethodParameter) { | |
| 7737 return id == other.id && | |
| 7738 kind == other.kind && | |
| 7739 type == other.type && | |
| 7740 name == other.name && | |
| 7741 parameters == other.parameters; | |
| 7742 } | |
| 7743 return false; | |
| 7744 } | |
| 7745 | |
| 7746 @override | |
| 7747 int get hashCode { | |
| 7748 int hash = 0; | |
| 7749 hash = _JenkinsSmiHash.combine(hash, id.hashCode); | |
| 7750 hash = _JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 7751 hash = _JenkinsSmiHash.combine(hash, type.hashCode); | |
| 7752 hash = _JenkinsSmiHash.combine(hash, name.hashCode); | |
| 7753 hash = _JenkinsSmiHash.combine(hash, parameters.hashCode); | |
| 7754 return _JenkinsSmiHash.finish(hash); | |
| 7755 } | |
| 7756 } | |
| 7757 | |
| 7758 /** | |
| 7759 * RefactoringFeedback | |
| 7760 * | |
| 7761 * { | |
| 7762 * } | |
| 7763 */ | |
| 7764 class RefactoringFeedback implements HasToJson { | |
| 7765 RefactoringFeedback(); | |
| 7766 | |
| 7767 factory RefactoringFeedback.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json, Map responseJson) { | |
| 7768 return _refactoringFeedbackFromJson(jsonDecoder, jsonPath, json, responseJso
n); | |
| 7769 } | |
| 7770 | |
| 7771 Map<String, dynamic> toJson() { | |
| 7772 Map<String, dynamic> result = {}; | |
| 7773 return result; | |
| 7774 } | |
| 7775 | |
| 7776 @override | |
| 7777 String toString() => JSON.encode(toJson()); | |
| 7778 | |
| 7779 @override | |
| 7780 bool operator==(other) { | |
| 7781 if (other is RefactoringFeedback) { | |
| 7782 return true; | |
| 7783 } | |
| 7784 return false; | |
| 7785 } | |
| 7786 | |
| 7787 @override | |
| 7788 int get hashCode { | |
| 7789 int hash = 0; | |
| 7790 return _JenkinsSmiHash.finish(hash); | |
| 7791 } | |
| 7792 } | |
| 7793 | |
| 7794 /** | |
| 7795 * RefactoringOptions | |
| 7796 * | |
| 7797 * { | |
| 7798 * } | |
| 7799 */ | |
| 7800 class RefactoringOptions implements HasToJson { | |
| 7801 RefactoringOptions(); | |
| 7802 | |
| 7803 factory RefactoringOptions.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json, RefactoringKind kind) { | |
| 7804 return _refactoringOptionsFromJson(jsonDecoder, jsonPath, json, kind); | |
| 7805 } | |
| 7806 | |
| 7807 Map<String, dynamic> toJson() { | |
| 7808 Map<String, dynamic> result = {}; | |
| 7809 return result; | |
| 7810 } | |
| 7811 | |
| 7812 @override | |
| 7813 String toString() => JSON.encode(toJson()); | |
| 7814 | |
| 7815 @override | |
| 7816 bool operator==(other) { | |
| 7817 if (other is RefactoringOptions) { | |
| 7818 return true; | |
| 7819 } | |
| 7820 return false; | |
| 7821 } | |
| 7822 | |
| 7823 @override | |
| 7824 int get hashCode { | |
| 7825 int hash = 0; | |
| 7826 return _JenkinsSmiHash.finish(hash); | |
| 7827 } | |
| 7828 } | |
| 7829 | |
| 7830 /** | |
| 7831 * RefactoringMethodParameterKind | |
| 7832 * | |
| 7833 * enum { | |
| 7834 * REQUIRED | |
| 7835 * POSITIONAL | |
| 7836 * NAMED | |
| 7837 * } | |
| 7838 */ | |
| 7839 class RefactoringMethodParameterKind { | |
| 7840 static const REQUIRED = const RefactoringMethodParameterKind._("REQUIRED"); | |
| 7841 | |
| 7842 static const POSITIONAL = const RefactoringMethodParameterKind._("POSITIONAL")
; | |
| 7843 | |
| 7844 static const NAMED = const RefactoringMethodParameterKind._("NAMED"); | |
| 7845 | |
| 7846 final String name; | |
| 7847 | |
| 7848 const RefactoringMethodParameterKind._(this.name); | |
| 7849 | |
| 7850 factory RefactoringMethodParameterKind(String name) { | |
| 7851 switch (name) { | |
| 7852 case "REQUIRED": | |
| 7853 return REQUIRED; | |
| 7854 case "POSITIONAL": | |
| 7855 return POSITIONAL; | |
| 7856 case "NAMED": | |
| 7857 return NAMED; | |
| 7858 } | |
| 7859 throw new Exception('Illegal enum value: $name'); | |
| 7860 } | |
| 7861 | |
| 7862 factory RefactoringMethodParameterKind.fromJson(JsonDecoder jsonDecoder, Strin
g jsonPath, Object json) { | |
| 7863 if (json is String) { | |
| 7864 try { | |
| 7865 return new RefactoringMethodParameterKind(json); | |
| 7866 } catch(_) { | |
| 7867 // Fall through | |
| 7868 } | |
| 7869 } | |
| 7870 throw jsonDecoder.mismatch(jsonPath, "RefactoringMethodParameterKind"); | |
| 7871 } | |
| 7872 | |
| 7873 @override | |
| 7874 String toString() => "RefactoringMethodParameterKind.$name"; | |
| 7875 | |
| 7876 String toJson() => name; | |
| 7877 } | |
| 7878 | |
| 7879 /** | |
| 7880 * RefactoringProblem | |
| 7881 * | |
| 7882 * { | |
| 7883 * "severity": RefactoringProblemSeverity | |
| 7884 * "message": String | |
| 7885 * "location": optional Location | |
| 7886 * } | |
| 7887 */ | |
| 7888 class RefactoringProblem implements HasToJson { | |
| 7889 /** | |
| 7890 * The severity of the problem being represented. | |
| 7891 */ | |
| 7892 RefactoringProblemSeverity severity; | |
| 7893 | |
| 7894 /** | |
| 7895 * A human-readable description of the problem being represented. | |
| 7896 */ | |
| 7897 String message; | |
| 7898 | |
| 7899 /** | |
| 7900 * The location of the problem being represented. This field is omitted | |
| 7901 * unless there is a specific location associated with the problem (such as a | |
| 7902 * location where an element being renamed will be shadowed). | |
| 7903 */ | |
| 7904 Location location; | |
| 7905 | |
| 7906 RefactoringProblem(this.severity, this.message, {this.location}); | |
| 7907 | |
| 7908 factory RefactoringProblem.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 7909 if (json == null) { | |
| 7910 json = {}; | |
| 7911 } | |
| 7912 if (json is Map) { | |
| 7913 RefactoringProblemSeverity severity; | |
| 7914 if (json.containsKey("severity")) { | |
| 7915 severity = new RefactoringProblemSeverity.fromJson(jsonDecoder, jsonPath
+ ".severity", json["severity"]); | |
| 7916 } else { | |
| 7917 throw jsonDecoder.missingKey(jsonPath, "severity"); | |
| 7918 } | |
| 7919 String message; | |
| 7920 if (json.containsKey("message")) { | |
| 7921 message = jsonDecoder._decodeString(jsonPath + ".message", json["message
"]); | |
| 7922 } else { | |
| 7923 throw jsonDecoder.missingKey(jsonPath, "message"); | |
| 7924 } | |
| 7925 Location location; | |
| 7926 if (json.containsKey("location")) { | |
| 7927 location = new Location.fromJson(jsonDecoder, jsonPath + ".location", js
on["location"]); | |
| 7928 } | |
| 7929 return new RefactoringProblem(severity, message, location: location); | |
| 7930 } else { | |
| 7931 throw jsonDecoder.mismatch(jsonPath, "RefactoringProblem"); | |
| 7932 } | |
| 7933 } | |
| 7934 | |
| 7935 Map<String, dynamic> toJson() { | |
| 7936 Map<String, dynamic> result = {}; | |
| 7937 result["severity"] = severity.toJson(); | |
| 7938 result["message"] = message; | |
| 7939 if (location != null) { | |
| 7940 result["location"] = location.toJson(); | |
| 7941 } | |
| 7942 return result; | |
| 7943 } | |
| 7944 | |
| 7945 @override | |
| 7946 String toString() => JSON.encode(toJson()); | |
| 7947 | |
| 7948 @override | |
| 7949 bool operator==(other) { | |
| 7950 if (other is RefactoringProblem) { | |
| 7951 return severity == other.severity && | |
| 7952 message == other.message && | |
| 7953 location == other.location; | |
| 7954 } | |
| 7955 return false; | |
| 7956 } | |
| 7957 | |
| 7958 @override | |
| 7959 int get hashCode { | |
| 7960 int hash = 0; | |
| 7961 hash = _JenkinsSmiHash.combine(hash, severity.hashCode); | |
| 7962 hash = _JenkinsSmiHash.combine(hash, message.hashCode); | |
| 7963 hash = _JenkinsSmiHash.combine(hash, location.hashCode); | |
| 7964 return _JenkinsSmiHash.finish(hash); | |
| 7965 } | |
| 7966 } | |
| 7967 | |
| 7968 /** | |
| 7969 * RefactoringProblemSeverity | |
| 7970 * | |
| 7971 * enum { | |
| 7972 * INFO | |
| 7973 * WARNING | |
| 7974 * ERROR | |
| 7975 * FATAL | |
| 7976 * } | |
| 7977 */ | |
| 7978 class RefactoringProblemSeverity { | |
| 7979 static const INFO = const RefactoringProblemSeverity._("INFO"); | |
| 7980 | |
| 7981 static const WARNING = const RefactoringProblemSeverity._("WARNING"); | |
| 7982 | |
| 7983 static const ERROR = const RefactoringProblemSeverity._("ERROR"); | |
| 7984 | |
| 7985 static const FATAL = const RefactoringProblemSeverity._("FATAL"); | |
| 7986 | |
| 7987 final String name; | |
| 7988 | |
| 7989 const RefactoringProblemSeverity._(this.name); | |
| 7990 | |
| 7991 factory RefactoringProblemSeverity(String name) { | |
| 7992 switch (name) { | |
| 7993 case "INFO": | |
| 7994 return INFO; | |
| 7995 case "WARNING": | |
| 7996 return WARNING; | |
| 7997 case "ERROR": | |
| 7998 return ERROR; | |
| 7999 case "FATAL": | |
| 8000 return FATAL; | |
| 8001 } | |
| 8002 throw new Exception('Illegal enum value: $name'); | |
| 8003 } | |
| 8004 | |
| 8005 factory RefactoringProblemSeverity.fromJson(JsonDecoder jsonDecoder, String js
onPath, Object json) { | |
| 8006 if (json is String) { | |
| 8007 try { | |
| 8008 return new RefactoringProblemSeverity(json); | |
| 8009 } catch(_) { | |
| 8010 // Fall through | |
| 8011 } | |
| 8012 } | |
| 8013 throw jsonDecoder.mismatch(jsonPath, "RefactoringProblemSeverity"); | |
| 8014 } | |
| 8015 | |
| 8016 /** | |
| 8017 * Returns the [RefactoringProblemSeverity] with the maximal severity. | |
| 8018 */ | |
| 8019 static RefactoringProblemSeverity max(RefactoringProblemSeverity a, Refactorin
gProblemSeverity b) => | |
| 8020 _maxRefactoringProblemSeverity(a, b); | |
| 8021 | |
| 8022 @override | |
| 8023 String toString() => "RefactoringProblemSeverity.$name"; | |
| 8024 | |
| 8025 String toJson() => name; | |
| 8026 } | |
| 8027 | |
| 8028 /** | |
| 8029 * RemoveContentOverlay | |
| 8030 * | |
| 8031 * { | |
| 8032 * "type": "remove" | |
| 8033 * } | |
| 8034 */ | |
| 8035 class RemoveContentOverlay implements HasToJson { | |
| 8036 RemoveContentOverlay(); | |
| 8037 | |
| 8038 factory RemoveContentOverlay.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 8039 if (json == null) { | |
| 8040 json = {}; | |
| 8041 } | |
| 8042 if (json is Map) { | |
| 8043 if (json["type"] != "remove") { | |
| 8044 throw jsonDecoder.mismatch(jsonPath, "equal " + "remove"); | |
| 8045 } | |
| 8046 return new RemoveContentOverlay(); | |
| 8047 } else { | |
| 8048 throw jsonDecoder.mismatch(jsonPath, "RemoveContentOverlay"); | |
| 8049 } | |
| 8050 } | |
| 8051 | |
| 8052 Map<String, dynamic> toJson() { | |
| 8053 Map<String, dynamic> result = {}; | |
| 8054 result["type"] = "remove"; | |
| 8055 return result; | |
| 8056 } | |
| 8057 | |
| 8058 @override | |
| 8059 String toString() => JSON.encode(toJson()); | |
| 8060 | |
| 8061 @override | |
| 8062 bool operator==(other) { | |
| 8063 if (other is RemoveContentOverlay) { | |
| 8064 return true; | |
| 8065 } | |
| 8066 return false; | |
| 8067 } | |
| 8068 | |
| 8069 @override | |
| 8070 int get hashCode { | |
| 8071 int hash = 0; | |
| 8072 hash = _JenkinsSmiHash.combine(hash, 114870849); | |
| 8073 return _JenkinsSmiHash.finish(hash); | |
| 8074 } | |
| 8075 } | |
| 8076 | |
| 8077 /** | |
| 8078 * RequestError | |
| 8079 * | |
| 8080 * { | |
| 8081 * "code": RequestErrorCode | |
| 8082 * "message": String | |
| 8083 * "stackTrace": optional String | |
| 8084 * } | |
| 8085 */ | |
| 8086 class RequestError implements HasToJson { | |
| 8087 /** | |
| 8088 * A code that uniquely identifies the error that occurred. | |
| 8089 */ | |
| 8090 RequestErrorCode code; | |
| 8091 | |
| 8092 /** | |
| 8093 * A short description of the error. | |
| 8094 */ | |
| 8095 String message; | |
| 8096 | |
| 8097 /** | |
| 8098 * The stack trace associated with processing the request, used for debugging | |
| 8099 * the server. | |
| 8100 */ | |
| 8101 String stackTrace; | |
| 8102 | |
| 8103 RequestError(this.code, this.message, {this.stackTrace}); | |
| 8104 | |
| 8105 factory RequestError.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object
json) { | |
| 8106 if (json == null) { | |
| 8107 json = {}; | |
| 8108 } | |
| 8109 if (json is Map) { | |
| 8110 RequestErrorCode code; | |
| 8111 if (json.containsKey("code")) { | |
| 8112 code = new RequestErrorCode.fromJson(jsonDecoder, jsonPath + ".code", js
on["code"]); | |
| 8113 } else { | |
| 8114 throw jsonDecoder.missingKey(jsonPath, "code"); | |
| 8115 } | |
| 8116 String message; | |
| 8117 if (json.containsKey("message")) { | |
| 8118 message = jsonDecoder._decodeString(jsonPath + ".message", json["message
"]); | |
| 8119 } else { | |
| 8120 throw jsonDecoder.missingKey(jsonPath, "message"); | |
| 8121 } | |
| 8122 String stackTrace; | |
| 8123 if (json.containsKey("stackTrace")) { | |
| 8124 stackTrace = jsonDecoder._decodeString(jsonPath + ".stackTrace", json["s
tackTrace"]); | |
| 8125 } | |
| 8126 return new RequestError(code, message, stackTrace: stackTrace); | |
| 8127 } else { | |
| 8128 throw jsonDecoder.mismatch(jsonPath, "RequestError"); | |
| 8129 } | |
| 8130 } | |
| 8131 | |
| 8132 Map<String, dynamic> toJson() { | |
| 8133 Map<String, dynamic> result = {}; | |
| 8134 result["code"] = code.toJson(); | |
| 8135 result["message"] = message; | |
| 8136 if (stackTrace != null) { | |
| 8137 result["stackTrace"] = stackTrace; | |
| 8138 } | |
| 8139 return result; | |
| 8140 } | |
| 8141 | |
| 8142 @override | |
| 8143 String toString() => JSON.encode(toJson()); | |
| 8144 | |
| 8145 @override | |
| 8146 bool operator==(other) { | |
| 8147 if (other is RequestError) { | |
| 8148 return code == other.code && | |
| 8149 message == other.message && | |
| 8150 stackTrace == other.stackTrace; | |
| 8151 } | |
| 8152 return false; | |
| 8153 } | |
| 8154 | |
| 8155 @override | |
| 8156 int get hashCode { | |
| 8157 int hash = 0; | |
| 8158 hash = _JenkinsSmiHash.combine(hash, code.hashCode); | |
| 8159 hash = _JenkinsSmiHash.combine(hash, message.hashCode); | |
| 8160 hash = _JenkinsSmiHash.combine(hash, stackTrace.hashCode); | |
| 8161 return _JenkinsSmiHash.finish(hash); | |
| 8162 } | |
| 8163 } | |
| 8164 | |
| 8165 /** | |
| 8166 * RequestErrorCode | |
| 8167 * | |
| 8168 * enum { | |
| 8169 * GET_ERRORS_INVALID_FILE | |
| 8170 * INVALID_OVERLAY_CHANGE | |
| 8171 * INVALID_PARAMETER | |
| 8172 * INVALID_REQUEST | |
| 8173 * SERVER_ALREADY_STARTED | |
| 8174 * SERVER_ERROR | |
| 8175 * UNANALYZED_PRIORITY_FILES | |
| 8176 * UNKNOWN_REQUEST | |
| 8177 * UNSUPPORTED_FEATURE | |
| 8178 * } | |
| 8179 */ | |
| 8180 class RequestErrorCode { | |
| 8181 /** | |
| 8182 * An "analysis.getErrors" request specified a FilePath which does not match | |
| 8183 * a file currently subject to analysis. | |
| 8184 */ | |
| 8185 static const GET_ERRORS_INVALID_FILE = const RequestErrorCode._("GET_ERRORS_IN
VALID_FILE"); | |
| 8186 | |
| 8187 /** | |
| 8188 * An analysis.updateContent request contained a ChangeContentOverlay object | |
| 8189 * which can't be applied, due to an edit having an offset or length that is | |
| 8190 * out of range. | |
| 8191 */ | |
| 8192 static const INVALID_OVERLAY_CHANGE = const RequestErrorCode._("INVALID_OVERLA
Y_CHANGE"); | |
| 8193 | |
| 8194 /** | |
| 8195 * One of the method parameters was invalid. | |
| 8196 */ | |
| 8197 static const INVALID_PARAMETER = const RequestErrorCode._("INVALID_PARAMETER")
; | |
| 8198 | |
| 8199 /** | |
| 8200 * A malformed request was received. | |
| 8201 */ | |
| 8202 static const INVALID_REQUEST = const RequestErrorCode._("INVALID_REQUEST"); | |
| 8203 | |
| 8204 /** | |
| 8205 * The analysis server has already been started (and hence won't accept new | |
| 8206 * connections). | |
| 8207 * | |
| 8208 * This error is included for future expansion; at present the analysis | |
| 8209 * server can only speak to one client at a time so this error will never | |
| 8210 * occur. | |
| 8211 */ | |
| 8212 static const SERVER_ALREADY_STARTED = const RequestErrorCode._("SERVER_ALREADY
_STARTED"); | |
| 8213 | |
| 8214 /** | |
| 8215 * An internal error occurred in the analysis server. Also see the | |
| 8216 * server.error notification. | |
| 8217 */ | |
| 8218 static const SERVER_ERROR = const RequestErrorCode._("SERVER_ERROR"); | |
| 8219 | |
| 8220 /** | |
| 8221 * An "analysis.setPriorityFiles" request includes one or more files that are | |
| 8222 * not being analyzed. | |
| 8223 * | |
| 8224 * This is a legacy error; it will be removed before the API reaches version | |
| 8225 * 1.0. | |
| 8226 */ | |
| 8227 static const UNANALYZED_PRIORITY_FILES = const RequestErrorCode._("UNANALYZED_
PRIORITY_FILES"); | |
| 8228 | |
| 8229 /** | |
| 8230 * A request was received which the analysis server does not recognize, or | |
| 8231 * cannot handle in its current configuation. | |
| 8232 */ | |
| 8233 static const UNKNOWN_REQUEST = const RequestErrorCode._("UNKNOWN_REQUEST"); | |
| 8234 | |
| 8235 /** | |
| 8236 * The analysis server was requested to perform an action which is not | |
| 8237 * supported. | |
| 8238 * | |
| 8239 * This is a legacy error; it will be removed before the API reaches version | |
| 8240 * 1.0. | |
| 8241 */ | |
| 8242 static const UNSUPPORTED_FEATURE = const RequestErrorCode._("UNSUPPORTED_FEATU
RE"); | |
| 8243 | |
| 8244 final String name; | |
| 8245 | |
| 8246 const RequestErrorCode._(this.name); | |
| 8247 | |
| 8248 factory RequestErrorCode(String name) { | |
| 8249 switch (name) { | |
| 8250 case "GET_ERRORS_INVALID_FILE": | |
| 8251 return GET_ERRORS_INVALID_FILE; | |
| 8252 case "INVALID_OVERLAY_CHANGE": | |
| 8253 return INVALID_OVERLAY_CHANGE; | |
| 8254 case "INVALID_PARAMETER": | |
| 8255 return INVALID_PARAMETER; | |
| 8256 case "INVALID_REQUEST": | |
| 8257 return INVALID_REQUEST; | |
| 8258 case "SERVER_ALREADY_STARTED": | |
| 8259 return SERVER_ALREADY_STARTED; | |
| 8260 case "SERVER_ERROR": | |
| 8261 return SERVER_ERROR; | |
| 8262 case "UNANALYZED_PRIORITY_FILES": | |
| 8263 return UNANALYZED_PRIORITY_FILES; | |
| 8264 case "UNKNOWN_REQUEST": | |
| 8265 return UNKNOWN_REQUEST; | |
| 8266 case "UNSUPPORTED_FEATURE": | |
| 8267 return UNSUPPORTED_FEATURE; | |
| 8268 } | |
| 8269 throw new Exception('Illegal enum value: $name'); | |
| 8270 } | |
| 8271 | |
| 8272 factory RequestErrorCode.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob
ject json) { | |
| 8273 if (json is String) { | |
| 8274 try { | |
| 8275 return new RequestErrorCode(json); | |
| 8276 } catch(_) { | |
| 8277 // Fall through | |
| 8278 } | |
| 8279 } | |
| 8280 throw jsonDecoder.mismatch(jsonPath, "RequestErrorCode"); | |
| 8281 } | |
| 8282 | |
| 8283 @override | |
| 8284 String toString() => "RequestErrorCode.$name"; | |
| 8285 | |
| 8286 String toJson() => name; | |
| 8287 } | |
| 8288 | |
| 8289 /** | |
| 8290 * SearchResult | |
| 8291 * | |
| 8292 * { | |
| 8293 * "location": Location | |
| 8294 * "kind": SearchResultKind | |
| 8295 * "isPotential": bool | |
| 8296 * "path": List<Element> | |
| 8297 * } | |
| 8298 */ | |
| 8299 class SearchResult implements HasToJson { | |
| 8300 /** | |
| 8301 * The location of the code that matched the search criteria. | |
| 8302 */ | |
| 8303 Location location; | |
| 8304 | |
| 8305 /** | |
| 8306 * The kind of element that was found or the kind of reference that was | |
| 8307 * found. | |
| 8308 */ | |
| 8309 SearchResultKind kind; | |
| 8310 | |
| 8311 /** | |
| 8312 * True if the result is a potential match but cannot be confirmed to be a | |
| 8313 * match. For example, if all references to a method m defined in some class | |
| 8314 * were requested, and a reference to a method m from an unknown class were | |
| 8315 * found, it would be marked as being a potential match. | |
| 8316 */ | |
| 8317 bool isPotential; | |
| 8318 | |
| 8319 /** | |
| 8320 * The elements that contain the result, starting with the most immediately | |
| 8321 * enclosing ancestor and ending with the library. | |
| 8322 */ | |
| 8323 List<Element> path; | |
| 8324 | |
| 8325 SearchResult(this.location, this.kind, this.isPotential, this.path); | |
| 8326 | |
| 8327 factory SearchResult.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object
json) { | |
| 8328 if (json == null) { | |
| 8329 json = {}; | |
| 8330 } | |
| 8331 if (json is Map) { | |
| 8332 Location location; | |
| 8333 if (json.containsKey("location")) { | |
| 8334 location = new Location.fromJson(jsonDecoder, jsonPath + ".location", js
on["location"]); | |
| 8335 } else { | |
| 8336 throw jsonDecoder.missingKey(jsonPath, "location"); | |
| 8337 } | |
| 8338 SearchResultKind kind; | |
| 8339 if (json.containsKey("kind")) { | |
| 8340 kind = new SearchResultKind.fromJson(jsonDecoder, jsonPath + ".kind", js
on["kind"]); | |
| 8341 } else { | |
| 8342 throw jsonDecoder.missingKey(jsonPath, "kind"); | |
| 8343 } | |
| 8344 bool isPotential; | |
| 8345 if (json.containsKey("isPotential")) { | |
| 8346 isPotential = jsonDecoder._decodeBool(jsonPath + ".isPotential", json["i
sPotential"]); | |
| 8347 } else { | |
| 8348 throw jsonDecoder.missingKey(jsonPath, "isPotential"); | |
| 8349 } | |
| 8350 List<Element> path; | |
| 8351 if (json.containsKey("path")) { | |
| 8352 path = jsonDecoder._decodeList(jsonPath + ".path", json["path"], (String
jsonPath, Object json) => new Element.fromJson(jsonDecoder, jsonPath, json)); | |
| 8353 } else { | |
| 8354 throw jsonDecoder.missingKey(jsonPath, "path"); | |
| 8355 } | |
| 8356 return new SearchResult(location, kind, isPotential, path); | |
| 8357 } else { | |
| 8358 throw jsonDecoder.mismatch(jsonPath, "SearchResult"); | |
| 8359 } | |
| 8360 } | |
| 8361 | |
| 8362 Map<String, dynamic> toJson() { | |
| 8363 Map<String, dynamic> result = {}; | |
| 8364 result["location"] = location.toJson(); | |
| 8365 result["kind"] = kind.toJson(); | |
| 8366 result["isPotential"] = isPotential; | |
| 8367 result["path"] = path.map((Element value) => value.toJson()).toList(); | |
| 8368 return result; | |
| 8369 } | |
| 8370 | |
| 8371 @override | |
| 8372 String toString() => JSON.encode(toJson()); | |
| 8373 | |
| 8374 @override | |
| 8375 bool operator==(other) { | |
| 8376 if (other is SearchResult) { | |
| 8377 return location == other.location && | |
| 8378 kind == other.kind && | |
| 8379 isPotential == other.isPotential && | |
| 8380 _listEqual(path, other.path, (Element a, Element b) => a == b); | |
| 8381 } | |
| 8382 return false; | |
| 8383 } | |
| 8384 | |
| 8385 @override | |
| 8386 int get hashCode { | |
| 8387 int hash = 0; | |
| 8388 hash = _JenkinsSmiHash.combine(hash, location.hashCode); | |
| 8389 hash = _JenkinsSmiHash.combine(hash, kind.hashCode); | |
| 8390 hash = _JenkinsSmiHash.combine(hash, isPotential.hashCode); | |
| 8391 hash = _JenkinsSmiHash.combine(hash, path.hashCode); | |
| 8392 return _JenkinsSmiHash.finish(hash); | |
| 8393 } | |
| 8394 } | |
| 8395 | |
| 8396 /** | |
| 8397 * SearchResultKind | |
| 8398 * | |
| 8399 * enum { | |
| 8400 * DECLARATION | |
| 8401 * INVOCATION | |
| 8402 * READ | |
| 8403 * READ_WRITE | |
| 8404 * REFERENCE | |
| 8405 * UNKNOWN | |
| 8406 * WRITE | |
| 8407 * } | |
| 8408 */ | |
| 8409 class SearchResultKind { | |
| 8410 /** | |
| 8411 * The declaration of an element. | |
| 8412 */ | |
| 8413 static const DECLARATION = const SearchResultKind._("DECLARATION"); | |
| 8414 | |
| 8415 /** | |
| 8416 * The invocation of a function or method. | |
| 8417 */ | |
| 8418 static const INVOCATION = const SearchResultKind._("INVOCATION"); | |
| 8419 | |
| 8420 /** | |
| 8421 * A reference to a field, parameter or variable where it is being read. | |
| 8422 */ | |
| 8423 static const READ = const SearchResultKind._("READ"); | |
| 8424 | |
| 8425 /** | |
| 8426 * A reference to a field, parameter or variable where it is being read and | |
| 8427 * written. | |
| 8428 */ | |
| 8429 static const READ_WRITE = const SearchResultKind._("READ_WRITE"); | |
| 8430 | |
| 8431 /** | |
| 8432 * A reference to an element. | |
| 8433 */ | |
| 8434 static const REFERENCE = const SearchResultKind._("REFERENCE"); | |
| 8435 | |
| 8436 /** | |
| 8437 * Some other kind of search result. | |
| 8438 */ | |
| 8439 static const UNKNOWN = const SearchResultKind._("UNKNOWN"); | |
| 8440 | |
| 8441 /** | |
| 8442 * A reference to a field, parameter or variable where it is being written. | |
| 8443 */ | |
| 8444 static const WRITE = const SearchResultKind._("WRITE"); | |
| 8445 | |
| 8446 final String name; | |
| 8447 | |
| 8448 const SearchResultKind._(this.name); | |
| 8449 | |
| 8450 factory SearchResultKind(String name) { | |
| 8451 switch (name) { | |
| 8452 case "DECLARATION": | |
| 8453 return DECLARATION; | |
| 8454 case "INVOCATION": | |
| 8455 return INVOCATION; | |
| 8456 case "READ": | |
| 8457 return READ; | |
| 8458 case "READ_WRITE": | |
| 8459 return READ_WRITE; | |
| 8460 case "REFERENCE": | |
| 8461 return REFERENCE; | |
| 8462 case "UNKNOWN": | |
| 8463 return UNKNOWN; | |
| 8464 case "WRITE": | |
| 8465 return WRITE; | |
| 8466 } | |
| 8467 throw new Exception('Illegal enum value: $name'); | |
| 8468 } | |
| 8469 | |
| 8470 factory SearchResultKind.fromJson(JsonDecoder jsonDecoder, String jsonPath, Ob
ject json) { | |
| 8471 if (json is String) { | |
| 8472 try { | |
| 8473 return new SearchResultKind(json); | |
| 8474 } catch(_) { | |
| 8475 // Fall through | |
| 8476 } | |
| 8477 } | |
| 8478 throw jsonDecoder.mismatch(jsonPath, "SearchResultKind"); | |
| 8479 } | |
| 8480 | |
| 8481 @override | |
| 8482 String toString() => "SearchResultKind.$name"; | |
| 8483 | |
| 8484 String toJson() => name; | |
| 8485 } | |
| 8486 | |
| 8487 /** | |
| 8488 * ServerService | |
| 8489 * | |
| 8490 * enum { | |
| 8491 * STATUS | |
| 8492 * } | |
| 8493 */ | |
| 8494 class ServerService { | |
| 8495 static const STATUS = const ServerService._("STATUS"); | |
| 8496 | |
| 8497 final String name; | |
| 8498 | |
| 8499 const ServerService._(this.name); | |
| 8500 | |
| 8501 factory ServerService(String name) { | |
| 8502 switch (name) { | |
| 8503 case "STATUS": | |
| 8504 return STATUS; | |
| 8505 } | |
| 8506 throw new Exception('Illegal enum value: $name'); | |
| 8507 } | |
| 8508 | |
| 8509 factory ServerService.fromJson(JsonDecoder jsonDecoder, String jsonPath, Objec
t json) { | |
| 8510 if (json is String) { | |
| 8511 try { | |
| 8512 return new ServerService(json); | |
| 8513 } catch(_) { | |
| 8514 // Fall through | |
| 8515 } | |
| 8516 } | |
| 8517 throw jsonDecoder.mismatch(jsonPath, "ServerService"); | |
| 8518 } | |
| 8519 | |
| 8520 @override | |
| 8521 String toString() => "ServerService.$name"; | |
| 8522 | |
| 8523 String toJson() => name; | |
| 8524 } | |
| 8525 | |
| 8526 /** | |
| 8527 * SourceChange | |
| 8528 * | |
| 8529 * { | |
| 8530 * "message": String | |
| 8531 * "edits": List<SourceFileEdit> | |
| 8532 * "linkedEditGroups": List<LinkedEditGroup> | |
| 8533 * "selection": optional Position | |
| 8534 * } | |
| 8535 */ | |
| 8536 class SourceChange implements HasToJson { | |
| 8537 /** | |
| 8538 * A human-readable description of the change to be applied. | |
| 8539 */ | |
| 8540 String message; | |
| 8541 | |
| 8542 /** | |
| 8543 * A list of the edits used to effect the change, grouped by file. | |
| 8544 */ | |
| 8545 List<SourceFileEdit> edits; | |
| 8546 | |
| 8547 /** | |
| 8548 * A list of the linked editing groups used to customize the changes that | |
| 8549 * were made. | |
| 8550 */ | |
| 8551 List<LinkedEditGroup> linkedEditGroups; | |
| 8552 | |
| 8553 /** | |
| 8554 * The position that should be selected after the edits have been applied. | |
| 8555 */ | |
| 8556 Position selection; | |
| 8557 | |
| 8558 SourceChange(this.message, {this.edits, this.linkedEditGroups, this.selection}
) { | |
| 8559 if (edits == null) { | |
| 8560 edits = <SourceFileEdit>[]; | |
| 8561 } | |
| 8562 if (linkedEditGroups == null) { | |
| 8563 linkedEditGroups = <LinkedEditGroup>[]; | |
| 8564 } | |
| 8565 } | |
| 8566 | |
| 8567 factory SourceChange.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object
json) { | |
| 8568 if (json == null) { | |
| 8569 json = {}; | |
| 8570 } | |
| 8571 if (json is Map) { | |
| 8572 String message; | |
| 8573 if (json.containsKey("message")) { | |
| 8574 message = jsonDecoder._decodeString(jsonPath + ".message", json["message
"]); | |
| 8575 } else { | |
| 8576 throw jsonDecoder.missingKey(jsonPath, "message"); | |
| 8577 } | |
| 8578 List<SourceFileEdit> edits; | |
| 8579 if (json.containsKey("edits")) { | |
| 8580 edits = jsonDecoder._decodeList(jsonPath + ".edits", json["edits"], (Str
ing jsonPath, Object json) => new SourceFileEdit.fromJson(jsonDecoder, jsonPath,
json)); | |
| 8581 } else { | |
| 8582 throw jsonDecoder.missingKey(jsonPath, "edits"); | |
| 8583 } | |
| 8584 List<LinkedEditGroup> linkedEditGroups; | |
| 8585 if (json.containsKey("linkedEditGroups")) { | |
| 8586 linkedEditGroups = jsonDecoder._decodeList(jsonPath + ".linkedEditGroups
", json["linkedEditGroups"], (String jsonPath, Object json) => new LinkedEditGro
up.fromJson(jsonDecoder, jsonPath, json)); | |
| 8587 } else { | |
| 8588 throw jsonDecoder.missingKey(jsonPath, "linkedEditGroups"); | |
| 8589 } | |
| 8590 Position selection; | |
| 8591 if (json.containsKey("selection")) { | |
| 8592 selection = new Position.fromJson(jsonDecoder, jsonPath + ".selection",
json["selection"]); | |
| 8593 } | |
| 8594 return new SourceChange(message, edits: edits, linkedEditGroups: linkedEdi
tGroups, selection: selection); | |
| 8595 } else { | |
| 8596 throw jsonDecoder.mismatch(jsonPath, "SourceChange"); | |
| 8597 } | |
| 8598 } | |
| 8599 | |
| 8600 Map<String, dynamic> toJson() { | |
| 8601 Map<String, dynamic> result = {}; | |
| 8602 result["message"] = message; | |
| 8603 result["edits"] = edits.map((SourceFileEdit value) => value.toJson()).toList
(); | |
| 8604 result["linkedEditGroups"] = linkedEditGroups.map((LinkedEditGroup value) =>
value.toJson()).toList(); | |
| 8605 if (selection != null) { | |
| 8606 result["selection"] = selection.toJson(); | |
| 8607 } | |
| 8608 return result; | |
| 8609 } | |
| 8610 | |
| 8611 /** | |
| 8612 * Adds [edit] to the [FileEdit] for the given [file]. | |
| 8613 */ | |
| 8614 void addEdit(String file, int fileStamp, SourceEdit edit) => | |
| 8615 _addEditToSourceChange(this, file, fileStamp, edit); | |
| 8616 | |
| 8617 /** | |
| 8618 * Adds the given [FileEdit]. | |
| 8619 */ | |
| 8620 void addFileEdit(SourceFileEdit edit) { | |
| 8621 edits.add(edit); | |
| 8622 } | |
| 8623 | |
| 8624 /** | |
| 8625 * Adds the given [LinkedEditGroup]. | |
| 8626 */ | |
| 8627 void addLinkedEditGroup(LinkedEditGroup linkedEditGroup) { | |
| 8628 linkedEditGroups.add(linkedEditGroup); | |
| 8629 } | |
| 8630 | |
| 8631 /** | |
| 8632 * Returns the [FileEdit] for the given [file], maybe `null`. | |
| 8633 */ | |
| 8634 SourceFileEdit getFileEdit(String file) => | |
| 8635 _getChangeFileEdit(this, file); | |
| 8636 | |
| 8637 @override | |
| 8638 String toString() => JSON.encode(toJson()); | |
| 8639 | |
| 8640 @override | |
| 8641 bool operator==(other) { | |
| 8642 if (other is SourceChange) { | |
| 8643 return message == other.message && | |
| 8644 _listEqual(edits, other.edits, (SourceFileEdit a, SourceFileEdit b) =>
a == b) && | |
| 8645 _listEqual(linkedEditGroups, other.linkedEditGroups, (LinkedEditGroup
a, LinkedEditGroup b) => a == b) && | |
| 8646 selection == other.selection; | |
| 8647 } | |
| 8648 return false; | |
| 8649 } | |
| 8650 | |
| 8651 @override | |
| 8652 int get hashCode { | |
| 8653 int hash = 0; | |
| 8654 hash = _JenkinsSmiHash.combine(hash, message.hashCode); | |
| 8655 hash = _JenkinsSmiHash.combine(hash, edits.hashCode); | |
| 8656 hash = _JenkinsSmiHash.combine(hash, linkedEditGroups.hashCode); | |
| 8657 hash = _JenkinsSmiHash.combine(hash, selection.hashCode); | |
| 8658 return _JenkinsSmiHash.finish(hash); | |
| 8659 } | |
| 8660 } | |
| 8661 | |
| 8662 /** | |
| 8663 * SourceEdit | |
| 8664 * | |
| 8665 * { | |
| 8666 * "offset": int | |
| 8667 * "length": int | |
| 8668 * "replacement": String | |
| 8669 * "id": optional String | |
| 8670 * } | |
| 8671 */ | |
| 8672 class SourceEdit implements HasToJson { | |
| 8673 /** | |
| 8674 * Get the result of applying a set of [edits] to the given [code]. Edits are | |
| 8675 * applied in the order they appear in [edits]. | |
| 8676 */ | |
| 8677 static String applySequence(String code, Iterable<SourceEdit> edits) => | |
| 8678 _applySequence(code, edits); | |
| 8679 | |
| 8680 /** | |
| 8681 * The offset of the region to be modified. | |
| 8682 */ | |
| 8683 int offset; | |
| 8684 | |
| 8685 /** | |
| 8686 * The length of the region to be modified. | |
| 8687 */ | |
| 8688 int length; | |
| 8689 | |
| 8690 /** | |
| 8691 * The code that is to replace the specified region in the original code. | |
| 8692 */ | |
| 8693 String replacement; | |
| 8694 | |
| 8695 /** | |
| 8696 * An identifier that uniquely identifies this source edit from other edits | |
| 8697 * in the same response. This field is omitted unless a containing structure | |
| 8698 * needs to be able to identify the edit for some reason. | |
| 8699 * | |
| 8700 * For example, some refactoring operations can produce edits that might not | |
| 8701 * be appropriate (referred to as potential edits). Such edits will have an | |
| 8702 * id so that they can be referenced. Edits in the same response that do not | |
| 8703 * need to be referenced will not have an id. | |
| 8704 */ | |
| 8705 String id; | |
| 8706 | |
| 8707 SourceEdit(this.offset, this.length, this.replacement, {this.id}); | |
| 8708 | |
| 8709 factory SourceEdit.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object j
son) { | |
| 8710 if (json == null) { | |
| 8711 json = {}; | |
| 8712 } | |
| 8713 if (json is Map) { | |
| 8714 int offset; | |
| 8715 if (json.containsKey("offset")) { | |
| 8716 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 8717 } else { | |
| 8718 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 8719 } | |
| 8720 int length; | |
| 8721 if (json.containsKey("length")) { | |
| 8722 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 8723 } else { | |
| 8724 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 8725 } | |
| 8726 String replacement; | |
| 8727 if (json.containsKey("replacement")) { | |
| 8728 replacement = jsonDecoder._decodeString(jsonPath + ".replacement", json[
"replacement"]); | |
| 8729 } else { | |
| 8730 throw jsonDecoder.missingKey(jsonPath, "replacement"); | |
| 8731 } | |
| 8732 String id; | |
| 8733 if (json.containsKey("id")) { | |
| 8734 id = jsonDecoder._decodeString(jsonPath + ".id", json["id"]); | |
| 8735 } | |
| 8736 return new SourceEdit(offset, length, replacement, id: id); | |
| 8737 } else { | |
| 8738 throw jsonDecoder.mismatch(jsonPath, "SourceEdit"); | |
| 8739 } | |
| 8740 } | |
| 8741 | |
| 8742 /** | |
| 8743 * The end of the region to be modified. | |
| 8744 */ | |
| 8745 int get end => offset + length; | |
| 8746 | |
| 8747 Map<String, dynamic> toJson() { | |
| 8748 Map<String, dynamic> result = {}; | |
| 8749 result["offset"] = offset; | |
| 8750 result["length"] = length; | |
| 8751 result["replacement"] = replacement; | |
| 8752 if (id != null) { | |
| 8753 result["id"] = id; | |
| 8754 } | |
| 8755 return result; | |
| 8756 } | |
| 8757 | |
| 8758 /** | |
| 8759 * Get the result of applying the edit to the given [code]. | |
| 8760 */ | |
| 8761 String apply(String code) => _applyEdit(code, this); | |
| 8762 | |
| 8763 @override | |
| 8764 String toString() => JSON.encode(toJson()); | |
| 8765 | |
| 8766 @override | |
| 8767 bool operator==(other) { | |
| 8768 if (other is SourceEdit) { | |
| 8769 return offset == other.offset && | |
| 8770 length == other.length && | |
| 8771 replacement == other.replacement && | |
| 8772 id == other.id; | |
| 8773 } | |
| 8774 return false; | |
| 8775 } | |
| 8776 | |
| 8777 @override | |
| 8778 int get hashCode { | |
| 8779 int hash = 0; | |
| 8780 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 8781 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 8782 hash = _JenkinsSmiHash.combine(hash, replacement.hashCode); | |
| 8783 hash = _JenkinsSmiHash.combine(hash, id.hashCode); | |
| 8784 return _JenkinsSmiHash.finish(hash); | |
| 8785 } | |
| 8786 } | |
| 8787 | |
| 8788 /** | |
| 8789 * SourceFileEdit | |
| 8790 * | |
| 8791 * { | |
| 8792 * "file": FilePath | |
| 8793 * "fileStamp": long | |
| 8794 * "edits": List<SourceEdit> | |
| 8795 * } | |
| 8796 */ | |
| 8797 class SourceFileEdit implements HasToJson { | |
| 8798 /** | |
| 8799 * The file containing the code to be modified. | |
| 8800 */ | |
| 8801 String file; | |
| 8802 | |
| 8803 /** | |
| 8804 * The modification stamp of the file at the moment when the change was | |
| 8805 * created, in milliseconds since the "Unix epoch". Will be -1 if the file | |
| 8806 * did not exist and should be created. The client may use this field to make | |
| 8807 * sure that the file was not changed since then, so it is safe to apply the | |
| 8808 * change. | |
| 8809 */ | |
| 8810 int fileStamp; | |
| 8811 | |
| 8812 /** | |
| 8813 * A list of the edits used to effect the change. | |
| 8814 */ | |
| 8815 List<SourceEdit> edits; | |
| 8816 | |
| 8817 SourceFileEdit(this.file, this.fileStamp, {this.edits}) { | |
| 8818 if (edits == null) { | |
| 8819 edits = <SourceEdit>[]; | |
| 8820 } | |
| 8821 } | |
| 8822 | |
| 8823 factory SourceFileEdit.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obje
ct json) { | |
| 8824 if (json == null) { | |
| 8825 json = {}; | |
| 8826 } | |
| 8827 if (json is Map) { | |
| 8828 String file; | |
| 8829 if (json.containsKey("file")) { | |
| 8830 file = jsonDecoder._decodeString(jsonPath + ".file", json["file"]); | |
| 8831 } else { | |
| 8832 throw jsonDecoder.missingKey(jsonPath, "file"); | |
| 8833 } | |
| 8834 int fileStamp; | |
| 8835 if (json.containsKey("fileStamp")) { | |
| 8836 fileStamp = jsonDecoder._decodeInt(jsonPath + ".fileStamp", json["fileSt
amp"]); | |
| 8837 } else { | |
| 8838 throw jsonDecoder.missingKey(jsonPath, "fileStamp"); | |
| 8839 } | |
| 8840 List<SourceEdit> edits; | |
| 8841 if (json.containsKey("edits")) { | |
| 8842 edits = jsonDecoder._decodeList(jsonPath + ".edits", json["edits"], (Str
ing jsonPath, Object json) => new SourceEdit.fromJson(jsonDecoder, jsonPath, jso
n)); | |
| 8843 } else { | |
| 8844 throw jsonDecoder.missingKey(jsonPath, "edits"); | |
| 8845 } | |
| 8846 return new SourceFileEdit(file, fileStamp, edits: edits); | |
| 8847 } else { | |
| 8848 throw jsonDecoder.mismatch(jsonPath, "SourceFileEdit"); | |
| 8849 } | |
| 8850 } | |
| 8851 | |
| 8852 Map<String, dynamic> toJson() { | |
| 8853 Map<String, dynamic> result = {}; | |
| 8854 result["file"] = file; | |
| 8855 result["fileStamp"] = fileStamp; | |
| 8856 result["edits"] = edits.map((SourceEdit value) => value.toJson()).toList(); | |
| 8857 return result; | |
| 8858 } | |
| 8859 | |
| 8860 /** | |
| 8861 * Adds the given [Edit] to the list. | |
| 8862 */ | |
| 8863 void add(SourceEdit edit) => _addEditForSource(this, edit); | |
| 8864 | |
| 8865 /** | |
| 8866 * Adds the given [Edit]s. | |
| 8867 */ | |
| 8868 void addAll(Iterable<SourceEdit> edits) => | |
| 8869 _addAllEditsForSource(this, edits); | |
| 8870 | |
| 8871 @override | |
| 8872 String toString() => JSON.encode(toJson()); | |
| 8873 | |
| 8874 @override | |
| 8875 bool operator==(other) { | |
| 8876 if (other is SourceFileEdit) { | |
| 8877 return file == other.file && | |
| 8878 fileStamp == other.fileStamp && | |
| 8879 _listEqual(edits, other.edits, (SourceEdit a, SourceEdit b) => a == b)
; | |
| 8880 } | |
| 8881 return false; | |
| 8882 } | |
| 8883 | |
| 8884 @override | |
| 8885 int get hashCode { | |
| 8886 int hash = 0; | |
| 8887 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | |
| 8888 hash = _JenkinsSmiHash.combine(hash, fileStamp.hashCode); | |
| 8889 hash = _JenkinsSmiHash.combine(hash, edits.hashCode); | |
| 8890 return _JenkinsSmiHash.finish(hash); | |
| 8891 } | |
| 8892 } | |
| 8893 | |
| 8894 /** | |
| 8895 * TypeHierarchyItem | |
| 8896 * | |
| 8897 * { | |
| 8898 * "classElement": Element | |
| 8899 * "displayName": optional String | |
| 8900 * "memberElement": optional Element | |
| 8901 * "superclass": optional int | |
| 8902 * "interfaces": List<int> | |
| 8903 * "mixins": List<int> | |
| 8904 * "subclasses": List<int> | |
| 8905 * } | |
| 8906 */ | |
| 8907 class TypeHierarchyItem implements HasToJson { | |
| 8908 /** | |
| 8909 * The class element represented by this item. | |
| 8910 */ | |
| 8911 Element classElement; | |
| 8912 | |
| 8913 /** | |
| 8914 * The name to be displayed for the class. This field will be omitted if the | |
| 8915 * display name is the same as the name of the element. The display name is | |
| 8916 * different if there is additional type information to be displayed, such as | |
| 8917 * type arguments. | |
| 8918 */ | |
| 8919 String displayName; | |
| 8920 | |
| 8921 /** | |
| 8922 * The member in the class corresponding to the member on which the hierarchy | |
| 8923 * was requested. This field will be omitted if the hierarchy was not | |
| 8924 * requested for a member or if the class does not have a corresponding | |
| 8925 * member. | |
| 8926 */ | |
| 8927 Element memberElement; | |
| 8928 | |
| 8929 /** | |
| 8930 * The index of the item representing the superclass of this class. This | |
| 8931 * field will be omitted if this item represents the class Object. | |
| 8932 */ | |
| 8933 int superclass; | |
| 8934 | |
| 8935 /** | |
| 8936 * The indexes of the items representing the interfaces implemented by this | |
| 8937 * class. The list will be empty if there are no implemented interfaces. | |
| 8938 */ | |
| 8939 List<int> interfaces; | |
| 8940 | |
| 8941 /** | |
| 8942 * The indexes of the items representing the mixins referenced by this class. | |
| 8943 * The list will be empty if there are no classes mixed in to this class. | |
| 8944 */ | |
| 8945 List<int> mixins; | |
| 8946 | |
| 8947 /** | |
| 8948 * The indexes of the items representing the subtypes of this class. The list | |
| 8949 * will be empty if there are no subtypes or if this item represents a | |
| 8950 * supertype of the pivot type. | |
| 8951 */ | |
| 8952 List<int> subclasses; | |
| 8953 | |
| 8954 TypeHierarchyItem(this.classElement, {this.displayName, this.memberElement, th
is.superclass, this.interfaces, this.mixins, this.subclasses}) { | |
| 8955 if (interfaces == null) { | |
| 8956 interfaces = <int>[]; | |
| 8957 } | |
| 8958 if (mixins == null) { | |
| 8959 mixins = <int>[]; | |
| 8960 } | |
| 8961 if (subclasses == null) { | |
| 8962 subclasses = <int>[]; | |
| 8963 } | |
| 8964 } | |
| 8965 | |
| 8966 factory TypeHierarchyItem.fromJson(JsonDecoder jsonDecoder, String jsonPath, O
bject json) { | |
| 8967 if (json == null) { | |
| 8968 json = {}; | |
| 8969 } | |
| 8970 if (json is Map) { | |
| 8971 Element classElement; | |
| 8972 if (json.containsKey("classElement")) { | |
| 8973 classElement = new Element.fromJson(jsonDecoder, jsonPath + ".classEleme
nt", json["classElement"]); | |
| 8974 } else { | |
| 8975 throw jsonDecoder.missingKey(jsonPath, "classElement"); | |
| 8976 } | |
| 8977 String displayName; | |
| 8978 if (json.containsKey("displayName")) { | |
| 8979 displayName = jsonDecoder._decodeString(jsonPath + ".displayName", json[
"displayName"]); | |
| 8980 } | |
| 8981 Element memberElement; | |
| 8982 if (json.containsKey("memberElement")) { | |
| 8983 memberElement = new Element.fromJson(jsonDecoder, jsonPath + ".memberEle
ment", json["memberElement"]); | |
| 8984 } | |
| 8985 int superclass; | |
| 8986 if (json.containsKey("superclass")) { | |
| 8987 superclass = jsonDecoder._decodeInt(jsonPath + ".superclass", json["supe
rclass"]); | |
| 8988 } | |
| 8989 List<int> interfaces; | |
| 8990 if (json.containsKey("interfaces")) { | |
| 8991 interfaces = jsonDecoder._decodeList(jsonPath + ".interfaces", json["int
erfaces"], jsonDecoder._decodeInt); | |
| 8992 } else { | |
| 8993 throw jsonDecoder.missingKey(jsonPath, "interfaces"); | |
| 8994 } | |
| 8995 List<int> mixins; | |
| 8996 if (json.containsKey("mixins")) { | |
| 8997 mixins = jsonDecoder._decodeList(jsonPath + ".mixins", json["mixins"], j
sonDecoder._decodeInt); | |
| 8998 } else { | |
| 8999 throw jsonDecoder.missingKey(jsonPath, "mixins"); | |
| 9000 } | |
| 9001 List<int> subclasses; | |
| 9002 if (json.containsKey("subclasses")) { | |
| 9003 subclasses = jsonDecoder._decodeList(jsonPath + ".subclasses", json["sub
classes"], jsonDecoder._decodeInt); | |
| 9004 } else { | |
| 9005 throw jsonDecoder.missingKey(jsonPath, "subclasses"); | |
| 9006 } | |
| 9007 return new TypeHierarchyItem(classElement, displayName: displayName, membe
rElement: memberElement, superclass: superclass, interfaces: interfaces, mixins:
mixins, subclasses: subclasses); | |
| 9008 } else { | |
| 9009 throw jsonDecoder.mismatch(jsonPath, "TypeHierarchyItem"); | |
| 9010 } | |
| 9011 } | |
| 9012 | |
| 9013 Map<String, dynamic> toJson() { | |
| 9014 Map<String, dynamic> result = {}; | |
| 9015 result["classElement"] = classElement.toJson(); | |
| 9016 if (displayName != null) { | |
| 9017 result["displayName"] = displayName; | |
| 9018 } | |
| 9019 if (memberElement != null) { | |
| 9020 result["memberElement"] = memberElement.toJson(); | |
| 9021 } | |
| 9022 if (superclass != null) { | |
| 9023 result["superclass"] = superclass; | |
| 9024 } | |
| 9025 result["interfaces"] = interfaces; | |
| 9026 result["mixins"] = mixins; | |
| 9027 result["subclasses"] = subclasses; | |
| 9028 return result; | |
| 9029 } | |
| 9030 | |
| 9031 @override | |
| 9032 String toString() => JSON.encode(toJson()); | |
| 9033 | |
| 9034 @override | |
| 9035 bool operator==(other) { | |
| 9036 if (other is TypeHierarchyItem) { | |
| 9037 return classElement == other.classElement && | |
| 9038 displayName == other.displayName && | |
| 9039 memberElement == other.memberElement && | |
| 9040 superclass == other.superclass && | |
| 9041 _listEqual(interfaces, other.interfaces, (int a, int b) => a == b) && | |
| 9042 _listEqual(mixins, other.mixins, (int a, int b) => a == b) && | |
| 9043 _listEqual(subclasses, other.subclasses, (int a, int b) => a == b); | |
| 9044 } | |
| 9045 return false; | |
| 9046 } | |
| 9047 | |
| 9048 @override | |
| 9049 int get hashCode { | |
| 9050 int hash = 0; | |
| 9051 hash = _JenkinsSmiHash.combine(hash, classElement.hashCode); | |
| 9052 hash = _JenkinsSmiHash.combine(hash, displayName.hashCode); | |
| 9053 hash = _JenkinsSmiHash.combine(hash, memberElement.hashCode); | |
| 9054 hash = _JenkinsSmiHash.combine(hash, superclass.hashCode); | |
| 9055 hash = _JenkinsSmiHash.combine(hash, interfaces.hashCode); | |
| 9056 hash = _JenkinsSmiHash.combine(hash, mixins.hashCode); | |
| 9057 hash = _JenkinsSmiHash.combine(hash, subclasses.hashCode); | |
| 9058 return _JenkinsSmiHash.finish(hash); | |
| 9059 } | |
| 9060 } | |
| 9061 /** | |
| 9062 * convertGetterToMethod feedback | |
| 9063 */ | |
| 9064 class ConvertGetterToMethodFeedback { | |
| 9065 @override | |
| 9066 bool operator==(other) { | |
| 9067 if (other is ConvertGetterToMethodFeedback) { | |
| 9068 return true; | |
| 9069 } | |
| 9070 return false; | |
| 9071 } | |
| 9072 | |
| 9073 @override | |
| 9074 int get hashCode { | |
| 9075 return 616032599; | |
| 9076 } | |
| 9077 } | |
| 9078 /** | |
| 9079 * convertGetterToMethod options | |
| 9080 */ | |
| 9081 class ConvertGetterToMethodOptions { | |
| 9082 @override | |
| 9083 bool operator==(other) { | |
| 9084 if (other is ConvertGetterToMethodOptions) { | |
| 9085 return true; | |
| 9086 } | |
| 9087 return false; | |
| 9088 } | |
| 9089 | |
| 9090 @override | |
| 9091 int get hashCode { | |
| 9092 return 488848400; | |
| 9093 } | |
| 9094 } | |
| 9095 /** | |
| 9096 * convertMethodToGetter feedback | |
| 9097 */ | |
| 9098 class ConvertMethodToGetterFeedback { | |
| 9099 @override | |
| 9100 bool operator==(other) { | |
| 9101 if (other is ConvertMethodToGetterFeedback) { | |
| 9102 return true; | |
| 9103 } | |
| 9104 return false; | |
| 9105 } | |
| 9106 | |
| 9107 @override | |
| 9108 int get hashCode { | |
| 9109 return 165291526; | |
| 9110 } | |
| 9111 } | |
| 9112 /** | |
| 9113 * convertMethodToGetter options | |
| 9114 */ | |
| 9115 class ConvertMethodToGetterOptions { | |
| 9116 @override | |
| 9117 bool operator==(other) { | |
| 9118 if (other is ConvertMethodToGetterOptions) { | |
| 9119 return true; | |
| 9120 } | |
| 9121 return false; | |
| 9122 } | |
| 9123 | |
| 9124 @override | |
| 9125 int get hashCode { | |
| 9126 return 27952290; | |
| 9127 } | |
| 9128 } | |
| 9129 | |
| 9130 /** | |
| 9131 * extractLocalVariable feedback | |
| 9132 * | |
| 9133 * { | |
| 9134 * "names": List<String> | |
| 9135 * "offsets": List<int> | |
| 9136 * "lengths": List<int> | |
| 9137 * } | |
| 9138 */ | |
| 9139 class ExtractLocalVariableFeedback extends RefactoringFeedback implements HasToJ
son { | |
| 9140 /** | |
| 9141 * The proposed names for the local variable. | |
| 9142 */ | |
| 9143 List<String> names; | |
| 9144 | |
| 9145 /** | |
| 9146 * The offsets of the expressions that would be replaced by a reference to | |
| 9147 * the variable. | |
| 9148 */ | |
| 9149 List<int> offsets; | |
| 9150 | |
| 9151 /** | |
| 9152 * The lengths of the expressions that would be replaced by a reference to | |
| 9153 * the variable. The lengths correspond to the offsets. In other words, for a | |
| 9154 * given expression, if the offset of that expression is offsets[i], then the | |
| 9155 * length of that expression is lengths[i]. | |
| 9156 */ | |
| 9157 List<int> lengths; | |
| 9158 | |
| 9159 ExtractLocalVariableFeedback(this.names, this.offsets, this.lengths); | |
| 9160 | |
| 9161 factory ExtractLocalVariableFeedback.fromJson(JsonDecoder jsonDecoder, String
jsonPath, Object json) { | |
| 9162 if (json == null) { | |
| 9163 json = {}; | |
| 9164 } | |
| 9165 if (json is Map) { | |
| 9166 List<String> names; | |
| 9167 if (json.containsKey("names")) { | |
| 9168 names = jsonDecoder._decodeList(jsonPath + ".names", json["names"], json
Decoder._decodeString); | |
| 9169 } else { | |
| 9170 throw jsonDecoder.missingKey(jsonPath, "names"); | |
| 9171 } | |
| 9172 List<int> offsets; | |
| 9173 if (json.containsKey("offsets")) { | |
| 9174 offsets = jsonDecoder._decodeList(jsonPath + ".offsets", json["offsets"]
, jsonDecoder._decodeInt); | |
| 9175 } else { | |
| 9176 throw jsonDecoder.missingKey(jsonPath, "offsets"); | |
| 9177 } | |
| 9178 List<int> lengths; | |
| 9179 if (json.containsKey("lengths")) { | |
| 9180 lengths = jsonDecoder._decodeList(jsonPath + ".lengths", json["lengths"]
, jsonDecoder._decodeInt); | |
| 9181 } else { | |
| 9182 throw jsonDecoder.missingKey(jsonPath, "lengths"); | |
| 9183 } | |
| 9184 return new ExtractLocalVariableFeedback(names, offsets, lengths); | |
| 9185 } else { | |
| 9186 throw jsonDecoder.mismatch(jsonPath, "extractLocalVariable feedback"); | |
| 9187 } | |
| 9188 } | |
| 9189 | |
| 9190 Map<String, dynamic> toJson() { | |
| 9191 Map<String, dynamic> result = {}; | |
| 9192 result["names"] = names; | |
| 9193 result["offsets"] = offsets; | |
| 9194 result["lengths"] = lengths; | |
| 9195 return result; | |
| 9196 } | |
| 9197 | |
| 9198 @override | |
| 9199 String toString() => JSON.encode(toJson()); | |
| 9200 | |
| 9201 @override | |
| 9202 bool operator==(other) { | |
| 9203 if (other is ExtractLocalVariableFeedback) { | |
| 9204 return _listEqual(names, other.names, (String a, String b) => a == b) && | |
| 9205 _listEqual(offsets, other.offsets, (int a, int b) => a == b) && | |
| 9206 _listEqual(lengths, other.lengths, (int a, int b) => a == b); | |
| 9207 } | |
| 9208 return false; | |
| 9209 } | |
| 9210 | |
| 9211 @override | |
| 9212 int get hashCode { | |
| 9213 int hash = 0; | |
| 9214 hash = _JenkinsSmiHash.combine(hash, names.hashCode); | |
| 9215 hash = _JenkinsSmiHash.combine(hash, offsets.hashCode); | |
| 9216 hash = _JenkinsSmiHash.combine(hash, lengths.hashCode); | |
| 9217 return _JenkinsSmiHash.finish(hash); | |
| 9218 } | |
| 9219 } | |
| 9220 | |
| 9221 /** | |
| 9222 * extractLocalVariable options | |
| 9223 * | |
| 9224 * { | |
| 9225 * "name": String | |
| 9226 * "extractAll": bool | |
| 9227 * } | |
| 9228 */ | |
| 9229 class ExtractLocalVariableOptions extends RefactoringOptions implements HasToJso
n { | |
| 9230 /** | |
| 9231 * The name that the local variable should be given. | |
| 9232 */ | |
| 9233 String name; | |
| 9234 | |
| 9235 /** | |
| 9236 * True if all occurrences of the expression within the scope in which the | |
| 9237 * variable will be defined should be replaced by a reference to the local | |
| 9238 * variable. The expression used to initiate the refactoring will always be | |
| 9239 * replaced. | |
| 9240 */ | |
| 9241 bool extractAll; | |
| 9242 | |
| 9243 ExtractLocalVariableOptions(this.name, this.extractAll); | |
| 9244 | |
| 9245 factory ExtractLocalVariableOptions.fromJson(JsonDecoder jsonDecoder, String j
sonPath, Object json) { | |
| 9246 if (json == null) { | |
| 9247 json = {}; | |
| 9248 } | |
| 9249 if (json is Map) { | |
| 9250 String name; | |
| 9251 if (json.containsKey("name")) { | |
| 9252 name = jsonDecoder._decodeString(jsonPath + ".name", json["name"]); | |
| 9253 } else { | |
| 9254 throw jsonDecoder.missingKey(jsonPath, "name"); | |
| 9255 } | |
| 9256 bool extractAll; | |
| 9257 if (json.containsKey("extractAll")) { | |
| 9258 extractAll = jsonDecoder._decodeBool(jsonPath + ".extractAll", json["ext
ractAll"]); | |
| 9259 } else { | |
| 9260 throw jsonDecoder.missingKey(jsonPath, "extractAll"); | |
| 9261 } | |
| 9262 return new ExtractLocalVariableOptions(name, extractAll); | |
| 9263 } else { | |
| 9264 throw jsonDecoder.mismatch(jsonPath, "extractLocalVariable options"); | |
| 9265 } | |
| 9266 } | |
| 9267 | |
| 9268 factory ExtractLocalVariableOptions.fromRefactoringParams(EditGetRefactoringPa
rams refactoringParams, Request request) { | |
| 9269 return new ExtractLocalVariableOptions.fromJson( | |
| 9270 new RequestDecoder(request), "options", refactoringParams.options); | |
| 9271 } | |
| 9272 | |
| 9273 Map<String, dynamic> toJson() { | |
| 9274 Map<String, dynamic> result = {}; | |
| 9275 result["name"] = name; | |
| 9276 result["extractAll"] = extractAll; | |
| 9277 return result; | |
| 9278 } | |
| 9279 | |
| 9280 @override | |
| 9281 String toString() => JSON.encode(toJson()); | |
| 9282 | |
| 9283 @override | |
| 9284 bool operator==(other) { | |
| 9285 if (other is ExtractLocalVariableOptions) { | |
| 9286 return name == other.name && | |
| 9287 extractAll == other.extractAll; | |
| 9288 } | |
| 9289 return false; | |
| 9290 } | |
| 9291 | |
| 9292 @override | |
| 9293 int get hashCode { | |
| 9294 int hash = 0; | |
| 9295 hash = _JenkinsSmiHash.combine(hash, name.hashCode); | |
| 9296 hash = _JenkinsSmiHash.combine(hash, extractAll.hashCode); | |
| 9297 return _JenkinsSmiHash.finish(hash); | |
| 9298 } | |
| 9299 } | |
| 9300 | |
| 9301 /** | |
| 9302 * extractMethod feedback | |
| 9303 * | |
| 9304 * { | |
| 9305 * "offset": int | |
| 9306 * "length": int | |
| 9307 * "returnType": String | |
| 9308 * "names": List<String> | |
| 9309 * "canCreateGetter": bool | |
| 9310 * "parameters": List<RefactoringMethodParameter> | |
| 9311 * "offsets": List<int> | |
| 9312 * "lengths": List<int> | |
| 9313 * } | |
| 9314 */ | |
| 9315 class ExtractMethodFeedback extends RefactoringFeedback implements HasToJson { | |
| 9316 /** | |
| 9317 * The offset to the beginning of the expression or statements that will be | |
| 9318 * extracted. | |
| 9319 */ | |
| 9320 int offset; | |
| 9321 | |
| 9322 /** | |
| 9323 * The length of the expression or statements that will be extracted. | |
| 9324 */ | |
| 9325 int length; | |
| 9326 | |
| 9327 /** | |
| 9328 * The proposed return type for the method. | |
| 9329 */ | |
| 9330 String returnType; | |
| 9331 | |
| 9332 /** | |
| 9333 * The proposed names for the method. | |
| 9334 */ | |
| 9335 List<String> names; | |
| 9336 | |
| 9337 /** | |
| 9338 * True if a getter could be created rather than a method. | |
| 9339 */ | |
| 9340 bool canCreateGetter; | |
| 9341 | |
| 9342 /** | |
| 9343 * The proposed parameters for the method. | |
| 9344 */ | |
| 9345 List<RefactoringMethodParameter> parameters; | |
| 9346 | |
| 9347 /** | |
| 9348 * The offsets of the expressions or statements that would be replaced by an | |
| 9349 * invocation of the method. | |
| 9350 */ | |
| 9351 List<int> offsets; | |
| 9352 | |
| 9353 /** | |
| 9354 * The lengths of the expressions or statements that would be replaced by an | |
| 9355 * invocation of the method. The lengths correspond to the offsets. In other | |
| 9356 * words, for a given expression (or block of statements), if the offset of | |
| 9357 * that expression is offsets[i], then the length of that expression is | |
| 9358 * lengths[i]. | |
| 9359 */ | |
| 9360 List<int> lengths; | |
| 9361 | |
| 9362 ExtractMethodFeedback(this.offset, this.length, this.returnType, this.names, t
his.canCreateGetter, this.parameters, this.offsets, this.lengths); | |
| 9363 | |
| 9364 factory ExtractMethodFeedback.fromJson(JsonDecoder jsonDecoder, String jsonPat
h, Object json) { | |
| 9365 if (json == null) { | |
| 9366 json = {}; | |
| 9367 } | |
| 9368 if (json is Map) { | |
| 9369 int offset; | |
| 9370 if (json.containsKey("offset")) { | |
| 9371 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 9372 } else { | |
| 9373 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 9374 } | |
| 9375 int length; | |
| 9376 if (json.containsKey("length")) { | |
| 9377 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 9378 } else { | |
| 9379 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 9380 } | |
| 9381 String returnType; | |
| 9382 if (json.containsKey("returnType")) { | |
| 9383 returnType = jsonDecoder._decodeString(jsonPath + ".returnType", json["r
eturnType"]); | |
| 9384 } else { | |
| 9385 throw jsonDecoder.missingKey(jsonPath, "returnType"); | |
| 9386 } | |
| 9387 List<String> names; | |
| 9388 if (json.containsKey("names")) { | |
| 9389 names = jsonDecoder._decodeList(jsonPath + ".names", json["names"], json
Decoder._decodeString); | |
| 9390 } else { | |
| 9391 throw jsonDecoder.missingKey(jsonPath, "names"); | |
| 9392 } | |
| 9393 bool canCreateGetter; | |
| 9394 if (json.containsKey("canCreateGetter")) { | |
| 9395 canCreateGetter = jsonDecoder._decodeBool(jsonPath + ".canCreateGetter",
json["canCreateGetter"]); | |
| 9396 } else { | |
| 9397 throw jsonDecoder.missingKey(jsonPath, "canCreateGetter"); | |
| 9398 } | |
| 9399 List<RefactoringMethodParameter> parameters; | |
| 9400 if (json.containsKey("parameters")) { | |
| 9401 parameters = jsonDecoder._decodeList(jsonPath + ".parameters", json["par
ameters"], (String jsonPath, Object json) => new RefactoringMethodParameter.from
Json(jsonDecoder, jsonPath, json)); | |
| 9402 } else { | |
| 9403 throw jsonDecoder.missingKey(jsonPath, "parameters"); | |
| 9404 } | |
| 9405 List<int> offsets; | |
| 9406 if (json.containsKey("offsets")) { | |
| 9407 offsets = jsonDecoder._decodeList(jsonPath + ".offsets", json["offsets"]
, jsonDecoder._decodeInt); | |
| 9408 } else { | |
| 9409 throw jsonDecoder.missingKey(jsonPath, "offsets"); | |
| 9410 } | |
| 9411 List<int> lengths; | |
| 9412 if (json.containsKey("lengths")) { | |
| 9413 lengths = jsonDecoder._decodeList(jsonPath + ".lengths", json["lengths"]
, jsonDecoder._decodeInt); | |
| 9414 } else { | |
| 9415 throw jsonDecoder.missingKey(jsonPath, "lengths"); | |
| 9416 } | |
| 9417 return new ExtractMethodFeedback(offset, length, returnType, names, canCre
ateGetter, parameters, offsets, lengths); | |
| 9418 } else { | |
| 9419 throw jsonDecoder.mismatch(jsonPath, "extractMethod feedback"); | |
| 9420 } | |
| 9421 } | |
| 9422 | |
| 9423 Map<String, dynamic> toJson() { | |
| 9424 Map<String, dynamic> result = {}; | |
| 9425 result["offset"] = offset; | |
| 9426 result["length"] = length; | |
| 9427 result["returnType"] = returnType; | |
| 9428 result["names"] = names; | |
| 9429 result["canCreateGetter"] = canCreateGetter; | |
| 9430 result["parameters"] = parameters.map((RefactoringMethodParameter value) =>
value.toJson()).toList(); | |
| 9431 result["offsets"] = offsets; | |
| 9432 result["lengths"] = lengths; | |
| 9433 return result; | |
| 9434 } | |
| 9435 | |
| 9436 @override | |
| 9437 String toString() => JSON.encode(toJson()); | |
| 9438 | |
| 9439 @override | |
| 9440 bool operator==(other) { | |
| 9441 if (other is ExtractMethodFeedback) { | |
| 9442 return offset == other.offset && | |
| 9443 length == other.length && | |
| 9444 returnType == other.returnType && | |
| 9445 _listEqual(names, other.names, (String a, String b) => a == b) && | |
| 9446 canCreateGetter == other.canCreateGetter && | |
| 9447 _listEqual(parameters, other.parameters, (RefactoringMethodParameter a
, RefactoringMethodParameter b) => a == b) && | |
| 9448 _listEqual(offsets, other.offsets, (int a, int b) => a == b) && | |
| 9449 _listEqual(lengths, other.lengths, (int a, int b) => a == b); | |
| 9450 } | |
| 9451 return false; | |
| 9452 } | |
| 9453 | |
| 9454 @override | |
| 9455 int get hashCode { | |
| 9456 int hash = 0; | |
| 9457 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 9458 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 9459 hash = _JenkinsSmiHash.combine(hash, returnType.hashCode); | |
| 9460 hash = _JenkinsSmiHash.combine(hash, names.hashCode); | |
| 9461 hash = _JenkinsSmiHash.combine(hash, canCreateGetter.hashCode); | |
| 9462 hash = _JenkinsSmiHash.combine(hash, parameters.hashCode); | |
| 9463 hash = _JenkinsSmiHash.combine(hash, offsets.hashCode); | |
| 9464 hash = _JenkinsSmiHash.combine(hash, lengths.hashCode); | |
| 9465 return _JenkinsSmiHash.finish(hash); | |
| 9466 } | |
| 9467 } | |
| 9468 | |
| 9469 /** | |
| 9470 * extractMethod options | |
| 9471 * | |
| 9472 * { | |
| 9473 * "returnType": String | |
| 9474 * "createGetter": bool | |
| 9475 * "name": String | |
| 9476 * "parameters": List<RefactoringMethodParameter> | |
| 9477 * "extractAll": bool | |
| 9478 * } | |
| 9479 */ | |
| 9480 class ExtractMethodOptions extends RefactoringOptions implements HasToJson { | |
| 9481 /** | |
| 9482 * The return type that should be defined for the method. | |
| 9483 */ | |
| 9484 String returnType; | |
| 9485 | |
| 9486 /** | |
| 9487 * True if a getter should be created rather than a method. It is an error if | |
| 9488 * this field is true and the list of parameters is non-empty. | |
| 9489 */ | |
| 9490 bool createGetter; | |
| 9491 | |
| 9492 /** | |
| 9493 * The name that the method should be given. | |
| 9494 */ | |
| 9495 String name; | |
| 9496 | |
| 9497 /** | |
| 9498 * The parameters that should be defined for the method. | |
| 9499 * | |
| 9500 * It is an error if a REQUIRED or NAMED parameter follows a POSITIONAL | |
| 9501 * parameter. It is an error if a REQUIRED or POSITIONAL parameter follows a | |
| 9502 * NAMED parameter. | |
| 9503 * | |
| 9504 * - To change the order and/or update proposed parameters, add parameters | |
| 9505 * with the same identifiers as proposed. | |
| 9506 * - To add new parameters, omit their identifier. | |
| 9507 * - To remove some parameters, omit them in this list. | |
| 9508 */ | |
| 9509 List<RefactoringMethodParameter> parameters; | |
| 9510 | |
| 9511 /** | |
| 9512 * True if all occurrences of the expression or statements should be replaced | |
| 9513 * by an invocation of the method. The expression or statements used to | |
| 9514 * initiate the refactoring will always be replaced. | |
| 9515 */ | |
| 9516 bool extractAll; | |
| 9517 | |
| 9518 ExtractMethodOptions(this.returnType, this.createGetter, this.name, this.param
eters, this.extractAll); | |
| 9519 | |
| 9520 factory ExtractMethodOptions.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 9521 if (json == null) { | |
| 9522 json = {}; | |
| 9523 } | |
| 9524 if (json is Map) { | |
| 9525 String returnType; | |
| 9526 if (json.containsKey("returnType")) { | |
| 9527 returnType = jsonDecoder._decodeString(jsonPath + ".returnType", json["r
eturnType"]); | |
| 9528 } else { | |
| 9529 throw jsonDecoder.missingKey(jsonPath, "returnType"); | |
| 9530 } | |
| 9531 bool createGetter; | |
| 9532 if (json.containsKey("createGetter")) { | |
| 9533 createGetter = jsonDecoder._decodeBool(jsonPath + ".createGetter", json[
"createGetter"]); | |
| 9534 } else { | |
| 9535 throw jsonDecoder.missingKey(jsonPath, "createGetter"); | |
| 9536 } | |
| 9537 String name; | |
| 9538 if (json.containsKey("name")) { | |
| 9539 name = jsonDecoder._decodeString(jsonPath + ".name", json["name"]); | |
| 9540 } else { | |
| 9541 throw jsonDecoder.missingKey(jsonPath, "name"); | |
| 9542 } | |
| 9543 List<RefactoringMethodParameter> parameters; | |
| 9544 if (json.containsKey("parameters")) { | |
| 9545 parameters = jsonDecoder._decodeList(jsonPath + ".parameters", json["par
ameters"], (String jsonPath, Object json) => new RefactoringMethodParameter.from
Json(jsonDecoder, jsonPath, json)); | |
| 9546 } else { | |
| 9547 throw jsonDecoder.missingKey(jsonPath, "parameters"); | |
| 9548 } | |
| 9549 bool extractAll; | |
| 9550 if (json.containsKey("extractAll")) { | |
| 9551 extractAll = jsonDecoder._decodeBool(jsonPath + ".extractAll", json["ext
ractAll"]); | |
| 9552 } else { | |
| 9553 throw jsonDecoder.missingKey(jsonPath, "extractAll"); | |
| 9554 } | |
| 9555 return new ExtractMethodOptions(returnType, createGetter, name, parameters
, extractAll); | |
| 9556 } else { | |
| 9557 throw jsonDecoder.mismatch(jsonPath, "extractMethod options"); | |
| 9558 } | |
| 9559 } | |
| 9560 | |
| 9561 factory ExtractMethodOptions.fromRefactoringParams(EditGetRefactoringParams re
factoringParams, Request request) { | |
| 9562 return new ExtractMethodOptions.fromJson( | |
| 9563 new RequestDecoder(request), "options", refactoringParams.options); | |
| 9564 } | |
| 9565 | |
| 9566 Map<String, dynamic> toJson() { | |
| 9567 Map<String, dynamic> result = {}; | |
| 9568 result["returnType"] = returnType; | |
| 9569 result["createGetter"] = createGetter; | |
| 9570 result["name"] = name; | |
| 9571 result["parameters"] = parameters.map((RefactoringMethodParameter value) =>
value.toJson()).toList(); | |
| 9572 result["extractAll"] = extractAll; | |
| 9573 return result; | |
| 9574 } | |
| 9575 | |
| 9576 @override | |
| 9577 String toString() => JSON.encode(toJson()); | |
| 9578 | |
| 9579 @override | |
| 9580 bool operator==(other) { | |
| 9581 if (other is ExtractMethodOptions) { | |
| 9582 return returnType == other.returnType && | |
| 9583 createGetter == other.createGetter && | |
| 9584 name == other.name && | |
| 9585 _listEqual(parameters, other.parameters, (RefactoringMethodParameter a
, RefactoringMethodParameter b) => a == b) && | |
| 9586 extractAll == other.extractAll; | |
| 9587 } | |
| 9588 return false; | |
| 9589 } | |
| 9590 | |
| 9591 @override | |
| 9592 int get hashCode { | |
| 9593 int hash = 0; | |
| 9594 hash = _JenkinsSmiHash.combine(hash, returnType.hashCode); | |
| 9595 hash = _JenkinsSmiHash.combine(hash, createGetter.hashCode); | |
| 9596 hash = _JenkinsSmiHash.combine(hash, name.hashCode); | |
| 9597 hash = _JenkinsSmiHash.combine(hash, parameters.hashCode); | |
| 9598 hash = _JenkinsSmiHash.combine(hash, extractAll.hashCode); | |
| 9599 return _JenkinsSmiHash.finish(hash); | |
| 9600 } | |
| 9601 } | |
| 9602 | |
| 9603 /** | |
| 9604 * inlineLocalVariable feedback | |
| 9605 * | |
| 9606 * { | |
| 9607 * "name": String | |
| 9608 * "occurrences": int | |
| 9609 * } | |
| 9610 */ | |
| 9611 class InlineLocalVariableFeedback extends RefactoringFeedback implements HasToJs
on { | |
| 9612 /** | |
| 9613 * The name of the variable being inlined. | |
| 9614 */ | |
| 9615 String name; | |
| 9616 | |
| 9617 /** | |
| 9618 * The number of times the variable occurs. | |
| 9619 */ | |
| 9620 int occurrences; | |
| 9621 | |
| 9622 InlineLocalVariableFeedback(this.name, this.occurrences); | |
| 9623 | |
| 9624 factory InlineLocalVariableFeedback.fromJson(JsonDecoder jsonDecoder, String j
sonPath, Object json) { | |
| 9625 if (json == null) { | |
| 9626 json = {}; | |
| 9627 } | |
| 9628 if (json is Map) { | |
| 9629 String name; | |
| 9630 if (json.containsKey("name")) { | |
| 9631 name = jsonDecoder._decodeString(jsonPath + ".name", json["name"]); | |
| 9632 } else { | |
| 9633 throw jsonDecoder.missingKey(jsonPath, "name"); | |
| 9634 } | |
| 9635 int occurrences; | |
| 9636 if (json.containsKey("occurrences")) { | |
| 9637 occurrences = jsonDecoder._decodeInt(jsonPath + ".occurrences", json["oc
currences"]); | |
| 9638 } else { | |
| 9639 throw jsonDecoder.missingKey(jsonPath, "occurrences"); | |
| 9640 } | |
| 9641 return new InlineLocalVariableFeedback(name, occurrences); | |
| 9642 } else { | |
| 9643 throw jsonDecoder.mismatch(jsonPath, "inlineLocalVariable feedback"); | |
| 9644 } | |
| 9645 } | |
| 9646 | |
| 9647 Map<String, dynamic> toJson() { | |
| 9648 Map<String, dynamic> result = {}; | |
| 9649 result["name"] = name; | |
| 9650 result["occurrences"] = occurrences; | |
| 9651 return result; | |
| 9652 } | |
| 9653 | |
| 9654 @override | |
| 9655 String toString() => JSON.encode(toJson()); | |
| 9656 | |
| 9657 @override | |
| 9658 bool operator==(other) { | |
| 9659 if (other is InlineLocalVariableFeedback) { | |
| 9660 return name == other.name && | |
| 9661 occurrences == other.occurrences; | |
| 9662 } | |
| 9663 return false; | |
| 9664 } | |
| 9665 | |
| 9666 @override | |
| 9667 int get hashCode { | |
| 9668 int hash = 0; | |
| 9669 hash = _JenkinsSmiHash.combine(hash, name.hashCode); | |
| 9670 hash = _JenkinsSmiHash.combine(hash, occurrences.hashCode); | |
| 9671 return _JenkinsSmiHash.finish(hash); | |
| 9672 } | |
| 9673 } | |
| 9674 /** | |
| 9675 * inlineLocalVariable options | |
| 9676 */ | |
| 9677 class InlineLocalVariableOptions { | |
| 9678 @override | |
| 9679 bool operator==(other) { | |
| 9680 if (other is InlineLocalVariableOptions) { | |
| 9681 return true; | |
| 9682 } | |
| 9683 return false; | |
| 9684 } | |
| 9685 | |
| 9686 @override | |
| 9687 int get hashCode { | |
| 9688 return 540364977; | |
| 9689 } | |
| 9690 } | |
| 9691 | |
| 9692 /** | |
| 9693 * inlineMethod feedback | |
| 9694 * | |
| 9695 * { | |
| 9696 * "className": optional String | |
| 9697 * "methodName": String | |
| 9698 * "isDeclaration": bool | |
| 9699 * } | |
| 9700 */ | |
| 9701 class InlineMethodFeedback extends RefactoringFeedback implements HasToJson { | |
| 9702 /** | |
| 9703 * The name of the class enclosing the method being inlined. If not a class | |
| 9704 * member is being inlined, this field will be absent. | |
| 9705 */ | |
| 9706 String className; | |
| 9707 | |
| 9708 /** | |
| 9709 * The name of the method (or function) being inlined. | |
| 9710 */ | |
| 9711 String methodName; | |
| 9712 | |
| 9713 /** | |
| 9714 * True if the declaration of the method is selected. So all references | |
| 9715 * should be inlined. | |
| 9716 */ | |
| 9717 bool isDeclaration; | |
| 9718 | |
| 9719 InlineMethodFeedback(this.methodName, this.isDeclaration, {this.className}); | |
| 9720 | |
| 9721 factory InlineMethodFeedback.fromJson(JsonDecoder jsonDecoder, String jsonPath
, Object json) { | |
| 9722 if (json == null) { | |
| 9723 json = {}; | |
| 9724 } | |
| 9725 if (json is Map) { | |
| 9726 String className; | |
| 9727 if (json.containsKey("className")) { | |
| 9728 className = jsonDecoder._decodeString(jsonPath + ".className", json["cla
ssName"]); | |
| 9729 } | |
| 9730 String methodName; | |
| 9731 if (json.containsKey("methodName")) { | |
| 9732 methodName = jsonDecoder._decodeString(jsonPath + ".methodName", json["m
ethodName"]); | |
| 9733 } else { | |
| 9734 throw jsonDecoder.missingKey(jsonPath, "methodName"); | |
| 9735 } | |
| 9736 bool isDeclaration; | |
| 9737 if (json.containsKey("isDeclaration")) { | |
| 9738 isDeclaration = jsonDecoder._decodeBool(jsonPath + ".isDeclaration", jso
n["isDeclaration"]); | |
| 9739 } else { | |
| 9740 throw jsonDecoder.missingKey(jsonPath, "isDeclaration"); | |
| 9741 } | |
| 9742 return new InlineMethodFeedback(methodName, isDeclaration, className: clas
sName); | |
| 9743 } else { | |
| 9744 throw jsonDecoder.mismatch(jsonPath, "inlineMethod feedback"); | |
| 9745 } | |
| 9746 } | |
| 9747 | |
| 9748 Map<String, dynamic> toJson() { | |
| 9749 Map<String, dynamic> result = {}; | |
| 9750 if (className != null) { | |
| 9751 result["className"] = className; | |
| 9752 } | |
| 9753 result["methodName"] = methodName; | |
| 9754 result["isDeclaration"] = isDeclaration; | |
| 9755 return result; | |
| 9756 } | |
| 9757 | |
| 9758 @override | |
| 9759 String toString() => JSON.encode(toJson()); | |
| 9760 | |
| 9761 @override | |
| 9762 bool operator==(other) { | |
| 9763 if (other is InlineMethodFeedback) { | |
| 9764 return className == other.className && | |
| 9765 methodName == other.methodName && | |
| 9766 isDeclaration == other.isDeclaration; | |
| 9767 } | |
| 9768 return false; | |
| 9769 } | |
| 9770 | |
| 9771 @override | |
| 9772 int get hashCode { | |
| 9773 int hash = 0; | |
| 9774 hash = _JenkinsSmiHash.combine(hash, className.hashCode); | |
| 9775 hash = _JenkinsSmiHash.combine(hash, methodName.hashCode); | |
| 9776 hash = _JenkinsSmiHash.combine(hash, isDeclaration.hashCode); | |
| 9777 return _JenkinsSmiHash.finish(hash); | |
| 9778 } | |
| 9779 } | |
| 9780 | |
| 9781 /** | |
| 9782 * inlineMethod options | |
| 9783 * | |
| 9784 * { | |
| 9785 * "deleteSource": bool | |
| 9786 * "inlineAll": bool | |
| 9787 * } | |
| 9788 */ | |
| 9789 class InlineMethodOptions extends RefactoringOptions implements HasToJson { | |
| 9790 /** | |
| 9791 * True if the method being inlined should be removed. It is an error if this | |
| 9792 * field is true and inlineAll is false. | |
| 9793 */ | |
| 9794 bool deleteSource; | |
| 9795 | |
| 9796 /** | |
| 9797 * True if all invocations of the method should be inlined, or false if only | |
| 9798 * the invocation site used to create this refactoring should be inlined. | |
| 9799 */ | |
| 9800 bool inlineAll; | |
| 9801 | |
| 9802 InlineMethodOptions(this.deleteSource, this.inlineAll); | |
| 9803 | |
| 9804 factory InlineMethodOptions.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | |
| 9805 if (json == null) { | |
| 9806 json = {}; | |
| 9807 } | |
| 9808 if (json is Map) { | |
| 9809 bool deleteSource; | |
| 9810 if (json.containsKey("deleteSource")) { | |
| 9811 deleteSource = jsonDecoder._decodeBool(jsonPath + ".deleteSource", json[
"deleteSource"]); | |
| 9812 } else { | |
| 9813 throw jsonDecoder.missingKey(jsonPath, "deleteSource"); | |
| 9814 } | |
| 9815 bool inlineAll; | |
| 9816 if (json.containsKey("inlineAll")) { | |
| 9817 inlineAll = jsonDecoder._decodeBool(jsonPath + ".inlineAll", json["inlin
eAll"]); | |
| 9818 } else { | |
| 9819 throw jsonDecoder.missingKey(jsonPath, "inlineAll"); | |
| 9820 } | |
| 9821 return new InlineMethodOptions(deleteSource, inlineAll); | |
| 9822 } else { | |
| 9823 throw jsonDecoder.mismatch(jsonPath, "inlineMethod options"); | |
| 9824 } | |
| 9825 } | |
| 9826 | |
| 9827 factory InlineMethodOptions.fromRefactoringParams(EditGetRefactoringParams ref
actoringParams, Request request) { | |
| 9828 return new InlineMethodOptions.fromJson( | |
| 9829 new RequestDecoder(request), "options", refactoringParams.options); | |
| 9830 } | |
| 9831 | |
| 9832 Map<String, dynamic> toJson() { | |
| 9833 Map<String, dynamic> result = {}; | |
| 9834 result["deleteSource"] = deleteSource; | |
| 9835 result["inlineAll"] = inlineAll; | |
| 9836 return result; | |
| 9837 } | |
| 9838 | |
| 9839 @override | |
| 9840 String toString() => JSON.encode(toJson()); | |
| 9841 | |
| 9842 @override | |
| 9843 bool operator==(other) { | |
| 9844 if (other is InlineMethodOptions) { | |
| 9845 return deleteSource == other.deleteSource && | |
| 9846 inlineAll == other.inlineAll; | |
| 9847 } | |
| 9848 return false; | |
| 9849 } | |
| 9850 | |
| 9851 @override | |
| 9852 int get hashCode { | |
| 9853 int hash = 0; | |
| 9854 hash = _JenkinsSmiHash.combine(hash, deleteSource.hashCode); | |
| 9855 hash = _JenkinsSmiHash.combine(hash, inlineAll.hashCode); | |
| 9856 return _JenkinsSmiHash.finish(hash); | |
| 9857 } | |
| 9858 } | |
| 9859 | |
| 9860 /** | |
| 9861 * rename feedback | |
| 9862 * | |
| 9863 * { | |
| 9864 * "offset": int | |
| 9865 * "length": int | |
| 9866 * "elementKindName": String | |
| 9867 * "oldName": String | |
| 9868 * } | |
| 9869 */ | |
| 9870 class RenameFeedback extends RefactoringFeedback implements HasToJson { | |
| 9871 /** | |
| 9872 * The offset to the beginning of the name selected to be renamed. | |
| 9873 */ | |
| 9874 int offset; | |
| 9875 | |
| 9876 /** | |
| 9877 * The length of the name selected to be renamed. | |
| 9878 */ | |
| 9879 int length; | |
| 9880 | |
| 9881 /** | |
| 9882 * The human-readable description of the kind of element being renamed (such | |
| 9883 * as “class” or “function type alias”). | |
| 9884 */ | |
| 9885 String elementKindName; | |
| 9886 | |
| 9887 /** | |
| 9888 * The old name of the element before the refactoring. | |
| 9889 */ | |
| 9890 String oldName; | |
| 9891 | |
| 9892 RenameFeedback(this.offset, this.length, this.elementKindName, this.oldName); | |
| 9893 | |
| 9894 factory RenameFeedback.fromJson(JsonDecoder jsonDecoder, String jsonPath, Obje
ct json) { | |
| 9895 if (json == null) { | |
| 9896 json = {}; | |
| 9897 } | |
| 9898 if (json is Map) { | |
| 9899 int offset; | |
| 9900 if (json.containsKey("offset")) { | |
| 9901 offset = jsonDecoder._decodeInt(jsonPath + ".offset", json["offset"]); | |
| 9902 } else { | |
| 9903 throw jsonDecoder.missingKey(jsonPath, "offset"); | |
| 9904 } | |
| 9905 int length; | |
| 9906 if (json.containsKey("length")) { | |
| 9907 length = jsonDecoder._decodeInt(jsonPath + ".length", json["length"]); | |
| 9908 } else { | |
| 9909 throw jsonDecoder.missingKey(jsonPath, "length"); | |
| 9910 } | |
| 9911 String elementKindName; | |
| 9912 if (json.containsKey("elementKindName")) { | |
| 9913 elementKindName = jsonDecoder._decodeString(jsonPath + ".elementKindName
", json["elementKindName"]); | |
| 9914 } else { | |
| 9915 throw jsonDecoder.missingKey(jsonPath, "elementKindName"); | |
| 9916 } | |
| 9917 String oldName; | |
| 9918 if (json.containsKey("oldName")) { | |
| 9919 oldName = jsonDecoder._decodeString(jsonPath + ".oldName", json["oldName
"]); | |
| 9920 } else { | |
| 9921 throw jsonDecoder.missingKey(jsonPath, "oldName"); | |
| 9922 } | |
| 9923 return new RenameFeedback(offset, length, elementKindName, oldName); | |
| 9924 } else { | |
| 9925 throw jsonDecoder.mismatch(jsonPath, "rename feedback"); | |
| 9926 } | |
| 9927 } | |
| 9928 | |
| 9929 Map<String, dynamic> toJson() { | |
| 9930 Map<String, dynamic> result = {}; | |
| 9931 result["offset"] = offset; | |
| 9932 result["length"] = length; | |
| 9933 result["elementKindName"] = elementKindName; | |
| 9934 result["oldName"] = oldName; | |
| 9935 return result; | |
| 9936 } | |
| 9937 | |
| 9938 @override | |
| 9939 String toString() => JSON.encode(toJson()); | |
| 9940 | |
| 9941 @override | |
| 9942 bool operator==(other) { | |
| 9943 if (other is RenameFeedback) { | |
| 9944 return offset == other.offset && | |
| 9945 length == other.length && | |
| 9946 elementKindName == other.elementKindName && | |
| 9947 oldName == other.oldName; | |
| 9948 } | |
| 9949 return false; | |
| 9950 } | |
| 9951 | |
| 9952 @override | |
| 9953 int get hashCode { | |
| 9954 int hash = 0; | |
| 9955 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | |
| 9956 hash = _JenkinsSmiHash.combine(hash, length.hashCode); | |
| 9957 hash = _JenkinsSmiHash.combine(hash, elementKindName.hashCode); | |
| 9958 hash = _JenkinsSmiHash.combine(hash, oldName.hashCode); | |
| 9959 return _JenkinsSmiHash.finish(hash); | |
| 9960 } | |
| 9961 } | |
| 9962 | |
| 9963 /** | |
| 9964 * rename options | |
| 9965 * | |
| 9966 * { | |
| 9967 * "newName": String | |
| 9968 * } | |
| 9969 */ | |
| 9970 class RenameOptions extends RefactoringOptions implements HasToJson { | |
| 9971 /** | |
| 9972 * The name that the element should have after the refactoring. | |
| 9973 */ | |
| 9974 String newName; | |
| 9975 | |
| 9976 RenameOptions(this.newName); | |
| 9977 | |
| 9978 factory RenameOptions.fromJson(JsonDecoder jsonDecoder, String jsonPath, Objec
t json) { | |
| 9979 if (json == null) { | |
| 9980 json = {}; | |
| 9981 } | |
| 9982 if (json is Map) { | |
| 9983 String newName; | |
| 9984 if (json.containsKey("newName")) { | |
| 9985 newName = jsonDecoder._decodeString(jsonPath + ".newName", json["newName
"]); | |
| 9986 } else { | |
| 9987 throw jsonDecoder.missingKey(jsonPath, "newName"); | |
| 9988 } | |
| 9989 return new RenameOptions(newName); | |
| 9990 } else { | |
| 9991 throw jsonDecoder.mismatch(jsonPath, "rename options"); | |
| 9992 } | |
| 9993 } | |
| 9994 | |
| 9995 factory RenameOptions.fromRefactoringParams(EditGetRefactoringParams refactori
ngParams, Request request) { | |
| 9996 return new RenameOptions.fromJson( | |
| 9997 new RequestDecoder(request), "options", refactoringParams.options); | |
| 9998 } | |
| 9999 | |
| 10000 Map<String, dynamic> toJson() { | |
| 10001 Map<String, dynamic> result = {}; | |
| 10002 result["newName"] = newName; | |
| 10003 return result; | |
| 10004 } | |
| 10005 | |
| 10006 @override | |
| 10007 String toString() => JSON.encode(toJson()); | |
| 10008 | |
| 10009 @override | |
| 10010 bool operator==(other) { | |
| 10011 if (other is RenameOptions) { | |
| 10012 return newName == other.newName; | |
| 10013 } | |
| 10014 return false; | |
| 10015 } | |
| 10016 | |
| 10017 @override | |
| 10018 int get hashCode { | |
| 10019 int hash = 0; | |
| 10020 hash = _JenkinsSmiHash.combine(hash, newName.hashCode); | |
| 10021 return _JenkinsSmiHash.finish(hash); | |
| 10022 } | |
| 10023 } | |
| OLD | NEW |