1
0
mirror of https://github.com/dart-lang/sdk synced 2024-07-08 12:06:26 +00:00

analyzer: use Object.hash functions, deprecate JenkinsSmiHash

Also bump min SDK for pkg:analyzer

Towards https://github.com/dart-lang/sdk/issues/27698

Change-Id: Ic32c839c02f18afd99fdb98eb382540aae7da88a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214126
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Kevin Moore 2021-09-22 19:11:24 +00:00 committed by commit-bot@chromium.org
parent 31922b8c57
commit cb7c932f7b
25 changed files with 1902 additions and 3216 deletions

View File

@ -11,7 +11,7 @@
"constraint, update this by running tools/generate_package_config.dart."
],
"configVersion": 2,
"generated": "2021-09-10T11:44:31.694550",
"generated": "2021-09-21T21:00:34.058842",
"generator": "tools/generate_package_config.dart",
"packages": [
{
@ -82,7 +82,7 @@
"name": "analyzer",
"rootUri": "../pkg/analyzer",
"packageUri": "lib/",
"languageVersion": "2.12"
"languageVersion": "2.14"
},
{
"name": "analyzer_cli",
@ -476,7 +476,7 @@
"name": "nnbd_migration",
"rootUri": "../pkg/nnbd_migration",
"packageUri": "lib/",
"languageVersion": "2.12"
"languageVersion": "2.14"
},
{
"name": "oauth2",

View File

@ -7,7 +7,6 @@ import 'dart:async';
import 'package:analysis_server/lsp_protocol/protocol_generated.dart';
import 'package:analysis_server/src/lsp/json_parsing.dart';
import 'package:analysis_server/src/protocol/protocol_internal.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
const jsonRpcVersion = '2.0';
@ -36,20 +35,15 @@ bool lspEquals(dynamic obj1, dynamic obj2) {
/// Returns an objects hash code, recursively combining hashes for items in
/// Maps/Lists.
int lspHashCode(dynamic obj) {
var hash = 0;
if (obj is List) {
for (var element in obj) {
hash = JenkinsSmiHash.combine(hash, lspHashCode(element));
}
return Object.hashAll(obj.map(lspHashCode));
} else if (obj is Map) {
for (var key in obj.keys) {
hash = JenkinsSmiHash.combine(hash, lspHashCode(key));
hash = JenkinsSmiHash.combine(hash, lspHashCode(obj[key]));
}
return Object.hashAll(obj.entries
.expand((element) => [element.key, element.value])
.map(lspHashCode));
} else {
hash = obj.hashCode;
return obj.hashCode;
}
return JenkinsSmiHash.finish(hash);
}
Object? specToJson(Object? obj) {

File diff suppressed because it is too large Load Diff

View File

@ -39,3 +39,11 @@ dev_dependencies:
matcher: any
pedantic: ^1.9.0
test_reflective_loader: any
dependency_overrides:
_fe_analyzer_shared:
path: ../_fe_analyzer_shared
analyzer:
path: ../analyzer
meta:
path: ../meta

View File

@ -384,8 +384,6 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
writeln("import 'dart:convert' hide JsonDecoder;");
writeln();
if (isServer) {
writeln(
"import 'package:analyzer/src/generated/utilities_general.dart';");
writeln("import 'package:$packageName/protocol/protocol.dart';");
writeln(
"import 'package:$packageName/src/protocol/protocol_internal.dart';");
@ -400,7 +398,6 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
"import 'package:$packageName/src/protocol/protocol_common.dart';");
writeln(
"import 'package:$packageName/src/protocol/protocol_internal.dart';");
writeln("import 'package:$packageName/src/protocol/protocol_util.dart';");
}
}
@ -641,25 +638,33 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
/// Emit the hashCode getter for an object class.
void emitObjectHashCode(TypeObject? type, String className) {
writeln('@override');
writeln('int get hashCode {');
writeln('int get hashCode => ');
indent(() {
if (type == null) {
writeln('return ${className.hashCode};');
writeln(' ${className.hashCode}');
} else {
writeln('var hash = 0;');
for (var field in type.fields) {
String valueToCombine;
final items = type.fields.map((field) {
if (field.value != null) {
valueToCombine = field.value.hashCode.toString();
return field.value.hashCode.toString();
} else {
valueToCombine = '${field.name}.hashCode';
return '${field.name}.hashCode';
}
writeln('hash = JenkinsSmiHash.combine(hash, $valueToCombine);');
}).toList();
if (items.isEmpty) {
writeln('0');
} else if (items.length == 1) {
writeln(items.single);
} else {
writeln('Object.hash(');
for (var field in items) {
writeln('$field,');
}
writeln(')');
}
writeln('return JenkinsSmiHash.finish(hash);');
}
writeln(';');
});
writeln('}');
}
/// If the class named [className] requires special constructors, emit them

View File

@ -8,7 +8,6 @@
import 'dart:convert' hide JsonDecoder;
import 'package:analysis_server_client/src/protocol/protocol_util.dart';
import 'package:analysis_server_client/src/protocol/protocol_base.dart';
import 'package:analysis_server_client/src/protocol/protocol_internal.dart';
@ -66,12 +65,10 @@ class AddContentOverlay implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, 704418402);
hash = JenkinsSmiHash.combine(hash, content.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
704418402,
content.hashCode,
);
}
/// AnalysisError
@ -252,19 +249,17 @@ class AnalysisError implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, severity.hashCode);
hash = JenkinsSmiHash.combine(hash, type.hashCode);
hash = JenkinsSmiHash.combine(hash, location.hashCode);
hash = JenkinsSmiHash.combine(hash, message.hashCode);
hash = JenkinsSmiHash.combine(hash, correction.hashCode);
hash = JenkinsSmiHash.combine(hash, code.hashCode);
hash = JenkinsSmiHash.combine(hash, url.hashCode);
hash = JenkinsSmiHash.combine(hash, contextMessages.hashCode);
hash = JenkinsSmiHash.combine(hash, hasFix.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
severity.hashCode,
type.hashCode,
location.hashCode,
message.hashCode,
correction.hashCode,
code.hashCode,
url.hashCode,
contextMessages.hashCode,
hasFix.hashCode,
);
}
/// AnalysisErrorSeverity
@ -477,12 +472,10 @@ class ChangeContentOverlay implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, 873118866);
hash = JenkinsSmiHash.combine(hash, edits.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
873118866,
edits.hashCode,
);
}
/// CompletionSuggestion
@ -918,33 +911,31 @@ class CompletionSuggestion implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, relevance.hashCode);
hash = JenkinsSmiHash.combine(hash, completion.hashCode);
hash = JenkinsSmiHash.combine(hash, displayText.hashCode);
hash = JenkinsSmiHash.combine(hash, replacementOffset.hashCode);
hash = JenkinsSmiHash.combine(hash, replacementLength.hashCode);
hash = JenkinsSmiHash.combine(hash, selectionOffset.hashCode);
hash = JenkinsSmiHash.combine(hash, selectionLength.hashCode);
hash = JenkinsSmiHash.combine(hash, isDeprecated.hashCode);
hash = JenkinsSmiHash.combine(hash, isPotential.hashCode);
hash = JenkinsSmiHash.combine(hash, docSummary.hashCode);
hash = JenkinsSmiHash.combine(hash, docComplete.hashCode);
hash = JenkinsSmiHash.combine(hash, declaringType.hashCode);
hash = JenkinsSmiHash.combine(hash, defaultArgumentListString.hashCode);
hash = JenkinsSmiHash.combine(hash, defaultArgumentListTextRanges.hashCode);
hash = JenkinsSmiHash.combine(hash, element.hashCode);
hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
hash = JenkinsSmiHash.combine(hash, parameterNames.hashCode);
hash = JenkinsSmiHash.combine(hash, parameterTypes.hashCode);
hash = JenkinsSmiHash.combine(hash, requiredParameterCount.hashCode);
hash = JenkinsSmiHash.combine(hash, hasNamedParameters.hashCode);
hash = JenkinsSmiHash.combine(hash, parameterName.hashCode);
hash = JenkinsSmiHash.combine(hash, parameterType.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hashAll([
kind.hashCode,
relevance.hashCode,
completion.hashCode,
displayText.hashCode,
replacementOffset.hashCode,
replacementLength.hashCode,
selectionOffset.hashCode,
selectionLength.hashCode,
isDeprecated.hashCode,
isPotential.hashCode,
docSummary.hashCode,
docComplete.hashCode,
declaringType.hashCode,
defaultArgumentListString.hashCode,
defaultArgumentListTextRanges.hashCode,
element.hashCode,
returnType.hashCode,
parameterNames.hashCode,
parameterTypes.hashCode,
requiredParameterCount.hashCode,
hasNamedParameters.hashCode,
parameterName.hashCode,
parameterType.hashCode,
]);
}
/// CompletionSuggestionKind
@ -1139,12 +1130,10 @@ class DiagnosticMessage implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, message.hashCode);
hash = JenkinsSmiHash.combine(hash, location.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
message.hashCode,
location.hashCode,
);
}
/// Element
@ -1347,18 +1336,16 @@ class Element implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, name.hashCode);
hash = JenkinsSmiHash.combine(hash, location.hashCode);
hash = JenkinsSmiHash.combine(hash, flags.hashCode);
hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
hash = JenkinsSmiHash.combine(hash, typeParameters.hashCode);
hash = JenkinsSmiHash.combine(hash, aliasedType.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
kind.hashCode,
name.hashCode,
location.hashCode,
flags.hashCode,
parameters.hashCode,
returnType.hashCode,
typeParameters.hashCode,
aliasedType.hashCode,
);
}
/// ElementKind
@ -1753,13 +1740,11 @@ class FoldingRegion implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
kind.hashCode,
offset.hashCode,
length.hashCode,
);
}
/// HighlightRegion
@ -1835,13 +1820,11 @@ class HighlightRegion implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, type.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
type.hashCode,
offset.hashCode,
length.hashCode,
);
}
/// HighlightRegionType
@ -2545,15 +2528,13 @@ class KytheEntry implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, source.hashCode);
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, target.hashCode);
hash = JenkinsSmiHash.combine(hash, fact.hashCode);
hash = JenkinsSmiHash.combine(hash, value.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
source.hashCode,
kind.hashCode,
target.hashCode,
fact.hashCode,
value.hashCode,
);
}
/// KytheVName
@ -2659,15 +2640,13 @@ class KytheVName implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, signature.hashCode);
hash = JenkinsSmiHash.combine(hash, corpus.hashCode);
hash = JenkinsSmiHash.combine(hash, root.hashCode);
hash = JenkinsSmiHash.combine(hash, path.hashCode);
hash = JenkinsSmiHash.combine(hash, language.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
signature.hashCode,
corpus.hashCode,
root.hashCode,
path.hashCode,
language.hashCode,
);
}
/// LinkedEditGroup
@ -2770,13 +2749,11 @@ class LinkedEditGroup implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, positions.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, suggestions.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
positions.hashCode,
length.hashCode,
suggestions.hashCode,
);
}
/// LinkedEditSuggestion
@ -2839,12 +2816,10 @@ class LinkedEditSuggestion implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, value.hashCode);
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
value.hashCode,
kind.hashCode,
);
}
/// LinkedEditSuggestionKind
@ -3043,17 +3018,15 @@ class Location implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, startLine.hashCode);
hash = JenkinsSmiHash.combine(hash, startColumn.hashCode);
hash = JenkinsSmiHash.combine(hash, endLine.hashCode);
hash = JenkinsSmiHash.combine(hash, endColumn.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
offset.hashCode,
length.hashCode,
startLine.hashCode,
startColumn.hashCode,
endLine.hashCode,
endColumn.hashCode,
);
}
/// NavigationRegion
@ -3131,13 +3104,11 @@ class NavigationRegion implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, targets.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
offset.hashCode,
length.hashCode,
targets.hashCode,
);
}
/// NavigationTarget
@ -3287,18 +3258,16 @@ class NavigationTarget implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, fileIndex.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, startLine.hashCode);
hash = JenkinsSmiHash.combine(hash, startColumn.hashCode);
hash = JenkinsSmiHash.combine(hash, codeOffset.hashCode);
hash = JenkinsSmiHash.combine(hash, codeLength.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
kind.hashCode,
fileIndex.hashCode,
offset.hashCode,
length.hashCode,
startLine.hashCode,
startColumn.hashCode,
codeOffset.hashCode,
codeLength.hashCode,
);
}
/// Occurrences
@ -3375,13 +3344,11 @@ class Occurrences implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, element.hashCode);
hash = JenkinsSmiHash.combine(hash, offsets.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
element.hashCode,
offsets.hashCode,
length.hashCode,
);
}
/// Outline
@ -3509,16 +3476,14 @@ class Outline implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, element.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, codeOffset.hashCode);
hash = JenkinsSmiHash.combine(hash, codeLength.hashCode);
hash = JenkinsSmiHash.combine(hash, children.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
element.hashCode,
offset.hashCode,
length.hashCode,
codeOffset.hashCode,
codeLength.hashCode,
children.hashCode,
);
}
/// ParameterInfo
@ -3609,14 +3574,12 @@ class ParameterInfo implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, name.hashCode);
hash = JenkinsSmiHash.combine(hash, type.hashCode);
hash = JenkinsSmiHash.combine(hash, defaultValue.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
kind.hashCode,
name.hashCode,
type.hashCode,
defaultValue.hashCode,
);
}
/// ParameterKind
@ -3748,12 +3711,10 @@ class Position implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
offset.hashCode,
);
}
/// RefactoringKind
@ -3963,15 +3924,13 @@ class RefactoringMethodParameter implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, id.hashCode);
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, type.hashCode);
hash = JenkinsSmiHash.combine(hash, name.hashCode);
hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
id.hashCode,
kind.hashCode,
type.hashCode,
name.hashCode,
parameters.hashCode,
);
}
/// RefactoringMethodParameterKind
@ -4111,13 +4070,11 @@ class RefactoringProblem implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, severity.hashCode);
hash = JenkinsSmiHash.combine(hash, message.hashCode);
hash = JenkinsSmiHash.combine(hash, location.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
severity.hashCode,
message.hashCode,
location.hashCode,
);
}
/// RefactoringProblemSeverity
@ -4248,11 +4205,7 @@ class RemoveContentOverlay implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, 114870849);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => 114870849;
}
/// SourceChange
@ -4397,15 +4350,13 @@ class SourceChange implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, message.hashCode);
hash = JenkinsSmiHash.combine(hash, edits.hashCode);
hash = JenkinsSmiHash.combine(hash, linkedEditGroups.hashCode);
hash = JenkinsSmiHash.combine(hash, selection.hashCode);
hash = JenkinsSmiHash.combine(hash, id.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
message.hashCode,
edits.hashCode,
linkedEditGroups.hashCode,
selection.hashCode,
id.hashCode,
);
}
/// SourceEdit
@ -4512,14 +4463,12 @@ class SourceEdit implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, replacement.hashCode);
hash = JenkinsSmiHash.combine(hash, id.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
offset.hashCode,
length.hashCode,
replacement.hashCode,
id.hashCode,
);
}
/// SourceFileEdit
@ -4610,11 +4559,9 @@ class SourceFileEdit implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, fileStamp.hashCode);
hash = JenkinsSmiHash.combine(hash, edits.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
fileStamp.hashCode,
edits.hashCode,
);
}

