| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This file has been automatically generated. Please do not edit it manually. | 5 // This file has been automatically generated. Please do not edit it manually. |
| 6 // To regenerate the file, use the script | 6 // To regenerate the file, use the script |
| 7 // "pkg/analysis_server/spec/generate_files". | 7 // "pkg/analysis_server/spec/generate_files". |
| 8 | 8 |
| 9 part of protocol; | 9 part of protocol; |
| 10 /** | 10 /** |
| (...skipping 3342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3353 hash = _JenkinsSmiHash.combine(hash, file.hashCode); | 3353 hash = _JenkinsSmiHash.combine(hash, file.hashCode); |
| 3354 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); | 3354 hash = _JenkinsSmiHash.combine(hash, offset.hashCode); |
| 3355 return _JenkinsSmiHash.finish(hash); | 3355 return _JenkinsSmiHash.finish(hash); |
| 3356 } | 3356 } |
| 3357 } | 3357 } |
| 3358 | 3358 |
| 3359 /** | 3359 /** |
| 3360 * edit.getFixes result | 3360 * edit.getFixes result |
| 3361 * | 3361 * |
| 3362 * { | 3362 * { |
| 3363 * "fixes": List<ErrorFixes> | 3363 * "fixes": List<AnalysisErrorFixes> |
| 3364 * } | 3364 * } |
| 3365 */ | 3365 */ |
| 3366 class EditGetFixesResult implements HasToJson { | 3366 class EditGetFixesResult implements HasToJson { |
| 3367 /** | 3367 /** |
| 3368 * The fixes that are available for each of the analysis errors. There is a | 3368 * The fixes that are available for each of the analysis errors. There is a |
| 3369 * one-to-one correspondence between the analysis errors in the request and | 3369 * one-to-one correspondence between the analysis errors in the request and |
| 3370 * the lists of changes in the response. In particular, it is always the case | 3370 * the lists of changes in the response. In particular, it is always the case |
| 3371 * that errors.length == fixes.length and that fixes[i] is the list of fixes | 3371 * that errors.length == fixes.length and that fixes[i] is the list of fixes |
| 3372 * for the error in errors[i]. The list of changes corresponding to an error | 3372 * for the error in errors[i]. The list of changes corresponding to an error |
| 3373 * can be empty if there are no fixes available for that error. | 3373 * can be empty if there are no fixes available for that error. |
| 3374 */ | 3374 */ |
| 3375 List<ErrorFixes> fixes; | 3375 List<AnalysisErrorFixes> fixes; |
| 3376 | 3376 |
| 3377 EditGetFixesResult(this.fixes); | 3377 EditGetFixesResult(this.fixes); |
| 3378 | 3378 |
| 3379 factory EditGetFixesResult.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { | 3379 factory EditGetFixesResult.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { |
| 3380 if (json == null) { | 3380 if (json == null) { |
| 3381 json = {}; | 3381 json = {}; |
| 3382 } | 3382 } |
| 3383 if (json is Map) { | 3383 if (json is Map) { |
| 3384 List<ErrorFixes> fixes; | 3384 List<AnalysisErrorFixes> fixes; |
| 3385 if (json.containsKey("fixes")) { | 3385 if (json.containsKey("fixes")) { |
| 3386 fixes = jsonDecoder._decodeList(jsonPath + ".fixes", json["fixes"], (Str
ing jsonPath, Object json) => new ErrorFixes.fromJson(jsonDecoder, jsonPath, jso
n)); | 3386 fixes = jsonDecoder._decodeList(jsonPath + ".fixes", json["fixes"], (Str
ing jsonPath, Object json) => new AnalysisErrorFixes.fromJson(jsonDecoder, jsonP
ath, json)); |
| 3387 } else { | 3387 } else { |
| 3388 throw jsonDecoder.missingKey(jsonPath, "fixes"); | 3388 throw jsonDecoder.missingKey(jsonPath, "fixes"); |
| 3389 } | 3389 } |
| 3390 return new EditGetFixesResult(fixes); | 3390 return new EditGetFixesResult(fixes); |
| 3391 } else { | 3391 } else { |
| 3392 throw jsonDecoder.mismatch(jsonPath, "edit.getFixes result"); | 3392 throw jsonDecoder.mismatch(jsonPath, "edit.getFixes result"); |
| 3393 } | 3393 } |
| 3394 } | 3394 } |
| 3395 | 3395 |
| 3396 factory EditGetFixesResult.fromResponse(Response response) { | 3396 factory EditGetFixesResult.fromResponse(Response response) { |
| 3397 return new EditGetFixesResult.fromJson( | 3397 return new EditGetFixesResult.fromJson( |
| 3398 new ResponseDecoder(), "result", response._result); | 3398 new ResponseDecoder(), "result", response._result); |
| 3399 } | 3399 } |
| 3400 | 3400 |
| 3401 Map<String, dynamic> toJson() { | 3401 Map<String, dynamic> toJson() { |
| 3402 Map<String, dynamic> result = {}; | 3402 Map<String, dynamic> result = {}; |
| 3403 result["fixes"] = fixes.map((ErrorFixes value) => value.toJson()).toList(); | 3403 result["fixes"] = fixes.map((AnalysisErrorFixes value) => value.toJson()).to
List(); |
| 3404 return result; | 3404 return result; |
| 3405 } | 3405 } |
| 3406 | 3406 |
| 3407 Response toResponse(String id) { | 3407 Response toResponse(String id) { |
| 3408 return new Response(id, result: toJson()); | 3408 return new Response(id, result: toJson()); |
| 3409 } | 3409 } |
| 3410 | 3410 |
| 3411 @override | 3411 @override |
| 3412 String toString() => JSON.encode(toJson()); | 3412 String toString() => JSON.encode(toJson()); |
| 3413 | 3413 |
| 3414 @override | 3414 @override |
| 3415 bool operator==(other) { | 3415 bool operator==(other) { |
| 3416 if (other is EditGetFixesResult) { | 3416 if (other is EditGetFixesResult) { |
| 3417 return _listEqual(fixes, other.fixes, (ErrorFixes a, ErrorFixes b) => a ==
b); | 3417 return _listEqual(fixes, other.fixes, (AnalysisErrorFixes a, AnalysisError
Fixes b) => a == b); |
| 3418 } | 3418 } |
| 3419 return false; | 3419 return false; |
| 3420 } | 3420 } |
| 3421 | 3421 |
| 3422 @override | 3422 @override |
| 3423 int get hashCode { | 3423 int get hashCode { |
| 3424 int hash = 0; | 3424 int hash = 0; |
| 3425 hash = _JenkinsSmiHash.combine(hash, fixes.hashCode); | 3425 hash = _JenkinsSmiHash.combine(hash, fixes.hashCode); |
| 3426 return _JenkinsSmiHash.finish(hash); | 3426 return _JenkinsSmiHash.finish(hash); |
| 3427 } | 3427 } |
| (...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4346 hash = _JenkinsSmiHash.combine(hash, 704418402); | 4346 hash = _JenkinsSmiHash.combine(hash, 704418402); |
| 4347 hash = _JenkinsSmiHash.combine(hash, content.hashCode); | 4347 hash = _JenkinsSmiHash.combine(hash, content.hashCode); |
| 4348 return _JenkinsSmiHash.finish(hash); | 4348 return _JenkinsSmiHash.finish(hash); |
| 4349 } | 4349 } |
| 4350 } | 4350 } |
| 4351 | 4351 |
| 4352 /** | 4352 /** |
| 4353 * AnalysisError | 4353 * AnalysisError |
| 4354 * | 4354 * |
| 4355 * { | 4355 * { |
| 4356 * "severity": ErrorSeverity | 4356 * "severity": AnalysisErrorSeverity |
| 4357 * "type": ErrorType | 4357 * "type": AnalysisErrorType |
| 4358 * "location": Location | 4358 * "location": Location |
| 4359 * "message": String | 4359 * "message": String |
| 4360 * "correction": optional String | 4360 * "correction": optional String |
| 4361 * } | 4361 * } |
| 4362 */ | 4362 */ |
| 4363 class AnalysisError implements HasToJson { | 4363 class AnalysisError implements HasToJson { |
| 4364 /** | 4364 /** |
| 4365 * Returns a list of AnalysisErrors correponding to the given list of Engine | 4365 * Returns a list of AnalysisErrors correponding to the given list of Engine |
| 4366 * errors. | 4366 * errors. |
| 4367 */ | 4367 */ |
| 4368 static List<AnalysisError> listFromEngine(engine.LineInfo lineInfo, List<engin
e.AnalysisError> errors) => | 4368 static List<AnalysisError> listFromEngine(engine.LineInfo lineInfo, List<engin
e.AnalysisError> errors) => |
| 4369 _analysisErrorListFromEngine(lineInfo, errors); | 4369 _analysisErrorListFromEngine(lineInfo, errors); |
| 4370 | 4370 |
| 4371 /** | 4371 /** |
| 4372 * The severity of the error. | 4372 * The severity of the error. |
| 4373 */ | 4373 */ |
| 4374 ErrorSeverity severity; | 4374 AnalysisErrorSeverity severity; |
| 4375 | 4375 |
| 4376 /** | 4376 /** |
| 4377 * The type of the error. | 4377 * The type of the error. |
| 4378 */ | 4378 */ |
| 4379 ErrorType type; | 4379 AnalysisErrorType type; |
| 4380 | 4380 |
| 4381 /** | 4381 /** |
| 4382 * The location associated with the error. | 4382 * The location associated with the error. |
| 4383 */ | 4383 */ |
| 4384 Location location; | 4384 Location location; |
| 4385 | 4385 |
| 4386 /** | 4386 /** |
| 4387 * The message to be displayed for this error. The message should indicate | 4387 * The message to be displayed for this error. The message should indicate |
| 4388 * what is wrong with the code and why it is wrong. | 4388 * what is wrong with the code and why it is wrong. |
| 4389 */ | 4389 */ |
| 4390 String message; | 4390 String message; |
| 4391 | 4391 |
| 4392 /** | 4392 /** |
| 4393 * The correction message to be displayed for this error. The correction | 4393 * The correction message to be displayed for this error. The correction |
| 4394 * message should indicate how the user can fix the error. The field is | 4394 * message should indicate how the user can fix the error. The field is |
| 4395 * omitted if there is no correction message associated with the error code. | 4395 * omitted if there is no correction message associated with the error code. |
| 4396 */ | 4396 */ |
| 4397 String correction; | 4397 String correction; |
| 4398 | 4398 |
| 4399 AnalysisError(this.severity, this.type, this.location, this.message, {this.cor
rection}); | 4399 AnalysisError(this.severity, this.type, this.location, this.message, {this.cor
rection}); |
| 4400 | 4400 |
| 4401 factory AnalysisError.fromJson(JsonDecoder jsonDecoder, String jsonPath, Objec
t json) { | 4401 factory AnalysisError.fromJson(JsonDecoder jsonDecoder, String jsonPath, Objec
t json) { |
| 4402 if (json == null) { | 4402 if (json == null) { |
| 4403 json = {}; | 4403 json = {}; |
| 4404 } | 4404 } |
| 4405 if (json is Map) { | 4405 if (json is Map) { |
| 4406 ErrorSeverity severity; | 4406 AnalysisErrorSeverity severity; |
| 4407 if (json.containsKey("severity")) { | 4407 if (json.containsKey("severity")) { |
| 4408 severity = new ErrorSeverity.fromJson(jsonDecoder, jsonPath + ".severity
", json["severity"]); | 4408 severity = new AnalysisErrorSeverity.fromJson(jsonDecoder, jsonPath + ".
severity", json["severity"]); |
| 4409 } else { | 4409 } else { |
| 4410 throw jsonDecoder.missingKey(jsonPath, "severity"); | 4410 throw jsonDecoder.missingKey(jsonPath, "severity"); |
| 4411 } | 4411 } |
| 4412 ErrorType type; | 4412 AnalysisErrorType type; |
| 4413 if (json.containsKey("type")) { | 4413 if (json.containsKey("type")) { |
| 4414 type = new ErrorType.fromJson(jsonDecoder, jsonPath + ".type", json["typ
e"]); | 4414 type = new AnalysisErrorType.fromJson(jsonDecoder, jsonPath + ".type", j
son["type"]); |
| 4415 } else { | 4415 } else { |
| 4416 throw jsonDecoder.missingKey(jsonPath, "type"); | 4416 throw jsonDecoder.missingKey(jsonPath, "type"); |
| 4417 } | 4417 } |
| 4418 Location location; | 4418 Location location; |
| 4419 if (json.containsKey("location")) { | 4419 if (json.containsKey("location")) { |
| 4420 location = new Location.fromJson(jsonDecoder, jsonPath + ".location", js
on["location"]); | 4420 location = new Location.fromJson(jsonDecoder, jsonPath + ".location", js
on["location"]); |
| 4421 } else { | 4421 } else { |
| 4422 throw jsonDecoder.missingKey(jsonPath, "location"); | 4422 throw jsonDecoder.missingKey(jsonPath, "location"); |
| 4423 } | 4423 } |
| 4424 String message; | 4424 String message; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4476 hash = _JenkinsSmiHash.combine(hash, severity.hashCode); | 4476 hash = _JenkinsSmiHash.combine(hash, severity.hashCode); |
| 4477 hash = _JenkinsSmiHash.combine(hash, type.hashCode); | 4477 hash = _JenkinsSmiHash.combine(hash, type.hashCode); |
| 4478 hash = _JenkinsSmiHash.combine(hash, location.hashCode); | 4478 hash = _JenkinsSmiHash.combine(hash, location.hashCode); |
| 4479 hash = _JenkinsSmiHash.combine(hash, message.hashCode); | 4479 hash = _JenkinsSmiHash.combine(hash, message.hashCode); |
| 4480 hash = _JenkinsSmiHash.combine(hash, correction.hashCode); | 4480 hash = _JenkinsSmiHash.combine(hash, correction.hashCode); |
| 4481 return _JenkinsSmiHash.finish(hash); | 4481 return _JenkinsSmiHash.finish(hash); |
| 4482 } | 4482 } |
| 4483 } | 4483 } |
| 4484 | 4484 |
| 4485 /** | 4485 /** |
| 4486 * AnalysisErrorFixes |
| 4487 * |
| 4488 * { |
| 4489 * "error": AnalysisError |
| 4490 * "fixes": List<SourceChange> |
| 4491 * } |
| 4492 */ |
| 4493 class AnalysisErrorFixes implements HasToJson { |
| 4494 /** |
| 4495 * The error with which the fixes are associated. |
| 4496 */ |
| 4497 AnalysisError error; |
| 4498 |
| 4499 /** |
| 4500 * The fixes associated with the error. |
| 4501 */ |
| 4502 List<SourceChange> fixes; |
| 4503 |
| 4504 AnalysisErrorFixes(this.error, {this.fixes}) { |
| 4505 if (fixes == null) { |
| 4506 fixes = <SourceChange>[]; |
| 4507 } |
| 4508 } |
| 4509 |
| 4510 factory AnalysisErrorFixes.fromJson(JsonDecoder jsonDecoder, String jsonPath,
Object json) { |
| 4511 if (json == null) { |
| 4512 json = {}; |
| 4513 } |
| 4514 if (json is Map) { |
| 4515 AnalysisError error; |
| 4516 if (json.containsKey("error")) { |
| 4517 error = new AnalysisError.fromJson(jsonDecoder, jsonPath + ".error", jso
n["error"]); |
| 4518 } else { |
| 4519 throw jsonDecoder.missingKey(jsonPath, "error"); |
| 4520 } |
| 4521 List<SourceChange> fixes; |
| 4522 if (json.containsKey("fixes")) { |
| 4523 fixes = jsonDecoder._decodeList(jsonPath + ".fixes", json["fixes"], (Str
ing jsonPath, Object json) => new SourceChange.fromJson(jsonDecoder, jsonPath, j
son)); |
| 4524 } else { |
| 4525 throw jsonDecoder.missingKey(jsonPath, "fixes"); |
| 4526 } |
| 4527 return new AnalysisErrorFixes(error, fixes: fixes); |
| 4528 } else { |
| 4529 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorFixes"); |
| 4530 } |
| 4531 } |
| 4532 |
| 4533 Map<String, dynamic> toJson() { |
| 4534 Map<String, dynamic> result = {}; |
| 4535 result["error"] = error.toJson(); |
| 4536 result["fixes"] = fixes.map((SourceChange value) => value.toJson()).toList()
; |
| 4537 return result; |
| 4538 } |
| 4539 |
| 4540 /** |
| 4541 * Add a [Fix] |
| 4542 */ |
| 4543 void addFix(Fix fix) { |
| 4544 fixes.add(fix.change); |
| 4545 } |
| 4546 |
| 4547 @override |
| 4548 String toString() => JSON.encode(toJson()); |
| 4549 |
| 4550 @override |
| 4551 bool operator==(other) { |
| 4552 if (other is AnalysisErrorFixes) { |
| 4553 return error == other.error && |
| 4554 _listEqual(fixes, other.fixes, (SourceChange a, SourceChange b) => a =
= b); |
| 4555 } |
| 4556 return false; |
| 4557 } |
| 4558 |
| 4559 @override |
| 4560 int get hashCode { |
| 4561 int hash = 0; |
| 4562 hash = _JenkinsSmiHash.combine(hash, error.hashCode); |
| 4563 hash = _JenkinsSmiHash.combine(hash, fixes.hashCode); |
| 4564 return _JenkinsSmiHash.finish(hash); |
| 4565 } |
| 4566 } |
| 4567 |
| 4568 /** |
| 4569 * AnalysisErrorSeverity |
| 4570 * |
| 4571 * enum { |
| 4572 * INFO |
| 4573 * WARNING |
| 4574 * ERROR |
| 4575 * } |
| 4576 */ |
| 4577 class AnalysisErrorSeverity { |
| 4578 static const INFO = const AnalysisErrorSeverity._("INFO"); |
| 4579 |
| 4580 static const WARNING = const AnalysisErrorSeverity._("WARNING"); |
| 4581 |
| 4582 static const ERROR = const AnalysisErrorSeverity._("ERROR"); |
| 4583 |
| 4584 final String name; |
| 4585 |
| 4586 const AnalysisErrorSeverity._(this.name); |
| 4587 |
| 4588 factory AnalysisErrorSeverity(String name) { |
| 4589 switch (name) { |
| 4590 case "INFO": |
| 4591 return INFO; |
| 4592 case "WARNING": |
| 4593 return WARNING; |
| 4594 case "ERROR": |
| 4595 return ERROR; |
| 4596 } |
| 4597 throw new Exception('Illegal enum value: $name'); |
| 4598 } |
| 4599 |
| 4600 factory AnalysisErrorSeverity.fromJson(JsonDecoder jsonDecoder, String jsonPat
h, Object json) { |
| 4601 if (json is String) { |
| 4602 try { |
| 4603 return new AnalysisErrorSeverity(json); |
| 4604 } catch(_) { |
| 4605 // Fall through |
| 4606 } |
| 4607 } |
| 4608 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorSeverity"); |
| 4609 } |
| 4610 |
| 4611 @override |
| 4612 String toString() => "AnalysisErrorSeverity.$name"; |
| 4613 |
| 4614 String toJson() => name; |
| 4615 } |
| 4616 |
| 4617 /** |
| 4618 * AnalysisErrorType |
| 4619 * |
| 4620 * enum { |
| 4621 * COMPILE_TIME_ERROR |
| 4622 * HINT |
| 4623 * STATIC_TYPE_WARNING |
| 4624 * STATIC_WARNING |
| 4625 * SYNTACTIC_ERROR |
| 4626 * TODO |
| 4627 * } |
| 4628 */ |
| 4629 class AnalysisErrorType { |
| 4630 static const COMPILE_TIME_ERROR = const AnalysisErrorType._("COMPILE_TIME_ERRO
R"); |
| 4631 |
| 4632 static const HINT = const AnalysisErrorType._("HINT"); |
| 4633 |
| 4634 static const STATIC_TYPE_WARNING = const AnalysisErrorType._("STATIC_TYPE_WARN
ING"); |
| 4635 |
| 4636 static const STATIC_WARNING = const AnalysisErrorType._("STATIC_WARNING"); |
| 4637 |
| 4638 static const SYNTACTIC_ERROR = const AnalysisErrorType._("SYNTACTIC_ERROR"); |
| 4639 |
| 4640 static const TODO = const AnalysisErrorType._("TODO"); |
| 4641 |
| 4642 final String name; |
| 4643 |
| 4644 const AnalysisErrorType._(this.name); |
| 4645 |
| 4646 factory AnalysisErrorType(String name) { |
| 4647 switch (name) { |
| 4648 case "COMPILE_TIME_ERROR": |
| 4649 return COMPILE_TIME_ERROR; |
| 4650 case "HINT": |
| 4651 return HINT; |
| 4652 case "STATIC_TYPE_WARNING": |
| 4653 return STATIC_TYPE_WARNING; |
| 4654 case "STATIC_WARNING": |
| 4655 return STATIC_WARNING; |
| 4656 case "SYNTACTIC_ERROR": |
| 4657 return SYNTACTIC_ERROR; |
| 4658 case "TODO": |
| 4659 return TODO; |
| 4660 } |
| 4661 throw new Exception('Illegal enum value: $name'); |
| 4662 } |
| 4663 |
| 4664 factory AnalysisErrorType.fromJson(JsonDecoder jsonDecoder, String jsonPath, O
bject json) { |
| 4665 if (json is String) { |
| 4666 try { |
| 4667 return new AnalysisErrorType(json); |
| 4668 } catch(_) { |
| 4669 // Fall through |
| 4670 } |
| 4671 } |
| 4672 throw jsonDecoder.mismatch(jsonPath, "AnalysisErrorType"); |
| 4673 } |
| 4674 |
| 4675 @override |
| 4676 String toString() => "AnalysisErrorType.$name"; |
| 4677 |
| 4678 String toJson() => name; |
| 4679 } |
| 4680 |
| 4681 /** |
| 4486 * AnalysisOptions | 4682 * AnalysisOptions |
| 4487 * | 4683 * |
| 4488 * { | 4684 * { |
| 4489 * "enableAsync": optional bool | 4685 * "enableAsync": optional bool |
| 4490 * "enableDeferredLoading": optional bool | 4686 * "enableDeferredLoading": optional bool |
| 4491 * "enableEnums": optional bool | 4687 * "enableEnums": optional bool |
| 4492 * "generateDart2jsHints": optional bool | 4688 * "generateDart2jsHints": optional bool |
| 4493 * "generateHints": optional bool | 4689 * "generateHints": optional bool |
| 4494 * } | 4690 * } |
| 4495 */ | 4691 */ |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5657 factory ElementKind.fromEngine(engine.ElementKind kind) => | 5853 factory ElementKind.fromEngine(engine.ElementKind kind) => |
| 5658 _elementKindFromEngine(kind); | 5854 _elementKindFromEngine(kind); |
| 5659 | 5855 |
| 5660 @override | 5856 @override |
| 5661 String toString() => "ElementKind.$name"; | 5857 String toString() => "ElementKind.$name"; |
| 5662 | 5858 |
| 5663 String toJson() => name; | 5859 String toJson() => name; |
| 5664 } | 5860 } |
| 5665 | 5861 |
| 5666 /** | 5862 /** |
| 5667 * ErrorFixes | |
| 5668 * | |
| 5669 * { | |
| 5670 * "error": AnalysisError | |
| 5671 * "fixes": List<SourceChange> | |
| 5672 * } | |
| 5673 */ | |
| 5674 class ErrorFixes implements HasToJson { | |
| 5675 /** | |
| 5676 * The error with which the fixes are associated. | |
| 5677 */ | |
| 5678 AnalysisError error; | |
| 5679 | |
| 5680 /** | |
| 5681 * The fixes associated with the error. | |
| 5682 */ | |
| 5683 List<SourceChange> fixes; | |
| 5684 | |
| 5685 ErrorFixes(this.error, {this.fixes}) { | |
| 5686 if (fixes == null) { | |
| 5687 fixes = <SourceChange>[]; | |
| 5688 } | |
| 5689 } | |
| 5690 | |
| 5691 factory ErrorFixes.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object j
son) { | |
| 5692 if (json == null) { | |
| 5693 json = {}; | |
| 5694 } | |
| 5695 if (json is Map) { | |
| 5696 AnalysisError error; | |
| 5697 if (json.containsKey("error")) { | |
| 5698 error = new AnalysisError.fromJson(jsonDecoder, jsonPath + ".error", jso
n["error"]); | |
| 5699 } else { | |
| 5700 throw jsonDecoder.missingKey(jsonPath, "error"); | |
| 5701 } | |
| 5702 List<SourceChange> fixes; | |
| 5703 if (json.containsKey("fixes")) { | |
| 5704 fixes = jsonDecoder._decodeList(jsonPath + ".fixes", json["fixes"], (Str
ing jsonPath, Object json) => new SourceChange.fromJson(jsonDecoder, jsonPath, j
son)); | |
| 5705 } else { | |
| 5706 throw jsonDecoder.missingKey(jsonPath, "fixes"); | |
| 5707 } | |
| 5708 return new ErrorFixes(error, fixes: fixes); | |
| 5709 } else { | |
| 5710 throw jsonDecoder.mismatch(jsonPath, "ErrorFixes"); | |
| 5711 } | |
| 5712 } | |
| 5713 | |
| 5714 Map<String, dynamic> toJson() { | |
| 5715 Map<String, dynamic> result = {}; | |
| 5716 result["error"] = error.toJson(); | |
| 5717 result["fixes"] = fixes.map((SourceChange value) => value.toJson()).toList()
; | |
| 5718 return result; | |
| 5719 } | |
| 5720 | |
| 5721 /** | |
| 5722 * Add a [Fix] | |
| 5723 */ | |
| 5724 void addFix(Fix fix) { | |
| 5725 fixes.add(fix.change); | |
| 5726 } | |
| 5727 | |
| 5728 @override | |
| 5729 String toString() => JSON.encode(toJson()); | |
| 5730 | |
| 5731 @override | |
| 5732 bool operator==(other) { | |
| 5733 if (other is ErrorFixes) { | |
| 5734 return error == other.error && | |
| 5735 _listEqual(fixes, other.fixes, (SourceChange a, SourceChange b) => a =
= b); | |
| 5736 } | |
| 5737 return false; | |
| 5738 } | |
| 5739 | |
| 5740 @override | |
| 5741 int get hashCode { | |
| 5742 int hash = 0; | |
| 5743 hash = _JenkinsSmiHash.combine(hash, error.hashCode); | |
| 5744 hash = _JenkinsSmiHash.combine(hash, fixes.hashCode); | |
| 5745 return _JenkinsSmiHash.finish(hash); | |
| 5746 } | |
| 5747 } | |
| 5748 | |
| 5749 /** | |
| 5750 * ErrorSeverity | |
| 5751 * | |
| 5752 * enum { | |
| 5753 * INFO | |
| 5754 * WARNING | |
| 5755 * ERROR | |
| 5756 * } | |
| 5757 */ | |
| 5758 class ErrorSeverity { | |
| 5759 static const INFO = const ErrorSeverity._("INFO"); | |
| 5760 | |
| 5761 static const WARNING = const ErrorSeverity._("WARNING"); | |
| 5762 | |
| 5763 static const ERROR = const ErrorSeverity._("ERROR"); | |
| 5764 | |
| 5765 final String name; | |
| 5766 | |
| 5767 const ErrorSeverity._(this.name); | |
| 5768 | |
| 5769 factory ErrorSeverity(String name) { | |
| 5770 switch (name) { | |
| 5771 case "INFO": | |
| 5772 return INFO; | |
| 5773 case "WARNING": | |
| 5774 return WARNING; | |
| 5775 case "ERROR": | |
| 5776 return ERROR; | |
| 5777 } | |
| 5778 throw new Exception('Illegal enum value: $name'); | |
| 5779 } | |
| 5780 | |
| 5781 factory ErrorSeverity.fromJson(JsonDecoder jsonDecoder, String jsonPath, Objec
t json) { | |
| 5782 if (json is String) { | |
| 5783 try { | |
| 5784 return new ErrorSeverity(json); | |
| 5785 } catch(_) { | |
| 5786 // Fall through | |
| 5787 } | |
| 5788 } | |
| 5789 throw jsonDecoder.mismatch(jsonPath, "ErrorSeverity"); | |
| 5790 } | |
| 5791 | |
| 5792 @override | |
| 5793 String toString() => "ErrorSeverity.$name"; | |
| 5794 | |
| 5795 String toJson() => name; | |
| 5796 } | |
| 5797 | |
| 5798 /** | |
| 5799 * ErrorType | |
| 5800 * | |
| 5801 * enum { | |
| 5802 * COMPILE_TIME_ERROR | |
| 5803 * HINT | |
| 5804 * STATIC_TYPE_WARNING | |
| 5805 * STATIC_WARNING | |
| 5806 * SYNTACTIC_ERROR | |
| 5807 * TODO | |
| 5808 * } | |
| 5809 */ | |
| 5810 class ErrorType { | |
| 5811 static const COMPILE_TIME_ERROR = const ErrorType._("COMPILE_TIME_ERROR"); | |
| 5812 | |
| 5813 static const HINT = const ErrorType._("HINT"); | |
| 5814 | |
| 5815 static const STATIC_TYPE_WARNING = const ErrorType._("STATIC_TYPE_WARNING"); | |
| 5816 | |
| 5817 static const STATIC_WARNING = const ErrorType._("STATIC_WARNING"); | |
| 5818 | |
| 5819 static const SYNTACTIC_ERROR = const ErrorType._("SYNTACTIC_ERROR"); | |
| 5820 | |
| 5821 static const TODO = const ErrorType._("TODO"); | |
| 5822 | |
| 5823 final String name; | |
| 5824 | |
| 5825 const ErrorType._(this.name); | |
| 5826 | |
| 5827 factory ErrorType(String name) { | |
| 5828 switch (name) { | |
| 5829 case "COMPILE_TIME_ERROR": | |
| 5830 return COMPILE_TIME_ERROR; | |
| 5831 case "HINT": | |
| 5832 return HINT; | |
| 5833 case "STATIC_TYPE_WARNING": | |
| 5834 return STATIC_TYPE_WARNING; | |
| 5835 case "STATIC_WARNING": | |
| 5836 return STATIC_WARNING; | |
| 5837 case "SYNTACTIC_ERROR": | |
| 5838 return SYNTACTIC_ERROR; | |
| 5839 case "TODO": | |
| 5840 return TODO; | |
| 5841 } | |
| 5842 throw new Exception('Illegal enum value: $name'); | |
| 5843 } | |
| 5844 | |
| 5845 factory ErrorType.fromJson(JsonDecoder jsonDecoder, String jsonPath, Object js
on) { | |
| 5846 if (json is String) { | |
| 5847 try { | |
| 5848 return new ErrorType(json); | |
| 5849 } catch(_) { | |
| 5850 // Fall through | |
| 5851 } | |
| 5852 } | |
| 5853 throw jsonDecoder.mismatch(jsonPath, "ErrorType"); | |
| 5854 } | |
| 5855 | |
| 5856 @override | |
| 5857 String toString() => "ErrorType.$name"; | |
| 5858 | |
| 5859 String toJson() => name; | |
| 5860 } | |
| 5861 | |
| 5862 /** | |
| 5863 * ExecutableFile | 5863 * ExecutableFile |
| 5864 * | 5864 * |
| 5865 * { | 5865 * { |
| 5866 * "file": FilePath | 5866 * "file": FilePath |
| 5867 * "offset": ExecutableKind | 5867 * "offset": ExecutableKind |
| 5868 * } | 5868 * } |
| 5869 */ | 5869 */ |
| 5870 class ExecutableFile implements HasToJson { | 5870 class ExecutableFile implements HasToJson { |
| 5871 /** | 5871 /** |
| 5872 * The path of the executable file. | 5872 * The path of the executable file. |
| (...skipping 3887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9760 return false; | 9760 return false; |
| 9761 } | 9761 } |
| 9762 | 9762 |
| 9763 @override | 9763 @override |
| 9764 int get hashCode { | 9764 int get hashCode { |
| 9765 int hash = 0; | 9765 int hash = 0; |
| 9766 hash = _JenkinsSmiHash.combine(hash, newName.hashCode); | 9766 hash = _JenkinsSmiHash.combine(hash, newName.hashCode); |
| 9767 return _JenkinsSmiHash.finish(hash); | 9767 return _JenkinsSmiHash.finish(hash); |
| 9768 } | 9768 } |
| 9769 } | 9769 } |
| OLD | NEW |