[analyzer] use package:lints for pkg/analysis_server_client, pkg/analyzer_plugin

Change-Id: I97d30af3930c3f65532d77dee06de57ce5f5fc20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250766
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Devon Carew 2022-07-06 19:54:00 +00:00 committed by Commit Bot
parent 1c45191c89
commit 9282573e2c
20 changed files with 445 additions and 516 deletions

View file

@ -1,58 +1,13 @@
analyzer: include: package:lints/recommended.yaml
#strong-mode:
# implicit-casts: false
linter: linter:
rules: rules:
- await_only_futures # In addition to lints/recommended:
- depend_on_referenced_packages always_declare_return_types: true
- empty_statements omit_local_variable_types: true
- unnecessary_brace_in_string_interps prefer_single_quotes: true
# unawaited_futures: true
# From pedantic 1.9.0:
# # Remove from lints/recommended:
- always_declare_return_types constant_identifier_names: false
- always_require_non_null_named_parameters non_constant_identifier_names: false
- annotate_overrides
- avoid_empty_else
- avoid_init_to_null
- avoid_null_checks_in_equality_operators
- avoid_relative_lib_imports
- avoid_return_types_on_setters
- avoid_shadowing_type_parameters
- avoid_types_as_parameter_names
- camel_case_extensions
- curly_braces_in_flow_control_structures
- empty_catches
- empty_constructor_bodies
- library_names
- library_prefixes
- no_duplicate_case_values
- null_closures
- omit_local_variable_types
- prefer_adjacent_string_concatenation
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_contains
- prefer_equal_for_default_values
- prefer_final_fields
- prefer_for_elements_to_map_fromIterable
- prefer_generic_function_type_aliases
- prefer_if_null_operators
- prefer_is_empty
- prefer_is_not_empty
- prefer_iterable_whereType
- prefer_single_quotes
- prefer_spread_collections
- recursive_getters
- slash_for_doc_comments
- type_init_formals
- unawaited_futures
- unnecessary_const
- unnecessary_new
- unnecessary_null_in_if_null_operators
- unnecessary_this
- unrelated_type_equality_checks
- use_function_type_syntax_for_parameters
- use_rethrow_when_possible
- valid_regexps

View file