View File

@ -2,7 +2,6 @@
// 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.
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:path/path.dart' as path;
/// Information about the root directory associated with an analysis context.
@ -29,12 +28,7 @@ class ContextRoot {
ContextRoot(this.root, this.exclude, {required this.pathContext});
@override
int get hashCode {
int hash = 0;
hash = JenkinsSmiHash.combine(hash, root.hashCode);
hash = JenkinsSmiHash.combine(hash, exclude.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(root, exclude);
@override
bool operator ==(Object other) {

View File

@ -4,7 +4,6 @@
import 'dart:typed_data';
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:convert/convert.dart';
/// The reference to a class member.
@ -23,7 +22,7 @@ class ClassMemberReference {
final int hashCode;
ClassMemberReference(this.target, this.name)
: hashCode = JenkinsSmiHash.hash2(target.hashCode, name.hashCode);
: hashCode = Object.hash(target.hashCode, name.hashCode);
@override
bool operator ==(Object other) {
@ -121,7 +120,7 @@ class LibraryQualifiedName {
factory LibraryQualifiedName(Uri libraryUri, String name) {
var isPrivate = name.startsWith('_');
var hashCode = JenkinsSmiHash.hash2(libraryUri.hashCode, name.hashCode);
var hashCode = Object.hash(libraryUri.hashCode, name.hashCode);
return LibraryQualifiedName._internal(
libraryUri, name, isPrivate, hashCode);
}

View File

@ -6,7 +6,6 @@ import 'dart:typed_data';
import 'package:analyzer/dart/analysis/features.dart';
import 'package:analyzer/src/dart/analysis/experiments_impl.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:meta/meta.dart';
import 'package:pub_semver/src/version.dart';
@ -172,13 +171,7 @@ class ExperimentStatus with _CurrentState implements FeatureSet {
);
@override
int get hashCode {
int hash = 0;
for (var flag in _flags) {
hash = JenkinsSmiHash.combine(hash, flag.hashCode);
}
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hashAll(_flags);
@override
bool operator ==(Object other) {

View File

@ -13,7 +13,6 @@ import 'package:analyzer/error/error.dart';
import 'package:analyzer/src/dart/constant/has_type_parameter_reference.dart';
import 'package:analyzer/src/dart/element/type_system.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:meta/meta.dart';
/// The state of an object representing a boolean value.
@ -185,7 +184,7 @@ class DartObjectImpl implements DartObject {
Map<String, DartObjectImpl>? get fields => _state.fields;
@override
int get hashCode => JenkinsSmiHash.hash2(type.hashCode, _state.hashCode);
int get hashCode => Object.hash(type.hashCode, _state.hashCode);
@override
bool get hasKnownValue => !_state.isUnknown;

View File

@ -42,7 +42,6 @@ import 'package:analyzer/src/generated/sdk.dart' show DartSdk;
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/utilities_collection.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer/src/macro/impl/error.dart' as macro;
import 'package:analyzer/src/summary2/ast_binary_tokens.dart';
import 'package:analyzer/src/summary2/bundle_reader.dart';
@ -2735,14 +2734,7 @@ class ElementLocationImpl implements ElementLocation {
}
@override
int get hashCode {
int result = 0;
for (int i = 0; i < _components.length; i++) {
String component = _components[i];
result = JenkinsSmiHash.combine(result, component.hashCode);
}
return result;
}
int get hashCode => Object.hashAll(_components);
@override
bool operator ==(Object object) {

View File

@ -8,7 +8,6 @@ import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/member.dart';
import 'package:analyzer/src/dart/element/type_algebra.dart';
import 'package:analyzer/src/dart/element/type_system.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
/// Failure because of there is no most specific signature in [candidates].
class CandidatesConflict extends Conflict {
@ -885,7 +884,7 @@ class Name {
factory Name(Uri? libraryUri, String name) {
if (name.startsWith('_')) {
var hashCode = JenkinsSmiHash.hash2(libraryUri.hashCode, name.hashCode);
var hashCode = Object.hash(libraryUri.hashCode, name.hashCode);
return Name._internal(libraryUri, name, false, hashCode);
} else {
return Name._internal(null, name, true, name.hashCode);

View File

@ -42,58 +42,6 @@ String? toLowerCase(Object? value) => value?.toString().toLowerCase();
/// null.
String? toUpperCase(Object? value) => value?.toString().toUpperCase();
/// Jenkins hash function, optimized for small integers.
///
/// Static methods borrowed from sdk/lib/math/jenkins_smi_hash.dart. Non-static
/// methods are an enhancement for the "front_end" package.
///
/// Where performance is critical, use [hash2], [hash3], or [hash4], or the
/// pattern `finish(combine(combine(...combine(0, a), b)..., z))`, where a..z
/// are hash codes to be combined.
///
/// For ease of use, you may also use this pattern:
/// `(new JenkinsSmiHash()..add(a)..add(b)....add(z)).hashCode`, where a..z are
/// the sub-objects whose hashes should be combined. This pattern performs the
/// same operations as the performance critical variant, but allocates an extra
/// object.
class JenkinsSmiHash {
int _hash = 0;
/// Finalizes the hash and return the resulting hashcode.
@override
int get hashCode => finish(_hash);
/// Accumulates the object [o] into the hash.
void add(Object o) {
_hash = combine(_hash, o.hashCode);
}
/// Accumulates the hash code [value] into the running hash [hash].
static int combine(int hash, int value) {
hash = 0x1fffffff & (hash + value);
hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
return hash ^ (hash >> 6);
}
/// Finalizes a running hash produced by [combine].
static int finish(int hash) {
hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
hash = hash ^ (hash >> 11);
return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
}
/// Combines together two hash codes.
static int hash2(int a, int b) => finish(combine(combine(0, a), b));
/// Combines together three hash codes.
static int hash3(int a, int b, int c) =>
finish(combine(combine(combine(0, a), b), c));
/// Combines together four hash codes.
static int hash4(int a, int b, int c, int d) =>
finish(combine(combine(combine(combine(0, a), b), c), d));
}
/// A simple limited queue.
class LimitedQueue<E> extends ListQueue<E> {
final int limit;

View File

@ -4,7 +4,7 @@ description: This package provides a library that performs static analysis of Da
homepage: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer
environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.14.0 <3.0.0'
dependencies:
_fe_analyzer_shared: ^26.0.0

View File

@ -8,7 +8,6 @@
import 'dart:convert' hide JsonDecoder;
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer_plugin/protocol/protocol.dart';
import 'package:analyzer_plugin/src/protocol/protocol_internal.dart';
@ -66,12 +65,10 @@ class AddContentOverlay implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, 704418402);
hash = JenkinsSmiHash.combine(hash, content.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
704418402,
content.hashCode,
);
}
/// AnalysisError
@ -252,19 +249,17 @@ class AnalysisError implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, severity.hashCode);
hash = JenkinsSmiHash.combine(hash, type.hashCode);
hash = JenkinsSmiHash.combine(hash, location.hashCode);
hash = JenkinsSmiHash.combine(hash, message.hashCode);
hash = JenkinsSmiHash.combine(hash, correction.hashCode);
hash = JenkinsSmiHash.combine(hash, code.hashCode);
hash = JenkinsSmiHash.combine(hash, url.hashCode);
hash = JenkinsSmiHash.combine(hash, contextMessages.hashCode);
hash = JenkinsSmiHash.combine(hash, hasFix.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
severity.hashCode,
type.hashCode,
location.hashCode,
message.hashCode,
correction.hashCode,
code.hashCode,
url.hashCode,
contextMessages.hashCode,
hasFix.hashCode,
);
}
/// AnalysisErrorSeverity
@ -477,12 +472,10 @@ class ChangeContentOverlay implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, 873118866);
hash = JenkinsSmiHash.combine(hash, edits.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
873118866,
edits.hashCode,
);
}
/// CompletionSuggestion
@ -918,33 +911,31 @@ class CompletionSuggestion implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, relevance.hashCode);
hash = JenkinsSmiHash.combine(hash, completion.hashCode);
hash = JenkinsSmiHash.combine(hash, displayText.hashCode);
hash = JenkinsSmiHash.combine(hash, replacementOffset.hashCode);
hash = JenkinsSmiHash.combine(hash, replacementLength.hashCode);
hash = JenkinsSmiHash.combine(hash, selectionOffset.hashCode);
hash = JenkinsSmiHash.combine(hash, selectionLength.hashCode);
hash = JenkinsSmiHash.combine(hash, isDeprecated.hashCode);
hash = JenkinsSmiHash.combine(hash, isPotential.hashCode);
hash = JenkinsSmiHash.combine(hash, docSummary.hashCode);
hash = JenkinsSmiHash.combine(hash, docComplete.hashCode);
hash = JenkinsSmiHash.combine(hash, declaringType.hashCode);
hash = JenkinsSmiHash.combine(hash, defaultArgumentListString.hashCode);
hash = JenkinsSmiHash.combine(hash, defaultArgumentListTextRanges.hashCode);
hash = JenkinsSmiHash.combine(hash, element.hashCode);
hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
hash = JenkinsSmiHash.combine(hash, parameterNames.hashCode);
hash = JenkinsSmiHash.combine(hash, parameterTypes.hashCode);
hash = JenkinsSmiHash.combine(hash, requiredParameterCount.hashCode);
hash = JenkinsSmiHash.combine(hash, hasNamedParameters.hashCode);
hash = JenkinsSmiHash.combine(hash, parameterName.hashCode);
hash = JenkinsSmiHash.combine(hash, parameterType.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hashAll([
kind.hashCode,
relevance.hashCode,
completion.hashCode,
displayText.hashCode,
replacementOffset.hashCode,
replacementLength.hashCode,
selectionOffset.hashCode,
selectionLength.hashCode,
isDeprecated.hashCode,
isPotential.hashCode,
docSummary.hashCode,
docComplete.hashCode,
declaringType.hashCode,
defaultArgumentListString.hashCode,
defaultArgumentListTextRanges.hashCode,
element.hashCode,
returnType.hashCode,
parameterNames.hashCode,
parameterTypes.hashCode,
requiredParameterCount.hashCode,
hasNamedParameters.hashCode,
parameterName.hashCode,
parameterType.hashCode,
]);
}
/// CompletionSuggestionKind
@ -1139,12 +1130,10 @@ class DiagnosticMessage implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, message.hashCode);
hash = JenkinsSmiHash.combine(hash, location.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
message.hashCode,
location.hashCode,
);
}
/// Element
@ -1347,18 +1336,16 @@ class Element implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, name.hashCode);
hash = JenkinsSmiHash.combine(hash, location.hashCode);
hash = JenkinsSmiHash.combine(hash, flags.hashCode);
hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
hash = JenkinsSmiHash.combine(hash, typeParameters.hashCode);
hash = JenkinsSmiHash.combine(hash, aliasedType.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
kind.hashCode,
name.hashCode,
location.hashCode,
flags.hashCode,
parameters.hashCode,
returnType.hashCode,
typeParameters.hashCode,
aliasedType.hashCode,
);
}
/// ElementKind
@ -1753,13 +1740,11 @@ class FoldingRegion implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
kind.hashCode,
offset.hashCode,
length.hashCode,
);
}
/// HighlightRegion
@ -1835,13 +1820,11 @@ class HighlightRegion implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, type.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
type.hashCode,
offset.hashCode,
length.hashCode,
);
}
/// HighlightRegionType
@ -2545,15 +2528,13 @@ class KytheEntry implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, source.hashCode);
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, target.hashCode);
hash = JenkinsSmiHash.combine(hash, fact.hashCode);
hash = JenkinsSmiHash.combine(hash, value.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
source.hashCode,
kind.hashCode,
target.hashCode,
fact.hashCode,
value.hashCode,
);
}
/// KytheVName
@ -2659,15 +2640,13 @@ class KytheVName implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, signature.hashCode);
hash = JenkinsSmiHash.combine(hash, corpus.hashCode);
hash = JenkinsSmiHash.combine(hash, root.hashCode);
hash = JenkinsSmiHash.combine(hash, path.hashCode);
hash = JenkinsSmiHash.combine(hash, language.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
signature.hashCode,
corpus.hashCode,
root.hashCode,
path.hashCode,
language.hashCode,
);
}
/// LinkedEditGroup
@ -2770,13 +2749,11 @@ class LinkedEditGroup implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, positions.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, suggestions.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
positions.hashCode,
length.hashCode,
suggestions.hashCode,
);
}
/// LinkedEditSuggestion
@ -2839,12 +2816,10 @@ class LinkedEditSuggestion implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, value.hashCode);
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
value.hashCode,
kind.hashCode,
);
}
/// LinkedEditSuggestionKind
@ -3043,17 +3018,15 @@ class Location implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, startLine.hashCode);
hash = JenkinsSmiHash.combine(hash, startColumn.hashCode);
hash = JenkinsSmiHash.combine(hash, endLine.hashCode);
hash = JenkinsSmiHash.combine(hash, endColumn.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
offset.hashCode,
length.hashCode,
startLine.hashCode,
startColumn.hashCode,
endLine.hashCode,
endColumn.hashCode,
);
}
/// NavigationRegion
@ -3131,13 +3104,11 @@ class NavigationRegion implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, targets.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
offset.hashCode,
length.hashCode,
targets.hashCode,
);
}
/// NavigationTarget
@ -3287,18 +3258,16 @@ class NavigationTarget implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, fileIndex.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, startLine.hashCode);
hash = JenkinsSmiHash.combine(hash, startColumn.hashCode);
hash = JenkinsSmiHash.combine(hash, codeOffset.hashCode);
hash = JenkinsSmiHash.combine(hash, codeLength.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
kind.hashCode,
fileIndex.hashCode,
offset.hashCode,
length.hashCode,
startLine.hashCode,
startColumn.hashCode,
codeOffset.hashCode,
codeLength.hashCode,
);
}
/// Occurrences
@ -3375,13 +3344,11 @@ class Occurrences implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, element.hashCode);
hash = JenkinsSmiHash.combine(hash, offsets.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
element.hashCode,
offsets.hashCode,
length.hashCode,
);
}
/// Outline
@ -3509,16 +3476,14 @@ class Outline implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, element.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, codeOffset.hashCode);
hash = JenkinsSmiHash.combine(hash, codeLength.hashCode);
hash = JenkinsSmiHash.combine(hash, children.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
element.hashCode,
offset.hashCode,
length.hashCode,
codeOffset.hashCode,
codeLength.hashCode,
children.hashCode,
);
}
/// ParameterInfo
@ -3609,14 +3574,12 @@ class ParameterInfo implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, name.hashCode);
hash = JenkinsSmiHash.combine(hash, type.hashCode);
hash = JenkinsSmiHash.combine(hash, defaultValue.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
kind.hashCode,
name.hashCode,
type.hashCode,
defaultValue.hashCode,
);
}
/// ParameterKind
@ -3748,12 +3711,10 @@ class Position implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
offset.hashCode,
);
}
/// RefactoringKind
@ -3963,15 +3924,13 @@ class RefactoringMethodParameter implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, id.hashCode);
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, type.hashCode);
hash = JenkinsSmiHash.combine(hash, name.hashCode);
hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
id.hashCode,
kind.hashCode,
type.hashCode,
name.hashCode,
parameters.hashCode,
);
}
/// RefactoringMethodParameterKind
@ -4111,13 +4070,11 @@ class RefactoringProblem implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, severity.hashCode);
hash = JenkinsSmiHash.combine(hash, message.hashCode);
hash = JenkinsSmiHash.combine(hash, location.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
severity.hashCode,
message.hashCode,
location.hashCode,
);
}
/// RefactoringProblemSeverity
@ -4248,11 +4205,7 @@ class RemoveContentOverlay implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, 114870849);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => 114870849;
}
/// SourceChange
@ -4397,15 +4350,13 @@ class SourceChange implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, message.hashCode);
hash = JenkinsSmiHash.combine(hash, edits.hashCode);
hash = JenkinsSmiHash.combine(hash, linkedEditGroups.hashCode);
hash = JenkinsSmiHash.combine(hash, selection.hashCode);
hash = JenkinsSmiHash.combine(hash, id.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
message.hashCode,
edits.hashCode,
linkedEditGroups.hashCode,
selection.hashCode,
id.hashCode,
);
}
/// SourceEdit
@ -4512,14 +4463,12 @@ class SourceEdit implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, replacement.hashCode);
hash = JenkinsSmiHash.combine(hash, id.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
offset.hashCode,
length.hashCode,
replacement.hashCode,
id.hashCode,
);
}
/// SourceFileEdit
@ -4610,11 +4559,9 @@ class SourceFileEdit implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, fileStamp.hashCode);
hash = JenkinsSmiHash.combine(hash, edits.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
fileStamp.hashCode,
edits.hashCode,
);
}

