From 9282573e2c3556798898be9d2b502802e1eb9cb9 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Wed, 6 Jul 2022 19:54:00 +0000 Subject: [PATCH] [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 Reviewed-by: Konstantin Shcheglov Reviewed-by: Samuel Rawlins Reviewed-by: Brian Wilkerson --- .../analysis_options.yaml | 65 +---- .../lib/src/protocol/protocol_common.dart | 257 +++++++++--------- .../lib/src/protocol/protocol_internal.dart | 9 +- pkg/analysis_server_client/pubspec.yaml | 1 + pkg/analyzer_plugin/analysis_options.yaml | 70 ++--- .../lib/protocol/protocol_common.dart | 257 +++++++++--------- .../lib/protocol/protocol_generated.dart | 237 ++++++++-------- .../lib/src/channel/isolate_channel.dart | 2 +- .../lib/src/protocol/protocol_internal.dart | 9 +- .../change_builder/change_builder_core.dart | 10 +- .../completion/completion_target.dart | 2 +- .../visitors/local_declaration_visitor.dart | 24 +- .../lib/utilities/fixes/fixes.dart | 2 +- pkg/analyzer_plugin/pubspec.yaml | 1 + .../support/integration_tests.dart | 1 + .../change_builder_dart_test.dart | 4 +- .../dart/import_library_element_test.dart | 2 + .../test/utilities/range_factory_test.dart | 2 + .../tool/spec/codegen_dart_protocol.dart | 2 +- .../tool/spec/codegen_protocol_constants.dart | 4 +- 20 files changed, 445 insertions(+), 516 deletions(-) diff --git a/pkg/analysis_server_client/analysis_options.yaml b/pkg/analysis_server_client/analysis_options.yaml index e4fce7efa23..fd44484a92b 100644 --- a/pkg/analysis_server_client/analysis_options.yaml +++ b/pkg/analysis_server_client/analysis_options.yaml @@ -1,58 +1,13 @@ -analyzer: - #strong-mode: - # implicit-casts: false +include: package:lints/recommended.yaml linter: rules: - - await_only_futures - - depend_on_referenced_packages - - empty_statements - - unnecessary_brace_in_string_interps - # - # From pedantic 1.9.0: - # - - always_declare_return_types - - always_require_non_null_named_parameters - - 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 + # In addition to lints/recommended: + always_declare_return_types: true + omit_local_variable_types: true + prefer_single_quotes: true + unawaited_futures: true + + # Remove from lints/recommended: + constant_identifier_names: false + non_constant_identifier_names: false diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_common.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_common.dart index 10de55117cb..cd84e7150e2 100644 --- a/pkg/analysis_server_client/lib/src/protocol/protocol_common.dart +++ b/pkg/analysis_server_client/lib/src/protocol/protocol_common.dart @@ -37,7 +37,7 @@ class AddContentOverlay implements HasToJson { String content; if (json.containsKey('content')) { content = - jsonDecoder.decodeString(jsonPath + '.content', json['content']); + jsonDecoder.decodeString('$jsonPath.content', json['content']); } else { throw jsonDecoder.mismatch(jsonPath, 'content'); } @@ -139,57 +139,57 @@ class AnalysisError implements HasToJson { AnalysisErrorSeverity severity; if (json.containsKey('severity')) { severity = AnalysisErrorSeverity.fromJson( - jsonDecoder, jsonPath + '.severity', json['severity']); + jsonDecoder, '$jsonPath.severity', json['severity']); } else { throw jsonDecoder.mismatch(jsonPath, 'severity'); } AnalysisErrorType type; if (json.containsKey('type')) { type = AnalysisErrorType.fromJson( - jsonDecoder, jsonPath + '.type', json['type']); + jsonDecoder, '$jsonPath.type', json['type']); } else { throw jsonDecoder.mismatch(jsonPath, 'type'); } Location location; if (json.containsKey('location')) { location = Location.fromJson( - jsonDecoder, jsonPath + '.location', json['location']); + jsonDecoder, '$jsonPath.location', json['location']); } else { throw jsonDecoder.mismatch(jsonPath, 'location'); } String message; if (json.containsKey('message')) { message = - jsonDecoder.decodeString(jsonPath + '.message', json['message']); + jsonDecoder.decodeString('$jsonPath.message', json['message']); } else { throw jsonDecoder.mismatch(jsonPath, 'message'); } String? correction; if (json.containsKey('correction')) { correction = jsonDecoder.decodeString( - jsonPath + '.correction', json['correction']); + '$jsonPath.correction', json['correction']); } String code; if (json.containsKey('code')) { - code = jsonDecoder.decodeString(jsonPath + '.code', json['code']); + code = jsonDecoder.decodeString('$jsonPath.code', json['code']); } else { throw jsonDecoder.mismatch(jsonPath, 'code'); } String? url; if (json.containsKey('url')) { - url = jsonDecoder.decodeString(jsonPath + '.url', json['url']); + url = jsonDecoder.decodeString('$jsonPath.url', json['url']); } List? contextMessages; if (json.containsKey('contextMessages')) { contextMessages = jsonDecoder.decodeList( - jsonPath + '.contextMessages', + '$jsonPath.contextMessages', json['contextMessages'], (String jsonPath, Object? json) => DiagnosticMessage.fromJson(jsonDecoder, jsonPath, json)); } bool? 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, correction: correction, @@ -440,7 +440,7 @@ class ChangeContentOverlay implements HasToJson { List edits; if (json.containsKey('edits')) { edits = jsonDecoder.decodeList( - jsonPath + '.edits', + '$jsonPath.edits', json['edits'], (String jsonPath, Object? json) => SourceEdit.fromJson(jsonDecoder, jsonPath, json)); @@ -673,145 +673,144 @@ class CompletionSuggestion implements HasToJson { CompletionSuggestionKind kind; if (json.containsKey('kind')) { kind = CompletionSuggestionKind.fromJson( - jsonDecoder, jsonPath + '.kind', json['kind']); + jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } int relevance; if (json.containsKey('relevance')) { relevance = - jsonDecoder.decodeInt(jsonPath + '.relevance', json['relevance']); + jsonDecoder.decodeInt('$jsonPath.relevance', json['relevance']); } else { throw jsonDecoder.mismatch(jsonPath, 'relevance'); } String completion; if (json.containsKey('completion')) { completion = jsonDecoder.decodeString( - jsonPath + '.completion', json['completion']); + '$jsonPath.completion', json['completion']); } else { throw jsonDecoder.mismatch(jsonPath, 'completion'); } String? displayText; if (json.containsKey('displayText')) { displayText = jsonDecoder.decodeString( - jsonPath + '.displayText', json['displayText']); + '$jsonPath.displayText', json['displayText']); } int? replacementOffset; if (json.containsKey('replacementOffset')) { replacementOffset = jsonDecoder.decodeInt( - jsonPath + '.replacementOffset', json['replacementOffset']); + '$jsonPath.replacementOffset', json['replacementOffset']); } int? replacementLength; if (json.containsKey('replacementLength')) { replacementLength = jsonDecoder.decodeInt( - jsonPath + '.replacementLength', json['replacementLength']); + '$jsonPath.replacementLength', json['replacementLength']); } int selectionOffset; if (json.containsKey('selectionOffset')) { selectionOffset = jsonDecoder.decodeInt( - jsonPath + '.selectionOffset', json['selectionOffset']); + '$jsonPath.selectionOffset', json['selectionOffset']); } else { throw jsonDecoder.mismatch(jsonPath, 'selectionOffset'); } int selectionLength; if (json.containsKey('selectionLength')) { selectionLength = jsonDecoder.decodeInt( - jsonPath + '.selectionLength', json['selectionLength']); + '$jsonPath.selectionLength', json['selectionLength']); } else { throw jsonDecoder.mismatch(jsonPath, 'selectionLength'); } bool isDeprecated; if (json.containsKey('isDeprecated')) { isDeprecated = jsonDecoder.decodeBool( - jsonPath + '.isDeprecated', json['isDeprecated']); + '$jsonPath.isDeprecated', json['isDeprecated']); } else { throw jsonDecoder.mismatch(jsonPath, 'isDeprecated'); } bool isPotential; if (json.containsKey('isPotential')) { isPotential = jsonDecoder.decodeBool( - jsonPath + '.isPotential', json['isPotential']); + '$jsonPath.isPotential', json['isPotential']); } else { throw jsonDecoder.mismatch(jsonPath, 'isPotential'); } String? docSummary; if (json.containsKey('docSummary')) { docSummary = jsonDecoder.decodeString( - jsonPath + '.docSummary', json['docSummary']); + '$jsonPath.docSummary', json['docSummary']); } String? docComplete; if (json.containsKey('docComplete')) { docComplete = jsonDecoder.decodeString( - jsonPath + '.docComplete', json['docComplete']); + '$jsonPath.docComplete', json['docComplete']); } String? declaringType; if (json.containsKey('declaringType')) { declaringType = jsonDecoder.decodeString( - jsonPath + '.declaringType', json['declaringType']); + '$jsonPath.declaringType', json['declaringType']); } String? defaultArgumentListString; if (json.containsKey('defaultArgumentListString')) { defaultArgumentListString = jsonDecoder.decodeString( - jsonPath + '.defaultArgumentListString', + '$jsonPath.defaultArgumentListString', json['defaultArgumentListString']); } List? defaultArgumentListTextRanges; if (json.containsKey('defaultArgumentListTextRanges')) { defaultArgumentListTextRanges = jsonDecoder.decodeList( - jsonPath + '.defaultArgumentListTextRanges', + '$jsonPath.defaultArgumentListTextRanges', json['defaultArgumentListTextRanges'], jsonDecoder.decodeInt); } Element? element; if (json.containsKey('element')) { - element = Element.fromJson( - jsonDecoder, jsonPath + '.element', json['element']); + element = + Element.fromJson(jsonDecoder, '$jsonPath.element', json['element']); } String? returnType; if (json.containsKey('returnType')) { returnType = jsonDecoder.decodeString( - jsonPath + '.returnType', json['returnType']); + '$jsonPath.returnType', json['returnType']); } List? parameterNames; if (json.containsKey('parameterNames')) { - parameterNames = jsonDecoder.decodeList(jsonPath + '.parameterNames', + parameterNames = jsonDecoder.decodeList('$jsonPath.parameterNames', json['parameterNames'], jsonDecoder.decodeString); } List? parameterTypes; if (json.containsKey('parameterTypes')) { - parameterTypes = jsonDecoder.decodeList(jsonPath + '.parameterTypes', + parameterTypes = jsonDecoder.decodeList('$jsonPath.parameterTypes', json['parameterTypes'], jsonDecoder.decodeString); } int? requiredParameterCount; if (json.containsKey('requiredParameterCount')) { requiredParameterCount = jsonDecoder.decodeInt( - jsonPath + '.requiredParameterCount', - json['requiredParameterCount']); + '$jsonPath.requiredParameterCount', json['requiredParameterCount']); } bool? hasNamedParameters; if (json.containsKey('hasNamedParameters')) { hasNamedParameters = jsonDecoder.decodeBool( - jsonPath + '.hasNamedParameters', json['hasNamedParameters']); + '$jsonPath.hasNamedParameters', json['hasNamedParameters']); } String? parameterName; if (json.containsKey('parameterName')) { parameterName = jsonDecoder.decodeString( - jsonPath + '.parameterName', json['parameterName']); + '$jsonPath.parameterName', json['parameterName']); } String? parameterType; if (json.containsKey('parameterType')) { parameterType = jsonDecoder.decodeString( - jsonPath + '.parameterType', json['parameterType']); + '$jsonPath.parameterType', json['parameterType']); } String? libraryUri; if (json.containsKey('libraryUri')) { libraryUri = jsonDecoder.decodeString( - jsonPath + '.libraryUri', json['libraryUri']); + '$jsonPath.libraryUri', json['libraryUri']); } bool? isNotImported; if (json.containsKey('isNotImported')) { isNotImported = jsonDecoder.decodeBool( - jsonPath + '.isNotImported', json['isNotImported']); + '$jsonPath.isNotImported', json['isNotImported']); } return CompletionSuggestion(kind, relevance, completion, selectionOffset, selectionLength, isDeprecated, isPotential, @@ -1146,14 +1145,14 @@ class DiagnosticMessage implements HasToJson { String message; if (json.containsKey('message')) { message = - jsonDecoder.decodeString(jsonPath + '.message', json['message']); + jsonDecoder.decodeString('$jsonPath.message', json['message']); } else { throw jsonDecoder.mismatch(jsonPath, 'message'); } Location location; if (json.containsKey('location')) { location = Location.fromJson( - jsonDecoder, jsonPath + '.location', json['location']); + jsonDecoder, '$jsonPath.location', json['location']); } else { throw jsonDecoder.mismatch(jsonPath, 'location'); } @@ -1282,46 +1281,46 @@ class Element implements HasToJson { ElementKind kind; if (json.containsKey('kind')) { kind = - ElementKind.fromJson(jsonDecoder, jsonPath + '.kind', json['kind']); + ElementKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } String name; if (json.containsKey('name')) { - name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); + name = jsonDecoder.decodeString('$jsonPath.name', json['name']); } else { throw jsonDecoder.mismatch(jsonPath, 'name'); } Location? location; if (json.containsKey('location')) { location = Location.fromJson( - jsonDecoder, jsonPath + '.location', json['location']); + jsonDecoder, '$jsonPath.location', json['location']); } int flags; if (json.containsKey('flags')) { - flags = jsonDecoder.decodeInt(jsonPath + '.flags', json['flags']); + flags = jsonDecoder.decodeInt('$jsonPath.flags', json['flags']); } else { throw jsonDecoder.mismatch(jsonPath, 'flags'); } String? parameters; if (json.containsKey('parameters')) { parameters = jsonDecoder.decodeString( - jsonPath + '.parameters', json['parameters']); + '$jsonPath.parameters', json['parameters']); } String? returnType; if (json.containsKey('returnType')) { returnType = jsonDecoder.decodeString( - jsonPath + '.returnType', json['returnType']); + '$jsonPath.returnType', json['returnType']); } String? typeParameters; if (json.containsKey('typeParameters')) { typeParameters = jsonDecoder.decodeString( - jsonPath + '.typeParameters', json['typeParameters']); + '$jsonPath.typeParameters', json['typeParameters']); } String? aliasedType; if (json.containsKey('aliasedType')) { aliasedType = jsonDecoder.decodeString( - jsonPath + '.aliasedType', json['aliasedType']); + '$jsonPath.aliasedType', json['aliasedType']); } return Element(kind, name, flags, location: location, @@ -1748,19 +1747,19 @@ class FoldingRegion implements HasToJson { FoldingKind kind; if (json.containsKey('kind')) { kind = - FoldingKind.fromJson(jsonDecoder, jsonPath + '.kind', json['kind']); + FoldingKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } @@ -1828,19 +1827,19 @@ class HighlightRegion implements HasToJson { HighlightRegionType type; if (json.containsKey('type')) { type = HighlightRegionType.fromJson( - jsonDecoder, jsonPath + '.type', json['type']); + jsonDecoder, '$jsonPath.type', json['type']); } else { throw jsonDecoder.mismatch(jsonPath, 'type'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } @@ -2522,29 +2521,29 @@ class KytheEntry implements HasToJson { KytheVName source; if (json.containsKey('source')) { source = KytheVName.fromJson( - jsonDecoder, jsonPath + '.source', json['source']); + jsonDecoder, '$jsonPath.source', json['source']); } else { throw jsonDecoder.mismatch(jsonPath, 'source'); } String? kind; if (json.containsKey('kind')) { - kind = jsonDecoder.decodeString(jsonPath + '.kind', json['kind']); + kind = jsonDecoder.decodeString('$jsonPath.kind', json['kind']); } KytheVName? target; if (json.containsKey('target')) { target = KytheVName.fromJson( - jsonDecoder, jsonPath + '.target', json['target']); + jsonDecoder, '$jsonPath.target', json['target']); } String fact; if (json.containsKey('fact')) { - fact = jsonDecoder.decodeString(jsonPath + '.fact', json['fact']); + fact = jsonDecoder.decodeString('$jsonPath.fact', json['fact']); } else { throw jsonDecoder.mismatch(jsonPath, 'fact'); } List? value; if (json.containsKey('value')) { 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); } else { @@ -2637,33 +2636,33 @@ class KytheVName implements HasToJson { if (json is Map) { String signature; if (json.containsKey('signature')) { - signature = jsonDecoder.decodeString( - jsonPath + '.signature', json['signature']); + signature = + jsonDecoder.decodeString('$jsonPath.signature', json['signature']); } else { throw jsonDecoder.mismatch(jsonPath, 'signature'); } String corpus; if (json.containsKey('corpus')) { - corpus = jsonDecoder.decodeString(jsonPath + '.corpus', json['corpus']); + corpus = jsonDecoder.decodeString('$jsonPath.corpus', json['corpus']); } else { throw jsonDecoder.mismatch(jsonPath, 'corpus'); } String root; if (json.containsKey('root')) { - root = jsonDecoder.decodeString(jsonPath + '.root', json['root']); + root = jsonDecoder.decodeString('$jsonPath.root', json['root']); } else { throw jsonDecoder.mismatch(jsonPath, 'root'); } String path; if (json.containsKey('path')) { - path = jsonDecoder.decodeString(jsonPath + '.path', json['path']); + path = jsonDecoder.decodeString('$jsonPath.path', json['path']); } else { throw jsonDecoder.mismatch(jsonPath, 'path'); } String language; if (json.containsKey('language')) { language = - jsonDecoder.decodeString(jsonPath + '.language', json['language']); + jsonDecoder.decodeString('$jsonPath.language', json['language']); } else { throw jsonDecoder.mismatch(jsonPath, 'language'); } @@ -2739,7 +2738,7 @@ class LinkedEditGroup implements HasToJson { List positions; if (json.containsKey('positions')) { positions = jsonDecoder.decodeList( - jsonPath + '.positions', + '$jsonPath.positions', json['positions'], (String jsonPath, Object? json) => Position.fromJson(jsonDecoder, jsonPath, json)); @@ -2748,14 +2747,14 @@ class LinkedEditGroup implements HasToJson { } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } List suggestions; if (json.containsKey('suggestions')) { suggestions = jsonDecoder.decodeList( - jsonPath + '.suggestions', + '$jsonPath.suggestions', json['suggestions'], (String jsonPath, Object? json) => LinkedEditSuggestion.fromJson(jsonDecoder, jsonPath, json)); @@ -2840,14 +2839,14 @@ class LinkedEditSuggestion implements HasToJson { if (json is Map) { String value; if (json.containsKey('value')) { - value = jsonDecoder.decodeString(jsonPath + '.value', json['value']); + value = jsonDecoder.decodeString('$jsonPath.value', json['value']); } else { throw jsonDecoder.mismatch(jsonPath, 'value'); } LinkedEditSuggestionKind kind; if (json.containsKey('kind')) { kind = LinkedEditSuggestionKind.fromJson( - jsonDecoder, jsonPath + '.kind', json['kind']); + jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } @@ -2996,44 +2995,44 @@ class Location implements HasToJson { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } int startLine; if (json.containsKey('startLine')) { startLine = - jsonDecoder.decodeInt(jsonPath + '.startLine', json['startLine']); + jsonDecoder.decodeInt('$jsonPath.startLine', json['startLine']); } else { throw jsonDecoder.mismatch(jsonPath, 'startLine'); } int startColumn; if (json.containsKey('startColumn')) { - startColumn = jsonDecoder.decodeInt( - jsonPath + '.startColumn', json['startColumn']); + startColumn = + jsonDecoder.decodeInt('$jsonPath.startColumn', json['startColumn']); } else { throw jsonDecoder.mismatch(jsonPath, 'startColumn'); } int? endLine; if (json.containsKey('endLine')) { - endLine = jsonDecoder.decodeInt(jsonPath + '.endLine', json['endLine']); + endLine = jsonDecoder.decodeInt('$jsonPath.endLine', json['endLine']); } int? endColumn; if (json.containsKey('endColumn')) { endColumn = - jsonDecoder.decodeInt(jsonPath + '.endColumn', json['endColumn']); + jsonDecoder.decodeInt('$jsonPath.endColumn', json['endColumn']); } return Location(file, offset, length, startLine, startColumn, endLine: endLine, endColumn: endColumn); @@ -3119,20 +3118,20 @@ class NavigationRegion implements HasToJson { if (json is Map) { int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } List targets; if (json.containsKey('targets')) { targets = jsonDecoder.decodeList( - jsonPath + '.targets', json['targets'], jsonDecoder.decodeInt); + '$jsonPath.targets', json['targets'], jsonDecoder.decodeInt); } else { throw jsonDecoder.mismatch(jsonPath, 'targets'); } @@ -3225,52 +3224,52 @@ class NavigationTarget implements HasToJson { ElementKind kind; if (json.containsKey('kind')) { kind = - ElementKind.fromJson(jsonDecoder, jsonPath + '.kind', json['kind']); + ElementKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } int fileIndex; if (json.containsKey('fileIndex')) { fileIndex = - jsonDecoder.decodeInt(jsonPath + '.fileIndex', json['fileIndex']); + jsonDecoder.decodeInt('$jsonPath.fileIndex', json['fileIndex']); } else { throw jsonDecoder.mismatch(jsonPath, 'fileIndex'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } int startLine; if (json.containsKey('startLine')) { startLine = - jsonDecoder.decodeInt(jsonPath + '.startLine', json['startLine']); + jsonDecoder.decodeInt('$jsonPath.startLine', json['startLine']); } else { throw jsonDecoder.mismatch(jsonPath, 'startLine'); } int startColumn; if (json.containsKey('startColumn')) { - startColumn = jsonDecoder.decodeInt( - jsonPath + '.startColumn', json['startColumn']); + startColumn = + jsonDecoder.decodeInt('$jsonPath.startColumn', json['startColumn']); } else { throw jsonDecoder.mismatch(jsonPath, 'startColumn'); } int? codeOffset; if (json.containsKey('codeOffset')) { codeOffset = - jsonDecoder.decodeInt(jsonPath + '.codeOffset', json['codeOffset']); + jsonDecoder.decodeInt('$jsonPath.codeOffset', json['codeOffset']); } int? codeLength; if (json.containsKey('codeLength')) { codeLength = - jsonDecoder.decodeInt(jsonPath + '.codeLength', json['codeLength']); + jsonDecoder.decodeInt('$jsonPath.codeLength', json['codeLength']); } return NavigationTarget( kind, fileIndex, offset, length, startLine, startColumn, @@ -3358,21 +3357,21 @@ class Occurrences implements HasToJson { if (json is Map) { Element element; if (json.containsKey('element')) { - element = Element.fromJson( - jsonDecoder, jsonPath + '.element', json['element']); + element = + Element.fromJson(jsonDecoder, '$jsonPath.element', json['element']); } else { throw jsonDecoder.mismatch(jsonPath, 'element'); } List offsets; if (json.containsKey('offsets')) { offsets = jsonDecoder.decodeList( - jsonPath + '.offsets', json['offsets'], jsonDecoder.decodeInt); + '$jsonPath.offsets', json['offsets'], jsonDecoder.decodeInt); } else { throw jsonDecoder.mismatch(jsonPath, 'offsets'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } @@ -3458,41 +3457,41 @@ class Outline implements HasToJson { if (json is Map) { Element element; if (json.containsKey('element')) { - element = Element.fromJson( - jsonDecoder, jsonPath + '.element', json['element']); + element = + Element.fromJson(jsonDecoder, '$jsonPath.element', json['element']); } else { throw jsonDecoder.mismatch(jsonPath, 'element'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } int codeOffset; if (json.containsKey('codeOffset')) { codeOffset = - jsonDecoder.decodeInt(jsonPath + '.codeOffset', json['codeOffset']); + jsonDecoder.decodeInt('$jsonPath.codeOffset', json['codeOffset']); } else { throw jsonDecoder.mismatch(jsonPath, 'codeOffset'); } int codeLength; if (json.containsKey('codeLength')) { codeLength = - jsonDecoder.decodeInt(jsonPath + '.codeLength', json['codeLength']); + jsonDecoder.decodeInt('$jsonPath.codeLength', json['codeLength']); } else { throw jsonDecoder.mismatch(jsonPath, 'codeLength'); } List? children; if (json.containsKey('children')) { children = jsonDecoder.decodeList( - jsonPath + '.children', + '$jsonPath.children', json['children'], (String jsonPath, Object? json) => Outline.fromJson(jsonDecoder, jsonPath, json)); @@ -3579,27 +3578,27 @@ class ParameterInfo implements HasToJson { if (json is Map) { ParameterKind kind; if (json.containsKey('kind')) { - kind = ParameterKind.fromJson( - jsonDecoder, jsonPath + '.kind', json['kind']); + kind = + ParameterKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } String name; if (json.containsKey('name')) { - name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); + name = jsonDecoder.decodeString('$jsonPath.name', json['name']); } else { throw jsonDecoder.mismatch(jsonPath, 'name'); } String type; if (json.containsKey('type')) { - type = jsonDecoder.decodeString(jsonPath + '.type', json['type']); + type = jsonDecoder.decodeString('$jsonPath.type', json['type']); } else { throw jsonDecoder.mismatch(jsonPath, 'type'); } String? defaultValue; if (json.containsKey('defaultValue')) { defaultValue = jsonDecoder.decodeString( - jsonPath + '.defaultValue', json['defaultValue']); + '$jsonPath.defaultValue', json['defaultValue']); } return ParameterInfo(kind, name, type, defaultValue: defaultValue); } else { @@ -3736,13 +3735,13 @@ class Position implements HasToJson { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } @@ -3919,31 +3918,31 @@ class RefactoringMethodParameter implements HasToJson { if (json is Map) { String? id; if (json.containsKey('id')) { - id = jsonDecoder.decodeString(jsonPath + '.id', json['id']); + id = jsonDecoder.decodeString('$jsonPath.id', json['id']); } RefactoringMethodParameterKind kind; if (json.containsKey('kind')) { kind = RefactoringMethodParameterKind.fromJson( - jsonDecoder, jsonPath + '.kind', json['kind']); + jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } String type; if (json.containsKey('type')) { - type = jsonDecoder.decodeString(jsonPath + '.type', json['type']); + type = jsonDecoder.decodeString('$jsonPath.type', json['type']); } else { throw jsonDecoder.mismatch(jsonPath, 'type'); } String name; if (json.containsKey('name')) { - name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); + name = jsonDecoder.decodeString('$jsonPath.name', json['name']); } else { throw jsonDecoder.mismatch(jsonPath, 'name'); } String? parameters; if (json.containsKey('parameters')) { parameters = jsonDecoder.decodeString( - jsonPath + '.parameters', json['parameters']); + '$jsonPath.parameters', json['parameters']); } return RefactoringMethodParameter(kind, type, name, id: id, parameters: parameters); @@ -4083,21 +4082,21 @@ class RefactoringProblem implements HasToJson { RefactoringProblemSeverity severity; if (json.containsKey('severity')) { severity = RefactoringProblemSeverity.fromJson( - jsonDecoder, jsonPath + '.severity', json['severity']); + jsonDecoder, '$jsonPath.severity', json['severity']); } else { throw jsonDecoder.mismatch(jsonPath, 'severity'); } String message; if (json.containsKey('message')) { message = - jsonDecoder.decodeString(jsonPath + '.message', json['message']); + jsonDecoder.decodeString('$jsonPath.message', json['message']); } else { throw jsonDecoder.mismatch(jsonPath, 'message'); } Location? location; if (json.containsKey('location')) { location = Location.fromJson( - jsonDecoder, jsonPath + '.location', json['location']); + jsonDecoder, '$jsonPath.location', json['location']); } return RefactoringProblem(severity, message, location: location); } else { @@ -4319,14 +4318,14 @@ class SourceChange implements HasToJson { String message; if (json.containsKey('message')) { message = - jsonDecoder.decodeString(jsonPath + '.message', json['message']); + jsonDecoder.decodeString('$jsonPath.message', json['message']); } else { throw jsonDecoder.mismatch(jsonPath, 'message'); } List edits; if (json.containsKey('edits')) { edits = jsonDecoder.decodeList( - jsonPath + '.edits', + '$jsonPath.edits', json['edits'], (String jsonPath, Object? json) => SourceFileEdit.fromJson(jsonDecoder, jsonPath, json)); @@ -4336,7 +4335,7 @@ class SourceChange implements HasToJson { List linkedEditGroups; if (json.containsKey('linkedEditGroups')) { linkedEditGroups = jsonDecoder.decodeList( - jsonPath + '.linkedEditGroups', + '$jsonPath.linkedEditGroups', json['linkedEditGroups'], (String jsonPath, Object? json) => LinkedEditGroup.fromJson(jsonDecoder, jsonPath, json)); @@ -4346,16 +4345,16 @@ class SourceChange implements HasToJson { Position? selection; if (json.containsKey('selection')) { selection = Position.fromJson( - jsonDecoder, jsonPath + '.selection', json['selection']); + jsonDecoder, '$jsonPath.selection', json['selection']); } int? selectionLength; if (json.containsKey('selectionLength')) { selectionLength = jsonDecoder.decodeInt( - jsonPath + '.selectionLength', json['selectionLength']); + '$jsonPath.selectionLength', json['selectionLength']); } String? id; if (json.containsKey('id')) { - id = jsonDecoder.decodeString(jsonPath + '.id', json['id']); + id = jsonDecoder.decodeString('$jsonPath.id', json['id']); } return SourceChange(message, edits: edits, @@ -4487,26 +4486,26 @@ class SourceEdit implements HasToJson { if (json is Map) { int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } String replacement; if (json.containsKey('replacement')) { replacement = jsonDecoder.decodeString( - jsonPath + '.replacement', json['replacement']); + '$jsonPath.replacement', json['replacement']); } else { throw jsonDecoder.mismatch(jsonPath, 'replacement'); } String? 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); } else { @@ -4588,21 +4587,21 @@ class SourceFileEdit implements HasToJson { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } int fileStamp; if (json.containsKey('fileStamp')) { fileStamp = - jsonDecoder.decodeInt(jsonPath + '.fileStamp', json['fileStamp']); + jsonDecoder.decodeInt('$jsonPath.fileStamp', json['fileStamp']); } else { throw jsonDecoder.mismatch(jsonPath, 'fileStamp'); } List edits; if (json.containsKey('edits')) { edits = jsonDecoder.decodeList( - jsonPath + '.edits', + '$jsonPath.edits', json['edits'], (String jsonPath, Object? json) => SourceEdit.fromJson(jsonDecoder, jsonPath, json)); diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart index 431cca2b893..edcf6934dc5 100644 --- a/pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart +++ b/pkg/analysis_server_client/lib/src/protocol/protocol_internal.dart @@ -20,8 +20,9 @@ final Map REQUEST_ID_REFACTORING_KINDS = void addAllEditsForSource( SourceFileEdit sourceFileEdit, Iterable edits, {bool insertBeforeExisting = false}) { - edits.forEach((edit) => - sourceFileEdit.add(edit, insertBeforeExisting: insertBeforeExisting)); + for (var edit in edits) { + sourceFileEdit.add(edit, insertBeforeExisting: insertBeforeExisting); + } } /// 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 /// SourceEdit.applySequence(). String applySequenceOfEdits(String code, Iterable edits) { - edits.forEach((SourceEdit edit) { + for (var edit in edits) { code = edit.apply(code); - }); + } return code; } diff --git a/pkg/analysis_server_client/pubspec.yaml b/pkg/analysis_server_client/pubspec.yaml index a5438e95393..293e5fbe190 100644 --- a/pkg/analysis_server_client/pubspec.yaml +++ b/pkg/analysis_server_client/pubspec.yaml @@ -21,4 +21,5 @@ dev_dependencies: analyzer: any analysis_server: any analyzer_utilities: any + lints: any test: any diff --git a/pkg/analyzer_plugin/analysis_options.yaml b/pkg/analyzer_plugin/analysis_options.yaml index a8cb96fce7e..e58f0a5f2cc 100644 --- a/pkg/analyzer_plugin/analysis_options.yaml +++ b/pkg/analyzer_plugin/analysis_options.yaml @@ -1,57 +1,23 @@ +include: package:lints/recommended.yaml + analyzer: language: strict-casts: true + linter: rules: - - await_only_futures - - depend_on_referenced_packages - - empty_statements - - unnecessary_brace_in_string_interps - # - # From pedantic 1.9.0: - # - - always_declare_return_types - - always_require_non_null_named_parameters - - 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 + # In addition to lints/recommended: + always_declare_return_types: true + omit_local_variable_types: true + prefer_single_quotes: true + unawaited_futures: true + + # Remove from lints/recommended: + constant_identifier_names: false + implementation_imports: false + non_constant_identifier_names: false + + # Existing violations (3) + library_private_types_in_public_api: false + # Existing violations (3) + prefer_initializing_formals: false diff --git a/pkg/analyzer_plugin/lib/protocol/protocol_common.dart b/pkg/analyzer_plugin/lib/protocol/protocol_common.dart index 6f3ab9e04a7..925dfa37fe2 100644 --- a/pkg/analyzer_plugin/lib/protocol/protocol_common.dart +++ b/pkg/analyzer_plugin/lib/protocol/protocol_common.dart @@ -37,7 +37,7 @@ class AddContentOverlay implements HasToJson { String content; if (json.containsKey('content')) { content = - jsonDecoder.decodeString(jsonPath + '.content', json['content']); + jsonDecoder.decodeString('$jsonPath.content', json['content']); } else { throw jsonDecoder.mismatch(jsonPath, 'content'); } @@ -139,57 +139,57 @@ class AnalysisError implements HasToJson { AnalysisErrorSeverity severity; if (json.containsKey('severity')) { severity = AnalysisErrorSeverity.fromJson( - jsonDecoder, jsonPath + '.severity', json['severity']); + jsonDecoder, '$jsonPath.severity', json['severity']); } else { throw jsonDecoder.mismatch(jsonPath, 'severity'); } AnalysisErrorType type; if (json.containsKey('type')) { type = AnalysisErrorType.fromJson( - jsonDecoder, jsonPath + '.type', json['type']); + jsonDecoder, '$jsonPath.type', json['type']); } else { throw jsonDecoder.mismatch(jsonPath, 'type'); } Location location; if (json.containsKey('location')) { location = Location.fromJson( - jsonDecoder, jsonPath + '.location', json['location']); + jsonDecoder, '$jsonPath.location', json['location']); } else { throw jsonDecoder.mismatch(jsonPath, 'location'); } String message; if (json.containsKey('message')) { message = - jsonDecoder.decodeString(jsonPath + '.message', json['message']); + jsonDecoder.decodeString('$jsonPath.message', json['message']); } else { throw jsonDecoder.mismatch(jsonPath, 'message'); } String? correction; if (json.containsKey('correction')) { correction = jsonDecoder.decodeString( - jsonPath + '.correction', json['correction']); + '$jsonPath.correction', json['correction']); } String code; if (json.containsKey('code')) { - code = jsonDecoder.decodeString(jsonPath + '.code', json['code']); + code = jsonDecoder.decodeString('$jsonPath.code', json['code']); } else { throw jsonDecoder.mismatch(jsonPath, 'code'); } String? url; if (json.containsKey('url')) { - url = jsonDecoder.decodeString(jsonPath + '.url', json['url']); + url = jsonDecoder.decodeString('$jsonPath.url', json['url']); } List? contextMessages; if (json.containsKey('contextMessages')) { contextMessages = jsonDecoder.decodeList( - jsonPath + '.contextMessages', + '$jsonPath.contextMessages', json['contextMessages'], (String jsonPath, Object? json) => DiagnosticMessage.fromJson(jsonDecoder, jsonPath, json)); } bool? 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, correction: correction, @@ -440,7 +440,7 @@ class ChangeContentOverlay implements HasToJson { List edits; if (json.containsKey('edits')) { edits = jsonDecoder.decodeList( - jsonPath + '.edits', + '$jsonPath.edits', json['edits'], (String jsonPath, Object? json) => SourceEdit.fromJson(jsonDecoder, jsonPath, json)); @@ -673,145 +673,144 @@ class CompletionSuggestion implements HasToJson { CompletionSuggestionKind kind; if (json.containsKey('kind')) { kind = CompletionSuggestionKind.fromJson( - jsonDecoder, jsonPath + '.kind', json['kind']); + jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } int relevance; if (json.containsKey('relevance')) { relevance = - jsonDecoder.decodeInt(jsonPath + '.relevance', json['relevance']); + jsonDecoder.decodeInt('$jsonPath.relevance', json['relevance']); } else { throw jsonDecoder.mismatch(jsonPath, 'relevance'); } String completion; if (json.containsKey('completion')) { completion = jsonDecoder.decodeString( - jsonPath + '.completion', json['completion']); + '$jsonPath.completion', json['completion']); } else { throw jsonDecoder.mismatch(jsonPath, 'completion'); } String? displayText; if (json.containsKey('displayText')) { displayText = jsonDecoder.decodeString( - jsonPath + '.displayText', json['displayText']); + '$jsonPath.displayText', json['displayText']); } int? replacementOffset; if (json.containsKey('replacementOffset')) { replacementOffset = jsonDecoder.decodeInt( - jsonPath + '.replacementOffset', json['replacementOffset']); + '$jsonPath.replacementOffset', json['replacementOffset']); } int? replacementLength; if (json.containsKey('replacementLength')) { replacementLength = jsonDecoder.decodeInt( - jsonPath + '.replacementLength', json['replacementLength']); + '$jsonPath.replacementLength', json['replacementLength']); } int selectionOffset; if (json.containsKey('selectionOffset')) { selectionOffset = jsonDecoder.decodeInt( - jsonPath + '.selectionOffset', json['selectionOffset']); + '$jsonPath.selectionOffset', json['selectionOffset']); } else { throw jsonDecoder.mismatch(jsonPath, 'selectionOffset'); } int selectionLength; if (json.containsKey('selectionLength')) { selectionLength = jsonDecoder.decodeInt( - jsonPath + '.selectionLength', json['selectionLength']); + '$jsonPath.selectionLength', json['selectionLength']); } else { throw jsonDecoder.mismatch(jsonPath, 'selectionLength'); } bool isDeprecated; if (json.containsKey('isDeprecated')) { isDeprecated = jsonDecoder.decodeBool( - jsonPath + '.isDeprecated', json['isDeprecated']); + '$jsonPath.isDeprecated', json['isDeprecated']); } else { throw jsonDecoder.mismatch(jsonPath, 'isDeprecated'); } bool isPotential; if (json.containsKey('isPotential')) { isPotential = jsonDecoder.decodeBool( - jsonPath + '.isPotential', json['isPotential']); + '$jsonPath.isPotential', json['isPotential']); } else { throw jsonDecoder.mismatch(jsonPath, 'isPotential'); } String? docSummary; if (json.containsKey('docSummary')) { docSummary = jsonDecoder.decodeString( - jsonPath + '.docSummary', json['docSummary']); + '$jsonPath.docSummary', json['docSummary']); } String? docComplete; if (json.containsKey('docComplete')) { docComplete = jsonDecoder.decodeString( - jsonPath + '.docComplete', json['docComplete']); + '$jsonPath.docComplete', json['docComplete']); } String? declaringType; if (json.containsKey('declaringType')) { declaringType = jsonDecoder.decodeString( - jsonPath + '.declaringType', json['declaringType']); + '$jsonPath.declaringType', json['declaringType']); } String? defaultArgumentListString; if (json.containsKey('defaultArgumentListString')) { defaultArgumentListString = jsonDecoder.decodeString( - jsonPath + '.defaultArgumentListString', + '$jsonPath.defaultArgumentListString', json['defaultArgumentListString']); } List? defaultArgumentListTextRanges; if (json.containsKey('defaultArgumentListTextRanges')) { defaultArgumentListTextRanges = jsonDecoder.decodeList( - jsonPath + '.defaultArgumentListTextRanges', + '$jsonPath.defaultArgumentListTextRanges', json['defaultArgumentListTextRanges'], jsonDecoder.decodeInt); } Element? element; if (json.containsKey('element')) { - element = Element.fromJson( - jsonDecoder, jsonPath + '.element', json['element']); + element = + Element.fromJson(jsonDecoder, '$jsonPath.element', json['element']); } String? returnType; if (json.containsKey('returnType')) { returnType = jsonDecoder.decodeString( - jsonPath + '.returnType', json['returnType']); + '$jsonPath.returnType', json['returnType']); } List? parameterNames; if (json.containsKey('parameterNames')) { - parameterNames = jsonDecoder.decodeList(jsonPath + '.parameterNames', + parameterNames = jsonDecoder.decodeList('$jsonPath.parameterNames', json['parameterNames'], jsonDecoder.decodeString); } List? parameterTypes; if (json.containsKey('parameterTypes')) { - parameterTypes = jsonDecoder.decodeList(jsonPath + '.parameterTypes', + parameterTypes = jsonDecoder.decodeList('$jsonPath.parameterTypes', json['parameterTypes'], jsonDecoder.decodeString); } int? requiredParameterCount; if (json.containsKey('requiredParameterCount')) { requiredParameterCount = jsonDecoder.decodeInt( - jsonPath + '.requiredParameterCount', - json['requiredParameterCount']); + '$jsonPath.requiredParameterCount', json['requiredParameterCount']); } bool? hasNamedParameters; if (json.containsKey('hasNamedParameters')) { hasNamedParameters = jsonDecoder.decodeBool( - jsonPath + '.hasNamedParameters', json['hasNamedParameters']); + '$jsonPath.hasNamedParameters', json['hasNamedParameters']); } String? parameterName; if (json.containsKey('parameterName')) { parameterName = jsonDecoder.decodeString( - jsonPath + '.parameterName', json['parameterName']); + '$jsonPath.parameterName', json['parameterName']); } String? parameterType; if (json.containsKey('parameterType')) { parameterType = jsonDecoder.decodeString( - jsonPath + '.parameterType', json['parameterType']); + '$jsonPath.parameterType', json['parameterType']); } String? libraryUri; if (json.containsKey('libraryUri')) { libraryUri = jsonDecoder.decodeString( - jsonPath + '.libraryUri', json['libraryUri']); + '$jsonPath.libraryUri', json['libraryUri']); } bool? isNotImported; if (json.containsKey('isNotImported')) { isNotImported = jsonDecoder.decodeBool( - jsonPath + '.isNotImported', json['isNotImported']); + '$jsonPath.isNotImported', json['isNotImported']); } return CompletionSuggestion(kind, relevance, completion, selectionOffset, selectionLength, isDeprecated, isPotential, @@ -1146,14 +1145,14 @@ class DiagnosticMessage implements HasToJson { String message; if (json.containsKey('message')) { message = - jsonDecoder.decodeString(jsonPath + '.message', json['message']); + jsonDecoder.decodeString('$jsonPath.message', json['message']); } else { throw jsonDecoder.mismatch(jsonPath, 'message'); } Location location; if (json.containsKey('location')) { location = Location.fromJson( - jsonDecoder, jsonPath + '.location', json['location']); + jsonDecoder, '$jsonPath.location', json['location']); } else { throw jsonDecoder.mismatch(jsonPath, 'location'); } @@ -1282,46 +1281,46 @@ class Element implements HasToJson { ElementKind kind; if (json.containsKey('kind')) { kind = - ElementKind.fromJson(jsonDecoder, jsonPath + '.kind', json['kind']); + ElementKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } String name; if (json.containsKey('name')) { - name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); + name = jsonDecoder.decodeString('$jsonPath.name', json['name']); } else { throw jsonDecoder.mismatch(jsonPath, 'name'); } Location? location; if (json.containsKey('location')) { location = Location.fromJson( - jsonDecoder, jsonPath + '.location', json['location']); + jsonDecoder, '$jsonPath.location', json['location']); } int flags; if (json.containsKey('flags')) { - flags = jsonDecoder.decodeInt(jsonPath + '.flags', json['flags']); + flags = jsonDecoder.decodeInt('$jsonPath.flags', json['flags']); } else { throw jsonDecoder.mismatch(jsonPath, 'flags'); } String? parameters; if (json.containsKey('parameters')) { parameters = jsonDecoder.decodeString( - jsonPath + '.parameters', json['parameters']); + '$jsonPath.parameters', json['parameters']); } String? returnType; if (json.containsKey('returnType')) { returnType = jsonDecoder.decodeString( - jsonPath + '.returnType', json['returnType']); + '$jsonPath.returnType', json['returnType']); } String? typeParameters; if (json.containsKey('typeParameters')) { typeParameters = jsonDecoder.decodeString( - jsonPath + '.typeParameters', json['typeParameters']); + '$jsonPath.typeParameters', json['typeParameters']); } String? aliasedType; if (json.containsKey('aliasedType')) { aliasedType = jsonDecoder.decodeString( - jsonPath + '.aliasedType', json['aliasedType']); + '$jsonPath.aliasedType', json['aliasedType']); } return Element(kind, name, flags, location: location, @@ -1748,19 +1747,19 @@ class FoldingRegion implements HasToJson { FoldingKind kind; if (json.containsKey('kind')) { kind = - FoldingKind.fromJson(jsonDecoder, jsonPath + '.kind', json['kind']); + FoldingKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } @@ -1828,19 +1827,19 @@ class HighlightRegion implements HasToJson { HighlightRegionType type; if (json.containsKey('type')) { type = HighlightRegionType.fromJson( - jsonDecoder, jsonPath + '.type', json['type']); + jsonDecoder, '$jsonPath.type', json['type']); } else { throw jsonDecoder.mismatch(jsonPath, 'type'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } @@ -2522,29 +2521,29 @@ class KytheEntry implements HasToJson { KytheVName source; if (json.containsKey('source')) { source = KytheVName.fromJson( - jsonDecoder, jsonPath + '.source', json['source']); + jsonDecoder, '$jsonPath.source', json['source']); } else { throw jsonDecoder.mismatch(jsonPath, 'source'); } String? kind; if (json.containsKey('kind')) { - kind = jsonDecoder.decodeString(jsonPath + '.kind', json['kind']); + kind = jsonDecoder.decodeString('$jsonPath.kind', json['kind']); } KytheVName? target; if (json.containsKey('target')) { target = KytheVName.fromJson( - jsonDecoder, jsonPath + '.target', json['target']); + jsonDecoder, '$jsonPath.target', json['target']); } String fact; if (json.containsKey('fact')) { - fact = jsonDecoder.decodeString(jsonPath + '.fact', json['fact']); + fact = jsonDecoder.decodeString('$jsonPath.fact', json['fact']); } else { throw jsonDecoder.mismatch(jsonPath, 'fact'); } List? value; if (json.containsKey('value')) { 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); } else { @@ -2637,33 +2636,33 @@ class KytheVName implements HasToJson { if (json is Map) { String signature; if (json.containsKey('signature')) { - signature = jsonDecoder.decodeString( - jsonPath + '.signature', json['signature']); + signature = + jsonDecoder.decodeString('$jsonPath.signature', json['signature']); } else { throw jsonDecoder.mismatch(jsonPath, 'signature'); } String corpus; if (json.containsKey('corpus')) { - corpus = jsonDecoder.decodeString(jsonPath + '.corpus', json['corpus']); + corpus = jsonDecoder.decodeString('$jsonPath.corpus', json['corpus']); } else { throw jsonDecoder.mismatch(jsonPath, 'corpus'); } String root; if (json.containsKey('root')) { - root = jsonDecoder.decodeString(jsonPath + '.root', json['root']); + root = jsonDecoder.decodeString('$jsonPath.root', json['root']); } else { throw jsonDecoder.mismatch(jsonPath, 'root'); } String path; if (json.containsKey('path')) { - path = jsonDecoder.decodeString(jsonPath + '.path', json['path']); + path = jsonDecoder.decodeString('$jsonPath.path', json['path']); } else { throw jsonDecoder.mismatch(jsonPath, 'path'); } String language; if (json.containsKey('language')) { language = - jsonDecoder.decodeString(jsonPath + '.language', json['language']); + jsonDecoder.decodeString('$jsonPath.language', json['language']); } else { throw jsonDecoder.mismatch(jsonPath, 'language'); } @@ -2739,7 +2738,7 @@ class LinkedEditGroup implements HasToJson { List positions; if (json.containsKey('positions')) { positions = jsonDecoder.decodeList( - jsonPath + '.positions', + '$jsonPath.positions', json['positions'], (String jsonPath, Object? json) => Position.fromJson(jsonDecoder, jsonPath, json)); @@ -2748,14 +2747,14 @@ class LinkedEditGroup implements HasToJson { } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } List suggestions; if (json.containsKey('suggestions')) { suggestions = jsonDecoder.decodeList( - jsonPath + '.suggestions', + '$jsonPath.suggestions', json['suggestions'], (String jsonPath, Object? json) => LinkedEditSuggestion.fromJson(jsonDecoder, jsonPath, json)); @@ -2840,14 +2839,14 @@ class LinkedEditSuggestion implements HasToJson { if (json is Map) { String value; if (json.containsKey('value')) { - value = jsonDecoder.decodeString(jsonPath + '.value', json['value']); + value = jsonDecoder.decodeString('$jsonPath.value', json['value']); } else { throw jsonDecoder.mismatch(jsonPath, 'value'); } LinkedEditSuggestionKind kind; if (json.containsKey('kind')) { kind = LinkedEditSuggestionKind.fromJson( - jsonDecoder, jsonPath + '.kind', json['kind']); + jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } @@ -2996,44 +2995,44 @@ class Location implements HasToJson { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } int startLine; if (json.containsKey('startLine')) { startLine = - jsonDecoder.decodeInt(jsonPath + '.startLine', json['startLine']); + jsonDecoder.decodeInt('$jsonPath.startLine', json['startLine']); } else { throw jsonDecoder.mismatch(jsonPath, 'startLine'); } int startColumn; if (json.containsKey('startColumn')) { - startColumn = jsonDecoder.decodeInt( - jsonPath + '.startColumn', json['startColumn']); + startColumn = + jsonDecoder.decodeInt('$jsonPath.startColumn', json['startColumn']); } else { throw jsonDecoder.mismatch(jsonPath, 'startColumn'); } int? endLine; if (json.containsKey('endLine')) { - endLine = jsonDecoder.decodeInt(jsonPath + '.endLine', json['endLine']); + endLine = jsonDecoder.decodeInt('$jsonPath.endLine', json['endLine']); } int? endColumn; if (json.containsKey('endColumn')) { endColumn = - jsonDecoder.decodeInt(jsonPath + '.endColumn', json['endColumn']); + jsonDecoder.decodeInt('$jsonPath.endColumn', json['endColumn']); } return Location(file, offset, length, startLine, startColumn, endLine: endLine, endColumn: endColumn); @@ -3119,20 +3118,20 @@ class NavigationRegion implements HasToJson { if (json is Map) { int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } List targets; if (json.containsKey('targets')) { targets = jsonDecoder.decodeList( - jsonPath + '.targets', json['targets'], jsonDecoder.decodeInt); + '$jsonPath.targets', json['targets'], jsonDecoder.decodeInt); } else { throw jsonDecoder.mismatch(jsonPath, 'targets'); } @@ -3225,52 +3224,52 @@ class NavigationTarget implements HasToJson { ElementKind kind; if (json.containsKey('kind')) { kind = - ElementKind.fromJson(jsonDecoder, jsonPath + '.kind', json['kind']); + ElementKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } int fileIndex; if (json.containsKey('fileIndex')) { fileIndex = - jsonDecoder.decodeInt(jsonPath + '.fileIndex', json['fileIndex']); + jsonDecoder.decodeInt('$jsonPath.fileIndex', json['fileIndex']); } else { throw jsonDecoder.mismatch(jsonPath, 'fileIndex'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } int startLine; if (json.containsKey('startLine')) { startLine = - jsonDecoder.decodeInt(jsonPath + '.startLine', json['startLine']); + jsonDecoder.decodeInt('$jsonPath.startLine', json['startLine']); } else { throw jsonDecoder.mismatch(jsonPath, 'startLine'); } int startColumn; if (json.containsKey('startColumn')) { - startColumn = jsonDecoder.decodeInt( - jsonPath + '.startColumn', json['startColumn']); + startColumn = + jsonDecoder.decodeInt('$jsonPath.startColumn', json['startColumn']); } else { throw jsonDecoder.mismatch(jsonPath, 'startColumn'); } int? codeOffset; if (json.containsKey('codeOffset')) { codeOffset = - jsonDecoder.decodeInt(jsonPath + '.codeOffset', json['codeOffset']); + jsonDecoder.decodeInt('$jsonPath.codeOffset', json['codeOffset']); } int? codeLength; if (json.containsKey('codeLength')) { codeLength = - jsonDecoder.decodeInt(jsonPath + '.codeLength', json['codeLength']); + jsonDecoder.decodeInt('$jsonPath.codeLength', json['codeLength']); } return NavigationTarget( kind, fileIndex, offset, length, startLine, startColumn, @@ -3358,21 +3357,21 @@ class Occurrences implements HasToJson { if (json is Map) { Element element; if (json.containsKey('element')) { - element = Element.fromJson( - jsonDecoder, jsonPath + '.element', json['element']); + element = + Element.fromJson(jsonDecoder, '$jsonPath.element', json['element']); } else { throw jsonDecoder.mismatch(jsonPath, 'element'); } List offsets; if (json.containsKey('offsets')) { offsets = jsonDecoder.decodeList( - jsonPath + '.offsets', json['offsets'], jsonDecoder.decodeInt); + '$jsonPath.offsets', json['offsets'], jsonDecoder.decodeInt); } else { throw jsonDecoder.mismatch(jsonPath, 'offsets'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } @@ -3458,41 +3457,41 @@ class Outline implements HasToJson { if (json is Map) { Element element; if (json.containsKey('element')) { - element = Element.fromJson( - jsonDecoder, jsonPath + '.element', json['element']); + element = + Element.fromJson(jsonDecoder, '$jsonPath.element', json['element']); } else { throw jsonDecoder.mismatch(jsonPath, 'element'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } int codeOffset; if (json.containsKey('codeOffset')) { codeOffset = - jsonDecoder.decodeInt(jsonPath + '.codeOffset', json['codeOffset']); + jsonDecoder.decodeInt('$jsonPath.codeOffset', json['codeOffset']); } else { throw jsonDecoder.mismatch(jsonPath, 'codeOffset'); } int codeLength; if (json.containsKey('codeLength')) { codeLength = - jsonDecoder.decodeInt(jsonPath + '.codeLength', json['codeLength']); + jsonDecoder.decodeInt('$jsonPath.codeLength', json['codeLength']); } else { throw jsonDecoder.mismatch(jsonPath, 'codeLength'); } List? children; if (json.containsKey('children')) { children = jsonDecoder.decodeList( - jsonPath + '.children', + '$jsonPath.children', json['children'], (String jsonPath, Object? json) => Outline.fromJson(jsonDecoder, jsonPath, json)); @@ -3579,27 +3578,27 @@ class ParameterInfo implements HasToJson { if (json is Map) { ParameterKind kind; if (json.containsKey('kind')) { - kind = ParameterKind.fromJson( - jsonDecoder, jsonPath + '.kind', json['kind']); + kind = + ParameterKind.fromJson(jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } String name; if (json.containsKey('name')) { - name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); + name = jsonDecoder.decodeString('$jsonPath.name', json['name']); } else { throw jsonDecoder.mismatch(jsonPath, 'name'); } String type; if (json.containsKey('type')) { - type = jsonDecoder.decodeString(jsonPath + '.type', json['type']); + type = jsonDecoder.decodeString('$jsonPath.type', json['type']); } else { throw jsonDecoder.mismatch(jsonPath, 'type'); } String? defaultValue; if (json.containsKey('defaultValue')) { defaultValue = jsonDecoder.decodeString( - jsonPath + '.defaultValue', json['defaultValue']); + '$jsonPath.defaultValue', json['defaultValue']); } return ParameterInfo(kind, name, type, defaultValue: defaultValue); } else { @@ -3736,13 +3735,13 @@ class Position implements HasToJson { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } @@ -3919,31 +3918,31 @@ class RefactoringMethodParameter implements HasToJson { if (json is Map) { String? id; if (json.containsKey('id')) { - id = jsonDecoder.decodeString(jsonPath + '.id', json['id']); + id = jsonDecoder.decodeString('$jsonPath.id', json['id']); } RefactoringMethodParameterKind kind; if (json.containsKey('kind')) { kind = RefactoringMethodParameterKind.fromJson( - jsonDecoder, jsonPath + '.kind', json['kind']); + jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } String type; if (json.containsKey('type')) { - type = jsonDecoder.decodeString(jsonPath + '.type', json['type']); + type = jsonDecoder.decodeString('$jsonPath.type', json['type']); } else { throw jsonDecoder.mismatch(jsonPath, 'type'); } String name; if (json.containsKey('name')) { - name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); + name = jsonDecoder.decodeString('$jsonPath.name', json['name']); } else { throw jsonDecoder.mismatch(jsonPath, 'name'); } String? parameters; if (json.containsKey('parameters')) { parameters = jsonDecoder.decodeString( - jsonPath + '.parameters', json['parameters']); + '$jsonPath.parameters', json['parameters']); } return RefactoringMethodParameter(kind, type, name, id: id, parameters: parameters); @@ -4083,21 +4082,21 @@ class RefactoringProblem implements HasToJson { RefactoringProblemSeverity severity; if (json.containsKey('severity')) { severity = RefactoringProblemSeverity.fromJson( - jsonDecoder, jsonPath + '.severity', json['severity']); + jsonDecoder, '$jsonPath.severity', json['severity']); } else { throw jsonDecoder.mismatch(jsonPath, 'severity'); } String message; if (json.containsKey('message')) { message = - jsonDecoder.decodeString(jsonPath + '.message', json['message']); + jsonDecoder.decodeString('$jsonPath.message', json['message']); } else { throw jsonDecoder.mismatch(jsonPath, 'message'); } Location? location; if (json.containsKey('location')) { location = Location.fromJson( - jsonDecoder, jsonPath + '.location', json['location']); + jsonDecoder, '$jsonPath.location', json['location']); } return RefactoringProblem(severity, message, location: location); } else { @@ -4319,14 +4318,14 @@ class SourceChange implements HasToJson { String message; if (json.containsKey('message')) { message = - jsonDecoder.decodeString(jsonPath + '.message', json['message']); + jsonDecoder.decodeString('$jsonPath.message', json['message']); } else { throw jsonDecoder.mismatch(jsonPath, 'message'); } List edits; if (json.containsKey('edits')) { edits = jsonDecoder.decodeList( - jsonPath + '.edits', + '$jsonPath.edits', json['edits'], (String jsonPath, Object? json) => SourceFileEdit.fromJson(jsonDecoder, jsonPath, json)); @@ -4336,7 +4335,7 @@ class SourceChange implements HasToJson { List linkedEditGroups; if (json.containsKey('linkedEditGroups')) { linkedEditGroups = jsonDecoder.decodeList( - jsonPath + '.linkedEditGroups', + '$jsonPath.linkedEditGroups', json['linkedEditGroups'], (String jsonPath, Object? json) => LinkedEditGroup.fromJson(jsonDecoder, jsonPath, json)); @@ -4346,16 +4345,16 @@ class SourceChange implements HasToJson { Position? selection; if (json.containsKey('selection')) { selection = Position.fromJson( - jsonDecoder, jsonPath + '.selection', json['selection']); + jsonDecoder, '$jsonPath.selection', json['selection']); } int? selectionLength; if (json.containsKey('selectionLength')) { selectionLength = jsonDecoder.decodeInt( - jsonPath + '.selectionLength', json['selectionLength']); + '$jsonPath.selectionLength', json['selectionLength']); } String? id; if (json.containsKey('id')) { - id = jsonDecoder.decodeString(jsonPath + '.id', json['id']); + id = jsonDecoder.decodeString('$jsonPath.id', json['id']); } return SourceChange(message, edits: edits, @@ -4487,26 +4486,26 @@ class SourceEdit implements HasToJson { if (json is Map) { int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } String replacement; if (json.containsKey('replacement')) { replacement = jsonDecoder.decodeString( - jsonPath + '.replacement', json['replacement']); + '$jsonPath.replacement', json['replacement']); } else { throw jsonDecoder.mismatch(jsonPath, 'replacement'); } String? 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); } else { @@ -4588,21 +4587,21 @@ class SourceFileEdit implements HasToJson { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } int fileStamp; if (json.containsKey('fileStamp')) { fileStamp = - jsonDecoder.decodeInt(jsonPath + '.fileStamp', json['fileStamp']); + jsonDecoder.decodeInt('$jsonPath.fileStamp', json['fileStamp']); } else { throw jsonDecoder.mismatch(jsonPath, 'fileStamp'); } List edits; if (json.containsKey('edits')) { edits = jsonDecoder.decodeList( - jsonPath + '.edits', + '$jsonPath.edits', json['edits'], (String jsonPath, Object? json) => SourceEdit.fromJson(jsonDecoder, jsonPath, json)); diff --git a/pkg/analyzer_plugin/lib/protocol/protocol_generated.dart b/pkg/analyzer_plugin/lib/protocol/protocol_generated.dart index 634de11e733..1644405382e 100644 --- a/pkg/analyzer_plugin/lib/protocol/protocol_generated.dart +++ b/pkg/analyzer_plugin/lib/protocol/protocol_generated.dart @@ -39,14 +39,14 @@ class AnalysisErrorFixes implements HasToJson { AnalysisError error; if (json.containsKey('error')) { error = AnalysisError.fromJson( - jsonDecoder, jsonPath + '.error', json['error']); + jsonDecoder, '$jsonPath.error', json['error']); } else { throw jsonDecoder.mismatch(jsonPath, 'error'); } List fixes; if (json.containsKey('fixes')) { fixes = jsonDecoder.decodeList( - jsonPath + '.fixes', + '$jsonPath.fixes', json['fixes'], (String jsonPath, Object? json) => PrioritizedSourceChange.fromJson(jsonDecoder, jsonPath, json)); @@ -111,14 +111,14 @@ class AnalysisErrorsParams implements HasToJson { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } List errors; if (json.containsKey('errors')) { errors = jsonDecoder.decodeList( - jsonPath + '.errors', + '$jsonPath.errors', json['errors'], (String jsonPath, Object? json) => AnalysisError.fromJson(jsonDecoder, jsonPath, json)); @@ -192,14 +192,14 @@ class AnalysisFoldingParams implements HasToJson { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } List regions; if (json.containsKey('regions')) { regions = jsonDecoder.decodeList( - jsonPath + '.regions', + '$jsonPath.regions', json['regions'], (String jsonPath, Object? json) => FoldingRegion.fromJson(jsonDecoder, jsonPath, json)); @@ -279,19 +279,19 @@ class AnalysisGetNavigationParams implements RequestParams { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } @@ -372,14 +372,14 @@ class AnalysisGetNavigationResult implements ResponseResult { List files; if (json.containsKey('files')) { files = jsonDecoder.decodeList( - jsonPath + '.files', json['files'], jsonDecoder.decodeString); + '$jsonPath.files', json['files'], jsonDecoder.decodeString); } else { throw jsonDecoder.mismatch(jsonPath, 'files'); } List targets; if (json.containsKey('targets')) { targets = jsonDecoder.decodeList( - jsonPath + '.targets', + '$jsonPath.targets', json['targets'], (String jsonPath, Object? json) => NavigationTarget.fromJson(jsonDecoder, jsonPath, json)); @@ -389,7 +389,7 @@ class AnalysisGetNavigationResult implements ResponseResult { List regions; if (json.containsKey('regions')) { regions = jsonDecoder.decodeList( - jsonPath + '.regions', + '$jsonPath.regions', json['regions'], (String jsonPath, Object? json) => NavigationRegion.fromJson(jsonDecoder, jsonPath, json)); @@ -469,7 +469,7 @@ class AnalysisHandleWatchEventsParams implements RequestParams { List events; if (json.containsKey('events')) { events = jsonDecoder.decodeList( - jsonPath + '.events', + '$jsonPath.events', json['events'], (String jsonPath, Object? json) => WatchEvent.fromJson(jsonDecoder, jsonPath, json)); @@ -559,14 +559,14 @@ class AnalysisHighlightsParams implements HasToJson { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } List regions; if (json.containsKey('regions')) { regions = jsonDecoder.decodeList( - jsonPath + '.regions', + '$jsonPath.regions', json['regions'], (String jsonPath, Object? json) => HighlightRegion.fromJson(jsonDecoder, jsonPath, json)); @@ -650,14 +650,14 @@ class AnalysisNavigationParams implements HasToJson { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } List regions; if (json.containsKey('regions')) { regions = jsonDecoder.decodeList( - jsonPath + '.regions', + '$jsonPath.regions', json['regions'], (String jsonPath, Object? json) => NavigationRegion.fromJson(jsonDecoder, jsonPath, json)); @@ -667,7 +667,7 @@ class AnalysisNavigationParams implements HasToJson { List targets; if (json.containsKey('targets')) { targets = jsonDecoder.decodeList( - jsonPath + '.targets', + '$jsonPath.targets', json['targets'], (String jsonPath, Object? json) => NavigationTarget.fromJson(jsonDecoder, jsonPath, json)); @@ -677,7 +677,7 @@ class AnalysisNavigationParams implements HasToJson { List files; if (json.containsKey('files')) { files = jsonDecoder.decodeList( - jsonPath + '.files', json['files'], jsonDecoder.decodeString); + '$jsonPath.files', json['files'], jsonDecoder.decodeString); } else { throw jsonDecoder.mismatch(jsonPath, 'files'); } @@ -756,14 +756,14 @@ class AnalysisOccurrencesParams implements HasToJson { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } List occurrences; if (json.containsKey('occurrences')) { occurrences = jsonDecoder.decodeList( - jsonPath + '.occurrences', + '$jsonPath.occurrences', json['occurrences'], (String jsonPath, Object? json) => Occurrences.fromJson(jsonDecoder, jsonPath, json)); @@ -838,14 +838,14 @@ class AnalysisOutlineParams implements HasToJson { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } List outline; if (json.containsKey('outline')) { outline = jsonDecoder.decodeList( - jsonPath + '.outline', + '$jsonPath.outline', json['outline'], (String jsonPath, Object? json) => Outline.fromJson(jsonDecoder, jsonPath, json)); @@ -984,7 +984,7 @@ class AnalysisSetContextRootsParams implements RequestParams { List roots; if (json.containsKey('roots')) { roots = jsonDecoder.decodeList( - jsonPath + '.roots', + '$jsonPath.roots', json['roots'], (String jsonPath, Object? json) => ContextRoot.fromJson(jsonDecoder, jsonPath, json)); @@ -1070,7 +1070,7 @@ class AnalysisSetPriorityFilesParams implements RequestParams { List files; if (json.containsKey('files')) { files = jsonDecoder.decodeList( - jsonPath + '.files', json['files'], jsonDecoder.decodeString); + '$jsonPath.files', json['files'], jsonDecoder.decodeString); } else { throw jsonDecoder.mismatch(jsonPath, 'files'); } @@ -1153,7 +1153,7 @@ class AnalysisSetSubscriptionsParams implements RequestParams { Map> subscriptions; if (json.containsKey('subscriptions')) { subscriptions = jsonDecoder.decodeMap( - jsonPath + '.subscriptions', json['subscriptions'], + '$jsonPath.subscriptions', json['subscriptions'], keyDecoder: (String jsonPath, Object? json) => AnalysisService.fromJson(jsonDecoder, jsonPath, json), valueDecoder: (String jsonPath, Object? json) => jsonDecoder @@ -1245,7 +1245,7 @@ class AnalysisUpdateContentParams implements RequestParams { if (json is Map) { Map files; if (json.containsKey('files')) { - files = jsonDecoder.decodeMap(jsonPath + '.files', json['files'], + files = jsonDecoder.decodeMap('$jsonPath.files', json['files'], valueDecoder: (String jsonPath, Object? json) => jsonDecoder.decodeUnion(jsonPath, json, 'type', { 'add': (String jsonPath, Object? json) => @@ -1341,13 +1341,13 @@ class CompletionGetSuggestionsParams implements RequestParams { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } @@ -1433,21 +1433,21 @@ class CompletionGetSuggestionsResult implements ResponseResult { int replacementOffset; if (json.containsKey('replacementOffset')) { replacementOffset = jsonDecoder.decodeInt( - jsonPath + '.replacementOffset', json['replacementOffset']); + '$jsonPath.replacementOffset', json['replacementOffset']); } else { throw jsonDecoder.mismatch(jsonPath, 'replacementOffset'); } int replacementLength; if (json.containsKey('replacementLength')) { replacementLength = jsonDecoder.decodeInt( - jsonPath + '.replacementLength', json['replacementLength']); + '$jsonPath.replacementLength', json['replacementLength']); } else { throw jsonDecoder.mismatch(jsonPath, 'replacementLength'); } List results; if (json.containsKey('results')) { results = jsonDecoder.decodeList( - jsonPath + '.results', + '$jsonPath.results', json['results'], (String jsonPath, Object? json) => CompletionSuggestion.fromJson(jsonDecoder, jsonPath, json)); @@ -1536,21 +1536,21 @@ class ContextRoot implements HasToJson { if (json is Map) { String root; if (json.containsKey('root')) { - root = jsonDecoder.decodeString(jsonPath + '.root', json['root']); + root = jsonDecoder.decodeString('$jsonPath.root', json['root']); } else { throw jsonDecoder.mismatch(jsonPath, 'root'); } List exclude; if (json.containsKey('exclude')) { exclude = jsonDecoder.decodeList( - jsonPath + '.exclude', json['exclude'], jsonDecoder.decodeString); + '$jsonPath.exclude', json['exclude'], jsonDecoder.decodeString); } else { throw jsonDecoder.mismatch(jsonPath, 'exclude'); } String? optionsFile; if (json.containsKey('optionsFile')) { optionsFile = jsonDecoder.decodeString( - jsonPath + '.optionsFile', json['optionsFile']); + '$jsonPath.optionsFile', json['optionsFile']); } return ContextRoot(root, exclude, optionsFile: optionsFile); } else { @@ -1666,19 +1666,19 @@ class EditGetAssistsParams implements RequestParams { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } @@ -1748,7 +1748,7 @@ class EditGetAssistsResult implements ResponseResult { List assists; if (json.containsKey('assists')) { assists = jsonDecoder.decodeList( - jsonPath + '.assists', + '$jsonPath.assists', json['assists'], (String jsonPath, Object? json) => PrioritizedSourceChange.fromJson(jsonDecoder, jsonPath, json)); @@ -1824,19 +1824,19 @@ class EditGetAvailableRefactoringsParams implements RequestParams { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } @@ -1912,7 +1912,7 @@ class EditGetAvailableRefactoringsResult implements ResponseResult { List kinds; if (json.containsKey('kinds')) { kinds = jsonDecoder.decodeList( - jsonPath + '.kinds', + '$jsonPath.kinds', json['kinds'], (String jsonPath, Object? json) => RefactoringKind.fromJson(jsonDecoder, jsonPath, json)); @@ -1985,13 +1985,13 @@ class EditGetFixesParams implements RequestParams { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } @@ -2057,7 +2057,7 @@ class EditGetFixesResult implements ResponseResult { List fixes; if (json.containsKey('fixes')) { fixes = jsonDecoder.decodeList( - jsonPath + '.fixes', + '$jsonPath.fixes', json['fixes'], (String jsonPath, Object? json) => AnalysisErrorFixes.fromJson(jsonDecoder, jsonPath, json)); @@ -2153,39 +2153,39 @@ class EditGetRefactoringParams implements RequestParams { RefactoringKind kind; if (json.containsKey('kind')) { kind = RefactoringKind.fromJson( - jsonDecoder, jsonPath + '.kind', json['kind']); + jsonDecoder, '$jsonPath.kind', json['kind']); } else { throw jsonDecoder.mismatch(jsonPath, 'kind'); } String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } bool validateOnly; if (json.containsKey('validateOnly')) { validateOnly = jsonDecoder.decodeBool( - jsonPath + '.validateOnly', json['validateOnly']); + '$jsonPath.validateOnly', json['validateOnly']); } else { throw jsonDecoder.mismatch(jsonPath, 'validateOnly'); } RefactoringOptions? options; if (json.containsKey('options')) { options = RefactoringOptions.fromJson( - jsonDecoder, jsonPath + '.options', json['options'], kind); + jsonDecoder, '$jsonPath.options', json['options'], kind); } return EditGetRefactoringParams(kind, file, offset, length, validateOnly, options: options); @@ -2307,7 +2307,7 @@ class EditGetRefactoringResult implements ResponseResult { List initialProblems; if (json.containsKey('initialProblems')) { initialProblems = jsonDecoder.decodeList( - jsonPath + '.initialProblems', + '$jsonPath.initialProblems', json['initialProblems'], (String jsonPath, Object? json) => RefactoringProblem.fromJson(jsonDecoder, jsonPath, json)); @@ -2317,7 +2317,7 @@ class EditGetRefactoringResult implements ResponseResult { List optionsProblems; if (json.containsKey('optionsProblems')) { optionsProblems = jsonDecoder.decodeList( - jsonPath + '.optionsProblems', + '$jsonPath.optionsProblems', json['optionsProblems'], (String jsonPath, Object? json) => RefactoringProblem.fromJson(jsonDecoder, jsonPath, json)); @@ -2327,7 +2327,7 @@ class EditGetRefactoringResult implements ResponseResult { List finalProblems; if (json.containsKey('finalProblems')) { finalProblems = jsonDecoder.decodeList( - jsonPath + '.finalProblems', + '$jsonPath.finalProblems', json['finalProblems'], (String jsonPath, Object? json) => RefactoringProblem.fromJson(jsonDecoder, jsonPath, json)); @@ -2337,16 +2337,16 @@ class EditGetRefactoringResult implements ResponseResult { RefactoringFeedback? feedback; if (json.containsKey('feedback')) { feedback = RefactoringFeedback.fromJson( - jsonDecoder, jsonPath + '.feedback', json['feedback'], json); + jsonDecoder, '$jsonPath.feedback', json['feedback'], json); } SourceChange? change; if (json.containsKey('change')) { change = SourceChange.fromJson( - jsonDecoder, jsonPath + '.change', json['change']); + jsonDecoder, '$jsonPath.change', json['change']); } List? potentialEdits; if (json.containsKey('potentialEdits')) { - potentialEdits = jsonDecoder.decodeList(jsonPath + '.potentialEdits', + potentialEdits = jsonDecoder.decodeList('$jsonPath.potentialEdits', json['potentialEdits'], jsonDecoder.decodeString); } return EditGetRefactoringResult( @@ -2470,35 +2470,35 @@ class ExtractLocalVariableFeedback extends RefactoringFeedback { List? coveringExpressionOffsets; if (json.containsKey('coveringExpressionOffsets')) { coveringExpressionOffsets = jsonDecoder.decodeList( - jsonPath + '.coveringExpressionOffsets', + '$jsonPath.coveringExpressionOffsets', json['coveringExpressionOffsets'], jsonDecoder.decodeInt); } List? coveringExpressionLengths; if (json.containsKey('coveringExpressionLengths')) { coveringExpressionLengths = jsonDecoder.decodeList( - jsonPath + '.coveringExpressionLengths', + '$jsonPath.coveringExpressionLengths', json['coveringExpressionLengths'], jsonDecoder.decodeInt); } List names; if (json.containsKey('names')) { names = jsonDecoder.decodeList( - jsonPath + '.names', json['names'], jsonDecoder.decodeString); + '$jsonPath.names', json['names'], jsonDecoder.decodeString); } else { throw jsonDecoder.mismatch(jsonPath, 'names'); } List offsets; if (json.containsKey('offsets')) { offsets = jsonDecoder.decodeList( - jsonPath + '.offsets', json['offsets'], jsonDecoder.decodeInt); + '$jsonPath.offsets', json['offsets'], jsonDecoder.decodeInt); } else { throw jsonDecoder.mismatch(jsonPath, 'offsets'); } List lengths; if (json.containsKey('lengths')) { lengths = jsonDecoder.decodeList( - jsonPath + '.lengths', json['lengths'], jsonDecoder.decodeInt); + '$jsonPath.lengths', json['lengths'], jsonDecoder.decodeInt); } else { throw jsonDecoder.mismatch(jsonPath, 'lengths'); } @@ -2581,14 +2581,14 @@ class ExtractLocalVariableOptions extends RefactoringOptions { if (json is Map) { String name; if (json.containsKey('name')) { - name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); + name = jsonDecoder.decodeString('$jsonPath.name', json['name']); } else { throw jsonDecoder.mismatch(jsonPath, 'name'); } bool extractAll; if (json.containsKey('extractAll')) { - extractAll = jsonDecoder.decodeBool( - jsonPath + '.extractAll', json['extractAll']); + extractAll = + jsonDecoder.decodeBool('$jsonPath.extractAll', json['extractAll']); } else { throw jsonDecoder.mismatch(jsonPath, 'extractAll'); } @@ -2686,41 +2686,41 @@ class ExtractMethodFeedback extends RefactoringFeedback { if (json is Map) { int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } String returnType; if (json.containsKey('returnType')) { returnType = jsonDecoder.decodeString( - jsonPath + '.returnType', json['returnType']); + '$jsonPath.returnType', json['returnType']); } else { throw jsonDecoder.mismatch(jsonPath, 'returnType'); } List names; if (json.containsKey('names')) { names = jsonDecoder.decodeList( - jsonPath + '.names', json['names'], jsonDecoder.decodeString); + '$jsonPath.names', json['names'], jsonDecoder.decodeString); } else { throw jsonDecoder.mismatch(jsonPath, 'names'); } bool canCreateGetter; if (json.containsKey('canCreateGetter')) { canCreateGetter = jsonDecoder.decodeBool( - jsonPath + '.canCreateGetter', json['canCreateGetter']); + '$jsonPath.canCreateGetter', json['canCreateGetter']); } else { throw jsonDecoder.mismatch(jsonPath, 'canCreateGetter'); } List parameters; if (json.containsKey('parameters')) { parameters = jsonDecoder.decodeList( - jsonPath + '.parameters', + '$jsonPath.parameters', json['parameters'], (String jsonPath, Object? json) => RefactoringMethodParameter.fromJson( @@ -2731,14 +2731,14 @@ class ExtractMethodFeedback extends RefactoringFeedback { List offsets; if (json.containsKey('offsets')) { offsets = jsonDecoder.decodeList( - jsonPath + '.offsets', json['offsets'], jsonDecoder.decodeInt); + '$jsonPath.offsets', json['offsets'], jsonDecoder.decodeInt); } else { throw jsonDecoder.mismatch(jsonPath, 'offsets'); } List lengths; if (json.containsKey('lengths')) { lengths = jsonDecoder.decodeList( - jsonPath + '.lengths', json['lengths'], jsonDecoder.decodeInt); + '$jsonPath.lengths', json['lengths'], jsonDecoder.decodeInt); } else { throw jsonDecoder.mismatch(jsonPath, 'lengths'); } @@ -2849,27 +2849,27 @@ class ExtractMethodOptions extends RefactoringOptions { String returnType; if (json.containsKey('returnType')) { returnType = jsonDecoder.decodeString( - jsonPath + '.returnType', json['returnType']); + '$jsonPath.returnType', json['returnType']); } else { throw jsonDecoder.mismatch(jsonPath, 'returnType'); } bool createGetter; if (json.containsKey('createGetter')) { createGetter = jsonDecoder.decodeBool( - jsonPath + '.createGetter', json['createGetter']); + '$jsonPath.createGetter', json['createGetter']); } else { throw jsonDecoder.mismatch(jsonPath, 'createGetter'); } String name; if (json.containsKey('name')) { - name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); + name = jsonDecoder.decodeString('$jsonPath.name', json['name']); } else { throw jsonDecoder.mismatch(jsonPath, 'name'); } List parameters; if (json.containsKey('parameters')) { parameters = jsonDecoder.decodeList( - jsonPath + '.parameters', + '$jsonPath.parameters', json['parameters'], (String jsonPath, Object? json) => RefactoringMethodParameter.fromJson( @@ -2879,8 +2879,8 @@ class ExtractMethodOptions extends RefactoringOptions { } bool extractAll; if (json.containsKey('extractAll')) { - extractAll = jsonDecoder.decodeBool( - jsonPath + '.extractAll', json['extractAll']); + extractAll = + jsonDecoder.decodeBool('$jsonPath.extractAll', json['extractAll']); } else { throw jsonDecoder.mismatch(jsonPath, 'extractAll'); } @@ -2962,14 +2962,14 @@ class InlineLocalVariableFeedback extends RefactoringFeedback { if (json is Map) { String name; if (json.containsKey('name')) { - name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); + name = jsonDecoder.decodeString('$jsonPath.name', json['name']); } else { throw jsonDecoder.mismatch(jsonPath, 'name'); } int occurrences; if (json.containsKey('occurrences')) { - occurrences = jsonDecoder.decodeInt( - jsonPath + '.occurrences', json['occurrences']); + occurrences = + jsonDecoder.decodeInt('$jsonPath.occurrences', json['occurrences']); } else { throw jsonDecoder.mismatch(jsonPath, 'occurrences'); } @@ -3047,20 +3047,20 @@ class InlineMethodFeedback extends RefactoringFeedback { if (json is Map) { String? className; if (json.containsKey('className')) { - className = jsonDecoder.decodeString( - jsonPath + '.className', json['className']); + className = + jsonDecoder.decodeString('$jsonPath.className', json['className']); } String methodName; if (json.containsKey('methodName')) { methodName = jsonDecoder.decodeString( - jsonPath + '.methodName', json['methodName']); + '$jsonPath.methodName', json['methodName']); } else { throw jsonDecoder.mismatch(jsonPath, 'methodName'); } bool isDeclaration; if (json.containsKey('isDeclaration')) { isDeclaration = jsonDecoder.decodeBool( - jsonPath + '.isDeclaration', json['isDeclaration']); + '$jsonPath.isDeclaration', json['isDeclaration']); } else { throw jsonDecoder.mismatch(jsonPath, 'isDeclaration'); } @@ -3130,14 +3130,14 @@ class InlineMethodOptions extends RefactoringOptions { bool deleteSource; if (json.containsKey('deleteSource')) { deleteSource = jsonDecoder.decodeBool( - jsonPath + '.deleteSource', json['deleteSource']); + '$jsonPath.deleteSource', json['deleteSource']); } else { throw jsonDecoder.mismatch(jsonPath, 'deleteSource'); } bool inlineAll; if (json.containsKey('inlineAll')) { inlineAll = - jsonDecoder.decodeBool(jsonPath + '.inlineAll', json['inlineAll']); + jsonDecoder.decodeBool('$jsonPath.inlineAll', json['inlineAll']); } else { throw jsonDecoder.mismatch(jsonPath, 'inlineAll'); } @@ -3199,7 +3199,7 @@ class KytheGetKytheEntriesParams implements RequestParams { if (json is Map) { String file; if (json.containsKey('file')) { - file = jsonDecoder.decodeString(jsonPath + '.file', json['file']); + file = jsonDecoder.decodeString('$jsonPath.file', json['file']); } else { throw jsonDecoder.mismatch(jsonPath, 'file'); } @@ -3269,7 +3269,7 @@ class KytheGetKytheEntriesResult implements ResponseResult { List entries; if (json.containsKey('entries')) { entries = jsonDecoder.decodeList( - jsonPath + '.entries', + '$jsonPath.entries', json['entries'], (String jsonPath, Object? json) => KytheEntry.fromJson(jsonDecoder, jsonPath, json)); @@ -3279,7 +3279,7 @@ class KytheGetKytheEntriesResult implements ResponseResult { List files; if (json.containsKey('files')) { files = jsonDecoder.decodeList( - jsonPath + '.files', json['files'], jsonDecoder.decodeString); + '$jsonPath.files', json['files'], jsonDecoder.decodeString); } else { throw jsonDecoder.mismatch(jsonPath, 'files'); } @@ -3362,7 +3362,7 @@ class MoveFileOptions extends RefactoringOptions { String newFile; if (json.containsKey('newFile')) { newFile = - jsonDecoder.decodeString(jsonPath + '.newFile', json['newFile']); + jsonDecoder.decodeString('$jsonPath.newFile', json['newFile']); } else { throw jsonDecoder.mismatch(jsonPath, 'newFile'); } @@ -3431,22 +3431,21 @@ class PluginErrorParams implements HasToJson { if (json is Map) { bool isFatal; if (json.containsKey('isFatal')) { - isFatal = - jsonDecoder.decodeBool(jsonPath + '.isFatal', json['isFatal']); + isFatal = jsonDecoder.decodeBool('$jsonPath.isFatal', json['isFatal']); } else { throw jsonDecoder.mismatch(jsonPath, 'isFatal'); } String message; if (json.containsKey('message')) { message = - jsonDecoder.decodeString(jsonPath + '.message', json['message']); + jsonDecoder.decodeString('$jsonPath.message', json['message']); } else { throw jsonDecoder.mismatch(jsonPath, 'message'); } String stackTrace; if (json.containsKey('stackTrace')) { stackTrace = jsonDecoder.decodeString( - jsonPath + '.stackTrace', json['stackTrace']); + '$jsonPath.stackTrace', json['stackTrace']); } else { throw jsonDecoder.mismatch(jsonPath, 'stackTrace'); } @@ -3564,21 +3563,21 @@ class PluginVersionCheckParams implements RequestParams { String byteStorePath; if (json.containsKey('byteStorePath')) { byteStorePath = jsonDecoder.decodeString( - jsonPath + '.byteStorePath', json['byteStorePath']); + '$jsonPath.byteStorePath', json['byteStorePath']); } else { throw jsonDecoder.mismatch(jsonPath, 'byteStorePath'); } String sdkPath; if (json.containsKey('sdkPath')) { sdkPath = - jsonDecoder.decodeString(jsonPath + '.sdkPath', json['sdkPath']); + jsonDecoder.decodeString('$jsonPath.sdkPath', json['sdkPath']); } else { throw jsonDecoder.mismatch(jsonPath, 'sdkPath'); } String version; if (json.containsKey('version')) { version = - jsonDecoder.decodeString(jsonPath + '.version', json['version']); + jsonDecoder.decodeString('$jsonPath.version', json['version']); } else { throw jsonDecoder.mismatch(jsonPath, 'version'); } @@ -3674,34 +3673,32 @@ class PluginVersionCheckResult implements ResponseResult { bool isCompatible; if (json.containsKey('isCompatible')) { isCompatible = jsonDecoder.decodeBool( - jsonPath + '.isCompatible', json['isCompatible']); + '$jsonPath.isCompatible', json['isCompatible']); } else { throw jsonDecoder.mismatch(jsonPath, 'isCompatible'); } String name; if (json.containsKey('name')) { - name = jsonDecoder.decodeString(jsonPath + '.name', json['name']); + name = jsonDecoder.decodeString('$jsonPath.name', json['name']); } else { throw jsonDecoder.mismatch(jsonPath, 'name'); } String version; if (json.containsKey('version')) { version = - jsonDecoder.decodeString(jsonPath + '.version', json['version']); + jsonDecoder.decodeString('$jsonPath.version', json['version']); } else { throw jsonDecoder.mismatch(jsonPath, 'version'); } String? contactInfo; if (json.containsKey('contactInfo')) { contactInfo = jsonDecoder.decodeString( - jsonPath + '.contactInfo', json['contactInfo']); + '$jsonPath.contactInfo', json['contactInfo']); } List interestingFiles; if (json.containsKey('interestingFiles')) { - interestingFiles = jsonDecoder.decodeList( - jsonPath + '.interestingFiles', - json['interestingFiles'], - jsonDecoder.decodeString); + interestingFiles = jsonDecoder.decodeList('$jsonPath.interestingFiles', + json['interestingFiles'], jsonDecoder.decodeString); } else { throw jsonDecoder.mismatch(jsonPath, 'interestingFiles'); } @@ -3790,14 +3787,14 @@ class PrioritizedSourceChange implements HasToJson { int priority; if (json.containsKey('priority')) { priority = - jsonDecoder.decodeInt(jsonPath + '.priority', json['priority']); + jsonDecoder.decodeInt('$jsonPath.priority', json['priority']); } else { throw jsonDecoder.mismatch(jsonPath, 'priority'); } SourceChange change; if (json.containsKey('change')) { change = SourceChange.fromJson( - jsonDecoder, jsonPath + '.change', json['change']); + jsonDecoder, '$jsonPath.change', json['change']); } else { throw jsonDecoder.mismatch(jsonPath, 'change'); } @@ -3936,27 +3933,27 @@ class RenameFeedback extends RefactoringFeedback { if (json is Map) { int offset; if (json.containsKey('offset')) { - offset = jsonDecoder.decodeInt(jsonPath + '.offset', json['offset']); + offset = jsonDecoder.decodeInt('$jsonPath.offset', json['offset']); } else { throw jsonDecoder.mismatch(jsonPath, 'offset'); } int length; if (json.containsKey('length')) { - length = jsonDecoder.decodeInt(jsonPath + '.length', json['length']); + length = jsonDecoder.decodeInt('$jsonPath.length', json['length']); } else { throw jsonDecoder.mismatch(jsonPath, 'length'); } String elementKindName; if (json.containsKey('elementKindName')) { elementKindName = jsonDecoder.decodeString( - jsonPath + '.elementKindName', json['elementKindName']); + '$jsonPath.elementKindName', json['elementKindName']); } else { throw jsonDecoder.mismatch(jsonPath, 'elementKindName'); } String oldName; if (json.containsKey('oldName')) { oldName = - jsonDecoder.decodeString(jsonPath + '.oldName', json['oldName']); + jsonDecoder.decodeString('$jsonPath.oldName', json['oldName']); } else { throw jsonDecoder.mismatch(jsonPath, 'oldName'); } @@ -4019,7 +4016,7 @@ class RenameOptions extends RefactoringOptions { String newName; if (json.containsKey('newName')) { newName = - jsonDecoder.decodeString(jsonPath + '.newName', json['newName']); + jsonDecoder.decodeString('$jsonPath.newName', json['newName']); } else { throw jsonDecoder.mismatch(jsonPath, 'newName'); } @@ -4086,21 +4083,21 @@ class RequestError implements HasToJson { RequestErrorCode code; if (json.containsKey('code')) { code = RequestErrorCode.fromJson( - jsonDecoder, jsonPath + '.code', json['code']); + jsonDecoder, '$jsonPath.code', json['code']); } else { throw jsonDecoder.mismatch(jsonPath, 'code'); } String message; if (json.containsKey('message')) { message = - jsonDecoder.decodeString(jsonPath + '.message', json['message']); + jsonDecoder.decodeString('$jsonPath.message', json['message']); } else { throw jsonDecoder.mismatch(jsonPath, 'message'); } String? stackTrace; if (json.containsKey('stackTrace')) { stackTrace = jsonDecoder.decodeString( - jsonPath + '.stackTrace', json['stackTrace']); + '$jsonPath.stackTrace', json['stackTrace']); } return RequestError(code, message, stackTrace: stackTrace); } else { @@ -4246,13 +4243,13 @@ class WatchEvent implements HasToJson { WatchEventType type; if (json.containsKey('type')) { type = WatchEventType.fromJson( - jsonDecoder, jsonPath + '.type', json['type']); + jsonDecoder, '$jsonPath.type', json['type']); } else { throw jsonDecoder.mismatch(jsonPath, 'type'); } String path; if (json.containsKey('path')) { - path = jsonDecoder.decodeString(jsonPath + '.path', json['path']); + path = jsonDecoder.decodeString('$jsonPath.path', json['path']); } else { throw jsonDecoder.mismatch(jsonPath, 'path'); } diff --git a/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart b/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart index f7cdfcbe45c..4fc7d7d955c 100644 --- a/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart +++ b/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart @@ -215,7 +215,7 @@ abstract class ServerIsolateChannel implements ServerCommunicationChannel { onDone(); } close(); - return null; + return; } var channelReady = Completer(); diff --git a/pkg/analyzer_plugin/lib/src/protocol/protocol_internal.dart b/pkg/analyzer_plugin/lib/src/protocol/protocol_internal.dart index 262911a753e..6f37b198929 100644 --- a/pkg/analyzer_plugin/lib/src/protocol/protocol_internal.dart +++ b/pkg/analyzer_plugin/lib/src/protocol/protocol_internal.dart @@ -21,8 +21,9 @@ final Map REQUEST_ID_REFACTORING_KINDS = void addAllEditsForSource( SourceFileEdit sourceFileEdit, Iterable edits, {bool insertBeforeExisting = false}) { - edits.forEach((edit) => - sourceFileEdit.add(edit, insertBeforeExisting: insertBeforeExisting)); + for (var edit in edits) { + sourceFileEdit.add(edit, insertBeforeExisting: insertBeforeExisting); + } } /// 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 /// SourceEdit.applySequence(). String applySequenceOfEdits(String code, Iterable edits) { - edits.forEach((SourceEdit edit) { + for (var edit in edits) { code = edit.apply(code); - }); + } return code; } diff --git a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart index 0f6f1dba920..080188dd396 100644 --- a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart +++ b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_core.dart @@ -312,7 +312,7 @@ class ChangeBuilderImpl implements ChangeBuilder { /// [offset] such that the positions are offset by the given [delta]. /// Positions occur in linked edit groups and as the post-change selection. void _updatePositions(int offset, int delta) { - void _updatePosition(Position position) { + void updatePosition(Position position) { if (position.offset >= offset && !_lockedPositions.contains(position)) { position.offset = position.offset + delta; } @@ -320,12 +320,12 @@ class ChangeBuilderImpl implements ChangeBuilder { for (var group in _linkedEditGroups.values) { for (var position in group.positions) { - _updatePosition(position); + updatePosition(position); } } var selection = _selection; if (selection != null) { - _updatePosition(selection); + updatePosition(selection); } } } @@ -639,7 +639,9 @@ class LinkedEditBuilderImpl implements LinkedEditBuilder { @override void addSuggestions(LinkedEditSuggestionKind kind, Iterable values) { - values.forEach((value) => addSuggestion(kind, value)); + for (var value in values) { + addSuggestion(kind, value); + } } @override diff --git a/pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart b/pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart index a884ea3a388..70b8e89e298 100644 --- a/pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart +++ b/pkg/analyzer_plugin/lib/src/utilities/completion/completion_target.dart @@ -526,7 +526,7 @@ class CompletionTarget { static Token? _computeDroppedToken( AstNode containingNode, Object? entity, int offset) { // Find the last token of the member before the entity. - var previousMember; + SyntacticEntity? previousMember; for (var member in containingNode.childEntities) { if (entity == member) { break; diff --git a/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart b/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart index 728782af551..2dfb78785c2 100644 --- a/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart +++ b/pkg/analyzer_plugin/lib/src/utilities/visitors/local_declaration_visitor.dart @@ -116,9 +116,9 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor { declaredLocalVar(loopVariable.identifier, loopVariable.type); } else if (forLoopParts is ForPartsWithDeclarations) { var varList = forLoopParts.variables; - varList.variables.forEach((VariableDeclaration varDecl) { + for (var varDecl in varList.variables) { declaredLocalVar(varDecl.name, varList.type); - }); + } } visitNode(node); } @@ -131,9 +131,9 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor { declaredLocalVar(loopVariable.identifier, loopVariable.type); } else if (forLoopParts is ForPartsWithDeclarations) { var varList = forLoopParts.variables; - varList.variables.forEach((VariableDeclaration varDecl) { + for (var varDecl in varList.variables) { declaredLocalVar(varDecl.name, varList.type); - }); + } } visitNode(node); } @@ -214,9 +214,9 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor { void _visitClassOrMixinMembers(List members) { for (var member in members) { if (member is FieldDeclaration) { - member.fields.variables.forEach((VariableDeclaration varDecl) { + for (var varDecl in member.fields.variables) { declaredField(member, varDecl); - }); + } } else if (member is MethodDeclaration) { declaredMethod(member); _visitTypeParameters(member, member.typeParameters); @@ -225,7 +225,7 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor { } void _visitCompilationUnit(CompilationUnit node) { - node.declarations.forEach((Declaration declaration) { + for (var declaration in node.declarations) { if (declaration is ClassDeclaration) { declaredClass(declaration); _visitTypeParameters(declaration, declaration.typeParameters); @@ -251,9 +251,9 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor { ); } else if (declaration is TopLevelVariableDeclaration) { var varList = declaration.variables; - varList.variables.forEach((VariableDeclaration varDecl) { + for (var varDecl in varList.variables) { declaredTopLevelVar(varList, varDecl); - }); + } } else if (declaration is ClassTypeAlias) { declaredClassTypeAlias(declaration); _visitTypeParameters(declaration, declaration.typeParameters); @@ -272,12 +272,12 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor { declaredMixin(declaration); _visitTypeParameters(declaration, declaration.typeParameters); } - }); + } } void _visitParamList(FormalParameterList? paramList) { if (paramList != null) { - paramList.parameters.forEach((FormalParameter param) { + for (var param in paramList.parameters) { NormalFormalParameter? normalParam; if (param is DefaultFormalParameter) { normalParam = param.parameter; @@ -294,7 +294,7 @@ abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor { } var name = param.identifier; declaredParam(name!, type); - }); + } } } diff --git a/pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart b/pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart index 497154308bc..77592cb1f2f 100644 --- a/pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart +++ b/pkg/analyzer_plugin/lib/utilities/fixes/fixes.dart @@ -114,7 +114,7 @@ class FixKind { int get hashCode => id.hashCode; @override - bool operator ==(o) => o is FixKind && o.id == id; + bool operator ==(other) => other is FixKind && other.id == id; @override String toString() => id; diff --git a/pkg/analyzer_plugin/pubspec.yaml b/pkg/analyzer_plugin/pubspec.yaml index 11bb9754bfe..2b61963b11f 100644 --- a/pkg/analyzer_plugin/pubspec.yaml +++ b/pkg/analyzer_plugin/pubspec.yaml @@ -19,6 +19,7 @@ dependencies: # See also https://dart.dev/tools/pub/dependencies. dev_dependencies: analyzer_utilities: any + lints: any meta: any path: any test_reflective_loader: any diff --git a/pkg/analyzer_plugin/test/integration/support/integration_tests.dart b/pkg/analyzer_plugin/test/integration/support/integration_tests.dart index 830140c9247..b71c0ae4f57 100644 --- a/pkg/analyzer_plugin/test/integration/support/integration_tests.dart +++ b/pkg/analyzer_plugin/test/integration/support/integration_tests.dart @@ -447,6 +447,7 @@ class Server { return; } _recordStdio('RECV: $trimmedLine'); + // ignore: prefer_typing_uninitialized_variables var message; try { message = json.decoder.convert(trimmedLine); diff --git a/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart b/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart index 4d9d8e90110..09bae68a605 100644 --- a/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart +++ b/pkg/analyzer_plugin/test/src/utilities/change_builder/change_builder_dart_test.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: camel_case_types + import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/dart/element/element.dart'; import 'package:analyzer/dart/element/nullability_suffix.dart'; @@ -1743,7 +1745,7 @@ _prefix0.A1 a1; _prefix0.A2 a2; _prefix1.B b;'''); Future _assertWriteType(String typeCode, {String? declarations}) async { var path = convertPath('/home/test/lib/test.dart'); - var content = (declarations ?? '') + '$typeCode v;'; + var content = '${declarations ?? ''}$typeCode v;'; addSource(path, content); var f = await _getTopLevelAccessorElement(path, 'v'); diff --git a/pkg/analyzer_plugin/test/src/utilities/change_builder/dart/import_library_element_test.dart b/pkg/analyzer_plugin/test/src/utilities/change_builder/dart/import_library_element_test.dart index 7a9aef867e6..157e8ab9159 100644 --- a/pkg/analyzer_plugin/test/src/utilities/change_builder/dart/import_library_element_test.dart +++ b/pkg/analyzer_plugin/test/src/utilities/change_builder/dart/import_library_element_test.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: camel_case_types + import 'package:analyzer/dart/analysis/results.dart'; import 'package:analyzer_plugin/protocol/protocol_common.dart'; import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart'; diff --git a/pkg/analyzer_plugin/test/utilities/range_factory_test.dart b/pkg/analyzer_plugin/test/utilities/range_factory_test.dart index e3ffd033679..6825c53ea83 100644 --- a/pkg/analyzer_plugin/test/utilities/range_factory_test.dart +++ b/pkg/analyzer_plugin/test/utilities/range_factory_test.dart @@ -2,6 +2,8 @@ // 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. +// ignore_for_file: camel_case_types + import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/source/source_range.dart'; import 'package:analyzer/src/generated/source.dart'; diff --git a/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart b/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart index cc470a365de..aa3882255d0 100644 --- a/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart +++ b/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart @@ -563,7 +563,7 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator { for (var field in type.fields) { var fieldNameString = literalString(field.name); var fieldAccessor = 'json[$fieldNameString]'; - var jsonPath = 'jsonPath + ${literalString('.${field.name}')}'; + var jsonPath = literalString('\$jsonPath.${field.name}'); if (field.value != null) { var valueString = literalString(field.value as String); writeln('if ($fieldAccessor != $valueString) {'); diff --git a/pkg/analyzer_plugin/tool/spec/codegen_protocol_constants.dart b/pkg/analyzer_plugin/tool/spec/codegen_protocol_constants.dart index 611e58380e9..40d6e68f33d 100644 --- a/pkg/analyzer_plugin/tool/spec/codegen_protocol_constants.dart +++ b/pkg/analyzer_plugin/tool/spec/codegen_protocol_constants.dart @@ -103,14 +103,14 @@ class _ConstantVisitor extends HierarchicalApiVisitor { if (type == null) { return; } - type.fields.forEach((TypeObjectField field) { + for (var field in type.fields) { var name = field.name; var components = []; components.add(parentName); components.addAll(_split(name)); var fieldConstantName = _fromComponents(components); constants.add(_Constant(fieldConstantName, "'$name'")); - }); + } } /// Return a name generated by converting each of the given [components] to an