@ -37,7 +37,7 @@ class AddContentOverlay implements HasToJson {
String content; String content;
if (json.containsKey('content')) { if (json.containsKey('content')) {
content = content =
jsonDecoder.decodeString(jsonPath + '.content', json['content']); jsonDecoder.decodeString('$jsonPath.content', json['content']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'content'); throw jsonDecoder.mismatch(jsonPath, 'content');
} }
@ -139,57 +139,57 @@ class AnalysisError implements HasToJson {
AnalysisErrorSeverity severity; AnalysisErrorSeverity severity;
if (json.containsKey('severity')) { if (json.containsKey('severity')) {
severity = AnalysisErrorSeverity.fromJson( severity = AnalysisErrorSeverity.fromJson(
jsonDecoder, jsonPath + '.severity', json['severity']); jsonDecoder, '$jsonPath.severity', json['severity']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'severity'); throw jsonDecoder.mismatch(jsonPath, 'severity');
} }
AnalysisErrorType type; AnalysisErrorType type;
if (json.containsKey('type')) { if (json.containsKey('type')) {
type = AnalysisErrorType.fromJson( type = AnalysisErrorType.fromJson(
jsonDecoder, jsonPath + '.type', json['type']); jsonDecoder, '$jsonPath.type', json['type']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'type'); throw jsonDecoder.mismatch(jsonPath, 'type');
} }
Location location; Location location;
if (json.containsKey('location')) { if (json.containsKey('location')) {
location = Location.fromJson( location = Location.fromJson(
jsonDecoder, jsonPath + '.location', json['location']); jsonDecoder, '$jsonPath.location', json['location']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'location'); throw jsonDecoder.mismatch(jsonPath, 'location');
} }
String message; String message;
if (json.containsKey('message')) { if (json.containsKey('message')) {
message = message =
jsonDecoder.decodeString(jsonPath + '.message', json['message']); jsonDecoder.decodeString('$jsonPath.message', json['message']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'message'); throw jsonDecoder.mismatch(jsonPath, 'message');
} }
String? correction; String? correction;
if (json.containsKey('correction')) { if (json.containsKey('correction')) {
correction = jsonDecoder.decodeString( correction = jsonDecoder.decodeString(
jsonPath + '.correction', json['correction']); '$jsonPath.correction', json['correction']);
} }
String code; String code;
if (json.containsKey('code')) { if (json.containsKey('code')) {
code = jsonDecoder.decodeString(jsonPath + '.code', json['code']); code = jsonDecoder.decodeString('$jsonPath.code', json['code']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'code'); throw jsonDecoder.mismatch(jsonPath, 'code');
} }
String? url; String? url;
if (json.containsKey('url')) { if (json.containsKey('url')) {
url = jsonDecoder.decodeString(jsonPath + '.url', json['url']); url = jsonDecoder.decodeString('$jsonPath.url', json['url']);
} }
List<DiagnosticMessage>? contextMessages; List<DiagnosticMessage>? contextMessages;
if (json.containsKey('contextMessages')) { if (json.containsKey('contextMessages')) {
contextMessages = jsonDecoder.decodeList( contextMessages = jsonDecoder.decodeList(
jsonPath + '.contextMessages', '$jsonPath.contextMessages',
json['contextMessages'], json['contextMessages'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
DiagnosticMessage.fromJson(jsonDecoder, jsonPath, json)); DiagnosticMessage.fromJson(jsonDecoder, jsonPath, json));
} }
bool? hasFix; bool? hasFix;
if (json.containsKey('hasFix')) { if (json.containsKey('hasFix')) {
hasFix = jsonDecoder.decodeBool(jsonPath + '.hasFix', json['hasFix']); hasFix = jsonDecoder.decodeBool('$jsonPath.hasFix', json['hasFix']);
} }
return AnalysisError(severity, type, location, message, code, return AnalysisError(severity, type, location, message, code,
correction: correction, correction: correction,
@ -440,7 +440,7 @@ class ChangeContentOverlay implements HasToJson {
List<SourceEdit> edits; List<SourceEdit> edits;
if (json.containsKey('edits')) { if (json.containsKey('edits')) {
edits = jsonDecoder.decodeList( edits = jsonDecoder.decodeList(
jsonPath + '.edits', '$jsonPath.edits',
json['edits'], json['edits'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
SourceEdit.fromJson(jsonDecoder, jsonPath, json)); SourceEdit.fromJson(jsonDecoder, jsonPath, json));
@ -673,145 +673,144 @@ class CompletionSuggestion implements HasToJson {
CompletionSuggestionKind kind; CompletionSuggestionKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = CompletionSuggestionKind.fromJson( kind = CompletionSuggestionKind.fromJson(
jsonDecoder, jsonPath + '.kind', json['kind']); jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
int relevance; int relevance;
if (json.containsKey('relevance')) { if (json.containsKey('relevance')) {
relevance = relevance =
jsonDecoder.decodeInt(jsonPath + '.relevance', json['relevance']); jsonDecoder.decodeInt('$jsonPath.relevance', json['relevance']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'relevance'); throw jsonDecoder.mismatch(jsonPath, 'relevance');
} }
String completion; String completion;
if (json.containsKey('completion')) { if (json.containsKey('completion')) {
completion = jsonDecoder.decodeString( completion = jsonDecoder.decodeString(
jsonPath + '.completion', json['completion']); '$jsonPath.completion', json['completion']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'completion'); throw jsonDecoder.mismatch(jsonPath, 'completion');
} }
String? displayText; String? displayText;
if (json.containsKey('displayText')) { if (json.containsKey('displayText')) {
displayText = jsonDecoder.decodeString( displayText = jsonDecoder.decodeString(
jsonPath + '.displayText', json['displayText']); '$jsonPath.displayText', json['displayText']);
} }
int? replacementOffset; int? replacementOffset;
if (json.containsKey('replacementOffset')) { if (json.containsKey('replacementOffset')) {
replacementOffset = jsonDecoder.decodeInt( replacementOffset = jsonDecoder.decodeInt(
jsonPath + '.replacementOffset', json['replacementOffset']); '$jsonPath.replacementOffset', json['replacementOffset']);
} }
int? replacementLength; int? replacementLength;
if (json.containsKey('replacementLength')) { if (json.containsKey('replacementLength')) {
replacementLength = jsonDecoder.decodeInt( replacementLength = jsonDecoder.decodeInt(
jsonPath + '.replacementLength', json['replacementLength']); '$jsonPath.replacementLength', json['replacementLength']);
} }
int selectionOffset; int selectionOffset;
if (json.containsKey('selectionOffset')) { if (json.containsKey('selectionOffset')) {
selectionOffset = jsonDecoder.decodeInt( selectionOffset = jsonDecoder.decodeInt(
jsonPath + '.selectionOffset', json['selectionOffset']); '$jsonPath.selectionOffset', json['selectionOffset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'selectionOffset'); throw jsonDecoder.mismatch(jsonPath, 'selectionOffset');
} }
int selectionLength; int selectionLength;
if (json.containsKey('selectionLength')) { if (json.containsKey('selectionLength')) {
selectionLength = jsonDecoder.decodeInt( selectionLength = jsonDecoder.decodeInt(
jsonPath + '.selectionLength', json['selectionLength']); '$jsonPath.selectionLength', json['selectionLength']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'selectionLength'); throw jsonDecoder.mismatch(jsonPath, 'selectionLength');
} }
bool isDeprecated; bool isDeprecated;
if (json.containsKey('isDeprecated')) { if (json.containsKey('isDeprecated')) {
isDeprecated = jsonDecoder.decodeBool( isDeprecated = jsonDecoder.decodeBool(
jsonPath + '.isDeprecated', json['isDeprecated']); '$jsonPath.isDeprecated', json['isDeprecated']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'isDeprecated'); throw jsonDecoder.mismatch(jsonPath, 'isDeprecated');
} }
bool isPotential; bool isPotential;
if (json.containsKey('isPotential')) { if (json.containsKey('isPotential')) {
isPotential = jsonDecoder.decodeBool( isPotential = jsonDecoder.decodeBool(
jsonPath + '.isPotential', json['isPotential']); '$jsonPath.isPotential', json['isPotential']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'isPotential'); throw jsonDecoder.mismatch(jsonPath, 'isPotential');
} }
String? docSummary; String? docSummary;
if (json.containsKey('docSummary')) { if (json.containsKey('docSummary')) {
docSummary = jsonDecoder.decodeString( docSummary = jsonDecoder.decodeString(
jsonPath + '.docSummary', json['docSummary']); '$jsonPath.docSummary', json['docSummary']);
} }
String? docComplete; String? docComplete;
if (json.containsKey('docComplete')) { if (json.containsKey('docComplete')) {
docComplete = jsonDecoder.decodeString( docComplete = jsonDecoder.decodeString(
jsonPath + '.docComplete', json['docComplete']); '$jsonPath.docComplete', json['docComplete']);
} }
String? declaringType; String? declaringType;
if (json.containsKey('declaringType')) { if (json.containsKey('declaringType')) {
declaringType = jsonDecoder.decodeString( declaringType = jsonDecoder.decodeString(
jsonPath + '.declaringType', json['declaringType']); '$jsonPath.declaringType', json['declaringType']);
} }
String? defaultArgumentListString; String? defaultArgumentListString;
if (json.containsKey('defaultArgumentListString')) { if (json.containsKey('defaultArgumentListString')) {
defaultArgumentListString = jsonDecoder.decodeString( defaultArgumentListString = jsonDecoder.decodeString(
jsonPath + '.defaultArgumentListString', '$jsonPath.defaultArgumentListString',
json['defaultArgumentListString']); json['defaultArgumentListString']);
} }
List<int>? defaultArgumentListTextRanges; List<int>? defaultArgumentListTextRanges;
if (json.containsKey('defaultArgumentListTextRanges')) { if (json.containsKey('defaultArgumentListTextRanges')) {
defaultArgumentListTextRanges = jsonDecoder.decodeList( defaultArgumentListTextRanges = jsonDecoder.decodeList(
jsonPath + '.defaultArgumentListTextRanges', '$jsonPath.defaultArgumentListTextRanges',
json['defaultArgumentListTextRanges'], json['defaultArgumentListTextRanges'],
jsonDecoder.decodeInt); jsonDecoder.decodeInt);
} }
Element? element; Element? element;
if (json.containsKey('element')) { if (json.containsKey('element')) {
element = Element.fromJson( element =
jsonDecoder, jsonPath + '.element', json['element']); Element.fromJson(jsonDecoder, '$jsonPath.element', json['element']);
} }
String? returnType; String? returnType;
if (json.containsKey('returnType')) { if (json.containsKey('returnType')) {
returnType = jsonDecoder.decodeString( returnType = jsonDecoder.decodeString(
jsonPath + '.returnType', json['returnType']); '$jsonPath.returnType', json['returnType']);
} }
List<String>? parameterNames; List<String>? parameterNames;
if (json.containsKey('parameterNames')) { if (json.containsKey('parameterNames')) {
parameterNames = jsonDecoder.decodeList(jsonPath + '.parameterNames', parameterNames = jsonDecoder.decodeList('$jsonPath.parameterNames',
json['parameterNames'], jsonDecoder.decodeString); json['parameterNames'], jsonDecoder.decodeString);
} }
List<String>? parameterTypes; List<String>? parameterTypes;
if (json.containsKey('parameterTypes')) { if (json.containsKey('parameterTypes')) {
parameterTypes = jsonDecoder.decodeList(jsonPath + '.parameterTypes', parameterTypes = jsonDecoder.decodeList('$jsonPath.parameterTypes',
json['parameterTypes'], jsonDecoder.decodeString); json['parameterTypes'], jsonDecoder.decodeString);
} }
int? requiredParameterCount; int? requiredParameterCount;
if (json.containsKey('requiredParameterCount')) { if (json.containsKey('requiredParameterCount')) {
requiredParameterCount = jsonDecoder.decodeInt( requiredParameterCount = jsonDecoder.decodeInt(
jsonPath + '.requiredParameterCount', '$jsonPath.requiredParameterCount', json['requiredParameterCount']);
json['requiredParameterCount']);
} }
bool? hasNamedParameters; bool? hasNamedParameters;
if (json.containsKey('hasNamedParameters')) { if (json.containsKey('hasNamedParameters')) {
hasNamedParameters = jsonDecoder.decodeBool( hasNamedParameters = jsonDecoder.decodeBool(
jsonPath + '.hasNamedParameters', json['hasNamedParameters']); '$jsonPath.hasNamedParameters', json['hasNamedParameters']);
} }
String? parameterName; String? parameterName;
if (json.containsKey('parameterName')) { if (json.containsKey('parameterName')) {
parameterName = jsonDecoder.decodeString( parameterName = jsonDecoder.decodeString(
jsonPath + '.parameterName', json['parameterName']); '$jsonPath.parameterName', json['parameterName']);
} }
String? parameterType; String? parameterType;
if (json.containsKey('parameterType')) { if (json.containsKey('parameterType')) {
parameterType = jsonDecoder.decodeString( parameterType = jsonDecoder.decodeString(
jsonPath + '.parameterType', json['parameterType']); '$jsonPath.parameterType', json['parameterType']);
} }
String? libraryUri; String? libraryUri;
if (json.containsKey('libraryUri')) { if (json.containsKey('libraryUri')) {
libraryUri = jsonDecoder.decodeString( libraryUri = jsonDecoder.decodeString(
jsonPath + '.libraryUri', json['libraryUri']); '$jsonPath.libraryUri', json['libraryUri']);
} }
bool? isNotImported; bool? isNotImported;
if (json.containsKey('isNotImported')) { if (json.containsKey('isNotImported')) {
isNotImported = jsonDecoder.decodeBool( isNotImported = jsonDecoder.decodeBool(
jsonPath + '.isNotImported', json['isNotImported']); '$jsonPath.isNotImported', json['isNotImported']);
} }
return CompletionSuggestion(kind, relevance, completion, selectionOffset, return CompletionSuggestion(kind, relevance, completion, selectionOffset,
selectionLength, isDeprecated, isPotential, selectionLength, isDeprecated, isPotential,
@ -1146,14 +1145,14 @@ class DiagnosticMessage implements HasToJson {
String message; String message;
if (json.containsKey('message')) { if (json.containsKey('message')) {
message = message =
jsonDecoder.decodeString(jsonPath + '.message', json['message']); jsonDecoder.decodeString('$jsonPath.message', json['message']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'message'); throw jsonDecoder.mismatch(jsonPath, 'message');
} }
Location location; Location location;
if (json.containsKey('location')) { if (json.containsKey('location')) {
location = Location.fromJson( location = Location.fromJson(
jsonDecoder, jsonPath + '.location', json['location']); jsonDecoder, '$jsonPath.location', json['location']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'location'); throw jsonDecoder.mismatch(jsonPath, 'location');
} }
@ -1282,46 +1281,46 @@ class Element implements HasToJson {
ElementKind kind; ElementKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = kind =
ElementKind.fromJson(jsonDecoder, jsonPath + '.kind', json['kind']); ElementKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
String name; String name;
if (json.containsKey('name')) { if (json.containsKey('name')) {
name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'name'); throw jsonDecoder.mismatch(jsonPath, 'name');
} }
Location? location; Location? location;
if (json.containsKey('location')) { if (json.containsKey('location')) {
location = Location.fromJson( location = Location.fromJson(
jsonDecoder, jsonPath + '.location', json['location']); jsonDecoder, '$jsonPath.location', json['location']);
} }
int flags; int flags;
if (json.containsKey('flags')) { if (json.containsKey('flags')) {
flags = jsonDecoder.decodeInt(jsonPath + '.flags', json['flags']); flags = jsonDecoder.decodeInt('$jsonPath.flags', json['flags']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'flags'); throw jsonDecoder.mismatch(jsonPath, 'flags');
} }
String? parameters; String? parameters;
if (json.containsKey('parameters')) { if (json.containsKey('parameters')) {
parameters = jsonDecoder.decodeString( parameters = jsonDecoder.decodeString(
jsonPath + '.parameters', json['parameters']); '$jsonPath.parameters', json['parameters']);
} }
String? returnType; String? returnType;
if (json.containsKey('returnType')) { if (json.containsKey('returnType')) {
returnType = jsonDecoder.decodeString( returnType = jsonDecoder.decodeString(
jsonPath + '.returnType', json['returnType']); '$jsonPath.returnType', json['returnType']);
} }
String? typeParameters; String? typeParameters;
if (json.containsKey('typeParameters')) { if (json.containsKey('typeParameters')) {
typeParameters = jsonDecoder.decodeString( typeParameters = jsonDecoder.decodeString(
jsonPath + '.typeParameters', json['typeParameters']); '$jsonPath.typeParameters', json['typeParameters']);
} }
String? aliasedType; String? aliasedType;
if (json.containsKey('aliasedType')) { if (json.containsKey('aliasedType')) {
aliasedType = jsonDecoder.decodeString( aliasedType = jsonDecoder.decodeString(
jsonPath + '.aliasedType', json['aliasedType']); '$jsonPath.aliasedType', json['aliasedType']);
} }
return Element(kind, name, flags, return Element(kind, name, flags,
location: location, location: location,
@ -1748,19 +1747,19 @@ class FoldingRegion implements HasToJson {
FoldingKind kind; FoldingKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = kind =
FoldingKind.fromJson(jsonDecoder, jsonPath + '.kind', json['kind']); FoldingKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
@ -1828,19 +1827,19 @@ class HighlightRegion implements HasToJson {
HighlightRegionType type; HighlightRegionType type;
if (json.containsKey('type')) { if (json.containsKey('type')) {
type = HighlightRegionType.fromJson( type = HighlightRegionType.fromJson(
jsonDecoder, jsonPath + '.type', json['type']); jsonDecoder, '$jsonPath.type', json['type']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'type'); throw jsonDecoder.mismatch(jsonPath, 'type');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
@ -2522,29 +2521,29 @@ class KytheEntry implements HasToJson {
KytheVName source; KytheVName source;
if (json.containsKey('source')) { if (json.containsKey('source')) {
source = KytheVName.fromJson( source = KytheVName.fromJson(
jsonDecoder, jsonPath + '.source', json['source']); jsonDecoder, '$jsonPath.source', json['source']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'source'); throw jsonDecoder.mismatch(jsonPath, 'source');
} }
String? kind; String? kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = jsonDecoder.decodeString(jsonPath + '.kind', json['kind']); kind = jsonDecoder.decodeString('$jsonPath.kind', json['kind']);
} }
KytheVName? target; KytheVName? target;
if (json.containsKey('target')) { if (json.containsKey('target')) {
target = KytheVName.fromJson( target = KytheVName.fromJson(
jsonDecoder, jsonPath + '.target', json['target']); jsonDecoder, '$jsonPath.target', json['target']);
} }
String fact; String fact;
if (json.containsKey('fact')) { if (json.containsKey('fact')) {
fact = jsonDecoder.decodeString(jsonPath + '.fact', json['fact']); fact = jsonDecoder.decodeString('$jsonPath.fact', json['fact']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'fact'); throw jsonDecoder.mismatch(jsonPath, 'fact');
} }
List<int>? value; List<int>? value;
if (json.containsKey('value')) { if (json.containsKey('value')) {
value = jsonDecoder.decodeList( value = jsonDecoder.decodeList(
jsonPath + '.value', json['value'], jsonDecoder.decodeInt); '$jsonPath.value', json['value'], jsonDecoder.decodeInt);
} }
return KytheEntry(source, fact, kind: kind, target: target, value: value); return KytheEntry(source, fact, kind: kind, target: target, value: value);
} else { } else {
@ -2637,33 +2636,33 @@ class KytheVName implements HasToJson {
if (json is Map) { if (json is Map) {
String signature; String signature;
if (json.containsKey('signature')) { if (json.containsKey('signature')) {
signature = jsonDecoder.decodeString( signature =
jsonPath + '.signature', json['signature']); jsonDecoder.decodeString('$jsonPath.signature', json['signature']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'signature'); throw jsonDecoder.mismatch(jsonPath, 'signature');
} }
String corpus; String corpus;
if (json.containsKey('corpus')) { if (json.containsKey('corpus')) {
corpus = jsonDecoder.decodeString(jsonPath + '.corpus', json['corpus']); corpus = jsonDecoder.decodeString('$jsonPath.corpus', json['corpus']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'corpus'); throw jsonDecoder.mismatch(jsonPath, 'corpus');
} }
String root; String root;
if (json.containsKey('root')) { if (json.containsKey('root')) {
root = jsonDecoder.decodeString(jsonPath + '.root', json['root']); root = jsonDecoder.decodeString('$jsonPath.root', json['root']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'root'); throw jsonDecoder.mismatch(jsonPath, 'root');
} }
String path; String path;
if (json.containsKey('path')) { if (json.containsKey('path')) {
path = jsonDecoder.decodeString(jsonPath + '.path', json['path']); path = jsonDecoder.decodeString('$jsonPath.path', json['path']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'path'); throw jsonDecoder.mismatch(jsonPath, 'path');
} }
String language; String language;
if (json.containsKey('language')) { if (json.containsKey('language')) {
language = language =
jsonDecoder.decodeString(jsonPath + '.language', json['language']); jsonDecoder.decodeString('$jsonPath.language', json['language']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'language'); throw jsonDecoder.mismatch(jsonPath, 'language');
} }
@ -2739,7 +2738,7 @@ class LinkedEditGroup implements HasToJson {
List<Position> positions; List<Position> positions;
if (json.containsKey('positions')) { if (json.containsKey('positions')) {
positions = jsonDecoder.decodeList( positions = jsonDecoder.decodeList(
jsonPath + '.positions', '$jsonPath.positions',
json['positions'], json['positions'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
Position.fromJson(jsonDecoder, jsonPath, json)); Position.fromJson(jsonDecoder, jsonPath, json));
@ -2748,14 +2747,14 @@ class LinkedEditGroup implements HasToJson {
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
List<LinkedEditSuggestion> suggestions; List<LinkedEditSuggestion> suggestions;
if (json.containsKey('suggestions')) { if (json.containsKey('suggestions')) {
suggestions = jsonDecoder.decodeList( suggestions = jsonDecoder.decodeList(
jsonPath + '.suggestions', '$jsonPath.suggestions',
json['suggestions'], json['suggestions'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
LinkedEditSuggestion.fromJson(jsonDecoder, jsonPath, json)); LinkedEditSuggestion.fromJson(jsonDecoder, jsonPath, json));
@ -2840,14 +2839,14 @@ class LinkedEditSuggestion implements HasToJson {
if (json is Map) { if (json is Map) {
String value; String value;
if (json.containsKey('value')) { if (json.containsKey('value')) {
value = jsonDecoder.decodeString(jsonPath + '.value', json['value']); value = jsonDecoder.decodeString('$jsonPath.value', json['value']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'value'); throw jsonDecoder.mismatch(jsonPath, 'value');
} }
LinkedEditSuggestionKind kind; LinkedEditSuggestionKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = LinkedEditSuggestionKind.fromJson( kind = LinkedEditSuggestionKind.fromJson(
jsonDecoder, jsonPath + '.kind', json['kind']); jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
@ -2996,44 +2995,44 @@ class Location implements HasToJson {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
int startLine; int startLine;
if (json.containsKey('startLine')) { if (json.containsKey('startLine')) {
startLine = startLine =
jsonDecoder.decodeInt(jsonPath + '.startLine', json['startLine']); jsonDecoder.decodeInt('$jsonPath.startLine', json['startLine']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'startLine'); throw jsonDecoder.mismatch(jsonPath, 'startLine');
} }
int startColumn; int startColumn;
if (json.containsKey('startColumn')) { if (json.containsKey('startColumn')) {
startColumn = jsonDecoder.decodeInt( startColumn =
jsonPath + '.startColumn', json['startColumn']); jsonDecoder.decodeInt('$jsonPath.startColumn', json['startColumn']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'startColumn'); throw jsonDecoder.mismatch(jsonPath, 'startColumn');
} }
int? endLine; int? endLine;
if (json.containsKey('endLine')) { if (json.containsKey('endLine')) {
endLine = jsonDecoder.decodeInt(jsonPath + '.endLine', json['endLine']); endLine = jsonDecoder.decodeInt('$jsonPath.endLine', json['endLine']);
} }
int? endColumn; int? endColumn;
if (json.containsKey('endColumn')) { if (json.containsKey('endColumn')) {
endColumn = endColumn =
jsonDecoder.decodeInt(jsonPath + '.endColumn', json['endColumn']); jsonDecoder.decodeInt('$jsonPath.endColumn', json['endColumn']);
} }
return Location(file, offset, length, startLine, startColumn, return Location(file, offset, length, startLine, startColumn,
endLine: endLine, endColumn: endColumn); endLine: endLine, endColumn: endColumn);
@ -3119,20 +3118,20 @@ class NavigationRegion implements HasToJson {
if (json is Map) { if (json is Map) {
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
List<int> targets; List<int> targets;
if (json.containsKey('targets')) { if (json.containsKey('targets')) {
targets = jsonDecoder.decodeList( targets = jsonDecoder.decodeList(
jsonPath + '.targets', json['targets'], jsonDecoder.decodeInt); '$jsonPath.targets', json['targets'], jsonDecoder.decodeInt);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'targets'); throw jsonDecoder.mismatch(jsonPath, 'targets');
} }
@ -3225,52 +3224,52 @@ class NavigationTarget implements HasToJson {
ElementKind kind; ElementKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = kind =
ElementKind.fromJson(jsonDecoder, jsonPath + '.kind', json['kind']); ElementKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
int fileIndex; int fileIndex;
if (json.containsKey('fileIndex')) { if (json.containsKey('fileIndex')) {
fileIndex = fileIndex =
jsonDecoder.decodeInt(jsonPath + '.fileIndex', json['fileIndex']); jsonDecoder.decodeInt('$jsonPath.fileIndex', json['fileIndex']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'fileIndex'); throw jsonDecoder.mismatch(jsonPath, 'fileIndex');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
int startLine; int startLine;
if (json.containsKey('startLine')) { if (json.containsKey('startLine')) {
startLine = startLine =
jsonDecoder.decodeInt(jsonPath + '.startLine', json['startLine']); jsonDecoder.decodeInt('$jsonPath.startLine', json['startLine']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'startLine'); throw jsonDecoder.mismatch(jsonPath, 'startLine');
} }
int startColumn; int startColumn;
if (json.containsKey('startColumn')) { if (json.containsKey('startColumn')) {
startColumn = jsonDecoder.decodeInt( startColumn =
jsonPath + '.startColumn', json['startColumn']); jsonDecoder.decodeInt('$jsonPath.startColumn', json['startColumn']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'startColumn'); throw jsonDecoder.mismatch(jsonPath, 'startColumn');
} }
int? codeOffset; int? codeOffset;
if (json.containsKey('codeOffset')) { if (json.containsKey('codeOffset')) {
codeOffset = codeOffset =
jsonDecoder.decodeInt(jsonPath + '.codeOffset', json['codeOffset']); jsonDecoder.decodeInt('$jsonPath.codeOffset', json['codeOffset']);
} }
int? codeLength; int? codeLength;
if (json.containsKey('codeLength')) { if (json.containsKey('codeLength')) {
codeLength = codeLength =
jsonDecoder.decodeInt(jsonPath + '.codeLength', json['codeLength']); jsonDecoder.decodeInt('$jsonPath.codeLength', json['codeLength']);
} }
return NavigationTarget( return NavigationTarget(
kind, fileIndex, offset, length, startLine, startColumn, kind, fileIndex, offset, length, startLine, startColumn,
@ -3358,21 +3357,21 @@ class Occurrences implements HasToJson {
if (json is Map) { if (json is Map) {
Element element; Element element;
if (json.containsKey('element')) { if (json.containsKey('element')) {
element = Element.fromJson( element =
jsonDecoder, jsonPath + '.element', json['element']); Element.fromJson(jsonDecoder, '$jsonPath.element', json['element']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'element'); throw jsonDecoder.mismatch(jsonPath, 'element');
} }
List<int> offsets; List<int> offsets;
if (json.containsKey('offsets')) { if (json.containsKey('offsets')) {
offsets = jsonDecoder.decodeList( offsets = jsonDecoder.decodeList(
jsonPath + '.offsets', json['offsets'], jsonDecoder.decodeInt); '$jsonPath.offsets', json['offsets'], jsonDecoder.decodeInt);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offsets'); throw jsonDecoder.mismatch(jsonPath, 'offsets');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
@ -3458,41 +3457,41 @@ class Outline implements HasToJson {
if (json is Map) { if (json is Map) {
Element element; Element element;
if (json.containsKey('element')) { if (json.containsKey('element')) {
element = Element.fromJson( element =
jsonDecoder, jsonPath + '.element', json['element']); Element.fromJson(jsonDecoder, '$jsonPath.element', json['element']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'element'); throw jsonDecoder.mismatch(jsonPath, 'element');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
int codeOffset; int codeOffset;
if (json.containsKey('codeOffset')) { if (json.containsKey('codeOffset')) {
codeOffset = codeOffset =
jsonDecoder.decodeInt(jsonPath + '.codeOffset', json['codeOffset']); jsonDecoder.decodeInt('$jsonPath.codeOffset', json['codeOffset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'codeOffset'); throw jsonDecoder.mismatch(jsonPath, 'codeOffset');
} }
int codeLength; int codeLength;
if (json.containsKey('codeLength')) { if (json.containsKey('codeLength')) {
codeLength = codeLength =
jsonDecoder.decodeInt(jsonPath + '.codeLength', json['codeLength']); jsonDecoder.decodeInt('$jsonPath.codeLength', json['codeLength']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'codeLength'); throw jsonDecoder.mismatch(jsonPath, 'codeLength');
} }
List<Outline>? children; List<Outline>? children;
if (json.containsKey('children')) { if (json.containsKey('children')) {
children = jsonDecoder.decodeList( children = jsonDecoder.decodeList(
jsonPath + '.children', '$jsonPath.children',
json['children'], json['children'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
Outline.fromJson(jsonDecoder, jsonPath, json)); Outline.fromJson(jsonDecoder, jsonPath, json));
@ -3579,27 +3578,27 @@ class ParameterInfo implements HasToJson {
if (json is Map) { if (json is Map) {
ParameterKind kind; ParameterKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = ParameterKind.fromJson( kind =
jsonDecoder, jsonPath + '.kind', json['kind']); ParameterKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
String name; String name;
if (json.containsKey('name')) { if (json.containsKey('name')) {
name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'name'); throw jsonDecoder.mismatch(jsonPath, 'name');
} }
String type; String type;
if (json.containsKey('type')) { if (json.containsKey('type')) {
type = jsonDecoder.decodeString(jsonPath + '.type', json['type']); type = jsonDecoder.decodeString('$jsonPath.type', json['type']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'type'); throw jsonDecoder.mismatch(jsonPath, 'type');
} }
String? defaultValue; String? defaultValue;
if (json.containsKey('defaultValue')) { if (json.containsKey('defaultValue')) {
defaultValue = jsonDecoder.decodeString( defaultValue = jsonDecoder.decodeString(
jsonPath + '.defaultValue', json['defaultValue']); '$jsonPath.defaultValue', json['defaultValue']);
} }
return ParameterInfo(kind, name, type, defaultValue: defaultValue); return ParameterInfo(kind, name, type, defaultValue: defaultValue);
} else { } else {
@ -3736,13 +3735,13 @@ class Position implements HasToJson {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
@ -3919,31 +3918,31 @@ class RefactoringMethodParameter implements HasToJson {
if (json is Map) { if (json is Map) {
String? id; String? id;
if (json.containsKey('id')) { if (json.containsKey('id')) {
id = jsonDecoder.decodeString(jsonPath + '.id', json['id']); id = jsonDecoder.decodeString('$jsonPath.id', json['id']);
} }
RefactoringMethodParameterKind kind; RefactoringMethodParameterKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = RefactoringMethodParameterKind.fromJson( kind = RefactoringMethodParameterKind.fromJson(
jsonDecoder, jsonPath + '.kind', json['kind']); jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
String type; String type;
if (json.containsKey('type')) { if (json.containsKey('type')) {
type = jsonDecoder.decodeString(jsonPath + '.type', json['type']); type = jsonDecoder.decodeString('$jsonPath.type', json['type']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'type'); throw jsonDecoder.mismatch(jsonPath, 'type');
} }
String name; String name;
if (json.containsKey('name')) { if (json.containsKey('name')) {
name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'name'); throw jsonDecoder.mismatch(jsonPath, 'name');
} }
String? parameters; String? parameters;
if (json.containsKey('parameters')) { if (json.containsKey('parameters')) {
parameters = jsonDecoder.decodeString( parameters = jsonDecoder.decodeString(
jsonPath + '.parameters', json['parameters']); '$jsonPath.parameters', json['parameters']);
} }
return RefactoringMethodParameter(kind, type, name, return RefactoringMethodParameter(kind, type, name,
id: id, parameters: parameters); id: id, parameters: parameters);
@ -4083,21 +4082,21 @@ class RefactoringProblem implements HasToJson {
RefactoringProblemSeverity severity; RefactoringProblemSeverity severity;
if (json.containsKey('severity')) { if (json.containsKey('severity')) {
severity = RefactoringProblemSeverity.fromJson( severity = RefactoringProblemSeverity.fromJson(
jsonDecoder, jsonPath + '.severity', json['severity']); jsonDecoder, '$jsonPath.severity', json['severity']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'severity'); throw jsonDecoder.mismatch(jsonPath, 'severity');
} }
String message; String message;
if (json.containsKey('message')) { if (json.containsKey('message')) {
message = message =
jsonDecoder.decodeString(jsonPath + '.message', json['message']); jsonDecoder.decodeString('$jsonPath.message', json['message']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'message'); throw jsonDecoder.mismatch(jsonPath, 'message');
} }
Location? location; Location? location;
if (json.containsKey('location')) { if (json.containsKey('location')) {
location = Location.fromJson( location = Location.fromJson(
jsonDecoder, jsonPath + '.location', json['location']); jsonDecoder, '$jsonPath.location', json['location']);
} }
return RefactoringProblem(severity, message, location: location); return RefactoringProblem(severity, message, location: location);
} else { } else {
@ -4319,14 +4318,14 @@ class SourceChange implements HasToJson {
String message; String message;
if (json.containsKey('message')) { if (json.containsKey('message')) {
message = message =
jsonDecoder.decodeString(jsonPath + '.message', json['message']); jsonDecoder.decodeString('$jsonPath.message', json['message']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'message'); throw jsonDecoder.mismatch(jsonPath, 'message');
} }
List<SourceFileEdit> edits; List<SourceFileEdit> edits;
if (json.containsKey('edits')) { if (json.containsKey('edits')) {
edits = jsonDecoder.decodeList( edits = jsonDecoder.decodeList(
jsonPath + '.edits', '$jsonPath.edits',
json['edits'], json['edits'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
SourceFileEdit.fromJson(jsonDecoder, jsonPath, json)); SourceFileEdit.fromJson(jsonDecoder, jsonPath, json));
@ -4336,7 +4335,7 @@ class SourceChange implements HasToJson {
List<LinkedEditGroup> linkedEditGroups; List<LinkedEditGroup> linkedEditGroups;
if (json.containsKey('linkedEditGroups')) { if (json.containsKey('linkedEditGroups')) {
linkedEditGroups = jsonDecoder.decodeList( linkedEditGroups = jsonDecoder.decodeList(
jsonPath + '.linkedEditGroups', '$jsonPath.linkedEditGroups',
json['linkedEditGroups'], json['linkedEditGroups'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
LinkedEditGroup.fromJson(jsonDecoder, jsonPath, json)); LinkedEditGroup.fromJson(jsonDecoder, jsonPath, json));
@ -4346,16 +4345,16 @@ class SourceChange implements HasToJson {
Position? selection; Position? selection;
if (json.containsKey('selection')) { if (json.containsKey('selection')) {
selection = Position.fromJson( selection = Position.fromJson(
jsonDecoder, jsonPath + '.selection', json['selection']); jsonDecoder, '$jsonPath.selection', json['selection']);
} }
int? selectionLength; int? selectionLength;
if (json.containsKey('selectionLength')) { if (json.containsKey('selectionLength')) {
selectionLength = jsonDecoder.decodeInt( selectionLength = jsonDecoder.decodeInt(
jsonPath + '.selectionLength', json['selectionLength']); '$jsonPath.selectionLength', json['selectionLength']);
} }
String? id; String? id;
if (json.containsKey('id')) { if (json.containsKey('id')) {
id = jsonDecoder.decodeString(jsonPath + '.id', json['id']); id = jsonDecoder.decodeString('$jsonPath.id', json['id']);
} }
return SourceChange(message, return SourceChange(message,
edits: edits, edits: edits,
@ -4487,26 +4486,26 @@ class SourceEdit implements HasToJson {
if (json is Map) { if (json is Map) {
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
String replacement; String replacement;
if (json.containsKey('replacement')) { if (json.containsKey('replacement')) {
replacement = jsonDecoder.decodeString( replacement = jsonDecoder.decodeString(
jsonPath + '.replacement', json['replacement']); '$jsonPath.replacement', json['replacement']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'replacement'); throw jsonDecoder.mismatch(jsonPath, 'replacement');
} }
String? id; String? id;
if (json.containsKey('id')) { if (json.containsKey('id')) {
id = jsonDecoder.decodeString(jsonPath + '.id', json['id']); id = jsonDecoder.decodeString('$jsonPath.id', json['id']);
} }
return SourceEdit(offset, length, replacement, id: id); return SourceEdit(offset, length, replacement, id: id);
} else { } else {
@ -4588,21 +4587,21 @@ class SourceFileEdit implements HasToJson {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
int fileStamp; int fileStamp;
if (json.containsKey('fileStamp')) { if (json.containsKey('fileStamp')) {
fileStamp = fileStamp =
jsonDecoder.decodeInt(jsonPath + '.fileStamp', json['fileStamp']); jsonDecoder.decodeInt('$jsonPath.fileStamp', json['fileStamp']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'fileStamp'); throw jsonDecoder.mismatch(jsonPath, 'fileStamp');
} }
List<SourceEdit> edits; List<SourceEdit> edits;
if (json.containsKey('edits')) { if (json.containsKey('edits')) {
edits = jsonDecoder.decodeList( edits = jsonDecoder.decodeList(
jsonPath + '.edits', '$jsonPath.edits',
json['edits'], json['edits'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
SourceEdit.fromJson(jsonDecoder, jsonPath, json)); SourceEdit.fromJson(jsonDecoder, jsonPath, json));

View file

@ -20,8 +20,9 @@ final Map<String, RefactoringKind> REQUEST_ID_REFACTORING_KINDS =
void addAllEditsForSource( void addAllEditsForSource(
SourceFileEdit sourceFileEdit, Iterable<SourceEdit> edits, SourceFileEdit sourceFileEdit, Iterable<SourceEdit> edits,
{bool insertBeforeExisting = false}) { {bool insertBeforeExisting = false}) {
edits.forEach((edit) => for (var edit in edits) {
sourceFileEdit.add(edit, insertBeforeExisting: insertBeforeExisting)); sourceFileEdit.add(edit, insertBeforeExisting: insertBeforeExisting);
}
} }
/// Adds the given [sourceEdit] to the list in [sourceFileEdit]. /// Adds the given [sourceEdit] to the list in [sourceFileEdit].
@ -76,9 +77,9 @@ String applyEdit(String code, SourceEdit edit) {
/// are applied in the order they appear in [edits]. Access via /// are applied in the order they appear in [edits]. Access via
/// SourceEdit.applySequence(). /// SourceEdit.applySequence().
String applySequenceOfEdits(String code, Iterable<SourceEdit> edits) { String applySequenceOfEdits(String code, Iterable<SourceEdit> edits) {
edits.forEach((SourceEdit edit) { for (var edit in edits) {
code = edit.apply(code); code = edit.apply(code);
}); }
return code; return code;
} }

View file

@ -21,4 +21,5 @@ dev_dependencies:
analyzer: any analyzer: any
analysis_server: any analysis_server: any
analyzer_utilities: any analyzer_utilities: any
lints: any
test: any test: any

View file

@ -1,57 +1,23 @@
include: package:lints/recommended.yaml
analyzer: analyzer:
language: language:
strict-casts: true strict-casts: true
linter: linter:
rules: rules:
- await_only_futures # In addition to lints/recommended:
- depend_on_referenced_packages always_declare_return_types: true
- empty_statements omit_local_variable_types: true
- unnecessary_brace_in_string_interps prefer_single_quotes: true
# unawaited_futures: true
# From pedantic 1.9.0:
# # Remove from lints/recommended:
- always_declare_return_types constant_identifier_names: false
- always_require_non_null_named_parameters implementation_imports: false
- annotate_overrides non_constant_identifier_names: false
- avoid_empty_else
- avoid_init_to_null # Existing violations (3)
- avoid_null_checks_in_equality_operators library_private_types_in_public_api: false
- avoid_relative_lib_imports # Existing violations (3)
- avoid_return_types_on_setters prefer_initializing_formals: false
- avoid_shadowing_type_parameters
- avoid_types_as_parameter_names
- camel_case_extensions
- curly_braces_in_flow_control_structures
- empty_catches
- empty_constructor_bodies
- library_names
- library_prefixes
- no_duplicate_case_values
- null_closures
- omit_local_variable_types
- prefer_adjacent_string_concatenation
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_contains
- prefer_equal_for_default_values
- prefer_final_fields
- prefer_for_elements_to_map_fromIterable
- prefer_generic_function_type_aliases
- prefer_if_null_operators
- prefer_is_empty
- prefer_is_not_empty
- prefer_iterable_whereType
- prefer_single_quotes
- prefer_spread_collections
- recursive_getters
- slash_for_doc_comments
- type_init_formals
- unawaited_futures
- unnecessary_const
- unnecessary_new
- unnecessary_null_in_if_null_operators
- unnecessary_this
- unrelated_type_equality_checks
- use_function_type_syntax_for_parameters
- use_rethrow_when_possible
- valid_regexps

View file

@ -37,7 +37,7 @@ class AddContentOverlay implements HasToJson {
String content; String content;
if (json.containsKey('content')) { if (json.containsKey('content')) {
content = content =
jsonDecoder.decodeString(jsonPath + '.content', json['content']); jsonDecoder.decodeString('$jsonPath.content', json['content']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'content'); throw jsonDecoder.mismatch(jsonPath, 'content');
} }
@ -139,57 +139,57 @@ class AnalysisError implements HasToJson {
AnalysisErrorSeverity severity; AnalysisErrorSeverity severity;
if (json.containsKey('severity')) { if (json.containsKey('severity')) {
severity = AnalysisErrorSeverity.fromJson( severity = AnalysisErrorSeverity.fromJson(
jsonDecoder, jsonPath + '.severity', json['severity']); jsonDecoder, '$jsonPath.severity', json['severity']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'severity'); throw jsonDecoder.mismatch(jsonPath, 'severity');
} }
AnalysisErrorType type; AnalysisErrorType type;
if (json.containsKey('type')) { if (json.containsKey('type')) {
type = AnalysisErrorType.fromJson( type = AnalysisErrorType.fromJson(
jsonDecoder, jsonPath + '.type', json['type']); jsonDecoder, '$jsonPath.type', json['type']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'type'); throw jsonDecoder.mismatch(jsonPath, 'type');
} }
Location location; Location location;
if (json.containsKey('location')) { if (json.containsKey('location')) {
location = Location.fromJson( location = Location.fromJson(
jsonDecoder, jsonPath + '.location', json['location']); jsonDecoder, '$jsonPath.location', json['location']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'location'); throw jsonDecoder.mismatch(jsonPath, 'location');
} }
String message; String message;
if (json.containsKey('message')) { if (json.containsKey('message')) {
message = message =
jsonDecoder.decodeString(jsonPath + '.message', json['message']); jsonDecoder.decodeString('$jsonPath.message', json['message']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'message'); throw jsonDecoder.mismatch(jsonPath, 'message');
} }
String? correction; String? correction;
if (json.containsKey('correction')) { if (json.containsKey('correction')) {
correction = jsonDecoder.decodeString( correction = jsonDecoder.decodeString(
jsonPath + '.correction', json['correction']); '$jsonPath.correction', json['correction']);
} }
String code; String code;
if (json.containsKey('code')) { if (json.containsKey('code')) {
code = jsonDecoder.decodeString(jsonPath + '.code', json['code']); code = jsonDecoder.decodeString('$jsonPath.code', json['code']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'code'); throw jsonDecoder.mismatch(jsonPath, 'code');
} }
String? url; String? url;
if (json.containsKey('url')) { if (json.containsKey('url')) {
url = jsonDecoder.decodeString(jsonPath + '.url', json['url']); url = jsonDecoder.decodeString('$jsonPath.url', json['url']);
} }
List<DiagnosticMessage>? contextMessages; List<DiagnosticMessage>? contextMessages;
if (json.containsKey('contextMessages')) { if (json.containsKey('contextMessages')) {
contextMessages = jsonDecoder.decodeList( contextMessages = jsonDecoder.decodeList(
jsonPath + '.contextMessages', '$jsonPath.contextMessages',
json['contextMessages'], json['contextMessages'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
DiagnosticMessage.fromJson(jsonDecoder, jsonPath, json)); DiagnosticMessage.fromJson(jsonDecoder, jsonPath, json));
} }
bool? hasFix; bool? hasFix;
if (json.containsKey('hasFix')) { if (json.containsKey('hasFix')) {
hasFix = jsonDecoder.decodeBool(jsonPath + '.hasFix', json['hasFix']); hasFix = jsonDecoder.decodeBool('$jsonPath.hasFix', json['hasFix']);
} }
return AnalysisError(severity, type, location, message, code, return AnalysisError(severity, type, location, message, code,
correction: correction, correction: correction,
@ -440,7 +440,7 @@ class ChangeContentOverlay implements HasToJson {
List<SourceEdit> edits; List<SourceEdit> edits;
if (json.containsKey('edits')) { if (json.containsKey('edits')) {
edits = jsonDecoder.decodeList( edits = jsonDecoder.decodeList(
jsonPath + '.edits', '$jsonPath.edits',
json['edits'], json['edits'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
SourceEdit.fromJson(jsonDecoder, jsonPath, json)); SourceEdit.fromJson(jsonDecoder, jsonPath, json));
@ -673,145 +673,144 @@ class CompletionSuggestion implements HasToJson {
CompletionSuggestionKind kind; CompletionSuggestionKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = CompletionSuggestionKind.fromJson( kind = CompletionSuggestionKind.fromJson(
jsonDecoder, jsonPath + '.kind', json['kind']); jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
int relevance; int relevance;
if (json.containsKey('relevance')) { if (json.containsKey('relevance')) {
relevance = relevance =
jsonDecoder.decodeInt(jsonPath + '.relevance', json['relevance']); jsonDecoder.decodeInt('$jsonPath.relevance', json['relevance']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'relevance'); throw jsonDecoder.mismatch(jsonPath, 'relevance');
} }
String completion; String completion;
if (json.containsKey('completion')) { if (json.containsKey('completion')) {
completion = jsonDecoder.decodeString( completion = jsonDecoder.decodeString(
jsonPath + '.completion', json['completion']); '$jsonPath.completion', json['completion']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'completion'); throw jsonDecoder.mismatch(jsonPath, 'completion');
} }
String? displayText; String? displayText;
if (json.containsKey('displayText')) { if (json.containsKey('displayText')) {
displayText = jsonDecoder.decodeString( displayText = jsonDecoder.decodeString(
jsonPath + '.displayText', json['displayText']); '$jsonPath.displayText', json['displayText']);
} }
int? replacementOffset; int? replacementOffset;
if (json.containsKey('replacementOffset')) { if (json.containsKey('replacementOffset')) {
replacementOffset = jsonDecoder.decodeInt( replacementOffset = jsonDecoder.decodeInt(
jsonPath + '.replacementOffset', json['replacementOffset']); '$jsonPath.replacementOffset', json['replacementOffset']);
} }
int? replacementLength; int? replacementLength;
if (json.containsKey('replacementLength')) { if (json.containsKey('replacementLength')) {
replacementLength = jsonDecoder.decodeInt( replacementLength = jsonDecoder.decodeInt(
jsonPath + '.replacementLength', json['replacementLength']); '$jsonPath.replacementLength', json['replacementLength']);
} }
int selectionOffset; int selectionOffset;
if (json.containsKey('selectionOffset')) { if (json.containsKey('selectionOffset')) {
selectionOffset = jsonDecoder.decodeInt( selectionOffset = jsonDecoder.decodeInt(
jsonPath + '.selectionOffset', json['selectionOffset']); '$jsonPath.selectionOffset', json['selectionOffset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'selectionOffset'); throw jsonDecoder.mismatch(jsonPath, 'selectionOffset');
} }
int selectionLength; int selectionLength;
if (json.containsKey('selectionLength')) { if (json.containsKey('selectionLength')) {
selectionLength = jsonDecoder.decodeInt( selectionLength = jsonDecoder.decodeInt(
jsonPath + '.selectionLength', json['selectionLength']); '$jsonPath.selectionLength', json['selectionLength']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'selectionLength'); throw jsonDecoder.mismatch(jsonPath, 'selectionLength');
} }
bool isDeprecated; bool isDeprecated;
if (json.containsKey('isDeprecated')) { if (json.containsKey('isDeprecated')) {
isDeprecated = jsonDecoder.decodeBool( isDeprecated = jsonDecoder.decodeBool(
jsonPath + '.isDeprecated', json['isDeprecated']); '$jsonPath.isDeprecated', json['isDeprecated']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'isDeprecated'); throw jsonDecoder.mismatch(jsonPath, 'isDeprecated');
} }
bool isPotential; bool isPotential;
if (json.containsKey('isPotential')) { if (json.containsKey('isPotential')) {
isPotential = jsonDecoder.decodeBool( isPotential = jsonDecoder.decodeBool(
jsonPath + '.isPotential', json['isPotential']); '$jsonPath.isPotential', json['isPotential']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'isPotential'); throw jsonDecoder.mismatch(jsonPath, 'isPotential');
} }
String? docSummary; String? docSummary;
if (json.containsKey('docSummary')) { if (json.containsKey('docSummary')) {
docSummary = jsonDecoder.decodeString( docSummary = jsonDecoder.decodeString(
jsonPath + '.docSummary', json['docSummary']); '$jsonPath.docSummary', json['docSummary']);
} }
String? docComplete; String? docComplete;
if (json.containsKey('docComplete')) { if (json.containsKey('docComplete')) {
docComplete = jsonDecoder.decodeString( docComplete = jsonDecoder.decodeString(
jsonPath + '.docComplete', json['docComplete']); '$jsonPath.docComplete', json['docComplete']);
} }
String? declaringType; String? declaringType;
if (json.containsKey('declaringType')) { if (json.containsKey('declaringType')) {
declaringType = jsonDecoder.decodeString( declaringType = jsonDecoder.decodeString(
jsonPath + '.declaringType', json['declaringType']); '$jsonPath.declaringType', json['declaringType']);
} }
String? defaultArgumentListString; String? defaultArgumentListString;
if (json.containsKey('defaultArgumentListString')) { if (json.containsKey('defaultArgumentListString')) {
defaultArgumentListString = jsonDecoder.decodeString( defaultArgumentListString = jsonDecoder.decodeString(
jsonPath + '.defaultArgumentListString', '$jsonPath.defaultArgumentListString',
json['defaultArgumentListString']); json['defaultArgumentListString']);
} }
List<int>? defaultArgumentListTextRanges; List<int>? defaultArgumentListTextRanges;
if (json.containsKey('defaultArgumentListTextRanges')) { if (json.containsKey('defaultArgumentListTextRanges')) {
defaultArgumentListTextRanges = jsonDecoder.decodeList( defaultArgumentListTextRanges = jsonDecoder.decodeList(
jsonPath + '.defaultArgumentListTextRanges', '$jsonPath.defaultArgumentListTextRanges',
json['defaultArgumentListTextRanges'], json['defaultArgumentListTextRanges'],
jsonDecoder.decodeInt); jsonDecoder.decodeInt);
} }
Element? element; Element? element;
if (json.containsKey('element')) { if (json.containsKey('element')) {
element = Element.fromJson( element =
jsonDecoder, jsonPath + '.element', json['element']); Element.fromJson(jsonDecoder, '$jsonPath.element', json['element']);
} }
String? returnType; String? returnType;
if (json.containsKey('returnType')) { if (json.containsKey('returnType')) {
returnType = jsonDecoder.decodeString( returnType = jsonDecoder.decodeString(
jsonPath + '.returnType', json['returnType']); '$jsonPath.returnType', json['returnType']);
} }
List<String>? parameterNames; List<String>? parameterNames;
if (json.containsKey('parameterNames')) { if (json.containsKey('parameterNames')) {
parameterNames = jsonDecoder.decodeList(jsonPath + '.parameterNames', parameterNames = jsonDecoder.decodeList('$jsonPath.parameterNames',
json['parameterNames'], jsonDecoder.decodeString); json['parameterNames'], jsonDecoder.decodeString);
} }
List<String>? parameterTypes; List<String>? parameterTypes;
if (json.containsKey('parameterTypes')) { if (json.containsKey('parameterTypes')) {
parameterTypes = jsonDecoder.decodeList(jsonPath + '.parameterTypes', parameterTypes = jsonDecoder.decodeList('$jsonPath.parameterTypes',
json['parameterTypes'], jsonDecoder.decodeString); json['parameterTypes'], jsonDecoder.decodeString);
} }
int? requiredParameterCount; int? requiredParameterCount;
if (json.containsKey('requiredParameterCount')) { if (json.containsKey('requiredParameterCount')) {
requiredParameterCount = jsonDecoder.decodeInt( requiredParameterCount = jsonDecoder.decodeInt(
jsonPath + '.requiredParameterCount', '$jsonPath.requiredParameterCount', json['requiredParameterCount']);
json['requiredParameterCount']);
} }
bool? hasNamedParameters; bool? hasNamedParameters;
if (json.containsKey('hasNamedParameters')) { if (json.containsKey('hasNamedParameters')) {
hasNamedParameters = jsonDecoder.decodeBool( hasNamedParameters = jsonDecoder.decodeBool(
jsonPath + '.hasNamedParameters', json['hasNamedParameters']); '$jsonPath.hasNamedParameters', json['hasNamedParameters']);
} }
String? parameterName; String? parameterName;
if (json.containsKey('parameterName')) { if (json.containsKey('parameterName')) {
parameterName = jsonDecoder.decodeString( parameterName = jsonDecoder.decodeString(
jsonPath + '.parameterName', json['parameterName']); '$jsonPath.parameterName', json['parameterName']);
} }
String? parameterType; String? parameterType;
if (json.containsKey('parameterType')) { if (json.containsKey('parameterType')) {
parameterType = jsonDecoder.decodeString( parameterType = jsonDecoder.decodeString(
jsonPath + '.parameterType', json['parameterType']); '$jsonPath.parameterType', json['parameterType']);
} }
String? libraryUri; String? libraryUri;
if (json.containsKey('libraryUri')) { if (json.containsKey('libraryUri')) {
libraryUri = jsonDecoder.decodeString( libraryUri = jsonDecoder.decodeString(
jsonPath + '.libraryUri', json['libraryUri']); '$jsonPath.libraryUri', json['libraryUri']);
} }
bool? isNotImported; bool? isNotImported;
if (json.containsKey('isNotImported')) { if (json.containsKey('isNotImported')) {
isNotImported = jsonDecoder.decodeBool( isNotImported = jsonDecoder.decodeBool(
jsonPath + '.isNotImported', json['isNotImported']); '$jsonPath.isNotImported', json['isNotImported']);
} }
return CompletionSuggestion(kind, relevance, completion, selectionOffset, return CompletionSuggestion(kind, relevance, completion, selectionOffset,
selectionLength, isDeprecated, isPotential, selectionLength, isDeprecated, isPotential,
@ -1146,14 +1145,14 @@ class DiagnosticMessage implements HasToJson {
String message; String message;
if (json.containsKey('message')) { if (json.containsKey('message')) {
message = message =
jsonDecoder.decodeString(jsonPath + '.message', json['message']); jsonDecoder.decodeString('$jsonPath.message', json['message']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'message'); throw jsonDecoder.mismatch(jsonPath, 'message');
} }
Location location; Location location;
if (json.containsKey('location')) { if (json.containsKey('location')) {
location = Location.fromJson( location = Location.fromJson(
jsonDecoder, jsonPath + '.location', json['location']); jsonDecoder, '$jsonPath.location', json['location']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'location'); throw jsonDecoder.mismatch(jsonPath, 'location');
} }
@ -1282,46 +1281,46 @@ class Element implements HasToJson {
ElementKind kind; ElementKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = kind =
ElementKind.fromJson(jsonDecoder, jsonPath + '.kind', json['kind']); ElementKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
String name; String name;
if (json.containsKey('name')) { if (json.containsKey('name')) {
name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'name'); throw jsonDecoder.mismatch(jsonPath, 'name');
} }
Location? location; Location? location;
if (json.containsKey('location')) { if (json.containsKey('location')) {
location = Location.fromJson( location = Location.fromJson(
jsonDecoder, jsonPath + '.location', json['location']); jsonDecoder, '$jsonPath.location', json['location']);
} }
int flags; int flags;
if (json.containsKey('flags')) { if (json.containsKey('flags')) {
flags = jsonDecoder.decodeInt(jsonPath + '.flags', json['flags']); flags = jsonDecoder.decodeInt('$jsonPath.flags', json['flags']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'flags'); throw jsonDecoder.mismatch(jsonPath, 'flags');
} }
String? parameters; String? parameters;
if (json.containsKey('parameters')) { if (json.containsKey('parameters')) {
parameters = jsonDecoder.decodeString( parameters = jsonDecoder.decodeString(
jsonPath + '.parameters', json['parameters']); '$jsonPath.parameters', json['parameters']);
} }
String? returnType; String? returnType;
if (json.containsKey('returnType')) { if (json.containsKey('returnType')) {
returnType = jsonDecoder.decodeString( returnType = jsonDecoder.decodeString(
jsonPath + '.returnType', json['returnType']); '$jsonPath.returnType', json['returnType']);
} }
String? typeParameters; String? typeParameters;
if (json.containsKey('typeParameters')) { if (json.containsKey('typeParameters')) {
typeParameters = jsonDecoder.decodeString( typeParameters = jsonDecoder.decodeString(
jsonPath + '.typeParameters', json['typeParameters']); '$jsonPath.typeParameters', json['typeParameters']);
} }
String? aliasedType; String? aliasedType;
if (json.containsKey('aliasedType')) { if (json.containsKey('aliasedType')) {
aliasedType = jsonDecoder.decodeString( aliasedType = jsonDecoder.decodeString(
jsonPath + '.aliasedType', json['aliasedType']); '$jsonPath.aliasedType', json['aliasedType']);
} }
return Element(kind, name, flags, return Element(kind, name, flags,
location: location, location: location,
@ -1748,19 +1747,19 @@ class FoldingRegion implements HasToJson {
FoldingKind kind; FoldingKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = kind =
FoldingKind.fromJson(jsonDecoder, jsonPath + '.kind', json['kind']); FoldingKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
@ -1828,19 +1827,19 @@ class HighlightRegion implements HasToJson {
HighlightRegionType type; HighlightRegionType type;
if (json.containsKey('type')) { if (json.containsKey('type')) {
type = HighlightRegionType.fromJson( type = HighlightRegionType.fromJson(
jsonDecoder, jsonPath + '.type', json['type']); jsonDecoder, '$jsonPath.type', json['type']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'type'); throw jsonDecoder.mismatch(jsonPath, 'type');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
@ -2522,29 +2521,29 @@ class KytheEntry implements HasToJson {
KytheVName source; KytheVName source;
if (json.containsKey('source')) { if (json.containsKey('source')) {
source = KytheVName.fromJson( source = KytheVName.fromJson(
jsonDecoder, jsonPath + '.source', json['source']); jsonDecoder, '$jsonPath.source', json['source']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'source'); throw jsonDecoder.mismatch(jsonPath, 'source');
} }
String? kind; String? kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = jsonDecoder.decodeString(jsonPath + '.kind', json['kind']); kind = jsonDecoder.decodeString('$jsonPath.kind', json['kind']);
} }
KytheVName? target; KytheVName? target;
if (json.containsKey('target')) { if (json.containsKey('target')) {
target = KytheVName.fromJson( target = KytheVName.fromJson(
jsonDecoder, jsonPath + '.target', json['target']); jsonDecoder, '$jsonPath.target', json['target']);
} }
String fact; String fact;
if (json.containsKey('fact')) { if (json.containsKey('fact')) {
fact = jsonDecoder.decodeString(jsonPath + '.fact', json['fact']); fact = jsonDecoder.decodeString('$jsonPath.fact', json['fact']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'fact'); throw jsonDecoder.mismatch(jsonPath, 'fact');
} }
List<int>? value; List<int>? value;
if (json.containsKey('value')) { if (json.containsKey('value')) {
value = jsonDecoder.decodeList( value = jsonDecoder.decodeList(
jsonPath + '.value', json['value'], jsonDecoder.decodeInt); '$jsonPath.value', json['value'], jsonDecoder.decodeInt);
} }
return KytheEntry(source, fact, kind: kind, target: target, value: value); return KytheEntry(source, fact, kind: kind, target: target, value: value);
} else { } else {
@ -2637,33 +2636,33 @@ class KytheVName implements HasToJson {
if (json is Map) { if (json is Map) {
String signature; String signature;
if (json.containsKey('signature')) { if (json.containsKey('signature')) {
signature = jsonDecoder.decodeString( signature =
jsonPath + '.signature', json['signature']); jsonDecoder.decodeString('$jsonPath.signature', json['signature']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'signature'); throw jsonDecoder.mismatch(jsonPath, 'signature');
} }
String corpus; String corpus;
if (json.containsKey('corpus')) { if (json.containsKey('corpus')) {
corpus = jsonDecoder.decodeString(jsonPath + '.corpus', json['corpus']); corpus = jsonDecoder.decodeString('$jsonPath.corpus', json['corpus']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'corpus'); throw jsonDecoder.mismatch(jsonPath, 'corpus');
} }
String root; String root;
if (json.containsKey('root')) { if (json.containsKey('root')) {
root = jsonDecoder.decodeString(jsonPath + '.root', json['root']); root = jsonDecoder.decodeString('$jsonPath.root', json['root']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'root'); throw jsonDecoder.mismatch(jsonPath, 'root');
} }
String path; String path;
if (json.containsKey('path')) { if (json.containsKey('path')) {
path = jsonDecoder.decodeString(jsonPath + '.path', json['path']); path = jsonDecoder.decodeString('$jsonPath.path', json['path']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'path'); throw jsonDecoder.mismatch(jsonPath, 'path');
} }
String language; String language;
if (json.containsKey('language')) { if (json.containsKey('language')) {
language = language =
jsonDecoder.decodeString(jsonPath + '.language', json['language']); jsonDecoder.decodeString('$jsonPath.language', json['language']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'language'); throw jsonDecoder.mismatch(jsonPath, 'language');
} }
@ -2739,7 +2738,7 @@ class LinkedEditGroup implements HasToJson {
List<Position> positions; List<Position> positions;
if (json.containsKey('positions')) { if (json.containsKey('positions')) {
positions = jsonDecoder.decodeList( positions = jsonDecoder.decodeList(
jsonPath + '.positions', '$jsonPath.positions',
json['positions'], json['positions'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
Position.fromJson(jsonDecoder, jsonPath, json)); Position.fromJson(jsonDecoder, jsonPath, json));
@ -2748,14 +2747,14 @@ class LinkedEditGroup implements HasToJson {
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
List<LinkedEditSuggestion> suggestions; List<LinkedEditSuggestion> suggestions;
if (json.containsKey('suggestions')) { if (json.containsKey('suggestions')) {
suggestions = jsonDecoder.decodeList( suggestions = jsonDecoder.decodeList(
jsonPath + '.suggestions', '$jsonPath.suggestions',
json['suggestions'], json['suggestions'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
LinkedEditSuggestion.fromJson(jsonDecoder, jsonPath, json)); LinkedEditSuggestion.fromJson(jsonDecoder, jsonPath, json));
@ -2840,14 +2839,14 @@ class LinkedEditSuggestion implements HasToJson {
if (json is Map) { if (json is Map) {
String value; String value;
if (json.containsKey('value')) { if (json.containsKey('value')) {
value = jsonDecoder.decodeString(jsonPath + '.value', json['value']); value = jsonDecoder.decodeString('$jsonPath.value', json['value']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'value'); throw jsonDecoder.mismatch(jsonPath, 'value');
} }
LinkedEditSuggestionKind kind; LinkedEditSuggestionKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = LinkedEditSuggestionKind.fromJson( kind = LinkedEditSuggestionKind.fromJson(
jsonDecoder, jsonPath + '.kind', json['kind']); jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
@ -2996,44 +2995,44 @@ class Location implements HasToJson {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
int startLine; int startLine;
if (json.containsKey('startLine')) { if (json.containsKey('startLine')) {
startLine = startLine =
jsonDecoder.decodeInt(jsonPath + '.startLine', json['startLine']); jsonDecoder.decodeInt('$jsonPath.startLine', json['startLine']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'startLine'); throw jsonDecoder.mismatch(jsonPath, 'startLine');
} }
int startColumn; int startColumn;
if (json.containsKey('startColumn')) { if (json.containsKey('startColumn')) {
startColumn = jsonDecoder.decodeInt( startColumn =
jsonPath + '.startColumn', json['startColumn']); jsonDecoder.decodeInt('$jsonPath.startColumn', json['startColumn']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'startColumn'); throw jsonDecoder.mismatch(jsonPath, 'startColumn');
} }
int? endLine; int? endLine;
if (json.containsKey('endLine')) { if (json.containsKey('endLine')) {
endLine = jsonDecoder.decodeInt(jsonPath + '.endLine', json['endLine']); endLine = jsonDecoder.decodeInt('$jsonPath.endLine', json['endLine']);
} }
int? endColumn; int? endColumn;
if (json.containsKey('endColumn')) { if (json.containsKey('endColumn')) {
endColumn = endColumn =
jsonDecoder.decodeInt(jsonPath + '.endColumn', json['endColumn']); jsonDecoder.decodeInt('$jsonPath.endColumn', json['endColumn']);
} }
return Location(file, offset, length, startLine, startColumn, return Location(file, offset, length, startLine, startColumn,
endLine: endLine, endColumn: endColumn); endLine: endLine, endColumn: endColumn);
@ -3119,20 +3118,20 @@ class NavigationRegion implements HasToJson {
if (json is Map) { if (json is Map) {
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
List<int> targets; List<int> targets;
if (json.containsKey('targets')) { if (json.containsKey('targets')) {
targets = jsonDecoder.decodeList( targets = jsonDecoder.decodeList(
jsonPath + '.targets', json['targets'], jsonDecoder.decodeInt); '$jsonPath.targets', json['targets'], jsonDecoder.decodeInt);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'targets'); throw jsonDecoder.mismatch(jsonPath, 'targets');
} }
@ -3225,52 +3224,52 @@ class NavigationTarget implements HasToJson {
ElementKind kind; ElementKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = kind =
ElementKind.fromJson(jsonDecoder, jsonPath + '.kind', json['kind']); ElementKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
int fileIndex; int fileIndex;
if (json.containsKey('fileIndex')) { if (json.containsKey('fileIndex')) {
fileIndex = fileIndex =
jsonDecoder.decodeInt(jsonPath + '.fileIndex', json['fileIndex']); jsonDecoder.decodeInt('$jsonPath.fileIndex', json['fileIndex']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'fileIndex'); throw jsonDecoder.mismatch(jsonPath, 'fileIndex');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
int startLine; int startLine;
if (json.containsKey('startLine')) { if (json.containsKey('startLine')) {
startLine = startLine =
jsonDecoder.decodeInt(jsonPath + '.startLine', json['startLine']); jsonDecoder.decodeInt('$jsonPath.startLine', json['startLine']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'startLine'); throw jsonDecoder.mismatch(jsonPath, 'startLine');
} }
int startColumn; int startColumn;
if (json.containsKey('startColumn')) { if (json.containsKey('startColumn')) {
startColumn = jsonDecoder.decodeInt( startColumn =
jsonPath + '.startColumn', json['startColumn']); jsonDecoder.decodeInt('$jsonPath.startColumn', json['startColumn']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'startColumn'); throw jsonDecoder.mismatch(jsonPath, 'startColumn');
} }
int? codeOffset; int? codeOffset;
if (json.containsKey('codeOffset')) { if (json.containsKey('codeOffset')) {
codeOffset = codeOffset =
jsonDecoder.decodeInt(jsonPath + '.codeOffset', json['codeOffset']); jsonDecoder.decodeInt('$jsonPath.codeOffset', json['codeOffset']);
} }
int? codeLength; int? codeLength;
if (json.containsKey('codeLength')) { if (json.containsKey('codeLength')) {
codeLength = codeLength =
jsonDecoder.decodeInt(jsonPath + '.codeLength', json['codeLength']); jsonDecoder.decodeInt('$jsonPath.codeLength', json['codeLength']);
} }
return NavigationTarget( return NavigationTarget(
kind, fileIndex, offset, length, startLine, startColumn, kind, fileIndex, offset, length, startLine, startColumn,
@ -3358,21 +3357,21 @@ class Occurrences implements HasToJson {
if (json is Map) { if (json is Map) {
Element element; Element element;
if (json.containsKey('element')) { if (json.containsKey('element')) {
element = Element.fromJson( element =
jsonDecoder, jsonPath + '.element', json['element']); Element.fromJson(jsonDecoder, '$jsonPath.element', json['element']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'element'); throw jsonDecoder.mismatch(jsonPath, 'element');
} }
List<int> offsets; List<int> offsets;
if (json.containsKey('offsets')) { if (json.containsKey('offsets')) {
offsets = jsonDecoder.decodeList( offsets = jsonDecoder.decodeList(
jsonPath + '.offsets', json['offsets'], jsonDecoder.decodeInt); '$jsonPath.offsets', json['offsets'], jsonDecoder.decodeInt);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offsets'); throw jsonDecoder.mismatch(jsonPath, 'offsets');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
@ -3458,41 +3457,41 @@ class Outline implements HasToJson {
if (json is Map) { if (json is Map) {
Element element; Element element;
if (json.containsKey('element')) { if (json.containsKey('element')) {
element = Element.fromJson( element =
jsonDecoder, jsonPath + '.element', json['element']); Element.fromJson(jsonDecoder, '$jsonPath.element', json['element']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'element'); throw jsonDecoder.mismatch(jsonPath, 'element');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
int codeOffset; int codeOffset;
if (json.containsKey('codeOffset')) { if (json.containsKey('codeOffset')) {
codeOffset = codeOffset =
jsonDecoder.decodeInt(jsonPath + '.codeOffset', json['codeOffset']); jsonDecoder.decodeInt('$jsonPath.codeOffset', json['codeOffset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'codeOffset'); throw jsonDecoder.mismatch(jsonPath, 'codeOffset');
} }
int codeLength; int codeLength;
if (json.containsKey('codeLength')) { if (json.containsKey('codeLength')) {
codeLength = codeLength =
jsonDecoder.decodeInt(jsonPath + '.codeLength', json['codeLength']); jsonDecoder.decodeInt('$jsonPath.codeLength', json['codeLength']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'codeLength'); throw jsonDecoder.mismatch(jsonPath, 'codeLength');
} }
List<Outline>? children; List<Outline>? children;
if (json.containsKey('children')) { if (json.containsKey('children')) {
children = jsonDecoder.decodeList( children = jsonDecoder.decodeList(
jsonPath + '.children', '$jsonPath.children',
json['children'], json['children'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
Outline.fromJson(jsonDecoder, jsonPath, json)); Outline.fromJson(jsonDecoder, jsonPath, json));
@ -3579,27 +3578,27 @@ class ParameterInfo implements HasToJson {
if (json is Map) { if (json is Map) {
ParameterKind kind; ParameterKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = ParameterKind.fromJson( kind =
jsonDecoder, jsonPath + '.kind', json['kind']); ParameterKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
String name; String name;
if (json.containsKey('name')) { if (json.containsKey('name')) {
name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'name'); throw jsonDecoder.mismatch(jsonPath, 'name');
} }
String type; String type;
if (json.containsKey('type')) { if (json.containsKey('type')) {
type = jsonDecoder.decodeString(jsonPath + '.type', json['type']); type = jsonDecoder.decodeString('$jsonPath.type', json['type']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'type'); throw jsonDecoder.mismatch(jsonPath, 'type');
} }
String? defaultValue; String? defaultValue;
if (json.containsKey('defaultValue')) { if (json.containsKey('defaultValue')) {
defaultValue = jsonDecoder.decodeString( defaultValue = jsonDecoder.decodeString(
jsonPath + '.defaultValue', json['defaultValue']); '$jsonPath.defaultValue', json['defaultValue']);
} }
return ParameterInfo(kind, name, type, defaultValue: defaultValue); return ParameterInfo(kind, name, type, defaultValue: defaultValue);
} else { } else {
@ -3736,13 +3735,13 @@ class Position implements HasToJson {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
@ -3919,31 +3918,31 @@ class RefactoringMethodParameter implements HasToJson {
if (json is Map) { if (json is Map) {
String? id; String? id;
if (json.containsKey('id')) { if (json.containsKey('id')) {
id = jsonDecoder.decodeString(jsonPath + '.id', json['id']); id = jsonDecoder.decodeString('$jsonPath.id', json['id']);
} }
RefactoringMethodParameterKind kind; RefactoringMethodParameterKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = RefactoringMethodParameterKind.fromJson( kind = RefactoringMethodParameterKind.fromJson(
jsonDecoder, jsonPath + '.kind', json['kind']); jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
String type; String type;
if (json.containsKey('type')) { if (json.containsKey('type')) {
type = jsonDecoder.decodeString(jsonPath + '.type', json['type']); type = jsonDecoder.decodeString('$jsonPath.type', json['type']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'type'); throw jsonDecoder.mismatch(jsonPath, 'type');
} }
String name; String name;
if (json.containsKey('name')) { if (json.containsKey('name')) {
name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'name'); throw jsonDecoder.mismatch(jsonPath, 'name');
} }
String? parameters; String? parameters;
if (json.containsKey('parameters')) { if (json.containsKey('parameters')) {
parameters = jsonDecoder.decodeString( parameters = jsonDecoder.decodeString(
jsonPath + '.parameters', json['parameters']); '$jsonPath.parameters', json['parameters']);
} }
return RefactoringMethodParameter(kind, type, name, return RefactoringMethodParameter(kind, type, name,
id: id, parameters: parameters); id: id, parameters: parameters);
@ -4083,21 +4082,21 @@ class RefactoringProblem implements HasToJson {
RefactoringProblemSeverity severity; RefactoringProblemSeverity severity;
if (json.containsKey('severity')) { if (json.containsKey('severity')) {
severity = RefactoringProblemSeverity.fromJson( severity = RefactoringProblemSeverity.fromJson(
jsonDecoder, jsonPath + '.severity', json['severity']); jsonDecoder, '$jsonPath.severity', json['severity']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'severity'); throw jsonDecoder.mismatch(jsonPath, 'severity');
} }
String message; String message;
if (json.containsKey('message')) { if (json.containsKey('message')) {
message = message =
jsonDecoder.decodeString(jsonPath + '.message', json['message']); jsonDecoder.decodeString('$jsonPath.message', json['message']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'message'); throw jsonDecoder.mismatch(jsonPath, 'message');
} }
Location? location; Location? location;
if (json.containsKey('location')) { if (json.containsKey('location')) {
location = Location.fromJson( location = Location.fromJson(
jsonDecoder, jsonPath + '.location', json['location']); jsonDecoder, '$jsonPath.location', json['location']);
} }
return RefactoringProblem(severity, message, location: location); return RefactoringProblem(severity, message, location: location);
} else { } else {
@ -4319,14 +4318,14 @@ class SourceChange implements HasToJson {
String message; String message;
if (json.containsKey('message')) { if (json.containsKey('message')) {
message = message =
jsonDecoder.decodeString(jsonPath + '.message', json['message']); jsonDecoder.decodeString('$jsonPath.message', json['message']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'message'); throw jsonDecoder.mismatch(jsonPath, 'message');
} }
List<SourceFileEdit> edits; List<SourceFileEdit> edits;
if (json.containsKey('edits')) { if (json.containsKey('edits')) {
edits = jsonDecoder.decodeList( edits = jsonDecoder.decodeList(
jsonPath + '.edits', '$jsonPath.edits',
json['edits'], json['edits'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
SourceFileEdit.fromJson(jsonDecoder, jsonPath, json)); SourceFileEdit.fromJson(jsonDecoder, jsonPath, json));
@ -4336,7 +4335,7 @@ class SourceChange implements HasToJson {
List<LinkedEditGroup> linkedEditGroups; List<LinkedEditGroup> linkedEditGroups;
if (json.containsKey('linkedEditGroups')) { if (json.containsKey('linkedEditGroups')) {
linkedEditGroups = jsonDecoder.decodeList( linkedEditGroups = jsonDecoder.decodeList(
jsonPath + '.linkedEditGroups', '$jsonPath.linkedEditGroups',
json['linkedEditGroups'], json['linkedEditGroups'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
LinkedEditGroup.fromJson(jsonDecoder, jsonPath, json)); LinkedEditGroup.fromJson(jsonDecoder, jsonPath, json));
@ -4346,16 +4345,16 @@ class SourceChange implements HasToJson {
Position? selection; Position? selection;
if (json.containsKey('selection')) { if (json.containsKey('selection')) {
selection = Position.fromJson( selection = Position.fromJson(
jsonDecoder, jsonPath + '.selection', json['selection']); jsonDecoder, '$jsonPath.selection', json['selection']);
} }
int? selectionLength; int? selectionLength;
if (json.containsKey('selectionLength')) { if (json.containsKey('selectionLength')) {
selectionLength = jsonDecoder.decodeInt( selectionLength = jsonDecoder.decodeInt(
jsonPath + '.selectionLength', json['selectionLength']); '$jsonPath.selectionLength', json['selectionLength']);
} }
String? id; String? id;
if (json.containsKey('id')) { if (json.containsKey('id')) {
id = jsonDecoder.decodeString(jsonPath + '.id', json['id']); id = jsonDecoder.decodeString('$jsonPath.id', json['id']);
} }
return SourceChange(message, return SourceChange(message,
edits: edits, edits: edits,
@ -4487,26 +4486,26 @@ class SourceEdit implements HasToJson {
if (json is Map) { if (json is Map) {
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
String replacement; String replacement;
if (json.containsKey('replacement')) { if (json.containsKey('replacement')) {
replacement = jsonDecoder.decodeString( replacement = jsonDecoder.decodeString(
jsonPath + '.replacement', json['replacement']); '$jsonPath.replacement', json['replacement']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'replacement'); throw jsonDecoder.mismatch(jsonPath, 'replacement');
} }
String? id; String? id;
if (json.containsKey('id')) { if (json.containsKey('id')) {
id = jsonDecoder.decodeString(jsonPath + '.id', json['id']); id = jsonDecoder.decodeString('$jsonPath.id', json['id']);
} }
return SourceEdit(offset, length, replacement, id: id); return SourceEdit(offset, length, replacement, id: id);
} else { } else {
@ -4588,21 +4587,21 @@ class SourceFileEdit implements HasToJson {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
int fileStamp; int fileStamp;
if (json.containsKey('fileStamp')) { if (json.containsKey('fileStamp')) {
fileStamp = fileStamp =
jsonDecoder.decodeInt(jsonPath + '.fileStamp', json['fileStamp']); jsonDecoder.decodeInt('$jsonPath.fileStamp', json['fileStamp']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'fileStamp'); throw jsonDecoder.mismatch(jsonPath, 'fileStamp');
} }
List<SourceEdit> edits; List<SourceEdit> edits;
if (json.containsKey('edits')) { if (json.containsKey('edits')) {
edits = jsonDecoder.decodeList( edits = jsonDecoder.decodeList(
jsonPath + '.edits', '$jsonPath.edits',
json['edits'], json['edits'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
SourceEdit.fromJson(jsonDecoder, jsonPath, json)); SourceEdit.fromJson(jsonDecoder, jsonPath, json));

View file

@ -39,14 +39,14 @@ class AnalysisErrorFixes implements HasToJson {
AnalysisError error; AnalysisError error;
if (json.containsKey('error')) { if (json.containsKey('error')) {
error = AnalysisError.fromJson( error = AnalysisError.fromJson(
jsonDecoder, jsonPath + '.error', json['error']); jsonDecoder, '$jsonPath.error', json['error']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'error'); throw jsonDecoder.mismatch(jsonPath, 'error');
} }
List<PrioritizedSourceChange> fixes; List<PrioritizedSourceChange> fixes;
if (json.containsKey('fixes')) { if (json.containsKey('fixes')) {
fixes = jsonDecoder.decodeList( fixes = jsonDecoder.decodeList(
jsonPath + '.fixes', '$jsonPath.fixes',
json['fixes'], json['fixes'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
PrioritizedSourceChange.fromJson(jsonDecoder, jsonPath, json)); PrioritizedSourceChange.fromJson(jsonDecoder, jsonPath, json));
@ -111,14 +111,14 @@ class AnalysisErrorsParams implements HasToJson {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
List<AnalysisError> errors; List<AnalysisError> errors;
if (json.containsKey('errors')) { if (json.containsKey('errors')) {
errors = jsonDecoder.decodeList( errors = jsonDecoder.decodeList(
jsonPath + '.errors', '$jsonPath.errors',
json['errors'], json['errors'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
AnalysisError.fromJson(jsonDecoder, jsonPath, json)); AnalysisError.fromJson(jsonDecoder, jsonPath, json));
@ -192,14 +192,14 @@ class AnalysisFoldingParams implements HasToJson {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
List<FoldingRegion> regions; List<FoldingRegion> regions;
if (json.containsKey('regions')) { if (json.containsKey('regions')) {
regions = jsonDecoder.decodeList( regions = jsonDecoder.decodeList(
jsonPath + '.regions', '$jsonPath.regions',
json['regions'], json['regions'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
FoldingRegion.fromJson(jsonDecoder, jsonPath, json)); FoldingRegion.fromJson(jsonDecoder, jsonPath, json));
@ -279,19 +279,19 @@ class AnalysisGetNavigationParams implements RequestParams {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
@ -372,14 +372,14 @@ class AnalysisGetNavigationResult implements ResponseResult {
List<String> files; List<String> files;
if (json.containsKey('files')) { if (json.containsKey('files')) {
files = jsonDecoder.decodeList( files = jsonDecoder.decodeList(
jsonPath + '.files', json['files'], jsonDecoder.decodeString); '$jsonPath.files', json['files'], jsonDecoder.decodeString);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'files'); throw jsonDecoder.mismatch(jsonPath, 'files');
} }
List<NavigationTarget> targets; List<NavigationTarget> targets;
if (json.containsKey('targets')) { if (json.containsKey('targets')) {
targets = jsonDecoder.decodeList( targets = jsonDecoder.decodeList(
jsonPath + '.targets', '$jsonPath.targets',
json['targets'], json['targets'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
NavigationTarget.fromJson(jsonDecoder, jsonPath, json)); NavigationTarget.fromJson(jsonDecoder, jsonPath, json));
@ -389,7 +389,7 @@ class AnalysisGetNavigationResult implements ResponseResult {
List<NavigationRegion> regions; List<NavigationRegion> regions;
if (json.containsKey('regions')) { if (json.containsKey('regions')) {
regions = jsonDecoder.decodeList( regions = jsonDecoder.decodeList(
jsonPath + '.regions', '$jsonPath.regions',
json['regions'], json['regions'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
NavigationRegion.fromJson(jsonDecoder, jsonPath, json)); NavigationRegion.fromJson(jsonDecoder, jsonPath, json));
@ -469,7 +469,7 @@ class AnalysisHandleWatchEventsParams implements RequestParams {
List<WatchEvent> events; List<WatchEvent> events;
if (json.containsKey('events')) { if (json.containsKey('events')) {
events = jsonDecoder.decodeList( events = jsonDecoder.decodeList(
jsonPath + '.events', '$jsonPath.events',
json['events'], json['events'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
WatchEvent.fromJson(jsonDecoder, jsonPath, json)); WatchEvent.fromJson(jsonDecoder, jsonPath, json));
@ -559,14 +559,14 @@ class AnalysisHighlightsParams implements HasToJson {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
List<HighlightRegion> regions; List<HighlightRegion> regions;
if (json.containsKey('regions')) { if (json.containsKey('regions')) {
regions = jsonDecoder.decodeList( regions = jsonDecoder.decodeList(
jsonPath + '.regions', '$jsonPath.regions',
json['regions'], json['regions'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
HighlightRegion.fromJson(jsonDecoder, jsonPath, json)); HighlightRegion.fromJson(jsonDecoder, jsonPath, json));
@ -650,14 +650,14 @@ class AnalysisNavigationParams implements HasToJson {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
List<NavigationRegion> regions; List<NavigationRegion> regions;
if (json.containsKey('regions')) { if (json.containsKey('regions')) {
regions = jsonDecoder.decodeList( regions = jsonDecoder.decodeList(
jsonPath + '.regions', '$jsonPath.regions',
json['regions'], json['regions'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
NavigationRegion.fromJson(jsonDecoder, jsonPath, json)); NavigationRegion.fromJson(jsonDecoder, jsonPath, json));
@ -667,7 +667,7 @@ class AnalysisNavigationParams implements HasToJson {
List<NavigationTarget> targets; List<NavigationTarget> targets;
if (json.containsKey('targets')) { if (json.containsKey('targets')) {
targets = jsonDecoder.decodeList( targets = jsonDecoder.decodeList(
jsonPath + '.targets', '$jsonPath.targets',
json['targets'], json['targets'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
NavigationTarget.fromJson(jsonDecoder, jsonPath, json)); NavigationTarget.fromJson(jsonDecoder, jsonPath, json));
@ -677,7 +677,7 @@ class AnalysisNavigationParams implements HasToJson {
List<String> files; List<String> files;
if (json.containsKey('files')) { if (json.containsKey('files')) {
files = jsonDecoder.decodeList( files = jsonDecoder.decodeList(
jsonPath + '.files', json['files'], jsonDecoder.decodeString); '$jsonPath.files', json['files'], jsonDecoder.decodeString);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'files'); throw jsonDecoder.mismatch(jsonPath, 'files');
} }
@ -756,14 +756,14 @@ class AnalysisOccurrencesParams implements HasToJson {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
List<Occurrences> occurrences; List<Occurrences> occurrences;
if (json.containsKey('occurrences')) { if (json.containsKey('occurrences')) {
occurrences = jsonDecoder.decodeList( occurrences = jsonDecoder.decodeList(
jsonPath + '.occurrences', '$jsonPath.occurrences',
json['occurrences'], json['occurrences'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
Occurrences.fromJson(jsonDecoder, jsonPath, json)); Occurrences.fromJson(jsonDecoder, jsonPath, json));
@ -838,14 +838,14 @@ class AnalysisOutlineParams implements HasToJson {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
List<Outline> outline; List<Outline> outline;
if (json.containsKey('outline')) { if (json.containsKey('outline')) {
outline = jsonDecoder.decodeList( outline = jsonDecoder.decodeList(
jsonPath + '.outline', '$jsonPath.outline',
json['outline'], json['outline'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
Outline.fromJson(jsonDecoder, jsonPath, json)); Outline.fromJson(jsonDecoder, jsonPath, json));
@ -984,7 +984,7 @@ class AnalysisSetContextRootsParams implements RequestParams {
List<ContextRoot> roots; List<ContextRoot> roots;
if (json.containsKey('roots')) { if (json.containsKey('roots')) {
roots = jsonDecoder.decodeList( roots = jsonDecoder.decodeList(
jsonPath + '.roots', '$jsonPath.roots',
json['roots'], json['roots'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
ContextRoot.fromJson(jsonDecoder, jsonPath, json)); ContextRoot.fromJson(jsonDecoder, jsonPath, json));
@ -1070,7 +1070,7 @@ class AnalysisSetPriorityFilesParams implements RequestParams {
List<String> files; List<String> files;
if (json.containsKey('files')) { if (json.containsKey('files')) {
files = jsonDecoder.decodeList( files = jsonDecoder.decodeList(
jsonPath + '.files', json['files'], jsonDecoder.decodeString); '$jsonPath.files', json['files'], jsonDecoder.decodeString);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'files'); throw jsonDecoder.mismatch(jsonPath, 'files');
} }
@ -1153,7 +1153,7 @@ class AnalysisSetSubscriptionsParams implements RequestParams {
Map<AnalysisService, List<String>> subscriptions; Map<AnalysisService, List<String>> subscriptions;
if (json.containsKey('subscriptions')) { if (json.containsKey('subscriptions')) {
subscriptions = jsonDecoder.decodeMap( subscriptions = jsonDecoder.decodeMap(
jsonPath + '.subscriptions', json['subscriptions'], '$jsonPath.subscriptions', json['subscriptions'],
keyDecoder: (String jsonPath, Object? json) => keyDecoder: (String jsonPath, Object? json) =>
AnalysisService.fromJson(jsonDecoder, jsonPath, json), AnalysisService.fromJson(jsonDecoder, jsonPath, json),
valueDecoder: (String jsonPath, Object? json) => jsonDecoder valueDecoder: (String jsonPath, Object? json) => jsonDecoder
@ -1245,7 +1245,7 @@ class AnalysisUpdateContentParams implements RequestParams {
if (json is Map) { if (json is Map) {
Map<String, Object> files; Map<String, Object> files;
if (json.containsKey('files')) { if (json.containsKey('files')) {
files = jsonDecoder.decodeMap(jsonPath + '.files', json['files'], files = jsonDecoder.decodeMap('$jsonPath.files', json['files'],
valueDecoder: (String jsonPath, Object? json) => valueDecoder: (String jsonPath, Object? json) =>
jsonDecoder.decodeUnion(jsonPath, json, 'type', { jsonDecoder.decodeUnion(jsonPath, json, 'type', {
'add': (String jsonPath, Object? json) => 'add': (String jsonPath, Object? json) =>
@ -1341,13 +1341,13 @@ class CompletionGetSuggestionsParams implements RequestParams {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
@ -1433,21 +1433,21 @@ class CompletionGetSuggestionsResult implements ResponseResult {
int replacementOffset; int replacementOffset;
if (json.containsKey('replacementOffset')) { if (json.containsKey('replacementOffset')) {
replacementOffset = jsonDecoder.decodeInt( replacementOffset = jsonDecoder.decodeInt(
jsonPath + '.replacementOffset', json['replacementOffset']); '$jsonPath.replacementOffset', json['replacementOffset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'replacementOffset'); throw jsonDecoder.mismatch(jsonPath, 'replacementOffset');
} }
int replacementLength; int replacementLength;
if (json.containsKey('replacementLength')) { if (json.containsKey('replacementLength')) {
replacementLength = jsonDecoder.decodeInt( replacementLength = jsonDecoder.decodeInt(
jsonPath + '.replacementLength', json['replacementLength']); '$jsonPath.replacementLength', json['replacementLength']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'replacementLength'); throw jsonDecoder.mismatch(jsonPath, 'replacementLength');
} }
List<CompletionSuggestion> results; List<CompletionSuggestion> results;
if (json.containsKey('results')) { if (json.containsKey('results')) {
results = jsonDecoder.decodeList( results = jsonDecoder.decodeList(
jsonPath + '.results', '$jsonPath.results',
json['results'], json['results'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
CompletionSuggestion.fromJson(jsonDecoder, jsonPath, json)); CompletionSuggestion.fromJson(jsonDecoder, jsonPath, json));
@ -1536,21 +1536,21 @@ class ContextRoot implements HasToJson {
if (json is Map) { if (json is Map) {
String root; String root;
if (json.containsKey('root')) { if (json.containsKey('root')) {
root = jsonDecoder.decodeString(jsonPath + '.root', json['root']); root = jsonDecoder.decodeString('$jsonPath.root', json['root']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'root'); throw jsonDecoder.mismatch(jsonPath, 'root');
} }
List<String> exclude; List<String> exclude;
if (json.containsKey('exclude')) { if (json.containsKey('exclude')) {
exclude = jsonDecoder.decodeList( exclude = jsonDecoder.decodeList(
jsonPath + '.exclude', json['exclude'], jsonDecoder.decodeString); '$jsonPath.exclude', json['exclude'], jsonDecoder.decodeString);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'exclude'); throw jsonDecoder.mismatch(jsonPath, 'exclude');
} }
String? optionsFile; String? optionsFile;
if (json.containsKey('optionsFile')) { if (json.containsKey('optionsFile')) {
optionsFile = jsonDecoder.decodeString( optionsFile = jsonDecoder.decodeString(
jsonPath + '.optionsFile', json['optionsFile']); '$jsonPath.optionsFile', json['optionsFile']);
} }
return ContextRoot(root, exclude, optionsFile: optionsFile); return ContextRoot(root, exclude, optionsFile: optionsFile);
} else { } else {
@ -1666,19 +1666,19 @@ class EditGetAssistsParams implements RequestParams {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
@ -1748,7 +1748,7 @@ class EditGetAssistsResult implements ResponseResult {
List<PrioritizedSourceChange> assists; List<PrioritizedSourceChange> assists;
if (json.containsKey('assists')) { if (json.containsKey('assists')) {
assists = jsonDecoder.decodeList( assists = jsonDecoder.decodeList(
jsonPath + '.assists', '$jsonPath.assists',
json['assists'], json['assists'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
PrioritizedSourceChange.fromJson(jsonDecoder, jsonPath, json)); PrioritizedSourceChange.fromJson(jsonDecoder, jsonPath, json));
@ -1824,19 +1824,19 @@ class EditGetAvailableRefactoringsParams implements RequestParams {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
@ -1912,7 +1912,7 @@ class EditGetAvailableRefactoringsResult implements ResponseResult {
List<RefactoringKind> kinds; List<RefactoringKind> kinds;
if (json.containsKey('kinds')) { if (json.containsKey('kinds')) {
kinds = jsonDecoder.decodeList( kinds = jsonDecoder.decodeList(
jsonPath + '.kinds', '$jsonPath.kinds',
json['kinds'], json['kinds'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
RefactoringKind.fromJson(jsonDecoder, jsonPath, json)); RefactoringKind.fromJson(jsonDecoder, jsonPath, json));
@ -1985,13 +1985,13 @@ class EditGetFixesParams implements RequestParams {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
@ -2057,7 +2057,7 @@ class EditGetFixesResult implements ResponseResult {
List<AnalysisErrorFixes> fixes; List<AnalysisErrorFixes> fixes;
if (json.containsKey('fixes')) { if (json.containsKey('fixes')) {
fixes = jsonDecoder.decodeList( fixes = jsonDecoder.decodeList(
jsonPath + '.fixes', '$jsonPath.fixes',
json['fixes'], json['fixes'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
AnalysisErrorFixes.fromJson(jsonDecoder, jsonPath, json)); AnalysisErrorFixes.fromJson(jsonDecoder, jsonPath, json));
@ -2153,39 +2153,39 @@ class EditGetRefactoringParams implements RequestParams {
RefactoringKind kind; RefactoringKind kind;
if (json.containsKey('kind')) { if (json.containsKey('kind')) {
kind = RefactoringKind.fromJson( kind = RefactoringKind.fromJson(
jsonDecoder, jsonPath + '.kind', json['kind']); jsonDecoder, '$jsonPath.kind', json['kind']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'kind'); throw jsonDecoder.mismatch(jsonPath, 'kind');
} }
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
bool validateOnly; bool validateOnly;
if (json.containsKey('validateOnly')) { if (json.containsKey('validateOnly')) {
validateOnly = jsonDecoder.decodeBool( validateOnly = jsonDecoder.decodeBool(
jsonPath + '.validateOnly', json['validateOnly']); '$jsonPath.validateOnly', json['validateOnly']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'validateOnly'); throw jsonDecoder.mismatch(jsonPath, 'validateOnly');
} }
RefactoringOptions? options; RefactoringOptions? options;
if (json.containsKey('options')) { if (json.containsKey('options')) {
options = RefactoringOptions.fromJson( options = RefactoringOptions.fromJson(
jsonDecoder, jsonPath + '.options', json['options'], kind); jsonDecoder, '$jsonPath.options', json['options'], kind);
} }
return EditGetRefactoringParams(kind, file, offset, length, validateOnly, return EditGetRefactoringParams(kind, file, offset, length, validateOnly,
options: options); options: options);
@ -2307,7 +2307,7 @@ class EditGetRefactoringResult implements ResponseResult {
List<RefactoringProblem> initialProblems; List<RefactoringProblem> initialProblems;
if (json.containsKey('initialProblems')) { if (json.containsKey('initialProblems')) {
initialProblems = jsonDecoder.decodeList( initialProblems = jsonDecoder.decodeList(
jsonPath + '.initialProblems', '$jsonPath.initialProblems',
json['initialProblems'], json['initialProblems'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
RefactoringProblem.fromJson(jsonDecoder, jsonPath, json)); RefactoringProblem.fromJson(jsonDecoder, jsonPath, json));
@ -2317,7 +2317,7 @@ class EditGetRefactoringResult implements ResponseResult {
List<RefactoringProblem> optionsProblems; List<RefactoringProblem> optionsProblems;
if (json.containsKey('optionsProblems')) { if (json.containsKey('optionsProblems')) {
optionsProblems = jsonDecoder.decodeList( optionsProblems = jsonDecoder.decodeList(
jsonPath + '.optionsProblems', '$jsonPath.optionsProblems',
json['optionsProblems'], json['optionsProblems'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
RefactoringProblem.fromJson(jsonDecoder, jsonPath, json)); RefactoringProblem.fromJson(jsonDecoder, jsonPath, json));
@ -2327,7 +2327,7 @@ class EditGetRefactoringResult implements ResponseResult {
List<RefactoringProblem> finalProblems; List<RefactoringProblem> finalProblems;
if (json.containsKey('finalProblems')) { if (json.containsKey('finalProblems')) {
finalProblems = jsonDecoder.decodeList( finalProblems = jsonDecoder.decodeList(
jsonPath + '.finalProblems', '$jsonPath.finalProblems',
json['finalProblems'], json['finalProblems'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
RefactoringProblem.fromJson(jsonDecoder, jsonPath, json)); RefactoringProblem.fromJson(jsonDecoder, jsonPath, json));
@ -2337,16 +2337,16 @@ class EditGetRefactoringResult implements ResponseResult {
RefactoringFeedback? feedback; RefactoringFeedback? feedback;
if (json.containsKey('feedback')) { if (json.containsKey('feedback')) {
feedback = RefactoringFeedback.fromJson( feedback = RefactoringFeedback.fromJson(
jsonDecoder, jsonPath + '.feedback', json['feedback'], json); jsonDecoder, '$jsonPath.feedback', json['feedback'], json);
} }
SourceChange? change; SourceChange? change;
if (json.containsKey('change')) { if (json.containsKey('change')) {
change = SourceChange.fromJson( change = SourceChange.fromJson(
jsonDecoder, jsonPath + '.change', json['change']); jsonDecoder, '$jsonPath.change', json['change']);
} }
List<String>? potentialEdits; List<String>? potentialEdits;
if (json.containsKey('potentialEdits')) { if (json.containsKey('potentialEdits')) {
potentialEdits = jsonDecoder.decodeList(jsonPath + '.potentialEdits', potentialEdits = jsonDecoder.decodeList('$jsonPath.potentialEdits',
json['potentialEdits'], jsonDecoder.decodeString); json['potentialEdits'], jsonDecoder.decodeString);
} }
return EditGetRefactoringResult( return EditGetRefactoringResult(
@ -2470,35 +2470,35 @@ class ExtractLocalVariableFeedback extends RefactoringFeedback {
List<int>? coveringExpressionOffsets; List<int>? coveringExpressionOffsets;
if (json.containsKey('coveringExpressionOffsets')) { if (json.containsKey('coveringExpressionOffsets')) {
coveringExpressionOffsets = jsonDecoder.decodeList( coveringExpressionOffsets = jsonDecoder.decodeList(
jsonPath + '.coveringExpressionOffsets', '$jsonPath.coveringExpressionOffsets',
json['coveringExpressionOffsets'], json['coveringExpressionOffsets'],
jsonDecoder.decodeInt); jsonDecoder.decodeInt);
} }
List<int>? coveringExpressionLengths; List<int>? coveringExpressionLengths;
if (json.containsKey('coveringExpressionLengths')) { if (json.containsKey('coveringExpressionLengths')) {
coveringExpressionLengths = jsonDecoder.decodeList( coveringExpressionLengths = jsonDecoder.decodeList(
jsonPath + '.coveringExpressionLengths', '$jsonPath.coveringExpressionLengths',
json['coveringExpressionLengths'], json['coveringExpressionLengths'],
jsonDecoder.decodeInt); jsonDecoder.decodeInt);
} }
List<String> names; List<String> names;
if (json.containsKey('names')) { if (json.containsKey('names')) {
names = jsonDecoder.decodeList( names = jsonDecoder.decodeList(
jsonPath + '.names', json['names'], jsonDecoder.decodeString); '$jsonPath.names', json['names'], jsonDecoder.decodeString);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'names'); throw jsonDecoder.mismatch(jsonPath, 'names');
} }
List<int> offsets; List<int> offsets;
if (json.containsKey('offsets')) { if (json.containsKey('offsets')) {
offsets = jsonDecoder.decodeList( offsets = jsonDecoder.decodeList(
jsonPath + '.offsets', json['offsets'], jsonDecoder.decodeInt); '$jsonPath.offsets', json['offsets'], jsonDecoder.decodeInt);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offsets'); throw jsonDecoder.mismatch(jsonPath, 'offsets');
} }
List<int> lengths; List<int> lengths;
if (json.containsKey('lengths')) { if (json.containsKey('lengths')) {
lengths = jsonDecoder.decodeList( lengths = jsonDecoder.decodeList(
jsonPath + '.lengths', json['lengths'], jsonDecoder.decodeInt); '$jsonPath.lengths', json['lengths'], jsonDecoder.decodeInt);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'lengths'); throw jsonDecoder.mismatch(jsonPath, 'lengths');
} }
@ -2581,14 +2581,14 @@ class ExtractLocalVariableOptions extends RefactoringOptions {
if (json is Map) { if (json is Map) {
String name; String name;
if (json.containsKey('name')) { if (json.containsKey('name')) {
name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'name'); throw jsonDecoder.mismatch(jsonPath, 'name');
} }
bool extractAll; bool extractAll;
if (json.containsKey('extractAll')) { if (json.containsKey('extractAll')) {
extractAll = jsonDecoder.decodeBool( extractAll =
jsonPath + '.extractAll', json['extractAll']); jsonDecoder.decodeBool('$jsonPath.extractAll', json['extractAll']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'extractAll'); throw jsonDecoder.mismatch(jsonPath, 'extractAll');
} }
@ -2686,41 +2686,41 @@ class ExtractMethodFeedback extends RefactoringFeedback {
if (json is Map) { if (json is Map) {
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
String returnType; String returnType;
if (json.containsKey('returnType')) { if (json.containsKey('returnType')) {
returnType = jsonDecoder.decodeString( returnType = jsonDecoder.decodeString(
jsonPath + '.returnType', json['returnType']); '$jsonPath.returnType', json['returnType']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'returnType'); throw jsonDecoder.mismatch(jsonPath, 'returnType');
} }
List<String> names; List<String> names;
if (json.containsKey('names')) { if (json.containsKey('names')) {
names = jsonDecoder.decodeList( names = jsonDecoder.decodeList(
jsonPath + '.names', json['names'], jsonDecoder.decodeString); '$jsonPath.names', json['names'], jsonDecoder.decodeString);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'names'); throw jsonDecoder.mismatch(jsonPath, 'names');
} }
bool canCreateGetter; bool canCreateGetter;
if (json.containsKey('canCreateGetter')) { if (json.containsKey('canCreateGetter')) {
canCreateGetter = jsonDecoder.decodeBool( canCreateGetter = jsonDecoder.decodeBool(
jsonPath + '.canCreateGetter', json['canCreateGetter']); '$jsonPath.canCreateGetter', json['canCreateGetter']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'canCreateGetter'); throw jsonDecoder.mismatch(jsonPath, 'canCreateGetter');
} }
List<RefactoringMethodParameter> parameters; List<RefactoringMethodParameter> parameters;
if (json.containsKey('parameters')) { if (json.containsKey('parameters')) {
parameters = jsonDecoder.decodeList( parameters = jsonDecoder.decodeList(
jsonPath + '.parameters', '$jsonPath.parameters',
json['parameters'], json['parameters'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
RefactoringMethodParameter.fromJson( RefactoringMethodParameter.fromJson(
@ -2731,14 +2731,14 @@ class ExtractMethodFeedback extends RefactoringFeedback {
List<int> offsets; List<int> offsets;
if (json.containsKey('offsets')) { if (json.containsKey('offsets')) {
offsets = jsonDecoder.decodeList( offsets = jsonDecoder.decodeList(
jsonPath + '.offsets', json['offsets'], jsonDecoder.decodeInt); '$jsonPath.offsets', json['offsets'], jsonDecoder.decodeInt);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offsets'); throw jsonDecoder.mismatch(jsonPath, 'offsets');
} }
List<int> lengths; List<int> lengths;
if (json.containsKey('lengths')) { if (json.containsKey('lengths')) {
lengths = jsonDecoder.decodeList( lengths = jsonDecoder.decodeList(
jsonPath + '.lengths', json['lengths'], jsonDecoder.decodeInt); '$jsonPath.lengths', json['lengths'], jsonDecoder.decodeInt);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'lengths'); throw jsonDecoder.mismatch(jsonPath, 'lengths');
} }
@ -2849,27 +2849,27 @@ class ExtractMethodOptions extends RefactoringOptions {
String returnType; String returnType;
if (json.containsKey('returnType')) { if (json.containsKey('returnType')) {
returnType = jsonDecoder.decodeString( returnType = jsonDecoder.decodeString(
jsonPath + '.returnType', json['returnType']); '$jsonPath.returnType', json['returnType']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'returnType'); throw jsonDecoder.mismatch(jsonPath, 'returnType');
} }
bool createGetter; bool createGetter;
if (json.containsKey('createGetter')) { if (json.containsKey('createGetter')) {
createGetter = jsonDecoder.decodeBool( createGetter = jsonDecoder.decodeBool(
jsonPath + '.createGetter', json['createGetter']); '$jsonPath.createGetter', json['createGetter']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'createGetter'); throw jsonDecoder.mismatch(jsonPath, 'createGetter');
} }
String name; String name;
if (json.containsKey('name')) { if (json.containsKey('name')) {
name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'name'); throw jsonDecoder.mismatch(jsonPath, 'name');
} }
List<RefactoringMethodParameter> parameters; List<RefactoringMethodParameter> parameters;
if (json.containsKey('parameters')) { if (json.containsKey('parameters')) {
parameters = jsonDecoder.decodeList( parameters = jsonDecoder.decodeList(
jsonPath + '.parameters', '$jsonPath.parameters',
json['parameters'], json['parameters'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
RefactoringMethodParameter.fromJson( RefactoringMethodParameter.fromJson(
@ -2879,8 +2879,8 @@ class ExtractMethodOptions extends RefactoringOptions {
} }
bool extractAll; bool extractAll;
if (json.containsKey('extractAll')) { if (json.containsKey('extractAll')) {
extractAll = jsonDecoder.decodeBool( extractAll =
jsonPath + '.extractAll', json['extractAll']); jsonDecoder.decodeBool('$jsonPath.extractAll', json['extractAll']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'extractAll'); throw jsonDecoder.mismatch(jsonPath, 'extractAll');
} }
@ -2962,14 +2962,14 @@ class InlineLocalVariableFeedback extends RefactoringFeedback {
if (json is Map) { if (json is Map) {
String name; String name;
if (json.containsKey('name')) { if (json.containsKey('name')) {
name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'name'); throw jsonDecoder.mismatch(jsonPath, 'name');
} }
int occurrences; int occurrences;
if (json.containsKey('occurrences')) { if (json.containsKey('occurrences')) {
occurrences = jsonDecoder.decodeInt( occurrences =
jsonPath + '.occurrences', json['occurrences']); jsonDecoder.decodeInt('$jsonPath.occurrences', json['occurrences']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'occurrences'); throw jsonDecoder.mismatch(jsonPath, 'occurrences');
} }
@ -3047,20 +3047,20 @@ class InlineMethodFeedback extends RefactoringFeedback {
if (json is Map) { if (json is Map) {
String? className; String? className;
if (json.containsKey('className')) { if (json.containsKey('className')) {
className = jsonDecoder.decodeString( className =
jsonPath + '.className', json['className']); jsonDecoder.decodeString('$jsonPath.className', json['className']);
} }
String methodName; String methodName;
if (json.containsKey('methodName')) { if (json.containsKey('methodName')) {
methodName = jsonDecoder.decodeString( methodName = jsonDecoder.decodeString(
jsonPath + '.methodName', json['methodName']); '$jsonPath.methodName', json['methodName']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'methodName'); throw jsonDecoder.mismatch(jsonPath, 'methodName');
} }
bool isDeclaration; bool isDeclaration;
if (json.containsKey('isDeclaration')) { if (json.containsKey('isDeclaration')) {
isDeclaration = jsonDecoder.decodeBool( isDeclaration = jsonDecoder.decodeBool(
jsonPath + '.isDeclaration', json['isDeclaration']); '$jsonPath.isDeclaration', json['isDeclaration']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'isDeclaration'); throw jsonDecoder.mismatch(jsonPath, 'isDeclaration');
} }
@ -3130,14 +3130,14 @@ class InlineMethodOptions extends RefactoringOptions {
bool deleteSource; bool deleteSource;
if (json.containsKey('deleteSource')) { if (json.containsKey('deleteSource')) {
deleteSource = jsonDecoder.decodeBool( deleteSource = jsonDecoder.decodeBool(
jsonPath + '.deleteSource', json['deleteSource']); '$jsonPath.deleteSource', json['deleteSource']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'deleteSource'); throw jsonDecoder.mismatch(jsonPath, 'deleteSource');
} }
bool inlineAll; bool inlineAll;
if (json.containsKey('inlineAll')) { if (json.containsKey('inlineAll')) {
inlineAll = inlineAll =
jsonDecoder.decodeBool(jsonPath + '.inlineAll', json['inlineAll']); jsonDecoder.decodeBool('$jsonPath.inlineAll', json['inlineAll']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'inlineAll'); throw jsonDecoder.mismatch(jsonPath, 'inlineAll');
} }
@ -3199,7 +3199,7 @@ class KytheGetKytheEntriesParams implements RequestParams {
if (json is Map) { if (json is Map) {
String file; String file;
if (json.containsKey('file')) { if (json.containsKey('file')) {
file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); file = jsonDecoder.decodeString('$jsonPath.file', json['file']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'file'); throw jsonDecoder.mismatch(jsonPath, 'file');
} }
@ -3269,7 +3269,7 @@ class KytheGetKytheEntriesResult implements ResponseResult {
List<KytheEntry> entries; List<KytheEntry> entries;
if (json.containsKey('entries')) { if (json.containsKey('entries')) {
entries = jsonDecoder.decodeList( entries = jsonDecoder.decodeList(
jsonPath + '.entries', '$jsonPath.entries',
json['entries'], json['entries'],
(String jsonPath, Object? json) => (String jsonPath, Object? json) =>
KytheEntry.fromJson(jsonDecoder, jsonPath, json)); KytheEntry.fromJson(jsonDecoder, jsonPath, json));
@ -3279,7 +3279,7 @@ class KytheGetKytheEntriesResult implements ResponseResult {
List<String> files; List<String> files;
if (json.containsKey('files')) { if (json.containsKey('files')) {
files = jsonDecoder.decodeList( files = jsonDecoder.decodeList(
jsonPath + '.files', json['files'], jsonDecoder.decodeString); '$jsonPath.files', json['files'], jsonDecoder.decodeString);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'files'); throw jsonDecoder.mismatch(jsonPath, 'files');
} }
@ -3362,7 +3362,7 @@ class MoveFileOptions extends RefactoringOptions {
String newFile; String newFile;
if (json.containsKey('newFile')) { if (json.containsKey('newFile')) {
newFile = newFile =
jsonDecoder.decodeString(jsonPath + '.newFile', json['newFile']); jsonDecoder.decodeString('$jsonPath.newFile', json['newFile']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'newFile'); throw jsonDecoder.mismatch(jsonPath, 'newFile');
} }
@ -3431,22 +3431,21 @@ class PluginErrorParams implements HasToJson {
if (json is Map) { if (json is Map) {
bool isFatal; bool isFatal;
if (json.containsKey('isFatal')) { if (json.containsKey('isFatal')) {
isFatal = isFatal = jsonDecoder.decodeBool('$jsonPath.isFatal', json['isFatal']);
jsonDecoder.decodeBool(jsonPath + '.isFatal', json['isFatal']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'isFatal'); throw jsonDecoder.mismatch(jsonPath, 'isFatal');
} }
String message; String message;
if (json.containsKey('message')) { if (json.containsKey('message')) {
message = message =
jsonDecoder.decodeString(jsonPath + '.message', json['message']); jsonDecoder.decodeString('$jsonPath.message', json['message']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'message'); throw jsonDecoder.mismatch(jsonPath, 'message');
} }
String stackTrace; String stackTrace;
if (json.containsKey('stackTrace')) { if (json.containsKey('stackTrace')) {
stackTrace = jsonDecoder.decodeString( stackTrace = jsonDecoder.decodeString(
jsonPath + '.stackTrace', json['stackTrace']); '$jsonPath.stackTrace', json['stackTrace']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'stackTrace'); throw jsonDecoder.mismatch(jsonPath, 'stackTrace');
} }
@ -3564,21 +3563,21 @@ class PluginVersionCheckParams implements RequestParams {
String byteStorePath; String byteStorePath;
if (json.containsKey('byteStorePath')) { if (json.containsKey('byteStorePath')) {
byteStorePath = jsonDecoder.decodeString( byteStorePath = jsonDecoder.decodeString(
jsonPath + '.byteStorePath', json['byteStorePath']); '$jsonPath.byteStorePath', json['byteStorePath']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'byteStorePath'); throw jsonDecoder.mismatch(jsonPath, 'byteStorePath');
} }
String sdkPath; String sdkPath;
if (json.containsKey('sdkPath')) { if (json.containsKey('sdkPath')) {
sdkPath = sdkPath =
jsonDecoder.decodeString(jsonPath + '.sdkPath', json['sdkPath']); jsonDecoder.decodeString('$jsonPath.sdkPath', json['sdkPath']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'sdkPath'); throw jsonDecoder.mismatch(jsonPath, 'sdkPath');
} }
String version; String version;
if (json.containsKey('version')) { if (json.containsKey('version')) {
version = version =
jsonDecoder.decodeString(jsonPath + '.version', json['version']); jsonDecoder.decodeString('$jsonPath.version', json['version']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'version'); throw jsonDecoder.mismatch(jsonPath, 'version');
} }
@ -3674,34 +3673,32 @@ class PluginVersionCheckResult implements ResponseResult {
bool isCompatible; bool isCompatible;
if (json.containsKey('isCompatible')) { if (json.containsKey('isCompatible')) {
isCompatible = jsonDecoder.decodeBool( isCompatible = jsonDecoder.decodeBool(
jsonPath + '.isCompatible', json['isCompatible']); '$jsonPath.isCompatible', json['isCompatible']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'isCompatible'); throw jsonDecoder.mismatch(jsonPath, 'isCompatible');
} }
String name; String name;
if (json.containsKey('name')) { if (json.containsKey('name')) {
name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'name'); throw jsonDecoder.mismatch(jsonPath, 'name');
} }
String version; String version;
if (json.containsKey('version')) { if (json.containsKey('version')) {
version = version =
jsonDecoder.decodeString(jsonPath + '.version', json['version']); jsonDecoder.decodeString('$jsonPath.version', json['version']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'version'); throw jsonDecoder.mismatch(jsonPath, 'version');
} }
String? contactInfo; String? contactInfo;
if (json.containsKey('contactInfo')) { if (json.containsKey('contactInfo')) {
contactInfo = jsonDecoder.decodeString( contactInfo = jsonDecoder.decodeString(
jsonPath + '.contactInfo', json['contactInfo']); '$jsonPath.contactInfo', json['contactInfo']);
} }
List<String> interestingFiles; List<String> interestingFiles;
if (json.containsKey('interestingFiles')) { if (json.containsKey('interestingFiles')) {
interestingFiles = jsonDecoder.decodeList( interestingFiles = jsonDecoder.decodeList('$jsonPath.interestingFiles',
jsonPath + '.interestingFiles', json['interestingFiles'], jsonDecoder.decodeString);
json['interestingFiles'],
jsonDecoder.decodeString);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'interestingFiles'); throw jsonDecoder.mismatch(jsonPath, 'interestingFiles');
} }
@ -3790,14 +3787,14 @@ class PrioritizedSourceChange implements HasToJson {
int priority; int priority;
if (json.containsKey('priority')) { if (json.containsKey('priority')) {
priority = priority =
jsonDecoder.decodeInt(jsonPath + '.priority', json['priority']); jsonDecoder.decodeInt('$jsonPath.priority', json['priority']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'priority'); throw jsonDecoder.mismatch(jsonPath, 'priority');
} }
SourceChange change; SourceChange change;
if (json.containsKey('change')) { if (json.containsKey('change')) {
change = SourceChange.fromJson( change = SourceChange.fromJson(
jsonDecoder, jsonPath + '.change', json['change']); jsonDecoder, '$jsonPath.change', json['change']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'change'); throw jsonDecoder.mismatch(jsonPath, 'change');
} }
@ -3936,27 +3933,27 @@ class RenameFeedback extends RefactoringFeedback {
if (json is Map) { if (json is Map) {
int offset; int offset;
if (json.containsKey('offset')) { if (json.containsKey('offset')) {
offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'offset'); throw jsonDecoder.mismatch(jsonPath, 'offset');
} }
int length; int length;
if (json.containsKey('length')) { if (json.containsKey('length')) {
length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); length = jsonDecoder.decodeInt('$jsonPath.length', json['length']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'length'); throw jsonDecoder.mismatch(jsonPath, 'length');
} }
String elementKindName; String elementKindName;
if (json.containsKey('elementKindName')) { if (json.containsKey('elementKindName')) {
elementKindName = jsonDecoder.decodeString( elementKindName = jsonDecoder.decodeString(
jsonPath + '.elementKindName', json['elementKindName']); '$jsonPath.elementKindName', json['elementKindName']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'elementKindName'); throw jsonDecoder.mismatch(jsonPath, 'elementKindName');
} }
String oldName; String oldName;
if (json.containsKey('oldName')) { if (json.containsKey('oldName')) {
oldName = oldName =
jsonDecoder.decodeString(jsonPath + '.oldName', json['oldName']); jsonDecoder.decodeString('$jsonPath.oldName', json['oldName']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'oldName'); throw jsonDecoder.mismatch(jsonPath, 'oldName');
} }
@ -4019,7 +4016,7 @@ class RenameOptions extends RefactoringOptions {
String newName; String newName;
if (json.containsKey('newName')) { if (json.containsKey('newName')) {
newName = newName =
jsonDecoder.decodeString(jsonPath + '.newName', json['newName']); jsonDecoder.decodeString('$jsonPath.newName', json['newName']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'newName'); throw jsonDecoder.mismatch(jsonPath, 'newName');
} }
@ -4086,21 +4083,21 @@ class RequestError implements HasToJson {
RequestErrorCode code; RequestErrorCode code;
if (json.containsKey('code')) { if (json.containsKey('code')) {
code = RequestErrorCode.fromJson( code = RequestErrorCode.fromJson(
jsonDecoder, jsonPath + '.code', json['code']); jsonDecoder, '$jsonPath.code', json['code']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'code'); throw jsonDecoder.mismatch(jsonPath, 'code');
} }
String message; String message;
if (json.containsKey('message')) { if (json.containsKey('message')) {
message = message =
jsonDecoder.decodeString(jsonPath + '.message', json['message']); jsonDecoder.decodeString('$jsonPath.message', json['message']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'message'); throw jsonDecoder.mismatch(jsonPath, 'message');
} }
String? stackTrace; String? stackTrace;
if (json.containsKey('stackTrace')) { if (json.containsKey('stackTrace')) {
stackTrace = jsonDecoder.decodeString( stackTrace = jsonDecoder.decodeString(
jsonPath + '.stackTrace', json['stackTrace']); '$jsonPath.stackTrace', json['stackTrace']);
} }
return RequestError(code, message, stackTrace: stackTrace); return RequestError(code, message, stackTrace: stackTrace);
} else { } else {
@ -4246,13 +4243,13 @@ class WatchEvent implements HasToJson {
WatchEventType type; WatchEventType type;
if (json.containsKey('type')) { if (json.containsKey('type')) {
type = WatchEventType.fromJson( type = WatchEventType.fromJson(
jsonDecoder, jsonPath + '.type', json['type']); jsonDecoder, '$jsonPath.type', json['type']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'type'); throw jsonDecoder.mismatch(jsonPath, 'type');
} }
String path; String path;
if (json.containsKey('path')) { if (json.containsKey('path')) {
path = jsonDecoder.decodeString(jsonPath + '.path', json['path']); path = jsonDecoder.decodeString('$jsonPath.path', json['path']);
} else { } else {
throw jsonDecoder.mismatch(jsonPath, 'path'); throw jsonDecoder.mismatch(jsonPath, 'path');
} }

View file

@ -215,7 +215,7 @@ abstract class ServerIsolateChannel implements ServerCommunicationChannel {
onDone(); onDone();
} }
close(); close();
return null; return;
} }
var channelReady = Completer<void>(); var channelReady = Completer<void>();

View file

@ -21,8 +21,9 @@ final Map<String, RefactoringKind> REQUEST_ID_REFACTORING_KINDS =
void addAllEditsForSource( void addAllEditsForSource(
SourceFileEdit sourceFileEdit, Iterable<SourceEdit> edits, SourceFileEdit sourceFileEdit, Iterable<SourceEdit> edits,
{bool insertBeforeExisting = false}) { {bool insertBeforeExisting = false}) {
edits.forEach((edit) => for (var edit in edits) {
sourceFileEdit.add(edit, insertBeforeExisting: insertBeforeExisting)); sourceFileEdit.add(edit, insertBeforeExisting: insertBeforeExisting);
}
} }
/// Adds the given [sourceEdit] to the list in [sourceFileEdit] while preserving /// Adds the given [sourceEdit] to the list in [sourceFileEdit] while preserving
@ -108,9 +109,9 @@ String applyEdit(String code, SourceEdit edit) {
/// are applied in the order they appear in [edits]. Access via /// are applied in the order they appear in [edits]. Access via
/// SourceEdit.applySequence(). /// SourceEdit.applySequence().
String applySequenceOfEdits(String code, Iterable<SourceEdit> edits) { String applySequenceOfEdits(String code, Iterable<SourceEdit> edits) {
edits.forEach((SourceEdit edit) { for (var edit in edits) {
code = edit.apply(code); code = edit.apply(code);
}); }
return code; return code;
} }

View file

@ -312,7 +312,7 @@ class ChangeBuilderImpl implements ChangeBuilder {
/// [offset] such that the positions are offset by the given [delta]. /// [offset] such that the positions are offset by the given [delta].
/// Positions occur in linked edit groups and as the post-change selection. /// Positions occur in linked edit groups and as the post-change selection.
void _updatePositions(int offset, int delta) { void _updatePositions(int offset, int delta) {
void _updatePosition(Position position) { void updatePosition(Position position) {
if (position.offset >= offset && !_lockedPositions.contains(position)) { if (position.offset >= offset && !_lockedPositions.contains(position)) {
position.offset = position.offset + delta; position.offset = position.offset + delta;
} }
@ -320,12 +320,12 @@ class ChangeBuilderImpl implements ChangeBuilder {
for (var group in _linkedEditGroups.values) { for (var group in _linkedEditGroups.values) {
for (var position in group.positions) { for (var position in group.positions) {
_updatePosition(position); updatePosition(position);
} }
} }
var selection = _selection; var selection = _selection;
if (selection != null) { if (selection != null) {
_updatePosition(selection); updatePosition(selection);
} }
} }
} }
@ -639,7 +639,9 @@ class LinkedEditBuilderImpl implements LinkedEditBuilder {
@override @override
void addSuggestions(LinkedEditSuggestionKind kind, Iterable<String> values) { void addSuggestions(LinkedEditSuggestionKind kind, Iterable<String> values) {
values.forEach((value) => addSuggestion(kind, value)); for (var value in values) {
addSuggestion(kind, value);
}
} }
@override @override

View file

@ -526,7 +526,7 @@ class CompletionTarget {
static Token? _computeDroppedToken( static Token? _computeDroppedToken(
AstNode containingNode, Object? entity, int offset) { AstNode containingNode, Object? entity, int offset) {
// Find the last token of the member before the entity. // Find the last token of the member before the entity.
var previousMember; SyntacticEntity? previousMember;
for (var member in containingNode.childEntities) { for (var member in containingNode.childEntities) {
if (entity == member) { if (entity == member) {
break; break;

View file

@ -116,9 +116,9 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor {
declaredLocalVar(loopVariable.identifier, loopVariable.type); declaredLocalVar(loopVariable.identifier, loopVariable.type);
} else if (forLoopParts is ForPartsWithDeclarations) { } else if (forLoopParts is ForPartsWithDeclarations) {
var varList = forLoopParts.variables; var varList = forLoopParts.variables;
varList.variables.forEach((VariableDeclaration varDecl) { for (var varDecl in varList.variables) {
declaredLocalVar(varDecl.name, varList.type); declaredLocalVar(varDecl.name, varList.type);
}); }
} }
visitNode(node); visitNode(node);
} }
@ -131,9 +131,9 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor {
declaredLocalVar(loopVariable.identifier, loopVariable.type); declaredLocalVar(loopVariable.identifier, loopVariable.type);
} else if (forLoopParts is ForPartsWithDeclarations) { } else if (forLoopParts is ForPartsWithDeclarations) {
var varList = forLoopParts.variables; var varList = forLoopParts.variables;
varList.variables.forEach((VariableDeclaration varDecl) { for (var varDecl in varList.variables) {
declaredLocalVar(varDecl.name, varList.type); declaredLocalVar(varDecl.name, varList.type);
}); }
} }
visitNode(node); visitNode(node);
} }
@ -214,9 +214,9 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor {
void _visitClassOrMixinMembers(List<ClassMember> members) { void _visitClassOrMixinMembers(List<ClassMember> members) {
for (var member in members) { for (var member in members) {
if (member is FieldDeclaration) { if (member is FieldDeclaration) {
member.fields.variables.forEach((VariableDeclaration varDecl) { for (var varDecl in member.fields.variables) {
declaredField(member, varDecl); declaredField(member, varDecl);
}); }
} else if (member is MethodDeclaration) { } else if (member is MethodDeclaration) {
declaredMethod(member); declaredMethod(member);
_visitTypeParameters(member, member.typeParameters); _visitTypeParameters(member, member.typeParameters);
@ -225,7 +225,7 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor {
} }
void _visitCompilationUnit(CompilationUnit node) { void _visitCompilationUnit(CompilationUnit node) {
node.declarations.forEach((Declaration declaration) { for (var declaration in node.declarations) {
if (declaration is ClassDeclaration) { if (declaration is ClassDeclaration) {
declaredClass(declaration); declaredClass(declaration);
_visitTypeParameters(declaration, declaration.typeParameters); _visitTypeParameters(declaration, declaration.typeParameters);
@ -251,9 +251,9 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor {
); );
} else if (declaration is TopLevelVariableDeclaration) { } else if (declaration is TopLevelVariableDeclaration) {
var varList = declaration.variables; var varList = declaration.variables;
varList.variables.forEach((VariableDeclaration varDecl) { for (var varDecl in varList.variables) {
declaredTopLevelVar(varList, varDecl); declaredTopLevelVar(varList, varDecl);
}); }
} else if (declaration is ClassTypeAlias) { } else if (declaration is ClassTypeAlias) {
declaredClassTypeAlias(declaration); declaredClassTypeAlias(declaration);
_visitTypeParameters(declaration, declaration.typeParameters); _visitTypeParameters(declaration, declaration.typeParameters);
@ -272,12 +272,12 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor {
declaredMixin(declaration); declaredMixin(declaration);
_visitTypeParameters(declaration, declaration.typeParameters); _visitTypeParameters(declaration, declaration.typeParameters);
} }
}); }
} }
void _visitParamList(FormalParameterList? paramList) { void _visitParamList(FormalParameterList? paramList) {
if (paramList != null) { if (paramList != null) {
paramList.parameters.forEach((FormalParameter param) { for (var param in paramList.parameters) {
NormalFormalParameter? normalParam; NormalFormalParameter? normalParam;
if (param is DefaultFormalParameter) { if (param is DefaultFormalParameter) {
normalParam = param.parameter; normalParam = param.parameter;
@ -294,7 +294,7 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor {
} }
var name = param.identifier; var name = param.identifier;
declaredParam(name!, type); declaredParam(name!, type);
}); }
} }
} }

View file

@ -114,7 +114,7 @@ class FixKind {
int get hashCode => id.hashCode; int get hashCode => id.hashCode;
@override @override
bool operator ==(o) => o is FixKind && o.id == id; bool operator ==(other) => other is FixKind && other.id == id;
@override @override
String toString() => id; String toString() => id;

View file

@ -19,6 +19,7 @@ dependencies:
# See also https://dart.dev/tools/pub/dependencies. # See also https://dart.dev/tools/pub/dependencies.
dev_dependencies: dev_dependencies:
analyzer_utilities: any analyzer_utilities: any
lints: any
meta: any meta: any
path: any path: any
test_reflective_loader: any test_reflective_loader: any

View file

@ -447,6 +447,7 @@ class Server {
return; return;
} }
_recordStdio('RECV: $trimmedLine'); _recordStdio('RECV: $trimmedLine');
// ignore: prefer_typing_uninitialized_variables
var message; var message;
try { try {
message = json.decoder.convert(trimmedLine); message = json.decoder.convert(trimmedLine);

View file

@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a // for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file. // BSD-style license that can be found in the LICENSE file.
// ignore_for_file: camel_case_types
import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart'; import 'package:analyzer/dart/element/nullability_suffix.dart';
@ -1743,7 +1745,7 @@ _prefix0.A1 a1; _prefix0.A2 a2; _prefix1.B b;''');
Future<void> _assertWriteType(String typeCode, {String? declarations}) async { Future<void> _assertWriteType(String typeCode, {String? declarations}) async {
var path = convertPath('/home/test/lib/test.dart'); var path = convertPath('/home/test/lib/test.dart');
var content = (declarations ?? '') + '$typeCode v;'; var content = '${declarations ?? ''}$typeCode v;';
addSource(path, content); addSource(path, content);
var f = await _getTopLevelAccessorElement(path, 'v'); var f = await _getTopLevelAccessorElement(path, 'v');

View file

@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a // for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file. // BSD-style license that can be found in the LICENSE file.
// ignore_for_file: camel_case_types
import 'package:analyzer/dart/analysis/results.dart'; import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart'; import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'; import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';

View file

@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a // for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file. // BSD-style license that can be found in the LICENSE file.
// ignore_for_file: camel_case_types
import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/source/source_range.dart'; import 'package:analyzer/source/source_range.dart';
import 'package:analyzer/src/generated/source.dart'; import 'package:analyzer/src/generated/source.dart';

View file

@ -563,7 +563,7 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
for (var field in type.fields) { for (var field in type.fields) {
var fieldNameString = literalString(field.name); var fieldNameString = literalString(field.name);
var fieldAccessor = 'json[$fieldNameString]'; var fieldAccessor = 'json[$fieldNameString]';
var jsonPath = 'jsonPath + ${literalString('.${field.name}')}'; var jsonPath = literalString('\$jsonPath.${field.name}');
if (field.value != null) { if (field.value != null) {
var valueString = literalString(field.value as String); var valueString = literalString(field.value as String);
writeln('if ($fieldAccessor != $valueString) {'); writeln('if ($fieldAccessor != $valueString) {');

View file

@ -103,14 +103,14 @@ class _ConstantVisitor extends HierarchicalApiVisitor {
if (type == null) { if (type == null) {
return; return;
} }
type.fields.forEach((TypeObjectField field) { for (var field in type.fields) {
var name = field.name; var name = field.name;
var components = <String>[]; var components = <String>[];
components.add(parentName); components.add(parentName);
components.addAll(_split(name)); components.addAll(_split(name));
var fieldConstantName = _fromComponents(components); var fieldConstantName = _fromComponents(components);
constants.add(_Constant(fieldConstantName, "'$name'")); constants.add(_Constant(fieldConstantName, "'$name'"));
}); }
} }
/// Return a name generated by converting each of the given [components] to an /// Return a name generated by converting each of the given [components] to an