View File

@ -8,7 +8,6 @@
import 'dart:convert' hide JsonDecoder;
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer_plugin/protocol/protocol.dart';
import 'package:analyzer_plugin/src/protocol/protocol_internal.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
@ -81,12 +80,10 @@ class AnalysisErrorFixes implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, error.hashCode);
hash = JenkinsSmiHash.combine(hash, fixes.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
error.hashCode,
fixes.hashCode,
);
}
/// analysis.errors params
@ -164,12 +161,10 @@ class AnalysisErrorsParams implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, errors.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
errors.hashCode,
);
}
/// analysis.folding params
@ -247,12 +242,10 @@ class AnalysisFoldingParams implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, regions.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
regions.hashCode,
);
}
/// analysis.getNavigation params
@ -340,13 +333,11 @@ class AnalysisGetNavigationParams implements RequestParams {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
offset.hashCode,
length.hashCode,
);
}
/// analysis.getNavigation result
@ -449,13 +440,11 @@ class AnalysisGetNavigationResult implements ResponseResult {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, files.hashCode);
hash = JenkinsSmiHash.combine(hash, targets.hashCode);
hash = JenkinsSmiHash.combine(hash, regions.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
files.hashCode,
targets.hashCode,
regions.hashCode,
);
}
/// analysis.handleWatchEvents params
@ -523,11 +512,7 @@ class AnalysisHandleWatchEventsParams implements RequestParams {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, events.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => events.hashCode;
}
/// analysis.handleWatchEvents result
@ -551,9 +536,7 @@ class AnalysisHandleWatchEventsResult implements ResponseResult {
}
@override
int get hashCode {
return 779767607;
}
int get hashCode => 779767607;
}
/// analysis.highlights params
@ -631,12 +614,10 @@ class AnalysisHighlightsParams implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, regions.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
regions.hashCode,
);
}
/// analysis.navigation params
@ -747,14 +728,12 @@ class AnalysisNavigationParams implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, regions.hashCode);
hash = JenkinsSmiHash.combine(hash, targets.hashCode);
hash = JenkinsSmiHash.combine(hash, files.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
regions.hashCode,
targets.hashCode,
files.hashCode,
);
}
/// analysis.occurrences params
@ -833,12 +812,10 @@ class AnalysisOccurrencesParams implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, occurrences.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
occurrences.hashCode,
);
}
/// analysis.outline params
@ -914,12 +891,10 @@ class AnalysisOutlineParams implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, outline.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
outline.hashCode,
);
}
/// AnalysisService
@ -1056,11 +1031,7 @@ class AnalysisSetContextRootsParams implements RequestParams {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, roots.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => roots.hashCode;
}
/// analysis.setContextRoots result
@ -1084,9 +1055,7 @@ class AnalysisSetContextRootsResult implements ResponseResult {
}
@override
int get hashCode {
return 969645618;
}
int get hashCode => 969645618;
}
/// analysis.setPriorityFiles params
@ -1149,11 +1118,7 @@ class AnalysisSetPriorityFilesParams implements RequestParams {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, files.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => files.hashCode;
}
/// analysis.setPriorityFiles result
@ -1177,9 +1142,7 @@ class AnalysisSetPriorityFilesResult implements ResponseResult {
}
@override
int get hashCode {
return 330050055;
}
int get hashCode => 330050055;
}
/// analysis.setSubscriptions params
@ -1252,11 +1215,7 @@ class AnalysisSetSubscriptionsParams implements RequestParams {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => subscriptions.hashCode;
}
/// analysis.setSubscriptions result
@ -1280,9 +1239,7 @@ class AnalysisSetSubscriptionsResult implements ResponseResult {
}
@override
int get hashCode {
return 218088493;
}
int get hashCode => 218088493;
}
/// analysis.updateContent params
@ -1356,11 +1313,7 @@ class AnalysisUpdateContentParams implements RequestParams {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, files.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => files.hashCode;
}
/// analysis.updateContent result
@ -1384,9 +1337,7 @@ class AnalysisUpdateContentResult implements ResponseResult {
}
@override
int get hashCode {
return 468798730;
}
int get hashCode => 468798730;
}
/// completion.getSuggestions params
@ -1459,12 +1410,10 @@ class CompletionGetSuggestionsParams implements RequestParams {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
offset.hashCode,
);
}
/// completion.getSuggestions result
@ -1572,13 +1521,11 @@ class CompletionGetSuggestionsResult implements ResponseResult {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, replacementOffset.hashCode);
hash = JenkinsSmiHash.combine(hash, replacementLength.hashCode);
hash = JenkinsSmiHash.combine(hash, results.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
replacementOffset.hashCode,
replacementLength.hashCode,
results.hashCode,
);
}
/// ContextRoot
@ -1659,13 +1606,11 @@ class ContextRoot implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, root.hashCode);
hash = JenkinsSmiHash.combine(hash, exclude.hashCode);
hash = JenkinsSmiHash.combine(hash, optionsFile.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
root.hashCode,
exclude.hashCode,
optionsFile.hashCode,
);
}
/// convertGetterToMethod feedback
@ -1682,9 +1627,7 @@ class ConvertGetterToMethodFeedback extends RefactoringFeedback
}
@override
int get hashCode {
return 616032599;
}
int get hashCode => 616032599;
}
/// convertGetterToMethod options
@ -1701,9 +1644,7 @@ class ConvertGetterToMethodOptions extends RefactoringOptions
}
@override
int get hashCode {
return 488848400;
}
int get hashCode => 488848400;
}
/// convertMethodToGetter feedback
@ -1720,9 +1661,7 @@ class ConvertMethodToGetterFeedback extends RefactoringFeedback
}
@override
int get hashCode {
return 165291526;
}
int get hashCode => 165291526;
}
/// convertMethodToGetter options
@ -1739,9 +1678,7 @@ class ConvertMethodToGetterOptions extends RefactoringOptions
}
@override
int get hashCode {
return 27952290;
}
int get hashCode => 27952290;
}
/// edit.getAssists params
@ -1826,13 +1763,11 @@ class EditGetAssistsParams implements RequestParams {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
offset.hashCode,
length.hashCode,
);
}
/// edit.getAssists result
@ -1901,11 +1836,7 @@ class EditGetAssistsResult implements ResponseResult {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, assists.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => assists.hashCode;
}
/// edit.getAvailableRefactorings params
@ -1991,13 +1922,11 @@ class EditGetAvailableRefactoringsParams implements RequestParams {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
offset.hashCode,
length.hashCode,
);
}
/// edit.getAvailableRefactorings result
@ -2072,11 +2001,7 @@ class EditGetAvailableRefactoringsResult implements ResponseResult {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, kinds.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => kinds.hashCode;
}
/// edit.getFixes params
@ -2148,12 +2073,10 @@ class EditGetFixesParams implements RequestParams {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
file.hashCode,
offset.hashCode,
);
}
/// edit.getFixes result
@ -2222,11 +2145,7 @@ class EditGetFixesResult implements ResponseResult {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, fixes.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => fixes.hashCode;
}
/// edit.getRefactoring params
@ -2361,16 +2280,14 @@ class EditGetRefactoringParams implements RequestParams {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
hash = JenkinsSmiHash.combine(hash, file.hashCode);
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, validateOnly.hashCode);
hash = JenkinsSmiHash.combine(hash, options.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
kind.hashCode,
file.hashCode,
offset.hashCode,
length.hashCode,
validateOnly.hashCode,
options.hashCode,
);
}
/// edit.getRefactoring result
@ -2542,16 +2459,14 @@ class EditGetRefactoringResult implements ResponseResult {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, initialProblems.hashCode);
hash = JenkinsSmiHash.combine(hash, optionsProblems.hashCode);
hash = JenkinsSmiHash.combine(hash, finalProblems.hashCode);
hash = JenkinsSmiHash.combine(hash, feedback.hashCode);
hash = JenkinsSmiHash.combine(hash, change.hashCode);
hash = JenkinsSmiHash.combine(hash, potentialEdits.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
initialProblems.hashCode,
optionsProblems.hashCode,
finalProblems.hashCode,
feedback.hashCode,
change.hashCode,
potentialEdits.hashCode,
);
}
/// extractLocalVariable feedback
@ -2673,15 +2588,13 @@ class ExtractLocalVariableFeedback extends RefactoringFeedback {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, coveringExpressionOffsets.hashCode);
hash = JenkinsSmiHash.combine(hash, coveringExpressionLengths.hashCode);
hash = JenkinsSmiHash.combine(hash, names.hashCode);
hash = JenkinsSmiHash.combine(hash, offsets.hashCode);
hash = JenkinsSmiHash.combine(hash, lengths.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
coveringExpressionOffsets.hashCode,
coveringExpressionLengths.hashCode,
names.hashCode,
offsets.hashCode,
lengths.hashCode,
);
}
/// extractLocalVariable options
@ -2754,12 +2667,10 @@ class ExtractLocalVariableOptions extends RefactoringOptions {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, name.hashCode);
hash = JenkinsSmiHash.combine(hash, extractAll.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
name.hashCode,
extractAll.hashCode,
);
}
/// extractMethod feedback
@ -2919,18 +2830,16 @@ class ExtractMethodFeedback extends RefactoringFeedback {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
hash = JenkinsSmiHash.combine(hash, names.hashCode);
hash = JenkinsSmiHash.combine(hash, canCreateGetter.hashCode);
hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
hash = JenkinsSmiHash.combine(hash, offsets.hashCode);
hash = JenkinsSmiHash.combine(hash, lengths.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
offset.hashCode,
length.hashCode,
returnType.hashCode,
names.hashCode,
canCreateGetter.hashCode,
parameters.hashCode,
offsets.hashCode,
lengths.hashCode,
);
}
/// extractMethod options
@ -3063,15 +2972,13 @@ class ExtractMethodOptions extends RefactoringOptions {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
hash = JenkinsSmiHash.combine(hash, createGetter.hashCode);
hash = JenkinsSmiHash.combine(hash, name.hashCode);
hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
hash = JenkinsSmiHash.combine(hash, extractAll.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
returnType.hashCode,
createGetter.hashCode,
name.hashCode,
parameters.hashCode,
extractAll.hashCode,
);
}
/// inlineLocalVariable feedback
@ -3135,12 +3042,10 @@ class InlineLocalVariableFeedback extends RefactoringFeedback {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, name.hashCode);
hash = JenkinsSmiHash.combine(hash, occurrences.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
name.hashCode,
occurrences.hashCode,
);
}
/// inlineLocalVariable options
@ -3157,9 +3062,7 @@ class InlineLocalVariableOptions extends RefactoringOptions
}
@override
int get hashCode {
return 540364977;
}
int get hashCode => 540364977;
}
/// inlineMethod feedback
@ -3241,13 +3144,11 @@ class InlineMethodFeedback extends RefactoringFeedback {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, className.hashCode);
hash = JenkinsSmiHash.combine(hash, methodName.hashCode);
hash = JenkinsSmiHash.combine(hash, isDeclaration.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
className.hashCode,
methodName.hashCode,
isDeclaration.hashCode,
);
}
/// inlineMethod options
@ -3319,12 +3220,10 @@ class InlineMethodOptions extends RefactoringOptions {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, deleteSource.hashCode);
hash = JenkinsSmiHash.combine(hash, inlineAll.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
deleteSource.hashCode,
inlineAll.hashCode,
);
}
/// kythe.getKytheEntries params
@ -3387,11 +3286,7 @@ class KytheGetKytheEntriesParams implements RequestParams {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, file.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => file.hashCode;
}
/// kythe.getKytheEntries result
@ -3477,12 +3372,10 @@ class KytheGetKytheEntriesResult implements ResponseResult {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, entries.hashCode);
hash = JenkinsSmiHash.combine(hash, files.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
entries.hashCode,
files.hashCode,
);
}
/// moveFile feedback
@ -3498,9 +3391,7 @@ class MoveFileFeedback extends RefactoringFeedback implements HasToJson {
}
@override
int get hashCode {
return 438975893;
}
int get hashCode => 438975893;
}
/// moveFile options
@ -3558,11 +3449,7 @@ class MoveFileOptions extends RefactoringOptions {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, newFile.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => newFile.hashCode;
}
/// plugin.error params
@ -3653,13 +3540,11 @@ class PluginErrorParams implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, isFatal.hashCode);
hash = JenkinsSmiHash.combine(hash, message.hashCode);
hash = JenkinsSmiHash.combine(hash, stackTrace.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
isFatal.hashCode,
message.hashCode,
stackTrace.hashCode,
);
}
/// plugin.shutdown params
@ -3683,9 +3568,7 @@ class PluginShutdownParams implements RequestParams {
}
@override
int get hashCode {
return 478064585;
}
int get hashCode => 478064585;
}
/// plugin.shutdown result
@ -3709,9 +3592,7 @@ class PluginShutdownResult implements ResponseResult {
}
@override
int get hashCode {
return 9389109;
}
int get hashCode => 9389109;
}
/// plugin.versionCheck params
@ -3802,13 +3683,11 @@ class PluginVersionCheckParams implements RequestParams {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, byteStorePath.hashCode);
hash = JenkinsSmiHash.combine(hash, sdkPath.hashCode);
hash = JenkinsSmiHash.combine(hash, version.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
byteStorePath.hashCode,
sdkPath.hashCode,
version.hashCode,
);
}
/// plugin.versionCheck result
@ -3939,15 +3818,13 @@ class PluginVersionCheckResult implements ResponseResult {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, isCompatible.hashCode);
hash = JenkinsSmiHash.combine(hash, name.hashCode);
hash = JenkinsSmiHash.combine(hash, version.hashCode);
hash = JenkinsSmiHash.combine(hash, contactInfo.hashCode);
hash = JenkinsSmiHash.combine(hash, interestingFiles.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
isCompatible.hashCode,
name.hashCode,
version.hashCode,
contactInfo.hashCode,
interestingFiles.hashCode,
);
}
/// PrioritizedSourceChange
@ -4012,12 +3889,10 @@ class PrioritizedSourceChange implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, priority.hashCode);
hash = JenkinsSmiHash.combine(hash, change.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
priority.hashCode,
change.hashCode,
);
}
/// RefactoringFeedback
@ -4053,10 +3928,7 @@ class RefactoringFeedback implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
return JenkinsSmiHash.finish(hash);
}
int get hashCode => 0;
}
/// RefactoringOptions
@ -4091,10 +3963,7 @@ class RefactoringOptions implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
return JenkinsSmiHash.finish(hash);
}
int get hashCode => 0;
}
/// rename feedback
@ -4184,14 +4053,12 @@ class RenameFeedback extends RefactoringFeedback {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, offset.hashCode);
hash = JenkinsSmiHash.combine(hash, length.hashCode);
hash = JenkinsSmiHash.combine(hash, elementKindName.hashCode);
hash = JenkinsSmiHash.combine(hash, oldName.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
offset.hashCode,
length.hashCode,
elementKindName.hashCode,
oldName.hashCode,
);
}
/// rename options
@ -4249,11 +4116,7 @@ class RenameOptions extends RefactoringOptions {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, newName.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => newName.hashCode;
}
/// RequestError
@ -4333,13 +4196,11 @@ class RequestError implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, code.hashCode);
hash = JenkinsSmiHash.combine(hash, message.hashCode);
hash = JenkinsSmiHash.combine(hash, stackTrace.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
code.hashCode,
message.hashCode,
stackTrace.hashCode,
);
}
/// RequestErrorCode
@ -4483,12 +4344,10 @@ class WatchEvent implements HasToJson {
}
@override
int get hashCode {
var hash = 0;
hash = JenkinsSmiHash.combine(hash, type.hashCode);
hash = JenkinsSmiHash.combine(hash, path.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(
type.hashCode,
path.hashCode,
);
}
/// WatchEventType

View File

@ -10,7 +10,6 @@ import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:analyzer_plugin/src/utilities/change_builder/change_builder_dart.dart';
import 'package:analyzer_plugin/src/utilities/change_builder/change_builder_yaml.dart';
@ -71,23 +70,14 @@ class ChangeBuilderImpl implements ChangeBuilder {
// In addition, we should consider implementing our own hash function for
// file edits because the `hashCode` defined for them might not be
// sufficient to detect all changes to the list of edits.
var hash = 0;
for (var builder in _genericFileEditBuilders.values) {
if (builder.hasEdits) {
hash = JenkinsSmiHash.combine(hash, builder.fileEdit.hashCode);
}
}
for (var builder in _dartFileEditBuilders.values) {
if (builder.hasEdits) {
hash = JenkinsSmiHash.combine(hash, builder.fileEdit.hashCode);
}
}
for (var builder in _yamlFileEditBuilders.values) {
if (builder.hasEdits) {
hash = JenkinsSmiHash.combine(hash, builder.fileEdit.hashCode);
}
}
return JenkinsSmiHash.finish(hash);
return Object.hashAll([
for (var builder in _genericFileEditBuilders.values)
if (builder.hasEdits) builder.fileEdit,
for (var builder in _dartFileEditBuilders.values)
if (builder.hasEdits) builder.fileEdit,
for (var builder in _yamlFileEditBuilders.values)
if (builder.hasEdits) builder.fileEdit,
]);
}
@override

View File

@ -368,7 +368,6 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
void emitImports() {
writeln("import 'dart:convert' hide JsonDecoder;");
writeln();
writeln("import 'package:analyzer/src/generated/utilities_general.dart';");
writeln("import 'package:$packageName/protocol/protocol.dart';");
writeln(
"import 'package:$packageName/src/protocol/protocol_internal.dart';");
@ -614,25 +613,39 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
/// Emit the hashCode getter for an object class.
void emitObjectHashCode(TypeObject? type, String className) {
writeln('@override');
writeln('int get hashCode {');
writeln('int get hashCode => ');
indent(() {
if (type == null) {
writeln('return ${className.hashCode};');
writeln(' ${className.hashCode}');
} else {
writeln('var hash = 0;');
for (var field in type.fields) {
String valueToCombine;
final items = type.fields.map((field) {
if (field.value != null) {
valueToCombine = field.value.hashCode.toString();
return field.value.hashCode.toString();
} else {
valueToCombine = '${field.name}.hashCode';
return '${field.name}.hashCode';
}
writeln('hash = JenkinsSmiHash.combine(hash, $valueToCombine);');
}).toList();
if (items.isEmpty) {
writeln('0');
} else if (items.length == 1) {
writeln(items.single);
} else if (items.length <= 20) {
writeln('Object.hash(');
for (var field in items) {
writeln('$field,');
}
writeln(')');
} else {
writeln('Object.hashAll([');
for (var field in items) {
writeln('$field,');
}
writeln('])');
}
writeln('return JenkinsSmiHash.finish(hash);');
}
writeln(';');
});
writeln('}');
}
/// If the class named [className] requires special constructors, emit them

View File

@ -44,15 +44,11 @@ class CodegenCommonVisitor extends CodegenProtocolVisitor {
writeln("import 'dart:convert' hide JsonDecoder;");
writeln();
if (forClient) {
writeln(
"import 'package:analysis_server_client/src/protocol/protocol_util.dart';");
writeln(
"import 'package:analysis_server_client/src/protocol/protocol_base.dart';");
writeln(
"import 'package:analysis_server_client/src/protocol/protocol_internal.dart';");
} else {
writeln(
"import 'package:analyzer/src/generated/utilities_general.dart';");
writeln("import 'package:$packageName/protocol/protocol.dart';");
writeln(
"import 'package:$packageName/src/protocol/protocol_internal.dart';");

View File

@ -2,8 +2,6 @@
// 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.
import 'package:analyzer/src/generated/utilities_general.dart';
/// Data structure representing a part of a type. When a fix has multiple
/// reasons (due to a complex type having different nullabilities at different
/// locations), this data structure allows us to tell which part of the type
@ -53,7 +51,7 @@ class _FixReasonTarget_NamedParameter extends _FixReasonTarget_Part {
: super(inner);
@override
int get hashCode => JenkinsSmiHash.hash3(2, inner.hashCode, name.hashCode);
int get hashCode => Object.hash(2, inner.hashCode, name.hashCode);
@override
bool operator ==(Object other) =>
@ -82,7 +80,7 @@ class _FixReasonTarget_PositionalParameter extends _FixReasonTarget_Part {
: super(inner);
@override
int get hashCode => JenkinsSmiHash.hash3(1, inner.hashCode, index);
int get hashCode => Object.hash(1, inner.hashCode, index);
@override
bool operator ==(Object other) =>
@ -100,7 +98,7 @@ class _FixReasonTarget_ReturnType extends _FixReasonTarget_Part {
_FixReasonTarget_ReturnType(FixReasonTarget inner) : super(inner);
@override
int get hashCode => JenkinsSmiHash.hash2(3, inner.hashCode);
int get hashCode => Object.hash(3, inner.hashCode);
@override
bool operator ==(Object other) =>
@ -133,7 +131,7 @@ class _FixReasonTarget_TypeArgument extends _FixReasonTarget_Part {
: super(inner);
@override
int get hashCode => JenkinsSmiHash.hash3(5, inner.hashCode, index);
int get hashCode => Object.hash(5, inner.hashCode, index);
@override
bool operator ==(Object other) =>
@ -164,7 +162,7 @@ class _FixReasonTarget_YieldedType extends _FixReasonTarget_Part {
_FixReasonTarget_YieldedType(FixReasonTarget inner) : super(inner);
@override
int get hashCode => JenkinsSmiHash.hash2(4, inner.hashCode);
int get hashCode => Object.hash(4, inner.hashCode);
@override
bool operator ==(Object other) =>

View File

@ -7,7 +7,6 @@ import 'dart:convert';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:nnbd_migration/instrumentation.dart';
import 'package:nnbd_migration/src/nullability_migration_impl.dart';
@ -254,12 +253,7 @@ class NullabilityFixDescription {
{required this.appliedMessage, required this.kind});
@override
int get hashCode {
int hash = 0;
hash = JenkinsSmiHash.combine(hash, appliedMessage.hashCode);
hash = JenkinsSmiHash.combine(hash, kind.hashCode);
return JenkinsSmiHash.finish(hash);
}
int get hashCode => Object.hash(appliedMessage, kind);
@override
bool operator ==(Object other) =>

View File

@ -2,7 +2,6 @@
// 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.
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:collection/collection.dart';
import 'package:crypto/crypto.dart';
@ -143,7 +142,7 @@ class NavigationTarget extends NavigationRegion {
: super(offset, line, length);
@override
int get hashCode => JenkinsSmiHash.hash3(filePath.hashCode, offset, length);
int get hashCode => Object.hash(filePath.hashCode, offset, length);
@override
bool operator ==(Object other) {

View File

@ -4,7 +4,7 @@ name: nnbd_migration
publish_to: none
environment:
sdk: '>=2.12.0 <3.0.0'
sdk: '>=2.14.0 <3.0.0'
dependencies:
_fe_analyzer_shared:

View File

@ -7,7 +7,7 @@ environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:
http: ^0.12.0
http: ^0.13.0
meta:
path: ../meta
path: ^1.4.0