Version 2.15.0-140.0.dev
Merge commit '2fa89236d7526c2f869748d5bd011079ca78e6db' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
index 9ba9c1e..6a44192 100644
--- a/.dart_tool/package_config.json
+++ b/.dart_tool/package_config.json
@@ -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",
diff --git a/WATCHLISTS b/WATCHLISTS
index e4b5b89..be0e2b3 100644
--- a/WATCHLISTS
+++ b/WATCHLISTS
@@ -53,8 +53,7 @@
'pkg/analyzer/lib/src/dart/error/hint_codes\\.dart|'
'pkg/analyzer/lib/src/dart/error/lint_codes\\.dart|'
'pkg/analyzer/lib/src/dart/error/todo_codes\\.dart|'
- 'pkg/analyzer/lib/src/html/error/html_codes\\.dart|'
- 'pkg/dart_messages/lib/shared_messages\\.dart'
+ 'pkg/analyzer/lib/src/html/error/html_codes\\.dart'
')$'
)
},
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart
index d475eed..208db61 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart
@@ -69,6 +69,7 @@
TypeList,
TypeVariable,
TypeVariables,
+ UnresolvedType,
VarFinalOrConstToken,
WithClause,
}
@@ -374,7 +375,7 @@
@override
void handleNoType(Token lastConsumed) {
debugEvent("NoType");
- push(NullValue.Type);
+ push(NullValue.UnresolvedType);
}
@override
diff --git a/pkg/_js_interop_checks/lib/src/transformations/js_util_optimizer.dart b/pkg/_js_interop_checks/lib/src/transformations/js_util_optimizer.dart
index dacab35..cb04456 100644
--- a/pkg/_js_interop_checks/lib/src/transformations/js_util_optimizer.dart
+++ b/pkg/_js_interop_checks/lib/src/transformations/js_util_optimizer.dart
@@ -88,19 +88,17 @@
@override
visitProcedure(Procedure node) {
_staticTypeContext.enterMember(node);
- // Getters, setters, and fields declared as `static` will be skipped,
- // because they do not have a node.kind of ProcedureKind.Method.
- if (node.isExternal &&
- node.isExtensionMember &&
- node.kind == ProcedureKind.Method) {
+ if (node.isExternal && node.isExtensionMember && !_isDeclaredStatic(node)) {
var transformedBody;
if (api.getExtensionMemberKind(node) == ProcedureKind.Getter) {
transformedBody = _getExternalGetterBody(node);
} else if (api.getExtensionMemberKind(node) == ProcedureKind.Setter) {
transformedBody = _getExternalSetterBody(node);
+ } else if (api.getExtensionMemberKind(node) == ProcedureKind.Method) {
+ transformedBody = _getExternalMethodBody(node);
}
- // TODO(rileyporter): Add transformation for external extension methods,
- // static members, and any operators we decide to support.
+ // TODO(rileyporter): Add transformation for static members and any
+ // operators we decide to support.
if (transformedBody != null) {
node.function.body = transformedBody;
node.isExternal = false;
@@ -149,13 +147,50 @@
_lowerSetProperty(setPropertyInvocation), function.returnType));
}
+ /// Returns a new function body for the given [node] external method.
+ ///
+ /// The new function body will call the optimized version of
+ /// `js_util.callMethod` for the given external method.
+ ReturnStatement _getExternalMethodBody(Procedure node) {
+ var function = node.function;
+ var callMethodInvocation = StaticInvocation(
+ _callMethodTarget,
+ Arguments([
+ VariableGet(function.positionalParameters.first),
+ StringLiteral(_getMemberName(node)),
+ ListLiteral(function.positionalParameters
+ .sublist(1)
+ .map((argument) => VariableGet(argument))
+ .toList())
+ ]))
+ ..fileOffset = node.fileOffset;
+ return ReturnStatement(AsExpression(
+ _lowerCallMethod(callMethodInvocation), function.returnType));
+ }
+
/// Returns the member name, either from the `@JS` annotation if non-empty,
/// or parsed from CFE generated node name.
String _getMemberName(Procedure node) {
var jsAnnotationName = getJSName(node);
- return jsAnnotationName.isNotEmpty
- ? jsAnnotationName
- : node.name.text.substring(node.name.text.indexOf('#') + 1);
+ if (jsAnnotationName.isNotEmpty) {
+ return jsAnnotationName;
+ }
+ // TODO(rileyporter): Switch to using the ExtensionMemberDescriptor data.
+ var nodeName = node.name.text;
+ if (nodeName.contains('#')) {
+ return nodeName.substring(nodeName.indexOf('#') + 1);
+ } else {
+ return nodeName.substring(nodeName.indexOf('|') + 1);
+ }
+ }
+
+ /// Returns whether the given extension [node] is declared as `static`.
+ ///
+ /// All extension members have `isStatic` true, but the members declared as
+ /// static will not have a synthesized `this` variable.
+ bool _isDeclaredStatic(Procedure node) {
+ return node.function.positionalParameters.isEmpty ||
+ node.function.positionalParameters.first.name != '#this';
}
/// Replaces js_util method calls with optimization when possible.
diff --git a/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart b/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart
index 8f88db8..65c9513 100644
--- a/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart
+++ b/pkg/analysis_server/lib/lsp_protocol/protocol_special.dart
@@ -7,7 +7,6 @@
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 @@
/// 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) {
diff --git a/pkg/analysis_server/lib/protocol/protocol_generated.dart b/pkg/analysis_server/lib/protocol/protocol_generated.dart
index dcb4e02..118aac8 100644
--- a/pkg/analysis_server/lib/protocol/protocol_generated.dart
+++ b/pkg/analysis_server/lib/protocol/protocol_generated.dart
@@ -8,7 +8,6 @@
import 'dart:convert' hide JsonDecoder;
-import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analysis_server/protocol/protocol.dart';
import 'package:analysis_server/src/protocol/protocol_internal.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
@@ -74,11 +73,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, directories.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => directories.hashCode;
}
/// analysis.closingLabels params
@@ -164,12 +159,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, labels.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ labels.hashCode,
+ );
}
/// AnalysisErrorFixes
@@ -240,12 +233,10 @@
}
@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
@@ -323,12 +314,10 @@
}
@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.flushResults params
@@ -391,11 +380,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, files.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => files.hashCode;
}
/// analysis.folding params
@@ -473,12 +458,10 @@
}
@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.getErrors params
@@ -539,11 +522,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => file.hashCode;
}
/// analysis.getErrors result
@@ -612,11 +591,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, errors.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => errors.hashCode;
}
/// analysis.getHover params
@@ -688,12 +663,10 @@
}
@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,
+ );
}
/// analysis.getHover result
@@ -766,11 +739,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, hovers.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => hovers.hashCode;
}
/// analysis.getImportedElements params
@@ -856,13 +825,11 @@
}
@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.getImportedElements result
@@ -933,11 +900,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, elements.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => elements.hashCode;
}
/// analysis.getLibraryDependencies params
@@ -961,9 +924,7 @@
}
@override
- int get hashCode {
- return 246577680;
- }
+ int get hashCode => 246577680;
}
/// analysis.getLibraryDependencies result
@@ -1057,12 +1018,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, libraries.hashCode);
- hash = JenkinsSmiHash.combine(hash, packageMap.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ libraries.hashCode,
+ packageMap.hashCode,
+ );
}
/// analysis.getNavigation params
@@ -1150,13 +1109,11 @@
}
@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
@@ -1259,13 +1216,11 @@
}
@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.getReachableSources params
@@ -1327,11 +1282,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => file.hashCode;
}
/// analysis.getReachableSources result
@@ -1407,11 +1358,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, sources.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => sources.hashCode;
}
/// analysis.getSignature params
@@ -1484,12 +1431,10 @@
}
@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,
+ );
}
/// analysis.getSignature result
@@ -1590,13 +1535,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
- hash = JenkinsSmiHash.combine(hash, dartdoc.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ name.hashCode,
+ parameters.hashCode,
+ dartdoc.hashCode,
+ );
}
/// analysis.highlights params
@@ -1678,12 +1621,10 @@
}
@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.implemented params
@@ -1780,13 +1721,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, classes.hashCode);
- hash = JenkinsSmiHash.combine(hash, members.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ classes.hashCode,
+ members.hashCode,
+ );
}
/// analysis.invalidate params
@@ -1884,14 +1823,12 @@
}
@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, delta.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ offset.hashCode,
+ length.hashCode,
+ delta.hashCode,
+ );
}
/// analysis.navigation params
@@ -2008,14 +1945,12 @@
}
@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
@@ -2094,12 +2029,10 @@
}
@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,
+ );
}
/// AnalysisOptions
@@ -2282,18 +2215,16 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, enableAsync.hashCode);
- hash = JenkinsSmiHash.combine(hash, enableDeferredLoading.hashCode);
- hash = JenkinsSmiHash.combine(hash, enableEnums.hashCode);
- hash = JenkinsSmiHash.combine(hash, enableNullAwareOperators.hashCode);
- hash = JenkinsSmiHash.combine(hash, enableSuperMixins.hashCode);
- hash = JenkinsSmiHash.combine(hash, generateDart2jsHints.hashCode);
- hash = JenkinsSmiHash.combine(hash, generateHints.hashCode);
- hash = JenkinsSmiHash.combine(hash, generateLints.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ enableAsync.hashCode,
+ enableDeferredLoading.hashCode,
+ enableEnums.hashCode,
+ enableNullAwareOperators.hashCode,
+ enableSuperMixins.hashCode,
+ generateDart2jsHints.hashCode,
+ generateHints.hashCode,
+ generateLints.hashCode,
+ );
}
/// analysis.outline params
@@ -2397,14 +2328,12 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- hash = JenkinsSmiHash.combine(hash, libraryName.hashCode);
- hash = JenkinsSmiHash.combine(hash, outline.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ kind.hashCode,
+ libraryName.hashCode,
+ outline.hashCode,
+ );
}
/// analysis.overrides params
@@ -2482,12 +2411,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, overrides.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ overrides.hashCode,
+ );
}
/// analysis.reanalyze params
@@ -2511,9 +2438,7 @@
}
@override
- int get hashCode {
- return 613039876;
- }
+ int get hashCode => 613039876;
}
/// analysis.reanalyze result
@@ -2537,9 +2462,7 @@
}
@override
- int get hashCode {
- return 846803925;
- }
+ int get hashCode => 846803925;
}
/// AnalysisService
@@ -2743,13 +2666,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, included.hashCode);
- hash = JenkinsSmiHash.combine(hash, excluded.hashCode);
- hash = JenkinsSmiHash.combine(hash, packageRoots.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ included.hashCode,
+ excluded.hashCode,
+ packageRoots.hashCode,
+ );
}
/// analysis.setAnalysisRoots result
@@ -2773,9 +2694,7 @@
}
@override
- int get hashCode {
- return 866004753;
- }
+ int get hashCode => 866004753;
}
/// analysis.setGeneralSubscriptions params
@@ -2844,11 +2763,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => subscriptions.hashCode;
}
/// analysis.setGeneralSubscriptions result
@@ -2872,9 +2787,7 @@
}
@override
- int get hashCode {
- return 386759562;
- }
+ int get hashCode => 386759562;
}
/// analysis.setPriorityFiles params
@@ -2937,11 +2850,7 @@
}
@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
@@ -2965,9 +2874,7 @@
}
@override
- int get hashCode {
- return 330050055;
- }
+ int get hashCode => 330050055;
}
/// analysis.setSubscriptions params
@@ -3040,11 +2947,7 @@
}
@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
@@ -3068,9 +2971,7 @@
}
@override
- int get hashCode {
- return 218088493;
- }
+ int get hashCode => 218088493;
}
/// AnalysisStatus
@@ -3137,12 +3038,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, isAnalyzing.hashCode);
- hash = JenkinsSmiHash.combine(hash, analysisTarget.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ isAnalyzing.hashCode,
+ analysisTarget.hashCode,
+ );
}
/// analysis.updateContent params
@@ -3216,11 +3115,7 @@
}
@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
@@ -3273,10 +3168,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => 0;
}
/// analysis.updateOptions params
@@ -3339,11 +3231,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, options.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => options.hashCode;
}
/// analysis.updateOptions result
@@ -3367,9 +3255,7 @@
}
@override
- int get hashCode {
- return 179689467;
- }
+ int get hashCode => 179689467;
}
/// analytics.enable params
@@ -3430,11 +3316,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, value.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => value.hashCode;
}
/// analytics.enable result
@@ -3458,9 +3340,7 @@
}
@override
- int get hashCode {
- return 237990792;
- }
+ int get hashCode => 237990792;
}
/// analytics.isEnabled params
@@ -3484,9 +3364,7 @@
}
@override
- int get hashCode {
- return 57215544;
- }
+ int get hashCode => 57215544;
}
/// analytics.isEnabled result
@@ -3550,11 +3428,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, enabled.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => enabled.hashCode;
}
/// analytics.sendEvent params
@@ -3615,11 +3489,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, action.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => action.hashCode;
}
/// analytics.sendEvent result
@@ -3643,9 +3513,7 @@
}
@override
- int get hashCode {
- return 227063188;
- }
+ int get hashCode => 227063188;
}
/// analytics.sendTiming params
@@ -3717,12 +3585,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, event.hashCode);
- hash = JenkinsSmiHash.combine(hash, millis.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ event.hashCode,
+ millis.hashCode,
+ );
}
/// analytics.sendTiming result
@@ -3746,9 +3612,7 @@
}
@override
- int get hashCode {
- return 875010924;
- }
+ int get hashCode => 875010924;
}
/// AvailableSuggestion
@@ -3941,19 +3805,17 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, label.hashCode);
- hash = JenkinsSmiHash.combine(hash, declaringLibraryUri.hashCode);
- hash = JenkinsSmiHash.combine(hash, element.hashCode);
- hash = JenkinsSmiHash.combine(hash, defaultArgumentListString.hashCode);
- hash = JenkinsSmiHash.combine(hash, defaultArgumentListTextRanges.hashCode);
- hash = JenkinsSmiHash.combine(hash, parameterNames.hashCode);
- hash = JenkinsSmiHash.combine(hash, parameterTypes.hashCode);
- hash = JenkinsSmiHash.combine(hash, relevanceTags.hashCode);
- hash = JenkinsSmiHash.combine(hash, requiredParameterCount.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ label.hashCode,
+ declaringLibraryUri.hashCode,
+ element.hashCode,
+ defaultArgumentListString.hashCode,
+ defaultArgumentListTextRanges.hashCode,
+ parameterNames.hashCode,
+ parameterTypes.hashCode,
+ relevanceTags.hashCode,
+ requiredParameterCount.hashCode,
+ );
}
/// AvailableSuggestionSet
@@ -4033,13 +3895,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, uri.hashCode);
- hash = JenkinsSmiHash.combine(hash, items.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ id.hashCode,
+ uri.hashCode,
+ items.hashCode,
+ );
}
/// BulkFix
@@ -4108,12 +3968,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, path.hashCode);
- hash = JenkinsSmiHash.combine(hash, fixes.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ path.hashCode,
+ fixes.hashCode,
+ );
}
/// BulkFixDetail
@@ -4177,12 +4035,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, code.hashCode);
- hash = JenkinsSmiHash.combine(hash, occurrences.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ code.hashCode,
+ occurrences.hashCode,
+ );
}
/// ClosingLabel
@@ -4258,13 +4114,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, length.hashCode);
- hash = JenkinsSmiHash.combine(hash, label.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ offset.hashCode,
+ length.hashCode,
+ label.hashCode,
+ );
}
/// completion.availableSuggestions params
@@ -4355,12 +4209,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, changedLibraries.hashCode);
- hash = JenkinsSmiHash.combine(hash, removedLibraries.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ changedLibraries.hashCode,
+ removedLibraries.hashCode,
+ );
}
/// completion.existingImports params
@@ -4434,12 +4286,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, imports.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ imports.hashCode,
+ );
}
/// completion.getSuggestionDetails params
@@ -4540,14 +4390,12 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, label.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ id.hashCode,
+ label.hashCode,
+ offset.hashCode,
+ );
}
/// completion.getSuggestionDetails result
@@ -4627,12 +4475,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, completion.hashCode);
- hash = JenkinsSmiHash.combine(hash, change.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ completion.hashCode,
+ change.hashCode,
+ );
}
/// completion.getSuggestions params
@@ -4705,12 +4551,10 @@
}
@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
@@ -4774,11 +4618,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => id.hashCode;
}
/// completion.registerLibraryPaths params
@@ -4849,11 +4689,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, paths.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => paths.hashCode;
}
/// completion.registerLibraryPaths result
@@ -4877,9 +4713,7 @@
}
@override
- int get hashCode {
- return 104675661;
- }
+ int get hashCode => 104675661;
}
/// completion.results params
@@ -5111,20 +4945,17 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, replacementOffset.hashCode);
- hash = JenkinsSmiHash.combine(hash, replacementLength.hashCode);
- hash = JenkinsSmiHash.combine(hash, results.hashCode);
- hash = JenkinsSmiHash.combine(hash, isLast.hashCode);
- hash = JenkinsSmiHash.combine(hash, libraryFile.hashCode);
- hash = JenkinsSmiHash.combine(hash, includedSuggestionSets.hashCode);
- hash = JenkinsSmiHash.combine(hash, includedElementKinds.hashCode);
- hash =
- JenkinsSmiHash.combine(hash, includedSuggestionRelevanceTags.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ id.hashCode,
+ replacementOffset.hashCode,
+ replacementLength.hashCode,
+ results.hashCode,
+ isLast.hashCode,
+ libraryFile.hashCode,
+ includedSuggestionSets.hashCode,
+ includedElementKinds.hashCode,
+ includedSuggestionRelevanceTags.hashCode,
+ );
}
/// CompletionService
@@ -5246,11 +5077,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => subscriptions.hashCode;
}
/// completion.setSubscriptions result
@@ -5274,9 +5101,7 @@
}
@override
- int get hashCode {
- return 2482770;
- }
+ int get hashCode => 2482770;
}
/// ContextData
@@ -5384,15 +5209,13 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, explicitFileCount.hashCode);
- hash = JenkinsSmiHash.combine(hash, implicitFileCount.hashCode);
- hash = JenkinsSmiHash.combine(hash, workItemQueueLength.hashCode);
- hash = JenkinsSmiHash.combine(hash, cacheEntryExceptions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ name.hashCode,
+ explicitFileCount.hashCode,
+ implicitFileCount.hashCode,
+ workItemQueueLength.hashCode,
+ cacheEntryExceptions.hashCode,
+ );
}
/// convertGetterToMethod feedback
@@ -5409,9 +5232,7 @@
}
@override
- int get hashCode {
- return 616032599;
- }
+ int get hashCode => 616032599;
}
/// convertGetterToMethod options
@@ -5428,9 +5249,7 @@
}
@override
- int get hashCode {
- return 488848400;
- }
+ int get hashCode => 488848400;
}
/// convertMethodToGetter feedback
@@ -5447,9 +5266,7 @@
}
@override
- int get hashCode {
- return 165291526;
- }
+ int get hashCode => 165291526;
}
/// convertMethodToGetter options
@@ -5466,9 +5283,7 @@
}
@override
- int get hashCode {
- return 27952290;
- }
+ int get hashCode => 27952290;
}
/// diagnostic.getDiagnostics params
@@ -5492,9 +5307,7 @@
}
@override
- int get hashCode {
- return 587526202;
- }
+ int get hashCode => 587526202;
}
/// diagnostic.getDiagnostics result
@@ -5564,11 +5377,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, contexts.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => contexts.hashCode;
}
/// diagnostic.getServerPort params
@@ -5592,9 +5401,7 @@
}
@override
- int get hashCode {
- return 367508704;
- }
+ int get hashCode => 367508704;
}
/// diagnostic.getServerPort result
@@ -5658,11 +5465,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, port.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => port.hashCode;
}
/// edit.bulkFixes params
@@ -5751,12 +5554,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, included.hashCode);
- hash = JenkinsSmiHash.combine(hash, inTestMode.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ included.hashCode,
+ inTestMode.hashCode,
+ );
}
/// edit.bulkFixes result
@@ -5841,12 +5642,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, edits.hashCode);
- hash = JenkinsSmiHash.combine(hash, details.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ edits.hashCode,
+ details.hashCode,
+ );
}
/// edit.format params
@@ -5949,14 +5748,12 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, selectionOffset.hashCode);
- hash = JenkinsSmiHash.combine(hash, selectionLength.hashCode);
- hash = JenkinsSmiHash.combine(hash, lineLength.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ selectionOffset.hashCode,
+ selectionLength.hashCode,
+ lineLength.hashCode,
+ );
}
/// edit.format result
@@ -6051,13 +5848,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, edits.hashCode);
- hash = JenkinsSmiHash.combine(hash, selectionOffset.hashCode);
- hash = JenkinsSmiHash.combine(hash, selectionLength.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ edits.hashCode,
+ selectionOffset.hashCode,
+ selectionLength.hashCode,
+ );
}
/// edit.getAssists params
@@ -6142,13 +5937,11 @@
}
@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
@@ -6217,11 +6010,7 @@
}
@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
@@ -6307,13 +6096,11 @@
}
@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
@@ -6383,11 +6170,7 @@
}
@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
@@ -6459,12 +6242,10 @@
}
@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
@@ -6533,11 +6314,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, fixes.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => fixes.hashCode;
}
/// edit.getPostfixCompletion params
@@ -6622,13 +6399,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, key.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ key.hashCode,
+ offset.hashCode,
+ );
}
/// edit.getPostfixCompletion result
@@ -6693,11 +6468,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, change.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => change.hashCode;
}
/// edit.getRefactoring params
@@ -6832,16 +6603,14 @@
}
@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
@@ -7014,16 +6783,14 @@
}
@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,
+ );
}
/// edit.getStatementCompletion params
@@ -7096,12 +6863,10 @@
}
@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.getStatementCompletion result
@@ -7179,12 +6944,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, change.hashCode);
- hash = JenkinsSmiHash.combine(hash, whitespaceOnly.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ change.hashCode,
+ whitespaceOnly.hashCode,
+ );
}
/// edit.importElements params
@@ -7279,13 +7042,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, elements.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ elements.hashCode,
+ offset.hashCode,
+ );
}
/// edit.importElements result
@@ -7355,11 +7116,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, edit.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => edit.hashCode;
}
/// edit.isPostfixCompletionApplicable params
@@ -7444,13 +7201,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, key.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ key.hashCode,
+ offset.hashCode,
+ );
}
/// edit.isPostfixCompletionApplicable result
@@ -7515,11 +7270,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, value.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => value.hashCode;
}
/// edit.listPostfixCompletionTemplates params
@@ -7543,9 +7294,7 @@
}
@override
- int get hashCode {
- return 690713107;
- }
+ int get hashCode => 690713107;
}
/// edit.listPostfixCompletionTemplates result
@@ -7618,11 +7367,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, templates.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => templates.hashCode;
}
/// edit.organizeDirectives params
@@ -7684,11 +7429,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => file.hashCode;
}
/// edit.organizeDirectives result
@@ -7754,11 +7495,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, edit.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => edit.hashCode;
}
/// edit.sortMembers params
@@ -7819,11 +7556,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => file.hashCode;
}
/// edit.sortMembers result
@@ -7888,11 +7621,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, edit.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => edit.hashCode;
}
/// ElementDeclaration
@@ -8084,21 +7813,19 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- hash = JenkinsSmiHash.combine(hash, fileIndex.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, line.hashCode);
- hash = JenkinsSmiHash.combine(hash, column.hashCode);
- hash = JenkinsSmiHash.combine(hash, codeOffset.hashCode);
- hash = JenkinsSmiHash.combine(hash, codeLength.hashCode);
- hash = JenkinsSmiHash.combine(hash, className.hashCode);
- hash = JenkinsSmiHash.combine(hash, mixinName.hashCode);
- hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ name.hashCode,
+ kind.hashCode,
+ fileIndex.hashCode,
+ offset.hashCode,
+ line.hashCode,
+ column.hashCode,
+ codeOffset.hashCode,
+ codeLength.hashCode,
+ className.hashCode,
+ mixinName.hashCode,
+ parameters.hashCode,
+ );
}
/// ExecutableFile
@@ -8161,12 +7888,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ kind.hashCode,
+ );
}
/// ExecutableKind
@@ -8295,11 +8020,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, contextRoot.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => contextRoot.hashCode;
}
/// execution.createContext result
@@ -8363,11 +8084,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => id.hashCode;
}
/// execution.deleteContext params
@@ -8429,11 +8146,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => id.hashCode;
}
/// execution.deleteContext result
@@ -8457,9 +8170,7 @@
}
@override
- int get hashCode {
- return 479954425;
- }
+ int get hashCode => 479954425;
}
/// execution.getSuggestions params
@@ -8623,16 +8334,14 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, code.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, contextFile.hashCode);
- hash = JenkinsSmiHash.combine(hash, contextOffset.hashCode);
- hash = JenkinsSmiHash.combine(hash, variables.hashCode);
- hash = JenkinsSmiHash.combine(hash, expressions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ code.hashCode,
+ offset.hashCode,
+ contextFile.hashCode,
+ contextOffset.hashCode,
+ variables.hashCode,
+ expressions.hashCode,
+ );
}
/// execution.getSuggestions result
@@ -8739,12 +8448,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, suggestions.hashCode);
- hash = JenkinsSmiHash.combine(hash, expressions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ suggestions.hashCode,
+ expressions.hashCode,
+ );
}
/// execution.launchData params
@@ -8838,13 +8545,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- hash = JenkinsSmiHash.combine(hash, referencedFiles.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ kind.hashCode,
+ referencedFiles.hashCode,
+ );
}
/// execution.mapUri params
@@ -8929,13 +8634,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, uri.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ id.hashCode,
+ file.hashCode,
+ uri.hashCode,
+ );
}
/// execution.mapUri result
@@ -9013,12 +8716,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, uri.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ uri.hashCode,
+ );
}
/// ExecutionService
@@ -9130,11 +8831,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => subscriptions.hashCode;
}
/// execution.setSubscriptions result
@@ -9158,9 +8855,7 @@
}
@override
- int get hashCode {
- return 287678780;
- }
+ int get hashCode => 287678780;
}
/// ExistingImport
@@ -9225,12 +8920,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, uri.hashCode);
- hash = JenkinsSmiHash.combine(hash, elements.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ uri.hashCode,
+ elements.hashCode,
+ );
}
/// ExistingImports
@@ -9300,12 +8993,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, elements.hashCode);
- hash = JenkinsSmiHash.combine(hash, imports.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ elements.hashCode,
+ imports.hashCode,
+ );
}
/// extractLocalVariable feedback
@@ -9427,15 +9118,13 @@
}
@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
@@ -9508,12 +9197,10 @@
}
@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
@@ -9673,18 +9360,16 @@
}
@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
@@ -9817,15 +9502,13 @@
}
@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,
+ );
}
/// extractWidget feedback
@@ -9865,10 +9548,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => 0;
}
/// extractWidget options
@@ -9925,11 +9605,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => name.hashCode;
}
/// FileKind
@@ -10051,12 +9727,10 @@
}
@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,
+ );
}
/// flutter.getWidgetDescription result
@@ -10130,11 +9804,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, properties.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => properties.hashCode;
}
/// FlutterOutline
@@ -10374,22 +10044,20 @@
}
@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);
- hash = JenkinsSmiHash.combine(hash, codeOffset.hashCode);
- hash = JenkinsSmiHash.combine(hash, codeLength.hashCode);
- hash = JenkinsSmiHash.combine(hash, label.hashCode);
- hash = JenkinsSmiHash.combine(hash, dartElement.hashCode);
- hash = JenkinsSmiHash.combine(hash, attributes.hashCode);
- hash = JenkinsSmiHash.combine(hash, className.hashCode);
- hash = JenkinsSmiHash.combine(hash, parentAssociationLabel.hashCode);
- hash = JenkinsSmiHash.combine(hash, variableName.hashCode);
- hash = JenkinsSmiHash.combine(hash, children.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ kind.hashCode,
+ offset.hashCode,
+ length.hashCode,
+ codeOffset.hashCode,
+ codeLength.hashCode,
+ label.hashCode,
+ dartElement.hashCode,
+ attributes.hashCode,
+ className.hashCode,
+ parentAssociationLabel.hashCode,
+ variableName.hashCode,
+ children.hashCode,
+ );
}
/// FlutterOutlineAttribute
@@ -10540,17 +10208,15 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, label.hashCode);
- hash = JenkinsSmiHash.combine(hash, literalValueBoolean.hashCode);
- hash = JenkinsSmiHash.combine(hash, literalValueInteger.hashCode);
- hash = JenkinsSmiHash.combine(hash, literalValueString.hashCode);
- hash = JenkinsSmiHash.combine(hash, nameLocation.hashCode);
- hash = JenkinsSmiHash.combine(hash, valueLocation.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ name.hashCode,
+ label.hashCode,
+ literalValueBoolean.hashCode,
+ literalValueInteger.hashCode,
+ literalValueString.hashCode,
+ nameLocation.hashCode,
+ valueLocation.hashCode,
+ );
}
/// FlutterOutlineKind
@@ -10710,12 +10376,10 @@
}
@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,
+ );
}
/// FlutterService
@@ -10832,11 +10496,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => subscriptions.hashCode;
}
/// flutter.setSubscriptions result
@@ -10860,9 +10520,7 @@
}
@override
- int get hashCode {
- return 628296315;
- }
+ int get hashCode => 628296315;
}
/// flutter.setWidgetPropertyValue params
@@ -10949,12 +10607,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, value.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ id.hashCode,
+ value.hashCode,
+ );
}
/// flutter.setWidgetPropertyValue result
@@ -11019,11 +10675,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, change.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => change.hashCode;
}
/// FlutterWidgetProperty
@@ -11214,19 +10866,17 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, documentation.hashCode);
- hash = JenkinsSmiHash.combine(hash, expression.hashCode);
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, isRequired.hashCode);
- hash = JenkinsSmiHash.combine(hash, isSafeToUpdate.hashCode);
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, children.hashCode);
- hash = JenkinsSmiHash.combine(hash, editor.hashCode);
- hash = JenkinsSmiHash.combine(hash, value.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ documentation.hashCode,
+ expression.hashCode,
+ id.hashCode,
+ isRequired.hashCode,
+ isSafeToUpdate.hashCode,
+ name.hashCode,
+ children.hashCode,
+ editor.hashCode,
+ value.hashCode,
+ );
}
/// FlutterWidgetPropertyEditor
@@ -11301,12 +10951,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- hash = JenkinsSmiHash.combine(hash, enumItems.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ kind.hashCode,
+ enumItems.hashCode,
+ );
}
/// FlutterWidgetPropertyEditorKind
@@ -11529,16 +11177,14 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, boolValue.hashCode);
- hash = JenkinsSmiHash.combine(hash, doubleValue.hashCode);
- hash = JenkinsSmiHash.combine(hash, intValue.hashCode);
- hash = JenkinsSmiHash.combine(hash, stringValue.hashCode);
- hash = JenkinsSmiHash.combine(hash, enumValue.hashCode);
- hash = JenkinsSmiHash.combine(hash, expression.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ boolValue.hashCode,
+ doubleValue.hashCode,
+ intValue.hashCode,
+ stringValue.hashCode,
+ enumValue.hashCode,
+ expression.hashCode,
+ );
}
/// FlutterWidgetPropertyValueEnumItem
@@ -11637,14 +11283,12 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, libraryUri.hashCode);
- hash = JenkinsSmiHash.combine(hash, className.hashCode);
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, documentation.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ libraryUri.hashCode,
+ className.hashCode,
+ name.hashCode,
+ documentation.hashCode,
+ );
}
/// GeneralAnalysisService
@@ -11935,22 +11579,20 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, length.hashCode);
- hash = JenkinsSmiHash.combine(hash, containingLibraryPath.hashCode);
- hash = JenkinsSmiHash.combine(hash, containingLibraryName.hashCode);
- hash = JenkinsSmiHash.combine(hash, containingClassDescription.hashCode);
- hash = JenkinsSmiHash.combine(hash, dartdoc.hashCode);
- hash = JenkinsSmiHash.combine(hash, elementDescription.hashCode);
- hash = JenkinsSmiHash.combine(hash, elementKind.hashCode);
- hash = JenkinsSmiHash.combine(hash, isDeprecated.hashCode);
- hash = JenkinsSmiHash.combine(hash, parameter.hashCode);
- hash = JenkinsSmiHash.combine(hash, propagatedType.hashCode);
- hash = JenkinsSmiHash.combine(hash, staticType.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ offset.hashCode,
+ length.hashCode,
+ containingLibraryPath.hashCode,
+ containingLibraryName.hashCode,
+ containingClassDescription.hashCode,
+ dartdoc.hashCode,
+ elementDescription.hashCode,
+ elementKind.hashCode,
+ isDeprecated.hashCode,
+ parameter.hashCode,
+ propagatedType.hashCode,
+ staticType.hashCode,
+ );
}
/// ImplementedClass
@@ -12012,12 +11654,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, length.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ offset.hashCode,
+ length.hashCode,
+ );
}
/// ImplementedMember
@@ -12079,12 +11719,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, length.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ offset.hashCode,
+ length.hashCode,
+ );
}
/// ImportedElementSet
@@ -12163,13 +11801,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, strings.hashCode);
- hash = JenkinsSmiHash.combine(hash, uris.hashCode);
- hash = JenkinsSmiHash.combine(hash, names.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ strings.hashCode,
+ uris.hashCode,
+ names.hashCode,
+ );
}
/// ImportedElements
@@ -12246,13 +11882,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, path.hashCode);
- hash = JenkinsSmiHash.combine(hash, prefix.hashCode);
- hash = JenkinsSmiHash.combine(hash, elements.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ path.hashCode,
+ prefix.hashCode,
+ elements.hashCode,
+ );
}
/// IncludedSuggestionRelevanceTag
@@ -12318,12 +11952,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, tag.hashCode);
- hash = JenkinsSmiHash.combine(hash, relevanceBoost.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ tag.hashCode,
+ relevanceBoost.hashCode,
+ );
}
/// IncludedSuggestionSet
@@ -12409,13 +12041,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, relevance.hashCode);
- hash = JenkinsSmiHash.combine(hash, displayUri.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ id.hashCode,
+ relevance.hashCode,
+ displayUri.hashCode,
+ );
}
/// inlineLocalVariable feedback
@@ -12479,12 +12109,10 @@
}
@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
@@ -12501,9 +12129,7 @@
}
@override
- int get hashCode {
- return 540364977;
- }
+ int get hashCode => 540364977;
}
/// inlineMethod feedback
@@ -12585,13 +12211,11 @@
}
@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
@@ -12663,12 +12287,10 @@
}
@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
@@ -12731,11 +12353,7 @@
}
@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
@@ -12821,12 +12439,10 @@
}
@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,
+ );
}
/// LibraryPathSet
@@ -12894,12 +12510,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, scope.hashCode);
- hash = JenkinsSmiHash.combine(hash, libraryPaths.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ scope.hashCode,
+ libraryPaths.hashCode,
+ );
}
/// moveFile feedback
@@ -12915,9 +12529,7 @@
}
@override
- int get hashCode {
- return 438975893;
- }
+ int get hashCode => 438975893;
}
/// moveFile options
@@ -12975,11 +12587,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, newFile.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => newFile.hashCode;
}
/// OverriddenMember
@@ -13043,12 +12651,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, element.hashCode);
- hash = JenkinsSmiHash.combine(hash, className.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ element.hashCode,
+ className.hashCode,
+ );
}
/// Override
@@ -13152,14 +12758,12 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, length.hashCode);
- hash = JenkinsSmiHash.combine(hash, superclassMember.hashCode);
- hash = JenkinsSmiHash.combine(hash, interfaceMembers.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ offset.hashCode,
+ length.hashCode,
+ superclassMember.hashCode,
+ interfaceMembers.hashCode,
+ );
}
/// PostfixTemplateDescriptor
@@ -13234,13 +12838,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, key.hashCode);
- hash = JenkinsSmiHash.combine(hash, example.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ name.hashCode,
+ key.hashCode,
+ example.hashCode,
+ );
}
/// PubStatus
@@ -13293,11 +12895,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, isListingPackageDirs.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => isListingPackageDirs.hashCode;
}
/// RefactoringFeedback
@@ -13333,10 +12931,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => 0;
}
/// RefactoringOptions
@@ -13371,10 +12966,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => 0;
}
/// rename feedback
@@ -13465,14 +13057,12 @@
}
@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
@@ -13530,11 +13120,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, newName.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => newName.hashCode;
}
/// RequestError
@@ -13614,13 +13200,11 @@
}
@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
@@ -14048,13 +13632,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, length.hashCode);
- hash = JenkinsSmiHash.combine(hash, type.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ offset.hashCode,
+ length.hashCode,
+ type.hashCode,
+ );
}
/// RuntimeCompletionExpressionType
@@ -14234,17 +13816,15 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, libraryPath.hashCode);
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, typeArguments.hashCode);
- hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
- hash = JenkinsSmiHash.combine(hash, parameterTypes.hashCode);
- hash = JenkinsSmiHash.combine(hash, parameterNames.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ libraryPath.hashCode,
+ kind.hashCode,
+ name.hashCode,
+ typeArguments.hashCode,
+ returnType.hashCode,
+ parameterTypes.hashCode,
+ parameterNames.hashCode,
+ );
}
/// RuntimeCompletionExpressionTypeKind
@@ -14368,12 +13948,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, type.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ name.hashCode,
+ type.hashCode,
+ );
}
/// search.findElementReferences params
@@ -14463,13 +14041,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, includePotential.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ offset.hashCode,
+ includePotential.hashCode,
+ );
}
/// search.findElementReferences result
@@ -14553,12 +14129,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, element.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ id.hashCode,
+ element.hashCode,
+ );
}
/// search.findMemberDeclarations params
@@ -14620,11 +14194,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => name.hashCode;
}
/// search.findMemberDeclarations result
@@ -14688,11 +14258,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => id.hashCode;
}
/// search.findMemberReferences params
@@ -14754,11 +14320,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => name.hashCode;
}
/// search.findMemberReferences result
@@ -14822,11 +14384,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => id.hashCode;
}
/// search.findTopLevelDeclarations params
@@ -14890,11 +14448,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, pattern.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => pattern.hashCode;
}
/// search.findTopLevelDeclarations result
@@ -14958,11 +14512,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => id.hashCode;
}
/// search.getElementDeclarations params
@@ -15058,13 +14608,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, pattern.hashCode);
- hash = JenkinsSmiHash.combine(hash, maxResults.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ pattern.hashCode,
+ maxResults.hashCode,
+ );
}
/// search.getElementDeclarations result
@@ -15147,12 +14695,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, declarations.hashCode);
- hash = JenkinsSmiHash.combine(hash, files.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ declarations.hashCode,
+ files.hashCode,
+ );
}
/// search.getTypeHierarchy params
@@ -15242,13 +14788,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, superOnly.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ offset.hashCode,
+ superOnly.hashCode,
+ );
}
/// search.getTypeHierarchy result
@@ -15328,11 +14872,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, hierarchyItems.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => hierarchyItems.hashCode;
}
/// SearchResult
@@ -15431,14 +14971,12 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, location.hashCode);
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- hash = JenkinsSmiHash.combine(hash, isPotential.hashCode);
- hash = JenkinsSmiHash.combine(hash, path.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ location.hashCode,
+ kind.hashCode,
+ isPotential.hashCode,
+ path.hashCode,
+ );
}
/// SearchResultKind
@@ -15619,13 +15157,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, results.hashCode);
- hash = JenkinsSmiHash.combine(hash, isLast.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ id.hashCode,
+ results.hashCode,
+ isLast.hashCode,
+ );
}
/// server.connected params
@@ -15697,12 +15233,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, version.hashCode);
- hash = JenkinsSmiHash.combine(hash, pid.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ version.hashCode,
+ pid.hashCode,
+ );
}
/// server.error params
@@ -15791,13 +15325,11 @@
}
@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,
+ );
}
/// server.getVersion params
@@ -15821,9 +15353,7 @@
}
@override
- int get hashCode {
- return 55877452;
- }
+ int get hashCode => 55877452;
}
/// server.getVersion result
@@ -15887,11 +15417,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, version.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => version.hashCode;
}
/// ServerLogEntry
@@ -15968,13 +15494,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, time.hashCode);
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- hash = JenkinsSmiHash.combine(hash, data.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ time.hashCode,
+ kind.hashCode,
+ data.hashCode,
+ );
}
/// ServerLogEntryKind
@@ -16121,11 +15645,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, entry.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => entry.hashCode;
}
/// ServerService
@@ -16242,11 +15762,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => subscriptions.hashCode;
}
/// server.setSubscriptions result
@@ -16270,9 +15786,7 @@
}
@override
- int get hashCode {
- return 748820900;
- }
+ int get hashCode => 748820900;
}
/// server.shutdown params
@@ -16296,9 +15810,7 @@
}
@override
- int get hashCode {
- return 366630911;
- }
+ int get hashCode => 366630911;
}
/// server.shutdown result
@@ -16322,9 +15834,7 @@
}
@override
- int get hashCode {
- return 193626532;
- }
+ int get hashCode => 193626532;
}
/// server.status params
@@ -16403,12 +15913,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, analysis.hashCode);
- hash = JenkinsSmiHash.combine(hash, pub.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ analysis.hashCode,
+ pub.hashCode,
+ );
}
/// TypeHierarchyItem
@@ -16568,15 +16076,13 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, classElement.hashCode);
- hash = JenkinsSmiHash.combine(hash, displayName.hashCode);
- hash = JenkinsSmiHash.combine(hash, memberElement.hashCode);
- hash = JenkinsSmiHash.combine(hash, superclass.hashCode);
- hash = JenkinsSmiHash.combine(hash, interfaces.hashCode);
- hash = JenkinsSmiHash.combine(hash, mixins.hashCode);
- hash = JenkinsSmiHash.combine(hash, subclasses.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ classElement.hashCode,
+ displayName.hashCode,
+ memberElement.hashCode,
+ superclass.hashCode,
+ interfaces.hashCode,
+ mixins.hashCode,
+ subclasses.hashCode,
+ );
}
diff --git a/pkg/analysis_server/lib/src/computer/computer_closingLabels.dart b/pkg/analysis_server/lib/src/computer/computer_closingLabels.dart
index 856e20d..76a08e2 100644
--- a/pkg/analysis_server/lib/src/computer/computer_closingLabels.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_closingLabels.dart
@@ -51,7 +51,7 @@
@override
void visitInstanceCreationExpression(InstanceCreationExpression node) {
- var labelText = node.constructorName.type.name.name;
+ var labelText = node.constructorName.type2.name.name;
var name = node.constructorName.name;
if (name != null) {
labelText += '.${name.name}';
diff --git a/pkg/analysis_server/lib/src/computer/computer_highlights.dart b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
index 44a2362..eac6314 100644
--- a/pkg/analysis_server/lib/src/computer/computer_highlights.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
@@ -676,7 +676,7 @@
@override
void visitConstructorReference(ConstructorReference node) {
var constructorName = node.constructorName;
- constructorName.type.accept(this);
+ constructorName.type2.accept(this);
// We have a `ConstructorReference` only when it is resolved.
// TODO(scheglov) The `ConstructorName` in a tear-off always has a name,
@@ -967,6 +967,18 @@
}
@override
+ void visitNamedType(NamedType node) {
+ var type = node.type;
+ if (type != null) {
+ if (type.isDynamic && node.name.name == 'dynamic') {
+ computer._addRegion_node(node, HighlightRegionType.TYPE_NAME_DYNAMIC);
+ return null;
+ }
+ }
+ super.visitNamedType(node);
+ }
+
+ @override
void visitNativeClause(NativeClause node) {
computer._addRegion_token(node.nativeKeyword, HighlightRegionType.BUILT_IN);
super.visitNativeClause(node);
@@ -1118,18 +1130,6 @@
}
@override
- void visitTypeName(TypeName node) {
- var type = node.type;
- if (type != null) {
- if (type.isDynamic && node.name.name == 'dynamic') {
- computer._addRegion_node(node, HighlightRegionType.TYPE_NAME_DYNAMIC);
- return null;
- }
- }
- super.visitTypeName(node);
- }
-
- @override
void visitVariableDeclarationList(VariableDeclarationList node) {
computer._addRegion_token(node.lateKeyword, HighlightRegionType.KEYWORD);
computer._addRegion_token(node.keyword, HighlightRegionType.KEYWORD);
diff --git a/pkg/analysis_server/lib/src/computer/computer_signature.dart b/pkg/analysis_server/lib/src/computer/computer_signature.dart
index 0e852c2..04013bf 100644
--- a/pkg/analysis_server/lib/src/computer/computer_signature.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_signature.dart
@@ -42,7 +42,7 @@
var element = ElementLocator.locate(parent);
execElement = element is ExecutableElement ? element : null;
} else if (parent is InstanceCreationExpression) {
- name = parent.constructorName.type.name.name;
+ name = parent.constructorName.type2.name.name;
var constructorName = parent.constructorName.name;
if (constructorName != null) {
name += '.${constructorName.name}';
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/named_constructor_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/named_constructor_contributor.dart
index 93a1727..e00de9c 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/named_constructor_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/named_constructor_contributor.dart
@@ -21,7 +21,7 @@
if (libraryElement == null) {
return;
}
- var namedType = node.type;
+ var namedType = node.type2;
var type = namedType.type;
if (type != null) {
var element = type.element;
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
index d8d642e..4a4c7d5 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
@@ -29,9 +29,11 @@
};
/// A marker used in place of `null` when a function has no return type.
-final NamedType NO_RETURN_TYPE = astFactory.typeName(
- astFactory.simpleIdentifier(StringToken(TokenType.IDENTIFIER, '', 0)),
- null);
+final NamedType NO_RETURN_TYPE = astFactory.namedType(
+ name: astFactory.simpleIdentifier(
+ StringToken(TokenType.IDENTIFIER, '', 0),
+ ),
+);
/// Add default argument list text and ranges based on the given
/// [requiredParams] and [namedParams].
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_list_literal.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_list_literal.dart
index 8d9d8d4..4e1c0eb 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_list_literal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_list_literal.dart
@@ -49,7 +49,7 @@
//
// Extract the information needed to build the edit.
//
- var constructorTypeArguments = creation.constructorName.type.typeArguments;
+ var constructorTypeArguments = creation.constructorName.type2.typeArguments;
//
// Build the edit.
//
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_map_literal.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_map_literal.dart
index cbc6f18..1704cda 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_map_literal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_map_literal.dart
@@ -51,7 +51,7 @@
//
// Extract the information needed to build the edit.
//
- var constructorTypeArguments = creation.constructorName.type.typeArguments;
+ var constructorTypeArguments = creation.constructorName.type2.typeArguments;
//
// Build the edit.
//
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_set_literal.dart b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_set_literal.dart
index 158a890..8ebe7c7 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/convert_to_set_literal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/convert_to_set_literal.dart
@@ -66,7 +66,7 @@
//
var name = creation.constructorName.name;
var constructorTypeArguments =
- creation.constructorName.type.typeArguments;
+ creation.constructorName.type2.typeArguments;
TypeArgumentList? elementTypeArguments;
SourceRange? elementsRange;
if (name == null) {
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
index 1e367b0..e476729 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/create_constructor.dart
@@ -63,7 +63,7 @@
}
// prepare target interface type
- var targetType = _constructorName.type.type;
+ var targetType = _constructorName.type2.type;
if (targetType is! InterfaceType) {
return;
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart
index c88cbcf..6c9e4d0 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/flutter_convert_to_stateful_widget.dart
@@ -23,7 +23,7 @@
@override
Future<void> compute(ChangeBuilder builder) async {
var widgetClass = node.thisOrAncestorOfType<ClassDeclaration>();
- var superclass = widgetClass?.extendsClause?.superclass;
+ var superclass = widgetClass?.extendsClause?.superclass2;
if (widgetClass == null || superclass == null) {
return;
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/inline_typedef.dart b/pkg/analysis_server/lib/src/services/correction/dart/inline_typedef.dart
index d3089fb..0ae8706 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/inline_typedef.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/inline_typedef.dart
@@ -158,11 +158,11 @@
_ReferenceFinder(this.typeName);
@override
- void visitTypeName(TypeName node) {
+ void visitNamedType(NamedType node) {
if (node.name.name == typeName) {
reference ??= node;
count++;
}
- super.visitTypeName(node);
+ super.visitNamedType(node);
}
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/move_type_arguments_to_class.dart b/pkg/analysis_server/lib/src/services/correction/dart/move_type_arguments_to_class.dart
index 82676c6..417a2cf 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/move_type_arguments_to_class.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/move_type_arguments_to_class.dart
@@ -27,7 +27,7 @@
return;
}
- var namedType = creation.constructorName.type;
+ var namedType = creation.constructorName.type2;
if (namedType.typeArguments != null) {
return;
}
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart
index b1236c9..a5f687c 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/replace_with_var.dart
@@ -67,9 +67,9 @@
}
}
} else if (initializer is InstanceCreationExpression) {
- if (initializer.constructorName.type.typeArguments == null) {
+ if (initializer.constructorName.type2.typeArguments == null) {
typeArgumentsText = utils.getNodeText(typeArguments);
- typeArgumentsOffset = initializer.constructorName.type.end;
+ typeArgumentsOffset = initializer.constructorName.type2.end;
}
}
}
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/accessor.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/accessor.dart
index bd0dde1..4f0972c 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/accessor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/accessor.dart
@@ -114,7 +114,7 @@
if (node is ExtensionOverride) {
return node.typeArguments;
} else if (node is InstanceCreationExpression) {
- return node.constructorName.type.typeArguments;
+ return node.constructorName.type2.typeArguments;
} else if (node is InvocationExpression) {
return node.typeArguments;
} else if (node is NamedType) {
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_descriptor.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_descriptor.dart
index 1c24767..4b9619d 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_descriptor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_descriptor.dart
@@ -52,7 +52,7 @@
}
} else if (node is InstanceCreationExpression) {
var name = node.constructorName;
- var className = _nameFromIdentifier(name.type.name);
+ var className = _nameFromIdentifier(name.type2.name);
var constructorName = name.name?.name ?? '';
if (components[0] == constructorName && components[1] == className) {
return true;
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart
index b3645cd..64000e8 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/element_matcher.dart
@@ -199,7 +199,10 @@
return [parent.extensionName.name];
} else if (parent is InstanceCreationExpression) {
var constructorName = parent.constructorName;
- return [constructorName.name?.name ?? '', constructorName.type.name.name];
+ return [
+ constructorName.name?.name ?? '',
+ constructorName.type2.name.name
+ ];
} else if (parent is MethodInvocation) {
var methodName = parent.methodName;
var targetName = _nameOfTarget(parent.realTarget);
diff --git a/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart b/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart
index 93de681..da822b8 100644
--- a/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart
+++ b/pkg/analysis_server/lib/src/services/correction/name_suggestion.dart
@@ -181,7 +181,7 @@
name = expression.methodName.name;
} else if (expression is InstanceCreationExpression) {
var constructorName = expression.constructorName;
- var namedType = constructorName.type;
+ var namedType = constructorName.type2;
var typeNameIdentifier = namedType.name;
// new ClassName()
if (typeNameIdentifier is SimpleIdentifier) {
diff --git a/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart b/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
index b902a8b..cbc0bc4 100644
--- a/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
+++ b/pkg/analysis_server/lib/src/services/kythe/kythe_visitors.dart
@@ -295,15 +295,15 @@
// ClassDeclarations) and super.visitClassTypeAlias is not sufficient.
//
_handleRefEdge(
- node.superclass.name.staticElement,
+ node.superclass2.name.staticElement,
const <String>[schema.REF_EDGE],
- syntacticEntity: node.superclass,
+ syntacticEntity: node.superclass2,
);
// TODO(jwren) refactor the following lines into a method that can be used
// by visitClassDeclaration()
// extends
var recordSupertypeVName = _vNameFromElement(
- node.superclass.name.staticElement, schema.RECORD_KIND);
+ node.superclass2.name.staticElement, schema.RECORD_KIND);
addEdge(_enclosingClassVName!, schema.EXTENDS_EDGE, recordSupertypeVName);
// implements
@@ -659,7 +659,7 @@
// assert (element.enclosingElement != null);
}
// visit children
- _safelyVisitList(constructorName.type.typeArguments?.arguments);
+ _safelyVisitList(constructorName.type2.typeArguments?.arguments);
_safelyVisit(node.argumentList);
}
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
index 4da1f25..4b470bf 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
@@ -966,6 +966,14 @@
}
@override
+ void visitNamedType(NamedType node) {
+ super.visitNamedType(node);
+ if (_isFirstSelectedNode(node)) {
+ invalidSelection('Cannot extract a single type reference.');
+ }
+ }
+
+ @override
void visitSimpleIdentifier(SimpleIdentifier node) {
super.visitSimpleIdentifier(node);
if (_isFirstSelectedNode(node)) {
@@ -987,14 +995,6 @@
}
@override
- void visitTypeName(TypeName node) {
- super.visitTypeName(node);
- if (_isFirstSelectedNode(node)) {
- invalidSelection('Cannot extract a single type reference.');
- }
- }
-
- @override
void visitVariableDeclaration(VariableDeclaration node) {
super.visitVariableDeclaration(node);
if (_isFirstSelectedNode(node)) {
diff --git a/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart b/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
index cdb3485..05e0eb3 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
@@ -418,7 +418,7 @@
// Rename the class when on `new` in an instance creation.
if (node is InstanceCreationExpression) {
var creation = node;
- var typeIdentifier = creation.constructorName.type.name;
+ var typeIdentifier = creation.constructorName.type2.name;
element = typeIdentifier.staticElement;
offset = typeIdentifier.offset;
length = typeIdentifier.length;
diff --git a/pkg/analysis_server/pubspec.yaml b/pkg/analysis_server/pubspec.yaml
index 0879e01..bb60379 100644
--- a/pkg/analysis_server/pubspec.yaml
+++ b/pkg/analysis_server/pubspec.yaml
@@ -39,3 +39,11 @@
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
diff --git a/pkg/analysis_server/test/src/utilities/flutter_test.dart b/pkg/analysis_server/test/src/utilities/flutter_test.dart
index d616586..53e071c 100644
--- a/pkg/analysis_server/test/src/utilities/flutter_test.dart
+++ b/pkg/analysis_server/test/src/utilities/flutter_test.dart
@@ -125,7 +125,7 @@
var statement = statements[0] as ExpressionStatement;
var creation = statement.expression as InstanceCreationExpression;
var constructorName = creation.constructorName;
- var namedType = constructorName.type;
+ var namedType = constructorName.type2;
var argumentList = creation.argumentList;
expect(_flutter.identifyWidgetExpression(creation), creation);
expect(_flutter.identifyWidgetExpression(constructorName), creation);
@@ -142,7 +142,7 @@
var statement = statements[1] as ExpressionStatement;
var creation = statement.expression as InstanceCreationExpression;
var constructorName = creation.constructorName;
- var namedType = constructorName.type;
+ var namedType = constructorName.type2;
var argumentList = creation.argumentList;
expect(_flutter.identifyWidgetExpression(creation), creation);
expect(_flutter.identifyWidgetExpression(constructorName), creation);
diff --git a/pkg/analysis_server/tool/code_completion/code_metrics.dart b/pkg/analysis_server/tool/code_completion/code_metrics.dart
index 6a37dfd..0ace057 100644
--- a/pkg/analysis_server/tool/code_completion/code_metrics.dart
+++ b/pkg/analysis_server/tool/code_completion/code_metrics.dart
@@ -326,7 +326,7 @@
'abstractKeyword': node.abstractKeyword,
'name': node.name,
'typeParameters': node.typeParameters,
- 'superclass': node.superclass,
+ 'superclass': node.superclass2,
'withClause': node.withClause,
'implementsClause': node.implementsClause,
});
@@ -409,7 +409,7 @@
@override
void visitConstructorName(ConstructorName node) {
_visitChildren(node, {
- 'type': node.type,
+ 'type': node.type2,
'name': node.name,
});
super.visitConstructorName(node);
@@ -531,7 +531,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
_visitChildren(node, {
- 'superclass': node.superclass,
+ 'superclass': node.superclass2,
});
super.visitExtendsClause(node);
}
@@ -954,6 +954,16 @@
}
@override
+ void visitNamedType(NamedType node) {
+ _visitChildren(node, {
+ 'name': node.name,
+ 'typeArguments': node.typeArguments,
+ 'question': node.question,
+ });
+ super.visitNamedType(node);
+ }
+
+ @override
void visitNativeClause(NativeClause node) {
_visitChildren(node, {
'name': node.name,
@@ -1220,16 +1230,6 @@
}
@override
- void visitTypeName(TypeName node) {
- _visitChildren(node, {
- 'name': node.name,
- 'typeArguments': node.typeArguments,
- 'question': node.question,
- });
- super.visitTypeName(node);
- }
-
- @override
void visitTypeParameter(TypeParameter node) {
_visitChildren(node, {
'name': node.name,
diff --git a/pkg/analysis_server/tool/code_completion/relevance_metrics.dart b/pkg/analysis_server/tool/code_completion/relevance_metrics.dart
index dbf9cec..a505521 100644
--- a/pkg/analysis_server/tool/code_completion/relevance_metrics.dart
+++ b/pkg/analysis_server/tool/code_completion/relevance_metrics.dart
@@ -456,7 +456,7 @@
void visitClassTypeAlias(ClassTypeAlias node) {
var wasInGenericContext = inGenericContext;
inGenericContext = inGenericContext || node.typeParameters != null;
- _recordDataForNode('ClassTypeAlias (superclass)', node.superclass);
+ _recordDataForNode('ClassTypeAlias (superclass)', node.superclass2);
var context = 'superclass';
_recordTokenType('ClassDeclaration ($context)', node.withClause);
context = 'with';
@@ -646,7 +646,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
- _recordDataForNode('ExtendsClause (type)', node.superclass);
+ _recordDataForNode('ExtendsClause (type)', node.superclass2);
super.visitExtendsClause(node);
}
@@ -1043,6 +1043,12 @@
}
@override
+ void visitNamedType(NamedType node) {
+ // There are no completions.
+ super.visitNamedType(node);
+ }
+
+ @override
void visitNativeClause(NativeClause node) {
// There are no completions.
super.visitNativeClause(node);
@@ -1299,12 +1305,6 @@
}
@override
- void visitTypeName(TypeName node) {
- // There are no completions.
- super.visitTypeName(node);
- }
-
- @override
void visitTypeParameter(TypeParameter node) {
if (node.bound != null) {
_recordDataForNode('TypeParameter (bound)', node.bound);
diff --git a/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart b/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart
index 9df1db8..e3978af 100644
--- a/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart
+++ b/pkg/analysis_server/tool/code_completion/relevance_table_generator.dart
@@ -463,7 +463,7 @@
@override
void visitClassTypeAlias(ClassTypeAlias node) {
- _recordDataForNode('ClassTypeAlias_superclass', node.superclass);
+ _recordDataForNode('ClassTypeAlias_superclass', node.superclass2);
var context = 'superclass';
_recordKeyword('ClassTypeAlias_$context', node.withClause);
context = 'with';
@@ -643,7 +643,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
- _recordDataForNode('ExtendsClause_superclass', node.superclass);
+ _recordDataForNode('ExtendsClause_superclass', node.superclass2);
super.visitExtendsClause(node);
}
@@ -973,6 +973,12 @@
}
@override
+ void visitNamedType(NamedType node) {
+ // There are no completions.
+ super.visitNamedType(node);
+ }
+
+ @override
void visitNativeClause(NativeClause node) {
// There are no completions.
super.visitNativeClause(node);
@@ -1199,12 +1205,6 @@
}
@override
- void visitTypeName(TypeName node) {
- // There are no completions.
- super.visitTypeName(node);
- }
-
- @override
void visitTypeParameter(TypeParameter node) {
if (node.bound != null) {
_recordDataForNode('TypeParameter_bound', node.bound);
diff --git a/pkg/analysis_server/tool/code_completion/visitors.dart b/pkg/analysis_server/tool/code_completion/visitors.dart
index 5783758..f65c8b6 100644
--- a/pkg/analysis_server/tool/code_completion/visitors.dart
+++ b/pkg/analysis_server/tool/code_completion/visitors.dart
@@ -653,7 +653,7 @@
if (constructorName is ConstructorName) {
var instanceCreationExpression = constructorName.parent;
if (instanceCreationExpression is InstanceCreationExpression &&
- constructorName.type.name == node) {
+ constructorName.type2.name == node) {
if (instanceCreationExpression.keyword != null ||
constructorName.name == null) {
elementKind = protocol.ElementKind.CONSTRUCTOR;
diff --git a/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart b/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart
index c17e46f..c3c4f3c 100644
--- a/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart
+++ b/pkg/analysis_server/tool/spec/codegen_dart_protocol.dart
@@ -384,8 +384,6 @@
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 @@
"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 @@
/// 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
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 0675a7a..96c6d1b 100644
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_common.dart
+++ b/pkg/analysis_server_client/lib/src/protocol/protocol_common.dart
@@ -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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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,
+ );
}
diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
index 470f830..ee185f6 100644
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
+++ b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart
@@ -11,7 +11,6 @@
import 'package:analysis_server_client/src/protocol/protocol_base.dart';
import 'package:analysis_server_client/src/protocol/protocol_common.dart';
import 'package:analysis_server_client/src/protocol/protocol_internal.dart';
-import 'package:analysis_server_client/src/protocol/protocol_util.dart';
/// analysis.analyzedFiles params
///
@@ -74,11 +73,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, directories.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => directories.hashCode;
}
/// analysis.closingLabels params
@@ -164,12 +159,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, labels.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ labels.hashCode,
+ );
}
/// AnalysisErrorFixes
@@ -240,12 +233,10 @@
}
@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
@@ -323,12 +314,10 @@
}
@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.flushResults params
@@ -391,11 +380,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, files.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => files.hashCode;
}
/// analysis.folding params
@@ -473,12 +458,10 @@
}
@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.getErrors params
@@ -539,11 +522,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => file.hashCode;
}
/// analysis.getErrors result
@@ -612,11 +591,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, errors.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => errors.hashCode;
}
/// analysis.getHover params
@@ -688,12 +663,10 @@
}
@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,
+ );
}
/// analysis.getHover result
@@ -766,11 +739,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, hovers.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => hovers.hashCode;
}
/// analysis.getImportedElements params
@@ -856,13 +825,11 @@
}
@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.getImportedElements result
@@ -933,11 +900,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, elements.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => elements.hashCode;
}
/// analysis.getLibraryDependencies params
@@ -961,9 +924,7 @@
}
@override
- int get hashCode {
- return 246577680;
- }
+ int get hashCode => 246577680;
}
/// analysis.getLibraryDependencies result
@@ -1057,12 +1018,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, libraries.hashCode);
- hash = JenkinsSmiHash.combine(hash, packageMap.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ libraries.hashCode,
+ packageMap.hashCode,
+ );
}
/// analysis.getNavigation params
@@ -1150,13 +1109,11 @@
}
@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
@@ -1259,13 +1216,11 @@
}
@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.getReachableSources params
@@ -1327,11 +1282,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => file.hashCode;
}
/// analysis.getReachableSources result
@@ -1407,11 +1358,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, sources.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => sources.hashCode;
}
/// analysis.getSignature params
@@ -1484,12 +1431,10 @@
}
@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,
+ );
}
/// analysis.getSignature result
@@ -1590,13 +1535,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
- hash = JenkinsSmiHash.combine(hash, dartdoc.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ name.hashCode,
+ parameters.hashCode,
+ dartdoc.hashCode,
+ );
}
/// analysis.highlights params
@@ -1678,12 +1621,10 @@
}
@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.implemented params
@@ -1780,13 +1721,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, classes.hashCode);
- hash = JenkinsSmiHash.combine(hash, members.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ classes.hashCode,
+ members.hashCode,
+ );
}
/// analysis.invalidate params
@@ -1884,14 +1823,12 @@
}
@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, delta.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ offset.hashCode,
+ length.hashCode,
+ delta.hashCode,
+ );
}
/// analysis.navigation params
@@ -2008,14 +1945,12 @@
}
@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
@@ -2094,12 +2029,10 @@
}
@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,
+ );
}
/// AnalysisOptions
@@ -2282,18 +2215,16 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, enableAsync.hashCode);
- hash = JenkinsSmiHash.combine(hash, enableDeferredLoading.hashCode);
- hash = JenkinsSmiHash.combine(hash, enableEnums.hashCode);
- hash = JenkinsSmiHash.combine(hash, enableNullAwareOperators.hashCode);
- hash = JenkinsSmiHash.combine(hash, enableSuperMixins.hashCode);
- hash = JenkinsSmiHash.combine(hash, generateDart2jsHints.hashCode);
- hash = JenkinsSmiHash.combine(hash, generateHints.hashCode);
- hash = JenkinsSmiHash.combine(hash, generateLints.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ enableAsync.hashCode,
+ enableDeferredLoading.hashCode,
+ enableEnums.hashCode,
+ enableNullAwareOperators.hashCode,
+ enableSuperMixins.hashCode,
+ generateDart2jsHints.hashCode,
+ generateHints.hashCode,
+ generateLints.hashCode,
+ );
}
/// analysis.outline params
@@ -2397,14 +2328,12 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- hash = JenkinsSmiHash.combine(hash, libraryName.hashCode);
- hash = JenkinsSmiHash.combine(hash, outline.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ kind.hashCode,
+ libraryName.hashCode,
+ outline.hashCode,
+ );
}
/// analysis.overrides params
@@ -2482,12 +2411,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, overrides.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ overrides.hashCode,
+ );
}
/// analysis.reanalyze params
@@ -2511,9 +2438,7 @@
}
@override
- int get hashCode {
- return 613039876;
- }
+ int get hashCode => 613039876;
}
/// analysis.reanalyze result
@@ -2537,9 +2462,7 @@
}
@override
- int get hashCode {
- return 846803925;
- }
+ int get hashCode => 846803925;
}
/// AnalysisService
@@ -2743,13 +2666,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, included.hashCode);
- hash = JenkinsSmiHash.combine(hash, excluded.hashCode);
- hash = JenkinsSmiHash.combine(hash, packageRoots.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ included.hashCode,
+ excluded.hashCode,
+ packageRoots.hashCode,
+ );
}
/// analysis.setAnalysisRoots result
@@ -2773,9 +2694,7 @@
}
@override
- int get hashCode {
- return 866004753;
- }
+ int get hashCode => 866004753;
}
/// analysis.setGeneralSubscriptions params
@@ -2844,11 +2763,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => subscriptions.hashCode;
}
/// analysis.setGeneralSubscriptions result
@@ -2872,9 +2787,7 @@
}
@override
- int get hashCode {
- return 386759562;
- }
+ int get hashCode => 386759562;
}
/// analysis.setPriorityFiles params
@@ -2937,11 +2850,7 @@
}
@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
@@ -2965,9 +2874,7 @@
}
@override
- int get hashCode {
- return 330050055;
- }
+ int get hashCode => 330050055;
}
/// analysis.setSubscriptions params
@@ -3040,11 +2947,7 @@
}
@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
@@ -3068,9 +2971,7 @@
}
@override
- int get hashCode {
- return 218088493;
- }
+ int get hashCode => 218088493;
}
/// AnalysisStatus
@@ -3137,12 +3038,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, isAnalyzing.hashCode);
- hash = JenkinsSmiHash.combine(hash, analysisTarget.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ isAnalyzing.hashCode,
+ analysisTarget.hashCode,
+ );
}
/// analysis.updateContent params
@@ -3216,11 +3115,7 @@
}
@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
@@ -3273,10 +3168,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => 0;
}
/// analysis.updateOptions params
@@ -3339,11 +3231,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, options.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => options.hashCode;
}
/// analysis.updateOptions result
@@ -3367,9 +3255,7 @@
}
@override
- int get hashCode {
- return 179689467;
- }
+ int get hashCode => 179689467;
}
/// analytics.enable params
@@ -3430,11 +3316,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, value.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => value.hashCode;
}
/// analytics.enable result
@@ -3458,9 +3340,7 @@
}
@override
- int get hashCode {
- return 237990792;
- }
+ int get hashCode => 237990792;
}
/// analytics.isEnabled params
@@ -3484,9 +3364,7 @@
}
@override
- int get hashCode {
- return 57215544;
- }
+ int get hashCode => 57215544;
}
/// analytics.isEnabled result
@@ -3550,11 +3428,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, enabled.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => enabled.hashCode;
}
/// analytics.sendEvent params
@@ -3615,11 +3489,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, action.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => action.hashCode;
}
/// analytics.sendEvent result
@@ -3643,9 +3513,7 @@
}
@override
- int get hashCode {
- return 227063188;
- }
+ int get hashCode => 227063188;
}
/// analytics.sendTiming params
@@ -3717,12 +3585,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, event.hashCode);
- hash = JenkinsSmiHash.combine(hash, millis.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ event.hashCode,
+ millis.hashCode,
+ );
}
/// analytics.sendTiming result
@@ -3746,9 +3612,7 @@
}
@override
- int get hashCode {
- return 875010924;
- }
+ int get hashCode => 875010924;
}
/// AvailableSuggestion
@@ -3941,19 +3805,17 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, label.hashCode);
- hash = JenkinsSmiHash.combine(hash, declaringLibraryUri.hashCode);
- hash = JenkinsSmiHash.combine(hash, element.hashCode);
- hash = JenkinsSmiHash.combine(hash, defaultArgumentListString.hashCode);
- hash = JenkinsSmiHash.combine(hash, defaultArgumentListTextRanges.hashCode);
- hash = JenkinsSmiHash.combine(hash, parameterNames.hashCode);
- hash = JenkinsSmiHash.combine(hash, parameterTypes.hashCode);
- hash = JenkinsSmiHash.combine(hash, relevanceTags.hashCode);
- hash = JenkinsSmiHash.combine(hash, requiredParameterCount.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ label.hashCode,
+ declaringLibraryUri.hashCode,
+ element.hashCode,
+ defaultArgumentListString.hashCode,
+ defaultArgumentListTextRanges.hashCode,
+ parameterNames.hashCode,
+ parameterTypes.hashCode,
+ relevanceTags.hashCode,
+ requiredParameterCount.hashCode,
+ );
}
/// AvailableSuggestionSet
@@ -4033,13 +3895,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, uri.hashCode);
- hash = JenkinsSmiHash.combine(hash, items.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ id.hashCode,
+ uri.hashCode,
+ items.hashCode,
+ );
}
/// BulkFix
@@ -4108,12 +3968,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, path.hashCode);
- hash = JenkinsSmiHash.combine(hash, fixes.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ path.hashCode,
+ fixes.hashCode,
+ );
}
/// BulkFixDetail
@@ -4177,12 +4035,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, code.hashCode);
- hash = JenkinsSmiHash.combine(hash, occurrences.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ code.hashCode,
+ occurrences.hashCode,
+ );
}
/// ClosingLabel
@@ -4258,13 +4114,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, length.hashCode);
- hash = JenkinsSmiHash.combine(hash, label.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ offset.hashCode,
+ length.hashCode,
+ label.hashCode,
+ );
}
/// completion.availableSuggestions params
@@ -4355,12 +4209,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, changedLibraries.hashCode);
- hash = JenkinsSmiHash.combine(hash, removedLibraries.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ changedLibraries.hashCode,
+ removedLibraries.hashCode,
+ );
}
/// completion.existingImports params
@@ -4434,12 +4286,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, imports.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ imports.hashCode,
+ );
}
/// completion.getSuggestionDetails params
@@ -4540,14 +4390,12 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, label.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ id.hashCode,
+ label.hashCode,
+ offset.hashCode,
+ );
}
/// completion.getSuggestionDetails result
@@ -4627,12 +4475,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, completion.hashCode);
- hash = JenkinsSmiHash.combine(hash, change.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ completion.hashCode,
+ change.hashCode,
+ );
}
/// completion.getSuggestions params
@@ -4705,12 +4551,10 @@
}
@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
@@ -4774,11 +4618,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => id.hashCode;
}
/// completion.registerLibraryPaths params
@@ -4849,11 +4689,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, paths.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => paths.hashCode;
}
/// completion.registerLibraryPaths result
@@ -4877,9 +4713,7 @@
}
@override
- int get hashCode {
- return 104675661;
- }
+ int get hashCode => 104675661;
}
/// completion.results params
@@ -5111,20 +4945,17 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, replacementOffset.hashCode);
- hash = JenkinsSmiHash.combine(hash, replacementLength.hashCode);
- hash = JenkinsSmiHash.combine(hash, results.hashCode);
- hash = JenkinsSmiHash.combine(hash, isLast.hashCode);
- hash = JenkinsSmiHash.combine(hash, libraryFile.hashCode);
- hash = JenkinsSmiHash.combine(hash, includedSuggestionSets.hashCode);
- hash = JenkinsSmiHash.combine(hash, includedElementKinds.hashCode);
- hash =
- JenkinsSmiHash.combine(hash, includedSuggestionRelevanceTags.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ id.hashCode,
+ replacementOffset.hashCode,
+ replacementLength.hashCode,
+ results.hashCode,
+ isLast.hashCode,
+ libraryFile.hashCode,
+ includedSuggestionSets.hashCode,
+ includedElementKinds.hashCode,
+ includedSuggestionRelevanceTags.hashCode,
+ );
}
/// CompletionService
@@ -5246,11 +5077,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => subscriptions.hashCode;
}
/// completion.setSubscriptions result
@@ -5274,9 +5101,7 @@
}
@override
- int get hashCode {
- return 2482770;
- }
+ int get hashCode => 2482770;
}
/// ContextData
@@ -5384,15 +5209,13 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, explicitFileCount.hashCode);
- hash = JenkinsSmiHash.combine(hash, implicitFileCount.hashCode);
- hash = JenkinsSmiHash.combine(hash, workItemQueueLength.hashCode);
- hash = JenkinsSmiHash.combine(hash, cacheEntryExceptions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ name.hashCode,
+ explicitFileCount.hashCode,
+ implicitFileCount.hashCode,
+ workItemQueueLength.hashCode,
+ cacheEntryExceptions.hashCode,
+ );
}
/// convertGetterToMethod feedback
@@ -5409,9 +5232,7 @@
}
@override
- int get hashCode {
- return 616032599;
- }
+ int get hashCode => 616032599;
}
/// convertGetterToMethod options
@@ -5428,9 +5249,7 @@
}
@override
- int get hashCode {
- return 488848400;
- }
+ int get hashCode => 488848400;
}
/// convertMethodToGetter feedback
@@ -5447,9 +5266,7 @@
}
@override
- int get hashCode {
- return 165291526;
- }
+ int get hashCode => 165291526;
}
/// convertMethodToGetter options
@@ -5466,9 +5283,7 @@
}
@override
- int get hashCode {
- return 27952290;
- }
+ int get hashCode => 27952290;
}
/// diagnostic.getDiagnostics params
@@ -5492,9 +5307,7 @@
}
@override
- int get hashCode {
- return 587526202;
- }
+ int get hashCode => 587526202;
}
/// diagnostic.getDiagnostics result
@@ -5564,11 +5377,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, contexts.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => contexts.hashCode;
}
/// diagnostic.getServerPort params
@@ -5592,9 +5401,7 @@
}
@override
- int get hashCode {
- return 367508704;
- }
+ int get hashCode => 367508704;
}
/// diagnostic.getServerPort result
@@ -5658,11 +5465,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, port.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => port.hashCode;
}
/// edit.bulkFixes params
@@ -5751,12 +5554,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, included.hashCode);
- hash = JenkinsSmiHash.combine(hash, inTestMode.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ included.hashCode,
+ inTestMode.hashCode,
+ );
}
/// edit.bulkFixes result
@@ -5841,12 +5642,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, edits.hashCode);
- hash = JenkinsSmiHash.combine(hash, details.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ edits.hashCode,
+ details.hashCode,
+ );
}
/// edit.format params
@@ -5949,14 +5748,12 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, selectionOffset.hashCode);
- hash = JenkinsSmiHash.combine(hash, selectionLength.hashCode);
- hash = JenkinsSmiHash.combine(hash, lineLength.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ selectionOffset.hashCode,
+ selectionLength.hashCode,
+ lineLength.hashCode,
+ );
}
/// edit.format result
@@ -6051,13 +5848,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, edits.hashCode);
- hash = JenkinsSmiHash.combine(hash, selectionOffset.hashCode);
- hash = JenkinsSmiHash.combine(hash, selectionLength.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ edits.hashCode,
+ selectionOffset.hashCode,
+ selectionLength.hashCode,
+ );
}
/// edit.getAssists params
@@ -6142,13 +5937,11 @@
}
@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
@@ -6217,11 +6010,7 @@
}
@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
@@ -6307,13 +6096,11 @@
}
@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
@@ -6383,11 +6170,7 @@
}
@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
@@ -6459,12 +6242,10 @@
}
@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
@@ -6533,11 +6314,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, fixes.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => fixes.hashCode;
}
/// edit.getPostfixCompletion params
@@ -6622,13 +6399,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, key.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ key.hashCode,
+ offset.hashCode,
+ );
}
/// edit.getPostfixCompletion result
@@ -6693,11 +6468,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, change.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => change.hashCode;
}
/// edit.getRefactoring params
@@ -6832,16 +6603,14 @@
}
@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
@@ -7014,16 +6783,14 @@
}
@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,
+ );
}
/// edit.getStatementCompletion params
@@ -7096,12 +6863,10 @@
}
@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.getStatementCompletion result
@@ -7179,12 +6944,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, change.hashCode);
- hash = JenkinsSmiHash.combine(hash, whitespaceOnly.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ change.hashCode,
+ whitespaceOnly.hashCode,
+ );
}
/// edit.importElements params
@@ -7279,13 +7042,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, elements.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ elements.hashCode,
+ offset.hashCode,
+ );
}
/// edit.importElements result
@@ -7355,11 +7116,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, edit.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => edit.hashCode;
}
/// edit.isPostfixCompletionApplicable params
@@ -7444,13 +7201,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, key.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ key.hashCode,
+ offset.hashCode,
+ );
}
/// edit.isPostfixCompletionApplicable result
@@ -7515,11 +7270,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, value.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => value.hashCode;
}
/// edit.listPostfixCompletionTemplates params
@@ -7543,9 +7294,7 @@
}
@override
- int get hashCode {
- return 690713107;
- }
+ int get hashCode => 690713107;
}
/// edit.listPostfixCompletionTemplates result
@@ -7618,11 +7367,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, templates.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => templates.hashCode;
}
/// edit.organizeDirectives params
@@ -7684,11 +7429,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => file.hashCode;
}
/// edit.organizeDirectives result
@@ -7754,11 +7495,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, edit.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => edit.hashCode;
}
/// edit.sortMembers params
@@ -7819,11 +7556,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => file.hashCode;
}
/// edit.sortMembers result
@@ -7888,11 +7621,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, edit.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => edit.hashCode;
}
/// ElementDeclaration
@@ -8084,21 +7813,19 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- hash = JenkinsSmiHash.combine(hash, fileIndex.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, line.hashCode);
- hash = JenkinsSmiHash.combine(hash, column.hashCode);
- hash = JenkinsSmiHash.combine(hash, codeOffset.hashCode);
- hash = JenkinsSmiHash.combine(hash, codeLength.hashCode);
- hash = JenkinsSmiHash.combine(hash, className.hashCode);
- hash = JenkinsSmiHash.combine(hash, mixinName.hashCode);
- hash = JenkinsSmiHash.combine(hash, parameters.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ name.hashCode,
+ kind.hashCode,
+ fileIndex.hashCode,
+ offset.hashCode,
+ line.hashCode,
+ column.hashCode,
+ codeOffset.hashCode,
+ codeLength.hashCode,
+ className.hashCode,
+ mixinName.hashCode,
+ parameters.hashCode,
+ );
}
/// ExecutableFile
@@ -8161,12 +7888,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ kind.hashCode,
+ );
}
/// ExecutableKind
@@ -8295,11 +8020,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, contextRoot.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => contextRoot.hashCode;
}
/// execution.createContext result
@@ -8363,11 +8084,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => id.hashCode;
}
/// execution.deleteContext params
@@ -8429,11 +8146,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => id.hashCode;
}
/// execution.deleteContext result
@@ -8457,9 +8170,7 @@
}
@override
- int get hashCode {
- return 479954425;
- }
+ int get hashCode => 479954425;
}
/// execution.getSuggestions params
@@ -8623,16 +8334,14 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, code.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, contextFile.hashCode);
- hash = JenkinsSmiHash.combine(hash, contextOffset.hashCode);
- hash = JenkinsSmiHash.combine(hash, variables.hashCode);
- hash = JenkinsSmiHash.combine(hash, expressions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ code.hashCode,
+ offset.hashCode,
+ contextFile.hashCode,
+ contextOffset.hashCode,
+ variables.hashCode,
+ expressions.hashCode,
+ );
}
/// execution.getSuggestions result
@@ -8739,12 +8448,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, suggestions.hashCode);
- hash = JenkinsSmiHash.combine(hash, expressions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ suggestions.hashCode,
+ expressions.hashCode,
+ );
}
/// execution.launchData params
@@ -8838,13 +8545,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- hash = JenkinsSmiHash.combine(hash, referencedFiles.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ kind.hashCode,
+ referencedFiles.hashCode,
+ );
}
/// execution.mapUri params
@@ -8929,13 +8634,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, uri.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ id.hashCode,
+ file.hashCode,
+ uri.hashCode,
+ );
}
/// execution.mapUri result
@@ -9013,12 +8716,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, uri.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ uri.hashCode,
+ );
}
/// ExecutionService
@@ -9130,11 +8831,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => subscriptions.hashCode;
}
/// execution.setSubscriptions result
@@ -9158,9 +8855,7 @@
}
@override
- int get hashCode {
- return 287678780;
- }
+ int get hashCode => 287678780;
}
/// ExistingImport
@@ -9225,12 +8920,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, uri.hashCode);
- hash = JenkinsSmiHash.combine(hash, elements.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ uri.hashCode,
+ elements.hashCode,
+ );
}
/// ExistingImports
@@ -9300,12 +8993,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, elements.hashCode);
- hash = JenkinsSmiHash.combine(hash, imports.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ elements.hashCode,
+ imports.hashCode,
+ );
}
/// extractLocalVariable feedback
@@ -9427,15 +9118,13 @@
}
@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
@@ -9508,12 +9197,10 @@
}
@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
@@ -9673,18 +9360,16 @@
}
@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
@@ -9817,15 +9502,13 @@
}
@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,
+ );
}
/// extractWidget feedback
@@ -9865,10 +9548,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => 0;
}
/// extractWidget options
@@ -9925,11 +9605,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => name.hashCode;
}
/// FileKind
@@ -10051,12 +9727,10 @@
}
@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,
+ );
}
/// flutter.getWidgetDescription result
@@ -10130,11 +9804,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, properties.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => properties.hashCode;
}
/// FlutterOutline
@@ -10374,22 +10044,20 @@
}
@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);
- hash = JenkinsSmiHash.combine(hash, codeOffset.hashCode);
- hash = JenkinsSmiHash.combine(hash, codeLength.hashCode);
- hash = JenkinsSmiHash.combine(hash, label.hashCode);
- hash = JenkinsSmiHash.combine(hash, dartElement.hashCode);
- hash = JenkinsSmiHash.combine(hash, attributes.hashCode);
- hash = JenkinsSmiHash.combine(hash, className.hashCode);
- hash = JenkinsSmiHash.combine(hash, parentAssociationLabel.hashCode);
- hash = JenkinsSmiHash.combine(hash, variableName.hashCode);
- hash = JenkinsSmiHash.combine(hash, children.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ kind.hashCode,
+ offset.hashCode,
+ length.hashCode,
+ codeOffset.hashCode,
+ codeLength.hashCode,
+ label.hashCode,
+ dartElement.hashCode,
+ attributes.hashCode,
+ className.hashCode,
+ parentAssociationLabel.hashCode,
+ variableName.hashCode,
+ children.hashCode,
+ );
}
/// FlutterOutlineAttribute
@@ -10540,17 +10208,15 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, label.hashCode);
- hash = JenkinsSmiHash.combine(hash, literalValueBoolean.hashCode);
- hash = JenkinsSmiHash.combine(hash, literalValueInteger.hashCode);
- hash = JenkinsSmiHash.combine(hash, literalValueString.hashCode);
- hash = JenkinsSmiHash.combine(hash, nameLocation.hashCode);
- hash = JenkinsSmiHash.combine(hash, valueLocation.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ name.hashCode,
+ label.hashCode,
+ literalValueBoolean.hashCode,
+ literalValueInteger.hashCode,
+ literalValueString.hashCode,
+ nameLocation.hashCode,
+ valueLocation.hashCode,
+ );
}
/// FlutterOutlineKind
@@ -10710,12 +10376,10 @@
}
@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,
+ );
}
/// FlutterService
@@ -10832,11 +10496,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => subscriptions.hashCode;
}
/// flutter.setSubscriptions result
@@ -10860,9 +10520,7 @@
}
@override
- int get hashCode {
- return 628296315;
- }
+ int get hashCode => 628296315;
}
/// flutter.setWidgetPropertyValue params
@@ -10949,12 +10607,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, value.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ id.hashCode,
+ value.hashCode,
+ );
}
/// flutter.setWidgetPropertyValue result
@@ -11019,11 +10675,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, change.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => change.hashCode;
}
/// FlutterWidgetProperty
@@ -11214,19 +10866,17 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, documentation.hashCode);
- hash = JenkinsSmiHash.combine(hash, expression.hashCode);
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, isRequired.hashCode);
- hash = JenkinsSmiHash.combine(hash, isSafeToUpdate.hashCode);
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, children.hashCode);
- hash = JenkinsSmiHash.combine(hash, editor.hashCode);
- hash = JenkinsSmiHash.combine(hash, value.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ documentation.hashCode,
+ expression.hashCode,
+ id.hashCode,
+ isRequired.hashCode,
+ isSafeToUpdate.hashCode,
+ name.hashCode,
+ children.hashCode,
+ editor.hashCode,
+ value.hashCode,
+ );
}
/// FlutterWidgetPropertyEditor
@@ -11301,12 +10951,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- hash = JenkinsSmiHash.combine(hash, enumItems.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ kind.hashCode,
+ enumItems.hashCode,
+ );
}
/// FlutterWidgetPropertyEditorKind
@@ -11529,16 +11177,14 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, boolValue.hashCode);
- hash = JenkinsSmiHash.combine(hash, doubleValue.hashCode);
- hash = JenkinsSmiHash.combine(hash, intValue.hashCode);
- hash = JenkinsSmiHash.combine(hash, stringValue.hashCode);
- hash = JenkinsSmiHash.combine(hash, enumValue.hashCode);
- hash = JenkinsSmiHash.combine(hash, expression.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ boolValue.hashCode,
+ doubleValue.hashCode,
+ intValue.hashCode,
+ stringValue.hashCode,
+ enumValue.hashCode,
+ expression.hashCode,
+ );
}
/// FlutterWidgetPropertyValueEnumItem
@@ -11637,14 +11283,12 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, libraryUri.hashCode);
- hash = JenkinsSmiHash.combine(hash, className.hashCode);
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, documentation.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ libraryUri.hashCode,
+ className.hashCode,
+ name.hashCode,
+ documentation.hashCode,
+ );
}
/// GeneralAnalysisService
@@ -11935,22 +11579,20 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, length.hashCode);
- hash = JenkinsSmiHash.combine(hash, containingLibraryPath.hashCode);
- hash = JenkinsSmiHash.combine(hash, containingLibraryName.hashCode);
- hash = JenkinsSmiHash.combine(hash, containingClassDescription.hashCode);
- hash = JenkinsSmiHash.combine(hash, dartdoc.hashCode);
- hash = JenkinsSmiHash.combine(hash, elementDescription.hashCode);
- hash = JenkinsSmiHash.combine(hash, elementKind.hashCode);
- hash = JenkinsSmiHash.combine(hash, isDeprecated.hashCode);
- hash = JenkinsSmiHash.combine(hash, parameter.hashCode);
- hash = JenkinsSmiHash.combine(hash, propagatedType.hashCode);
- hash = JenkinsSmiHash.combine(hash, staticType.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ offset.hashCode,
+ length.hashCode,
+ containingLibraryPath.hashCode,
+ containingLibraryName.hashCode,
+ containingClassDescription.hashCode,
+ dartdoc.hashCode,
+ elementDescription.hashCode,
+ elementKind.hashCode,
+ isDeprecated.hashCode,
+ parameter.hashCode,
+ propagatedType.hashCode,
+ staticType.hashCode,
+ );
}
/// ImplementedClass
@@ -12012,12 +11654,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, length.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ offset.hashCode,
+ length.hashCode,
+ );
}
/// ImplementedMember
@@ -12079,12 +11719,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, length.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ offset.hashCode,
+ length.hashCode,
+ );
}
/// ImportedElementSet
@@ -12163,13 +11801,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, strings.hashCode);
- hash = JenkinsSmiHash.combine(hash, uris.hashCode);
- hash = JenkinsSmiHash.combine(hash, names.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ strings.hashCode,
+ uris.hashCode,
+ names.hashCode,
+ );
}
/// ImportedElements
@@ -12246,13 +11882,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, path.hashCode);
- hash = JenkinsSmiHash.combine(hash, prefix.hashCode);
- hash = JenkinsSmiHash.combine(hash, elements.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ path.hashCode,
+ prefix.hashCode,
+ elements.hashCode,
+ );
}
/// IncludedSuggestionRelevanceTag
@@ -12318,12 +11952,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, tag.hashCode);
- hash = JenkinsSmiHash.combine(hash, relevanceBoost.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ tag.hashCode,
+ relevanceBoost.hashCode,
+ );
}
/// IncludedSuggestionSet
@@ -12409,13 +12041,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, relevance.hashCode);
- hash = JenkinsSmiHash.combine(hash, displayUri.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ id.hashCode,
+ relevance.hashCode,
+ displayUri.hashCode,
+ );
}
/// inlineLocalVariable feedback
@@ -12479,12 +12109,10 @@
}
@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
@@ -12501,9 +12129,7 @@
}
@override
- int get hashCode {
- return 540364977;
- }
+ int get hashCode => 540364977;
}
/// inlineMethod feedback
@@ -12585,13 +12211,11 @@
}
@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
@@ -12663,12 +12287,10 @@
}
@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
@@ -12731,11 +12353,7 @@
}
@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
@@ -12821,12 +12439,10 @@
}
@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,
+ );
}
/// LibraryPathSet
@@ -12894,12 +12510,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, scope.hashCode);
- hash = JenkinsSmiHash.combine(hash, libraryPaths.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ scope.hashCode,
+ libraryPaths.hashCode,
+ );
}
/// moveFile feedback
@@ -12915,9 +12529,7 @@
}
@override
- int get hashCode {
- return 438975893;
- }
+ int get hashCode => 438975893;
}
/// moveFile options
@@ -12975,11 +12587,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, newFile.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => newFile.hashCode;
}
/// OverriddenMember
@@ -13043,12 +12651,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, element.hashCode);
- hash = JenkinsSmiHash.combine(hash, className.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ element.hashCode,
+ className.hashCode,
+ );
}
/// Override
@@ -13152,14 +12758,12 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, length.hashCode);
- hash = JenkinsSmiHash.combine(hash, superclassMember.hashCode);
- hash = JenkinsSmiHash.combine(hash, interfaceMembers.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ offset.hashCode,
+ length.hashCode,
+ superclassMember.hashCode,
+ interfaceMembers.hashCode,
+ );
}
/// PostfixTemplateDescriptor
@@ -13234,13 +12838,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, key.hashCode);
- hash = JenkinsSmiHash.combine(hash, example.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ name.hashCode,
+ key.hashCode,
+ example.hashCode,
+ );
}
/// PubStatus
@@ -13293,11 +12895,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, isListingPackageDirs.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => isListingPackageDirs.hashCode;
}
/// RefactoringFeedback
@@ -13333,10 +12931,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => 0;
}
/// RefactoringOptions
@@ -13371,10 +12966,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => 0;
}
/// rename feedback
@@ -13465,14 +13057,12 @@
}
@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
@@ -13530,11 +13120,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, newName.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => newName.hashCode;
}
/// RequestError
@@ -13614,13 +13200,11 @@
}
@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
@@ -14048,13 +13632,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, length.hashCode);
- hash = JenkinsSmiHash.combine(hash, type.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ offset.hashCode,
+ length.hashCode,
+ type.hashCode,
+ );
}
/// RuntimeCompletionExpressionType
@@ -14234,17 +13816,15 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, libraryPath.hashCode);
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, typeArguments.hashCode);
- hash = JenkinsSmiHash.combine(hash, returnType.hashCode);
- hash = JenkinsSmiHash.combine(hash, parameterTypes.hashCode);
- hash = JenkinsSmiHash.combine(hash, parameterNames.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ libraryPath.hashCode,
+ kind.hashCode,
+ name.hashCode,
+ typeArguments.hashCode,
+ returnType.hashCode,
+ parameterTypes.hashCode,
+ parameterNames.hashCode,
+ );
}
/// RuntimeCompletionExpressionTypeKind
@@ -14368,12 +13948,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- hash = JenkinsSmiHash.combine(hash, type.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ name.hashCode,
+ type.hashCode,
+ );
}
/// search.findElementReferences params
@@ -14463,13 +14041,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, includePotential.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ offset.hashCode,
+ includePotential.hashCode,
+ );
}
/// search.findElementReferences result
@@ -14553,12 +14129,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, element.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ id.hashCode,
+ element.hashCode,
+ );
}
/// search.findMemberDeclarations params
@@ -14620,11 +14194,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => name.hashCode;
}
/// search.findMemberDeclarations result
@@ -14688,11 +14258,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => id.hashCode;
}
/// search.findMemberReferences params
@@ -14754,11 +14320,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, name.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => name.hashCode;
}
/// search.findMemberReferences result
@@ -14822,11 +14384,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => id.hashCode;
}
/// search.findTopLevelDeclarations params
@@ -14890,11 +14448,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, pattern.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => pattern.hashCode;
}
/// search.findTopLevelDeclarations result
@@ -14958,11 +14512,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => id.hashCode;
}
/// search.getElementDeclarations params
@@ -15058,13 +14608,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, pattern.hashCode);
- hash = JenkinsSmiHash.combine(hash, maxResults.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ pattern.hashCode,
+ maxResults.hashCode,
+ );
}
/// search.getElementDeclarations result
@@ -15147,12 +14695,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, declarations.hashCode);
- hash = JenkinsSmiHash.combine(hash, files.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ declarations.hashCode,
+ files.hashCode,
+ );
}
/// search.getTypeHierarchy params
@@ -15242,13 +14788,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, file.hashCode);
- hash = JenkinsSmiHash.combine(hash, offset.hashCode);
- hash = JenkinsSmiHash.combine(hash, superOnly.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ file.hashCode,
+ offset.hashCode,
+ superOnly.hashCode,
+ );
}
/// search.getTypeHierarchy result
@@ -15328,11 +14872,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, hierarchyItems.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => hierarchyItems.hashCode;
}
/// SearchResult
@@ -15431,14 +14971,12 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, location.hashCode);
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- hash = JenkinsSmiHash.combine(hash, isPotential.hashCode);
- hash = JenkinsSmiHash.combine(hash, path.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ location.hashCode,
+ kind.hashCode,
+ isPotential.hashCode,
+ path.hashCode,
+ );
}
/// SearchResultKind
@@ -15619,13 +15157,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, id.hashCode);
- hash = JenkinsSmiHash.combine(hash, results.hashCode);
- hash = JenkinsSmiHash.combine(hash, isLast.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ id.hashCode,
+ results.hashCode,
+ isLast.hashCode,
+ );
}
/// server.connected params
@@ -15697,12 +15233,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, version.hashCode);
- hash = JenkinsSmiHash.combine(hash, pid.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ version.hashCode,
+ pid.hashCode,
+ );
}
/// server.error params
@@ -15791,13 +15325,11 @@
}
@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,
+ );
}
/// server.getVersion params
@@ -15821,9 +15353,7 @@
}
@override
- int get hashCode {
- return 55877452;
- }
+ int get hashCode => 55877452;
}
/// server.getVersion result
@@ -15887,11 +15417,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, version.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => version.hashCode;
}
/// ServerLogEntry
@@ -15968,13 +15494,11 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, time.hashCode);
- hash = JenkinsSmiHash.combine(hash, kind.hashCode);
- hash = JenkinsSmiHash.combine(hash, data.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ time.hashCode,
+ kind.hashCode,
+ data.hashCode,
+ );
}
/// ServerLogEntryKind
@@ -16121,11 +15645,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, entry.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => entry.hashCode;
}
/// ServerService
@@ -16242,11 +15762,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, subscriptions.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => subscriptions.hashCode;
}
/// server.setSubscriptions result
@@ -16270,9 +15786,7 @@
}
@override
- int get hashCode {
- return 748820900;
- }
+ int get hashCode => 748820900;
}
/// server.shutdown params
@@ -16296,9 +15810,7 @@
}
@override
- int get hashCode {
- return 366630911;
- }
+ int get hashCode => 366630911;
}
/// server.shutdown result
@@ -16322,9 +15834,7 @@
}
@override
- int get hashCode {
- return 193626532;
- }
+ int get hashCode => 193626532;
}
/// server.status params
@@ -16403,12 +15913,10 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, analysis.hashCode);
- hash = JenkinsSmiHash.combine(hash, pub.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ analysis.hashCode,
+ pub.hashCode,
+ );
}
/// TypeHierarchyItem
@@ -16568,15 +16076,13 @@
}
@override
- int get hashCode {
- var hash = 0;
- hash = JenkinsSmiHash.combine(hash, classElement.hashCode);
- hash = JenkinsSmiHash.combine(hash, displayName.hashCode);
- hash = JenkinsSmiHash.combine(hash, memberElement.hashCode);
- hash = JenkinsSmiHash.combine(hash, superclass.hashCode);
- hash = JenkinsSmiHash.combine(hash, interfaces.hashCode);
- hash = JenkinsSmiHash.combine(hash, mixins.hashCode);
- hash = JenkinsSmiHash.combine(hash, subclasses.hashCode);
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => Object.hash(
+ classElement.hashCode,
+ displayName.hashCode,
+ memberElement.hashCode,
+ superclass.hashCode,
+ interfaces.hashCode,
+ mixins.hashCode,
+ subclasses.hashCode,
+ );
}
diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_util.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_util.dart
deleted file mode 100644
index 02e8c75..0000000
--- a/pkg/analysis_server_client/lib/src/protocol/protocol_util.dart
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
-// 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.
-
-/// 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));
-}
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index a5ec4d3..dd484df 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -2,6 +2,16 @@
* Deprecated `ResourceProvider.getModificationTimes()`.
* Deprecated `MemoryResourceProvider.newDummyLink()`.
* Deprecated `MemoryResourceProvider.updateFile()`.
+* Deprecated `TypeName`, use `NamedType` instead.
+* Override `AstVisitor.visitNamedType()` instead of `visitTypeName()`.
+* Deprecated `ClassTypeAlias.superclass`, use `superclass2` instead.
+* Deprecated `ConstructorName.type`, use `type2` instead.
+* Deprecated `ExtendsClause.superclass`, use `superclass2` instead.
+* Deprecated `ImplementsClause.interfaces`, use `interfaces2` instead.
+* Deprecated `OnClause.superclassConstraints`, use `superclassConstraints2` instead.
+* Deprecated `TypeLiteral.typeName`, use `type` instead.
+* Deprecated `WithClause.mixinTypes`, use `mixinTypes2` instead.
+* Deprecated `AstFactory.typeName()`, use `namedType()` instead.
## 2.3.0
* Enable `constructor-tearoffs` feature by default in `2.15`.
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 27e1aeb..7dc7476 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -513,6 +513,8 @@
R? visitNamedExpression(NamedExpression node);
+ R? visitNamedType(NamedType node);
+
R? visitNativeClause(NativeClause node);
R? visitNativeFunctionBody(NativeFunctionBody node);
@@ -586,6 +588,7 @@
R? visitTypeLiteral(TypeLiteral node);
+ @Deprecated('Override visitNamedType instead')
R? visitTypeName(TypeName node);
R? visitTypeParameter(TypeParameter node);
@@ -900,8 +903,12 @@
SimpleIdentifier get name;
/// Return the name of the superclass of the class being declared.
+ @Deprecated('Use superclass2 instead')
TypeName get superclass;
+ /// Return the name of the superclass of the class being declared.
+ NamedType get superclass2;
+
/// Return the type parameters for the class, or `null` if the class does not
/// have any type parameters.
TypeParameterList? get typeParameters;
@@ -1307,7 +1314,11 @@
Token? get period;
/// Return the name of the type defining the constructor.
+ @Deprecated('Use type2 instead')
TypeName get type;
+
+ /// Return the name of the type defining the constructor.
+ NamedType get type2;
}
/// An expression representing a reference to a constructor, e.g. the expression
@@ -1682,7 +1693,11 @@
Token get extendsKeyword;
/// Return the name of the class that is being extended.
+ @Deprecated('Use superclass2 instead')
TypeName get superclass;
+
+ /// Return the name of the class that is being extended.
+ NamedType get superclass2;
}
/// The declaration of an extension of a type.
@@ -3236,7 +3251,7 @@
/// [Identifier] typeArguments?
///
/// Clients may not extend, implement or mix-in this class.
-abstract class NamedType implements TypeAnnotation {
+abstract class NamedType implements TypeAnnotation, ShowHideClauseElement {
/// Return `true` if this type is a deferred type.
///
/// 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form
@@ -4247,6 +4262,10 @@
/// Clients may not extend, implement or mix-in this class.
abstract class TypeLiteral implements Expression {
/// The type represented by this literal.
+ NamedType get type;
+
+ /// The type represented by this literal.
+ @Deprecated('Use namedType instead')
TypeName get typeName;
}
@@ -4256,7 +4275,8 @@
/// [Identifier] typeArguments?
///
/// Clients may not extend, implement or mix-in this class.
-abstract class TypeName implements NamedType, ShowHideClauseElement {}
+@Deprecated('Use NamedType instead')
+abstract class TypeName implements NamedType {}
/// A type parameter.
///
diff --git a/pkg/analyzer/lib/dart/ast/ast_factory.dart b/pkg/analyzer/lib/dart/ast/ast_factory.dart
index c8ea01f..64d8fb4 100644
--- a/pkg/analyzer/lib/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/dart/ast/ast_factory.dart
@@ -918,6 +918,7 @@
/// Returns a newly created type name. The [typeArguments] can be `null` if
/// there are no type arguments. The [question] can be `null` if there is no
/// question mark.
+ @Deprecated('Use namedType() instead')
TypeName typeName(Identifier name, TypeArgumentList? typeArguments,
{Token? question});
diff --git a/pkg/analyzer/lib/dart/ast/visitor.dart b/pkg/analyzer/lib/dart/ast/visitor.dart
index 5129ab3..451f318 100644
--- a/pkg/analyzer/lib/dart/ast/visitor.dart
+++ b/pkg/analyzer/lib/dart/ast/visitor.dart
@@ -449,6 +449,10 @@
@override
R? visitNamedExpression(NamedExpression node) => visitExpression(node);
+ @override
+ // ignore: deprecated_member_use_from_same_package
+ R? visitNamedType(NamedType node) => visitTypeName(node as TypeName);
+
R? visitNamespaceDirective(NamespaceDirective node) =>
visitUriBasedDirective(node);
@@ -592,6 +596,7 @@
@override
R? visitTypeLiteral(TypeLiteral node) => visitExpression(node);
+ @Deprecated('Override visitNamedType instead')
@override
R? visitTypeName(TypeName node) => visitNode(node);
@@ -1132,6 +1137,12 @@
}
@override
+ R? visitNamedType(NamedType node) {
+ // ignore: deprecated_member_use_from_same_package
+ return visitTypeName(node as TypeName);
+ }
+
+ @override
R? visitNativeClause(NativeClause node) {
node.visitChildren(this);
return null;
@@ -1348,6 +1359,7 @@
return null;
}
+ @Deprecated('Override visitNamedType instead')
@override
R? visitTypeName(TypeName node) {
node.visitChildren(this);
@@ -1663,6 +1675,10 @@
R? visitNamedExpression(NamedExpression node) => null;
@override
+ // ignore: deprecated_member_use_from_same_package
+ R? visitNamedType(NamedType node) => visitTypeName(node as TypeName);
+
+ @override
R? visitNativeClause(NativeClause node) => null;
@override
@@ -1772,6 +1788,7 @@
@override
R? visitTypeLiteral(TypeLiteral node) => null;
+ @Deprecated('Override visitNamedType instead')
@override
R? visitTypeName(TypeName node) => null;
@@ -2067,6 +2084,10 @@
R? visitNamedExpression(NamedExpression node) => _throw(node);
@override
+ // ignore: deprecated_member_use_from_same_package
+ R? visitNamedType(NamedType node) => visitTypeName(node as TypeName);
+
+ @override
R? visitNativeClause(NativeClause node) => _throw(node);
@override
@@ -2178,6 +2199,7 @@
@override
R? visitTypeLiteral(TypeLiteral node) => _throw(node);
+ @Deprecated('Override visitNamedType instead')
@override
R? visitTypeName(TypeName node) => _throw(node);
@@ -2883,6 +2905,14 @@
}
@override
+ T? visitNamedType(NamedType node) {
+ stopwatch.start();
+ T? result = _baseVisitor.visitNamedType(node);
+ stopwatch.stop();
+ return result;
+ }
+
+ @override
T? visitNativeClause(NativeClause node) {
stopwatch.start();
T? result = _baseVisitor.visitNativeClause(node);
@@ -3171,6 +3201,7 @@
return result;
}
+ @Deprecated('Override visitNamedType instead')
@override
T? visitTypeName(TypeName node) {
stopwatch.start();
@@ -3520,6 +3551,10 @@
R? visitNamedExpression(NamedExpression node) => visitNode(node);
@override
+ // ignore: deprecated_member_use_from_same_package
+ R? visitNamedType(NamedType node) => visitTypeName(node as TypeName);
+
+ @override
R? visitNativeClause(NativeClause node) => visitNode(node);
@override
@@ -3637,6 +3672,7 @@
@override
R? visitTypeLiteral(TypeLiteral node) => visitNode(node);
+ @Deprecated('Override visitNamedType instead')
@override
R? visitTypeName(TypeName node) => visitNode(node);
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index d80043e..c07ce8f 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -141,6 +141,7 @@
CompileTimeErrorCode.CONST_WITH_NON_TYPE,
CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS_CONSTRUCTOR_TEAROFF,
+ CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS_FUNCTION_TEAROFF,
CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR,
CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT,
CompileTimeErrorCode.CONTINUE_LABEL_ON_SWITCH,
diff --git a/pkg/analyzer/lib/src/context/context_root.dart b/pkg/analyzer/lib/src/context/context_root.dart
index d79e72c..5155947 100644
--- a/pkg/analyzer/lib/src/context/context_root.dart
+++ b/pkg/analyzer/lib/src/context/context_root.dart
@@ -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 @@
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) {
diff --git a/pkg/analyzer/lib/src/dart/analysis/dependency/library_builder.dart b/pkg/analyzer/lib/src/dart/analysis/dependency/library_builder.dart
index 848cf02..437064a 100644
--- a/pkg/analyzer/lib/src/dart/analysis/dependency/library_builder.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/dependency/library_builder.dart
@@ -171,7 +171,7 @@
NamedType? enclosingSuperClass;
if (node is ClassDeclaration) {
- enclosingSuperClass = node.extendsClause?.superclass;
+ enclosingSuperClass = node.extendsClause?.superclass2;
}
enclosingClassNameSignature =
@@ -288,7 +288,7 @@
var api = referenceCollector.collect(
apiTokenSignature,
typeParameters: node.typeParameters,
- superClass: node.superclass,
+ superClass: node.superclass2,
withClause: node.withClause,
implementsClause: node.implementsClause,
);
diff --git a/pkg/analyzer/lib/src/dart/analysis/dependency/node.dart b/pkg/analyzer/lib/src/dart/analysis/dependency/node.dart
index e99f616..70eb2fa 100644
--- a/pkg/analyzer/lib/src/dart/analysis/dependency/node.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/dependency/node.dart
@@ -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 @@
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 @@
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);
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart b/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart
index c5243d5..96ec456 100644
--- a/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/dependency/reference_collector.dart
@@ -86,7 +86,7 @@
_visitTypeParameterList(typeParameters2);
// Parts of classes.
- _visitTypeAnnotation(extendsClause?.superclass);
+ _visitTypeAnnotation(extendsClause?.superclass2);
_visitTypeAnnotation(superClass);
_visitTypeAnnotations(withClause?.mixinTypes2);
_visitTypeAnnotations(onClause?.superclassConstraints2);
@@ -303,7 +303,7 @@
void _visitConstructorName(ConstructorName? node) {
if (node == null) return;
- _visitConstructor(node.type, node.name);
+ _visitConstructor(node.type2, node.name);
}
void _visitExpression(Expression? node, {bool get = true, bool set = false}) {
diff --git a/pkg/analyzer/lib/src/dart/analysis/experiments.dart b/pkg/analyzer/lib/src/dart/analysis/experiments.dart
index 88ced1a..7d99407 100644
--- a/pkg/analyzer/lib/src/dart/analysis/experiments.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/experiments.dart
@@ -6,7 +6,6 @@
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 @@
);
@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) {
diff --git a/pkg/analyzer/lib/src/dart/analysis/index.dart b/pkg/analyzer/lib/src/dart/analysis/index.dart
index 7ae5e72..5c8d8e7 100644
--- a/pkg/analyzer/lib/src/dart/analysis/index.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/index.dart
@@ -627,13 +627,13 @@
offset = node.period!.offset;
length = node.name!.end - offset;
} else {
- offset = node.type.end;
+ offset = node.type2.end;
length = 0;
}
recordRelationOffset(element, kind, offset, length, true);
- node.type.accept(this);
+ node.type2.accept(this);
}
@override
@@ -655,7 +655,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
- recordSuperType(node.superclass, IndexRelationKind.IS_EXTENDED_BY);
+ recordSuperType(node.superclass2, IndexRelationKind.IS_EXTENDED_BY);
}
@override
@@ -712,6 +712,16 @@
}
@override
+ void visitNamedType(NamedType node) {
+ AstNode parent = node.parent!;
+ if (parent is ClassTypeAlias && parent.superclass2 == node) {
+ recordSuperType(node, IndexRelationKind.IS_EXTENDED_BY);
+ } else {
+ super.visitNamedType(node);
+ }
+ }
+
+ @override
void visitOnClause(OnClause node) {
for (NamedType namedType in node.superclassConstraints2) {
recordSuperType(namedType, IndexRelationKind.IS_IMPLEMENTED_BY);
@@ -819,16 +829,6 @@
}
@override
- void visitTypeName(TypeName node) {
- AstNode parent = node.parent!;
- if (parent is ClassTypeAlias && parent.superclass == node) {
- recordSuperType(node, IndexRelationKind.IS_EXTENDED_BY);
- } else {
- super.visitTypeName(node);
- }
- }
-
- @override
void visitWithClause(WithClause node) {
for (NamedType namedType in node.mixinTypes2) {
recordSuperType(namedType, IndexRelationKind.IS_MIXED_IN_BY);
@@ -892,7 +892,7 @@
/// Record the given class as a subclass of its direct superclasses.
void _addSubtypeForClassDeclaration(ClassDeclaration node) {
_addSubtype(node.name.name,
- superclass: node.extendsClause?.superclass,
+ superclass: node.extendsClause?.superclass2,
withClause: node.withClause,
implementsClause: node.implementsClause,
memberNodes: node.members);
@@ -901,7 +901,7 @@
/// Record the given class as a subclass of its direct superclasses.
void _addSubtypeForClassTypeAlis(ClassTypeAlias node) {
_addSubtype(node.name.name,
- superclass: node.superclass,
+ superclass: node.superclass2,
withClause: node.withClause,
implementsClause: node.implementsClause,
memberNodes: const []);
diff --git a/pkg/analyzer/lib/src/dart/analysis/referenced_names.dart b/pkg/analyzer/lib/src/dart/analysis/referenced_names.dart
index 028dad7..2d5e347 100644
--- a/pkg/analyzer/lib/src/dart/analysis/referenced_names.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/referenced_names.dart
@@ -34,11 +34,11 @@
for (CompilationUnitMember declaration in unit.declarations) {
if (declaration is ClassDeclaration) {
- _addSubtypedName(declaration.extendsClause?.superclass);
+ _addSubtypedName(declaration.extendsClause?.superclass2);
_addSubtypedNames(declaration.withClause?.mixinTypes2);
_addSubtypedNames(declaration.implementsClause?.interfaces2);
} else if (declaration is ClassTypeAlias) {
- _addSubtypedName(declaration.superclass);
+ _addSubtypedName(declaration.superclass2);
_addSubtypedNames(declaration.withClause.mixinTypes2);
_addSubtypedNames(declaration.implementsClause?.interfaces2);
} else if (declaration is MixinDeclaration) {
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index f7c9969..187181e 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -1709,14 +1709,18 @@
@override
bool get isAbstract => abstractKeyword != null;
+ @Deprecated('Use superclass2 instead')
@override
TypeNameImpl get superclass => _superclass;
- set superclass(TypeName superclass) {
+ set superclass(NamedType superclass) {
_superclass = _becomeParentOf(superclass as TypeNameImpl);
}
@override
+ TypeNameImpl get superclass2 => _superclass;
+
+ @override
TypeParameterListImpl? get typeParameters => _typeParameters;
set typeParameters(TypeParameterList? typeParameters) {
@@ -2638,14 +2642,18 @@
_name = _becomeParentOf(name as SimpleIdentifierImpl?);
}
+ @Deprecated('Use type2 instead')
@override
TypeNameImpl get type => _type;
- set type(TypeName type) {
+ set type(NamedType type) {
_type = _becomeParentOf(type as TypeNameImpl);
}
@override
+ TypeNameImpl get type2 => _type;
+
+ @override
E? accept<E>(AstVisitor<E> visitor) => visitor.visitConstructorName(this);
@override
@@ -3648,14 +3656,18 @@
@override
Token get endToken => _superclass.endToken;
+ @Deprecated('Use superclass2 instead')
@override
TypeNameImpl get superclass => _superclass;
- set superclass(TypeName name) {
+ set superclass(NamedType name) {
_superclass = _becomeParentOf(name as TypeNameImpl);
}
@override
+ TypeNameImpl get superclass2 => _superclass;
+
+ @override
E? accept<E>(AstVisitor<E> visitor) => visitor.visitExtendsClause(this);
@override
@@ -7840,11 +7852,12 @@
// TODO(paulberry): add commas.
Iterable<SyntacticEntity> get childEntities => ChildEntities()
..add(onKeyword)
- ..addAll(superclassConstraints);
+ ..addAll(superclassConstraints2);
@override
Token get endToken => _superclassConstraints.endToken!;
+ @Deprecated('Use superclassConstraints2 instead')
@override
NodeList<TypeName> get superclassConstraints =>
_DelegatingTypeNameList(_superclassConstraints);
@@ -8978,7 +8991,7 @@
/// This element is set when this identifier is used not as an expression,
/// but just to reference some element.
///
- /// Examples are the name of the type in a [TypeName], the name of the method
+ /// Examples are the name of the type in a [NamedType], the name of the method
/// in a [MethodInvocation], the name of the constructor in a
/// [ConstructorName], the name of the property in a [PropertyAccess], the
/// prefix and the identifier in a [PrefixedIdentifier] (which then can be
@@ -10209,20 +10222,25 @@
}
@override
- Token get beginToken => typeName.beginToken;
+ Token get beginToken => _typeName.beginToken;
@override
- Iterable<SyntacticEntity> get childEntities => ChildEntities()..add(typeName);
+ Iterable<SyntacticEntity> get childEntities =>
+ ChildEntities()..add(_typeName);
@override
- Token get endToken => typeName.endToken;
+ Token get endToken => _typeName.endToken;
@override
- Precedence get precedence => typeName.typeArguments == null
- ? typeName.name.precedence
+ Precedence get precedence => _typeName.typeArguments == null
+ ? _typeName.name.precedence
: Precedence.postfix;
@override
+ TypeNameImpl get type => _typeName;
+
+ @Deprecated('Use namedType instead')
+ @override
TypeNameImpl get typeName => _typeName;
set typeName(TypeNameImpl value) {
@@ -10234,7 +10252,7 @@
@override
void visitChildren(AstVisitor visitor) {
- typeName.accept(visitor);
+ _typeName.accept(visitor);
}
}
@@ -10242,6 +10260,7 @@
///
/// typeName ::=
/// [Identifier] typeArguments? '?'?
+/// ignore: deprecated_member_use_from_same_package
class TypeNameImpl extends TypeAnnotationImpl implements TypeName {
/// The name of the type.
IdentifierImpl _name;
@@ -10304,7 +10323,7 @@
}
@override
- E? accept<E>(AstVisitor<E> visitor) => visitor.visitTypeName(this);
+ E? accept<E>(AstVisitor<E> visitor) => visitor.visitNamedType(this);
@override
void visitChildren(AstVisitor visitor) {
@@ -10967,6 +10986,7 @@
}
/// Implementation of `NodeList<TypeName>` that delegates.
+@Deprecated('Use NamedType instead')
class _DelegatingTypeNameList
with ListMixin<TypeName>
implements NodeList<TypeName> {
diff --git a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
index 36ae79d..e12111d 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
@@ -1244,6 +1244,7 @@
TypeLiteralImpl typeLiteral({required NamedType typeName}) =>
TypeLiteralImpl(typeName as TypeNameImpl);
+ @Deprecated('Use namedType() instead')
@override
TypeNameImpl typeName(Identifier name, TypeArgumentList? typeArguments,
{Token? question}) =>
diff --git a/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart b/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
index 908b3f4..b912645 100644
--- a/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart
@@ -172,7 +172,7 @@
_visitNode(node.name);
_visitNode(node.typeParameters);
sink.write(' = ');
- _visitNode(node.superclass);
+ _visitNode(node.superclass2);
_visitNode(node.withClause, prefix: ' ');
_visitNode(node.implementsClause, prefix: ' ');
sink.write(';');
@@ -237,7 +237,7 @@
@override
void visitConstructorName(ConstructorName node) {
- _visitNode(node.type);
+ _visitNode(node.type2);
_visitNode(node.name, prefix: '.');
}
@@ -355,7 +355,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
sink.write('extends ');
- _visitNode(node.superclass);
+ _visitNode(node.superclass2);
}
@override
@@ -756,6 +756,15 @@
}
@override
+ void visitNamedType(NamedType node) {
+ _visitNode(node.name);
+ _visitNode(node.typeArguments);
+ if (node.question != null) {
+ sink.write('?');
+ }
+ }
+
+ @override
void visitNativeClause(NativeClause node) {
sink.write('native ');
_visitNode(node.name);
@@ -1007,16 +1016,13 @@
@override
void visitTypeLiteral(TypeLiteral node) {
- _visitNode(node.typeName);
+ _visitNode(node.type);
}
+ @Deprecated('Override visitNamedType instead')
@override
void visitTypeName(TypeName node) {
- _visitNode(node.name);
- _visitNode(node.typeArguments);
- if (node.question != null) {
- sink.write('?');
- }
+ throw StateError('Should not be invoked');
}
@override
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart
index d24d4ea..e1189f9 100644
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart
@@ -255,7 +255,7 @@
isEqualNodes(node.typeParameters, other.typeParameters) &&
isEqualTokens(node.equals, other.equals) &&
isEqualTokens(node.abstractKeyword, other.abstractKeyword) &&
- isEqualNodes(node.superclass, other.superclass) &&
+ isEqualNodes(node.superclass2, other.superclass2) &&
isEqualNodes(node.withClause, other.withClause) &&
isEqualNodes(node.implementsClause, other.implementsClause) &&
isEqualTokens(node.semicolon, other.semicolon);
@@ -338,7 +338,7 @@
@override
bool visitConstructorName(ConstructorName node) {
ConstructorName other = _other as ConstructorName;
- return isEqualNodes(node.type, other.type) &&
+ return isEqualNodes(node.type2, other.type2) &&
isEqualTokens(node.period, other.period) &&
isEqualNodes(node.name, other.name);
}
@@ -467,7 +467,7 @@
bool visitExtendsClause(ExtendsClause node) {
ExtendsClause other = _other as ExtendsClause;
return isEqualTokens(node.extendsKeyword, other.extendsKeyword) &&
- isEqualNodes(node.superclass, other.superclass);
+ isEqualNodes(node.superclass2, other.superclass2);
}
@override
@@ -883,6 +883,14 @@
}
@override
+ bool? visitNamedType(NamedType node) {
+ NamedType other = _other as NamedType;
+ return isEqualNodes(node.name, other.name) &&
+ isEqualNodes(node.typeArguments, other.typeArguments) &&
+ isEqualTokens(node.question, other.question);
+ }
+
+ @override
bool visitNativeClause(NativeClause node) {
NativeClause other = _other as NativeClause;
return isEqualTokens(node.nativeKeyword, other.nativeKeyword) &&
@@ -1169,15 +1177,13 @@
@override
bool visitTypeLiteral(TypeLiteral node) {
TypeLiteral other = _other as TypeLiteral;
- return isEqualNodes(node.typeName, other.typeName);
+ return isEqualNodes(node.type, other.type);
}
+ @Deprecated('Override visitNamedType instead')
@override
bool visitTypeName(TypeName node) {
- var other = _other as NamedType;
- return isEqualNodes(node.name, other.name) &&
- isEqualNodes(node.typeArguments, other.typeArguments) &&
- isEqualTokens(node.question, other.question);
+ throw StateError('Should not be invoked');
}
@override
@@ -1759,8 +1765,8 @@
} else if (identical(node.typeParameters, _oldNode)) {
node.typeParameters = _newNode as TypeParameterList;
return true;
- } else if (identical(node.superclass, _oldNode)) {
- node.superclass = _newNode as TypeName;
+ } else if (identical(node.superclass2, _oldNode)) {
+ node.superclass = _newNode as NamedType;
return true;
} else if (identical(node.withClause, _oldNode)) {
node.withClause = _newNode as WithClause;
@@ -1870,8 +1876,8 @@
@override
bool visitConstructorName(covariant ConstructorNameImpl node) {
- if (identical(node.type, _oldNode)) {
- node.type = _newNode as TypeName;
+ if (identical(node.type2, _oldNode)) {
+ node.type = _newNode as NamedType;
return true;
} else if (identical(node.name, _oldNode)) {
node.name = _newNode as SimpleIdentifier;
@@ -1996,8 +2002,8 @@
@override
bool visitExtendsClause(covariant ExtendsClauseImpl node) {
- if (identical(node.superclass, _oldNode)) {
- node.superclass = _newNode as TypeName;
+ if (identical(node.superclass2, _oldNode)) {
+ node.superclass = _newNode as NamedType;
return true;
}
return visitNode(node);
@@ -2520,6 +2526,18 @@
return visitNode(node);
}
+ @override
+ bool? visitNamedType(covariant TypeNameImpl node) {
+ if (identical(node.name, _oldNode)) {
+ node.name = _newNode as Identifier;
+ return true;
+ } else if (identical(node.typeArguments, _oldNode)) {
+ node.typeArguments = _newNode as TypeArgumentList;
+ return true;
+ }
+ return visitNode(node);
+ }
+
bool visitNamespaceDirective(covariant NamespaceDirectiveImpl node) {
if (_replaceInList(node.combinators)) {
return true;
@@ -2567,7 +2585,7 @@
@override
bool visitOnClause(covariant OnClauseImpl node) {
- if (_replaceInList(node.superclassConstraints)) {
+ if (_replaceInList(node.superclassConstraints2)) {
return true;
}
return visitNode(node);
@@ -2838,7 +2856,7 @@
@override
bool visitTypeLiteral(covariant TypeLiteralImpl node) {
- if (identical(node.typeName, _oldNode)) {
+ if (identical(node.type, _oldNode)) {
node.typeName = _newNode as TypeNameImpl;
return true;
}
@@ -2847,14 +2865,7 @@
@override
bool visitTypeName(covariant TypeNameImpl node) {
- if (identical(node.name, _oldNode)) {
- node.name = _newNode as Identifier;
- return true;
- } else if (identical(node.typeArguments, _oldNode)) {
- node.typeArguments = _newNode as TypeArgumentList;
- return true;
- }
- return visitNode(node);
+ throw StateError('Should not be invoked');
}
@override
diff --git a/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart b/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
index 98d8a04..5b34511 100644
--- a/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
+++ b/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
@@ -117,7 +117,7 @@
void visitConstructorReference(ConstructorReference node) {
super.visitConstructorReference(node);
if (node.inConstantContext) {
- _checkForConstWithTypeParameters(node.constructorName.type,
+ _checkForConstWithTypeParameters(node.constructorName.type2,
CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS_CONSTRUCTOR_TEAROFF);
}
}
@@ -129,6 +129,21 @@
}
@override
+ void visitFunctionReference(FunctionReference node) {
+ super.visitFunctionReference(node);
+ if (node.inConstantContext) {
+ var typeArguments = node.typeArguments;
+ if (typeArguments == null) {
+ return;
+ }
+ for (var typeArgument in typeArguments.arguments) {
+ _checkForConstWithTypeParameters(typeArgument,
+ CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS_FUNCTION_TEAROFF);
+ }
+ }
+ }
+
+ @override
void visitGenericFunctionType(GenericFunctionType node) {
// TODO(srawlins): Also check interface types (TypeName?).
super.visitGenericFunctionType(node);
@@ -143,7 +158,7 @@
@override
void visitInstanceCreationExpression(InstanceCreationExpression node) {
if (node.isConst) {
- NamedType namedType = node.constructorName.type;
+ NamedType namedType = node.constructorName.type2;
_checkForConstWithTypeParameters(
namedType, CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS);
diff --git a/pkg/analyzer/lib/src/dart/constant/evaluation.dart b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
index c33aafe..9a4f218 100644
--- a/pkg/analyzer/lib/src/dart/constant/evaluation.dart
+++ b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
@@ -1098,7 +1098,7 @@
node.typeOrThrow,
FunctionState(node.constructorName.staticElement),
);
- var typeArgumentList = node.constructorName.type.typeArguments;
+ var typeArgumentList = node.constructorName.type2.typeArguments;
if (typeArgumentList == null) {
return constructorTearoffResult;
} else {
@@ -1297,6 +1297,29 @@
node.expression.accept(this);
@override
+ DartObjectImpl? visitNamedType(NamedType node) {
+ var type = node.type;
+
+ if (type == null) {
+ return null;
+ }
+
+ if (!_isNonNullableByDefault && hasTypeParameterReference(type)) {
+ return super.visitNamedType(node);
+ }
+
+ if (_substitution != null) {
+ type = _substitution!.substituteType(type);
+ }
+
+ return DartObjectImpl(
+ typeSystem,
+ _typeProvider.typeType,
+ TypeState(type),
+ );
+ }
+
+ @override
DartObjectImpl? visitNode(AstNode node) {
// TODO(https://github.com/dart-lang/sdk/issues/47061): Use a specific
// error code.
@@ -1484,29 +1507,6 @@
);
}
- @override
- DartObjectImpl? visitTypeName(TypeName node) {
- var type = node.type;
-
- if (type == null) {
- return null;
- }
-
- if (!_isNonNullableByDefault && hasTypeParameterReference(type)) {
- return super.visitTypeName(node);
- }
-
- if (_substitution != null) {
- type = _substitution!.substituteType(type);
- }
-
- return DartObjectImpl(
- typeSystem,
- _typeProvider.typeType,
- TypeState(type),
- );
- }
-
/// Add the entries produced by evaluating the given collection [element] to
/// the given [list]. Return `true` if the evaluation of one or more of the
/// elements failed.
diff --git a/pkg/analyzer/lib/src/dart/constant/value.dart b/pkg/analyzer/lib/src/dart/constant/value.dart
index 9f5cd42..80943a1 100644
--- a/pkg/analyzer/lib/src/dart/constant/value.dart
+++ b/pkg/analyzer/lib/src/dart/constant/value.dart
@@ -13,7 +13,6 @@
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 @@
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;
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index edcf6c3..9c3a24d 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -42,7 +42,6 @@
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 @@
}
@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) {
diff --git a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
index f4077d4..06fb704 100644
--- a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
+++ b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
@@ -551,10 +551,10 @@
return;
}
if (errorNode is ConstructorName &&
- !(errorNode.type.type as InterfaceType).element.hasOptionalTypeArgs) {
+ !(errorNode.type2.type as InterfaceType).element.hasOptionalTypeArgs) {
String constructorName = errorNode.name == null
- ? errorNode.type.name.name
- : '${errorNode.type}.${errorNode.name}';
+ ? errorNode.type2.name.name
+ : '${errorNode.type2}.${errorNode.name}';
errorReporter.reportErrorForNode(
HintCode.INFERENCE_FAILURE_ON_INSTANCE_CREATION,
errorNode,
diff --git a/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart b/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart
index 86ad536..1be5afd 100644
--- a/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart
+++ b/pkg/analyzer/lib/src/dart/element/inheritance_manager3.dart
@@ -8,7 +8,6 @@
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 @@
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);
diff --git a/pkg/analyzer/lib/src/dart/error/ffi_code.dart b/pkg/analyzer/lib/src/dart/error/ffi_code.dart
index d011515..c84bfad 100644
--- a/pkg/analyzer/lib/src/dart/error/ffi_code.dart
+++ b/pkg/analyzer/lib/src/dart/error/ffi_code.dart
@@ -404,7 +404,7 @@
hasPublishedDocs: hasPublishedDocs,
message: message,
name: name,
- uniqueName: uniqueName ?? 'FfiCode.$name',
+ uniqueName: 'FfiCode.${uniqueName ?? name}',
);
@override
diff --git a/pkg/analyzer/lib/src/dart/error/hint_codes.dart b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
index ba78ccb..dc07809 100644
--- a/pkg/analyzer/lib/src/dart/error/hint_codes.dart
+++ b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
@@ -399,7 +399,7 @@
correction: "Try replacing the use of the deprecated member with the "
"replacement.",
hasPublishedDocs: true,
- uniqueName: 'HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE_WITH_MESSAGE',
+ uniqueName: 'DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE_WITH_MESSAGE',
);
/**
@@ -413,7 +413,7 @@
correction: "Try replacing the use of the deprecated member with the "
"replacement.",
hasPublishedDocs: true,
- uniqueName: 'HintCode.DEPRECATED_MEMBER_USE_WITH_MESSAGE',
+ uniqueName: 'DEPRECATED_MEMBER_USE_WITH_MESSAGE',
);
/**
@@ -992,7 +992,7 @@
"The Dart language version override number must begin with '@dart'",
correction: "Specify a Dart language version override with a comment "
"like '// @dart = 2.0'.",
- uniqueName: 'HintCode.INVALID_LANGUAGE_VERSION_OVERRIDE_AT_SIGN',
+ uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_AT_SIGN',
);
/// Invalid Dart language version comments don't follow the specification [1].
@@ -1011,7 +1011,7 @@
"an '=' character",
correction: "Specify a Dart language version override with a comment "
"like '// @dart = 2.0'.",
- uniqueName: 'HintCode.INVALID_LANGUAGE_VERSION_OVERRIDE_EQUALS',
+ uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_EQUALS',
);
static const HintCode INVALID_LANGUAGE_VERSION_OVERRIDE_GREATER = HintCode(
@@ -1047,7 +1047,7 @@
"the word 'dart' in all lower case",
correction: "Specify a Dart language version override with a comment "
"like '// @dart = 2.0'.",
- uniqueName: 'HintCode.INVALID_LANGUAGE_VERSION_OVERRIDE_LOWER_CASE',
+ uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_LOWER_CASE',
);
/// Invalid Dart language version comments don't follow the specification [1].
@@ -1066,7 +1066,7 @@
"version number, like '2.0', after the '=' character.",
correction: "Specify a Dart language version override with a comment "
"like '// @dart = 2.0'.",
- uniqueName: 'HintCode.INVALID_LANGUAGE_VERSION_OVERRIDE_NUMBER',
+ uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_NUMBER',
);
/// Invalid Dart language version comments don't follow the specification [1].
@@ -1085,7 +1085,7 @@
"a letter",
correction: "Specify a Dart language version override with a comment "
"like '// @dart = 2.0'.",
- uniqueName: 'HintCode.INVALID_LANGUAGE_VERSION_OVERRIDE_PREFIX',
+ uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_PREFIX',
);
/// Invalid Dart language version comments don't follow the specification [1].
@@ -1105,8 +1105,7 @@
"any non-whitespace characters",
correction: "Specify a Dart language version override with a comment "
"like '// @dart = 2.0'.",
- uniqueName:
- 'HintCode.INVALID_LANGUAGE_VERSION_OVERRIDE_TRAILING_CHARACTERS',
+ uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_TRAILING_CHARACTERS',
);
/// Invalid Dart language version comments don't follow the specification [1].
@@ -1126,7 +1125,7 @@
'exactly two slashes.',
correction: "Specify a Dart language version override with a comment "
"like '// @dart = 2.0'.",
- uniqueName: 'HintCode.INVALID_LANGUAGE_VERSION_OVERRIDE_TWO_SLASHES',
+ uniqueName: 'INVALID_LANGUAGE_VERSION_OVERRIDE_TWO_SLASHES',
);
/**
@@ -1477,7 +1476,7 @@
'MISSING_REQUIRED_PARAM',
"The parameter '{0}' is required. {1}.",
hasPublishedDocs: true,
- uniqueName: 'HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS',
+ uniqueName: 'MISSING_REQUIRED_PARAM_WITH_DETAILS',
);
/**
@@ -1746,7 +1745,7 @@
"is marked as '@literal'.",
correction: "Try replacing the 'new' keyword with 'const'.",
hasPublishedDocs: true,
- uniqueName: 'HintCode.NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR_USING_NEW',
+ uniqueName: 'NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR_USING_NEW',
);
/**
@@ -1851,7 +1850,7 @@
correction: "Try updating this class to match the superclass, or "
"removing the override annotation.",
hasPublishedDocs: true,
- uniqueName: 'HintCode.OVERRIDE_ON_NON_OVERRIDING_FIELD',
+ uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_FIELD',
);
/**
@@ -1865,7 +1864,7 @@
correction: "Try updating this class to match the superclass, or "
"removing the override annotation.",
hasPublishedDocs: true,
- uniqueName: 'HintCode.OVERRIDE_ON_NON_OVERRIDING_GETTER',
+ uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_GETTER',
);
/**
@@ -1913,7 +1912,7 @@
correction: "Try updating this class to match the superclass, or "
"removing the override annotation.",
hasPublishedDocs: true,
- uniqueName: 'HintCode.OVERRIDE_ON_NON_OVERRIDING_METHOD',
+ uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_METHOD',
);
/**
@@ -1927,7 +1926,7 @@
correction: "Try updating this class to match the superclass, or "
"removing the override annotation.",
hasPublishedDocs: true,
- uniqueName: 'HintCode.OVERRIDE_ON_NON_OVERRIDING_SETTER',
+ uniqueName: 'OVERRIDE_ON_NON_OVERRIDING_SETTER',
);
/**
@@ -3314,7 +3313,7 @@
"A value for optional parameter '{0}' isn't ever given.",
correction: "Try removing the unused parameter.",
hasPublishedDocs: true,
- uniqueName: 'HintCode.UNUSED_ELEMENT_PARAMETER',
+ uniqueName: 'UNUSED_ELEMENT_PARAMETER',
);
/**
@@ -3495,7 +3494,7 @@
"Try using the result by invoking a member, passing it to a function, "
"or returning it from this function.",
hasPublishedDocs: false,
- uniqueName: 'HintCode.UNUSED_RESULT_WITH_MESSAGE',
+ uniqueName: 'UNUSED_RESULT_WITH_MESSAGE',
);
/**
@@ -3559,7 +3558,7 @@
hasPublishedDocs: hasPublishedDocs,
message: message,
name: name,
- uniqueName: uniqueName ?? 'HintCode.$name',
+ uniqueName: 'HintCode.${uniqueName ?? name}',
);
@override
diff --git a/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart b/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart
index 1dc3670..d8138bc 100644
--- a/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart
@@ -45,7 +45,7 @@
// Either `new` or `const` has been specified.
return node;
}
- var typeName = node.constructorName.type.name;
+ var typeName = node.constructorName.type2.name;
if (typeName is SimpleIdentifier) {
var element = nameScope.lookup(typeName.name).getter;
if (element is FunctionElement ||
@@ -388,7 +388,10 @@
[classElement.name, constructorElement.name]);
}
- var typeName = astFactory.typeName(typeNameIdentifier, typeArguments);
+ var typeName = astFactory.namedType(
+ name: typeNameIdentifier,
+ typeArguments: typeArguments,
+ );
var constructorName = astFactory.constructorName(
typeName, node.operator, constructorIdentifier);
var instanceCreationExpression = astFactory.instanceCreationExpression(
@@ -407,7 +410,7 @@
return node;
}
- var typeName = astFactory.typeName(node.prefix, null);
+ var typeName = astFactory.namedType(name: node.prefix);
var constructorName =
astFactory.constructorName(typeName, node.period, node.identifier);
var constructorReference =
@@ -436,7 +439,10 @@
var operator = node.operator;
- var typeName = astFactory.typeName(receiver, typeArguments);
+ var typeName = astFactory.namedType(
+ name: receiver,
+ typeArguments: typeArguments,
+ );
var constructorName =
astFactory.constructorName(typeName, operator, node.propertyName);
var constructorReference =
@@ -450,10 +456,14 @@
required SimpleIdentifier prefixIdentifier,
required SimpleIdentifier typeIdentifier,
}) {
- var typeName = astFactory.typeName(
- astFactory.prefixedIdentifier(
- prefixIdentifier, node.operator!, typeIdentifier),
- node.typeArguments);
+ var typeName = astFactory.namedType(
+ name: astFactory.prefixedIdentifier(
+ prefixIdentifier,
+ node.operator!,
+ typeIdentifier,
+ ),
+ typeArguments: node.typeArguments,
+ );
var constructorName = astFactory.constructorName(typeName, null, null);
var instanceCreationExpression = astFactory.instanceCreationExpression(
null, constructorName, node.argumentList);
@@ -465,7 +475,10 @@
required MethodInvocation node,
required SimpleIdentifier typeIdentifier,
}) {
- var typeName = astFactory.typeName(typeIdentifier, node.typeArguments);
+ var typeName = astFactory.namedType(
+ name: typeIdentifier,
+ typeArguments: node.typeArguments,
+ );
var constructorName = astFactory.constructorName(typeName, null, null);
var instanceCreationExpression = astFactory.instanceCreationExpression(
null, constructorName, node.argumentList);
@@ -492,7 +505,7 @@
typeArguments,
[classElement.name, constructorElement.name]);
}
- var typeName = astFactory.typeName(typeIdentifier, null);
+ var typeName = astFactory.namedType(name: typeIdentifier);
var constructorName = astFactory.constructorName(
typeName, node.operator, constructorIdentifier);
// TODO(scheglov) I think we should drop "typeArguments" below.
@@ -508,8 +521,10 @@
required Identifier function,
required TypeAliasElement element,
}) {
- var typeName = astFactory.typeName(node.constructorName.type.name,
- node.constructorName.type.typeArguments);
+ var typeName = astFactory.namedType(
+ name: node.constructorName.type2.name,
+ typeArguments: node.constructorName.type2.typeArguments,
+ );
typeName.type = element.aliasedType;
typeName.name.staticType = element.aliasedType;
var typeLiteral = astFactory.typeLiteral(typeName: typeName);
@@ -531,7 +546,7 @@
}) {
var functionReference = astFactory.functionReference(
function: function,
- typeArguments: node.constructorName.type.typeArguments,
+ typeArguments: node.constructorName.type2.typeArguments,
);
var methodInvocation = astFactory.methodInvocation(
functionReference,
diff --git a/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart
index 75ac605..a9fd9af 100644
--- a/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart
@@ -20,7 +20,7 @@
void resolve(ConstructorReferenceImpl node) {
if (!_resolver.isConstructorTearoffsEnabled &&
- node.constructorName.type.typeArguments == null) {
+ node.constructorName.type2.typeArguments == null) {
// Only report this if [node] has no explicit type arguments; otherwise
// the parser has already reported an error.
_resolver.errorReporter.reportErrorForNode(
@@ -49,7 +49,7 @@
//
// Only report errors when the constructor tearoff feature is enabled,
// to avoid reporting redundant errors.
- var enclosingElement = node.constructorName.type.name.staticElement;
+ var enclosingElement = node.constructorName.type2.name.staticElement;
if (enclosingElement is TypeAliasElement) {
enclosingElement = enclosingElement.aliasedType.element;
}
@@ -123,7 +123,7 @@
constructorName.staticElement = constructorElement.declaration;
constructorName.name?.staticElement = constructorElement.declaration;
node.staticType = inferred;
- constructorName.type.type = null;
+ constructorName.type2.type = null;
}
} else {
var constructorElement = constructorName.staticElement;
@@ -132,7 +132,7 @@
} else {
node.staticType = constructorElement.type;
}
- constructorName.type.type = null;
+ constructorName.type2.type = null;
}
}
}
diff --git a/pkg/analyzer/lib/src/dart/resolver/exit_detector.dart b/pkg/analyzer/lib/src/dart/resolver/exit_detector.dart
index f1a6fd8..7a39ba8 100644
--- a/pkg/analyzer/lib/src/dart/resolver/exit_detector.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/exit_detector.dart
@@ -443,6 +443,9 @@
node.expression.accept(this)!;
@override
+ bool visitNamedType(NamedType node) => false;
+
+ @override
bool visitNode(AstNode node) {
throw StateError(
'Missing a visit method for a node of type ${node.runtimeType}');
@@ -554,10 +557,7 @@
}
@override
- bool visitTypeLiteral(TypeLiteral node) => _nodeExits(node.typeName);
-
- @override
- bool visitTypeName(TypeName node) => false;
+ bool visitTypeLiteral(TypeLiteral node) => _nodeExits(node.type);
@override
bool visitVariableDeclaration(VariableDeclaration node) {
diff --git a/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
index 48be249..6e2d340 100644
--- a/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
@@ -61,7 +61,7 @@
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
typeArguments,
- [function.constructorName.type.name, function.constructorName.name],
+ [function.constructorName.type2.name, function.constructorName.name],
);
_resolve(node: node, rawType: function.staticType);
}
@@ -697,7 +697,10 @@
// This involves a fair amount of resolution, as [name] may be a prefixed
// identifier, etc. [TypeName]s should be resolved in [ResolutionVisitor],
// and this could be done for nodes like this via [AstRewriter].
- var typeName = astFactory.typeName(name, node.typeArguments);
+ var typeName = astFactory.namedType(
+ name: name,
+ typeArguments: node.typeArguments,
+ );
typeName.type = instantiatedType;
typeName.name.staticType = instantiatedType;
var typeLiteral = astFactory.typeLiteral(typeName: typeName);
diff --git a/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
index cf4574c..f824a1e 100644
--- a/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
@@ -13,7 +13,7 @@
/// This resolver is responsible for rewriting a given
/// [InstanceCreationExpression] as a [MethodInvocation] if the parsed
/// [ConstructorName]'s `type` resolves to a [FunctionReference] or
-/// [ConstructorReference], instead of a [TypeName].
+/// [ConstructorReference], instead of a [NamedType].
class InstanceCreationExpressionResolver {
/// The resolver driving this participant.
final ResolverVisitor _resolver;
@@ -36,7 +36,7 @@
// InstanceCreationExpression needs to be rewritten as a MethodInvocation
// with a target of `a.m<int>` (a FunctionReference) and a name of `apply`.
if (node.keyword == null) {
- var typeNameTypeArguments = node.constructorName.type.typeArguments;
+ var typeNameTypeArguments = node.constructorName.type2.typeArguments;
if (typeNameTypeArguments != null) {
// This could be a method call on a function reference or a constructor
// reference.
@@ -50,7 +50,7 @@
void _inferArgumentTypes(covariant InstanceCreationExpressionImpl node) {
var constructorName = node.constructorName;
- var typeName = constructorName.type;
+ var typeName = constructorName.type2;
var typeArguments = typeName.typeArguments;
var elementToInfer = _resolver.inferenceHelper.constructorElementToInfer(
constructorName: constructorName,
@@ -90,7 +90,7 @@
ResolverVisitor.resolveArgumentsToParameters(
arguments, inferred.parameters, null);
- constructorName.type.type = inferred.returnType;
+ constructorName.type2.type = inferred.returnType;
// Update the static element as well. This is used in some cases, such
// as computing constant values. It is stored in two places.
@@ -124,7 +124,7 @@
node.argumentList, whyNotPromotedList);
}
- /// Resolve [node] which has a [TypeName] with type arguments (given as
+ /// Resolve [node] which has a [NamedType] with type arguments (given as
/// [typeNameTypeArguments]).
///
/// The instance creation expression may actually be a method call on a
@@ -133,7 +133,7 @@
InstanceCreationExpressionImpl node,
TypeArgumentListImpl typeNameTypeArguments,
) {
- var typeNameName = node.constructorName.type.name;
+ var typeNameName = node.constructorName.type2.name;
if (typeNameName is SimpleIdentifierImpl) {
// TODO(srawlins): Lookup the name and potentially rewrite `node` as a
// [MethodInvocation].
diff --git a/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart b/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
index f665fe8f..2fe4604 100644
--- a/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
@@ -97,7 +97,7 @@
List<TypeParameterElement>? typeParameters;
ConstructorElement? rawElement;
- var typeName = constructorName.type;
+ var typeName = constructorName.type2;
var typeArguments = typeName.typeArguments;
var typeElement = typeName.name.staticElement;
if (typeElement is ClassElement) {
diff --git a/pkg/analyzer/lib/src/dart/resolver/legacy_type_asserter.dart b/pkg/analyzer/lib/src/dart/resolver/legacy_type_asserter.dart
index 7be20ef..580be8a 100644
--- a/pkg/analyzer/lib/src/dart/resolver/legacy_type_asserter.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/legacy_type_asserter.dart
@@ -97,15 +97,15 @@
}
@override
- void visitTypeAnnotation(TypeAnnotation node) {
+ void visitNamedType(NamedType node) {
_assertLegacyType(node.type);
- super.visitTypeAnnotation(node);
+ super.visitNamedType(node);
}
@override
- void visitTypeName(TypeName node) {
+ void visitTypeAnnotation(TypeAnnotation node) {
_assertLegacyType(node.type);
- super.visitTypeName(node);
+ super.visitTypeAnnotation(node);
}
@override
diff --git a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
index 190ab31..6833dd3 100644
--- a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
@@ -165,15 +165,15 @@
}
if (receiver is TypeLiteralImpl &&
- receiver.typeName.typeArguments != null &&
- receiver.typeName.type is FunctionType) {
+ receiver.type.typeArguments != null &&
+ receiver.type.type is FunctionType) {
// There is no possible resolution for a property access of a function
// type literal (which can only be a type instantiation of a type alias
// of a function type).
_resolver.errorReporter.reportErrorForNode(
CompileTimeErrorCode.UNDEFINED_METHOD_ON_FUNCTION_TYPE,
nameNode,
- [name, receiver.typeName.name.name],
+ [name, receiver.type.name.name],
);
_setDynamicResolution(node, whyNotPromotedList: whyNotPromotedList);
return;
diff --git a/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
index dd2e688..e8f3c35 100644
--- a/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
@@ -382,7 +382,7 @@
targetType = _typeSystem.promoteToNonNull(targetType);
}
- if (target is TypeLiteral && target.typeName.type is FunctionType) {
+ if (target is TypeLiteral && target.type.type is FunctionType) {
// There is no possible resolution for a property access of a function
// type literal (which can only be a type instantiation of a type alias
// of a function type).
@@ -390,13 +390,13 @@
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.UNDEFINED_GETTER_ON_FUNCTION_TYPE,
propertyName,
- [propertyName.name, target.typeName.name.name],
+ [propertyName.name, target.type.name.name],
);
} else {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.UNDEFINED_SETTER_ON_FUNCTION_TYPE,
propertyName,
- [propertyName.name, target.typeName.name.name],
+ [propertyName.name, target.type.name.name],
);
}
return PropertyElementResolverResult();
diff --git a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
index 964e414..1793675 100644
--- a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
@@ -53,7 +53,7 @@
/// 1. Set existing top-level elements from [_elementWalker] to corresponding
/// nodes in AST.
/// 2. Create and set new elements for local declarations.
-/// 3. Resolve all [TypeName]s - set elements and types.
+/// 3. Resolve all [NamedType]s - set elements and types.
/// 4. Resolve all [GenericFunctionType]s - set their types.
/// 5. Rewrite AST where resolution provides a more accurate understanding.
class ResolutionVisitor extends RecursiveAstVisitor<void> {
@@ -235,7 +235,7 @@
ErrorCode errorCode = withClause == null
? CompileTimeErrorCode.EXTENDS_NON_CLASS
: CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS;
- _resolveType(extendsClause.superclass, errorCode, asClass: true);
+ _resolveType(extendsClause.superclass2, errorCode, asClass: true);
}
_resolveWithClause(withClause);
@@ -265,7 +265,7 @@
node.typeParameters?.accept(this);
_resolveType(
- node.superclass,
+ node.superclass2,
CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS,
asClass: true,
);
@@ -761,7 +761,7 @@
void visitInstanceCreationExpression(InstanceCreationExpression node) {
var newNode = _astRewriter.instanceCreationExpression(_nameScope, node);
if (newNode != node) {
- if (node.constructorName.type.typeArguments != null &&
+ if (node.constructorName.type2.typeArguments != null &&
newNode is MethodInvocation &&
newNode.target is FunctionReference &&
!_libraryElement.featureSet.isEnabled(Feature.constructor_tearoffs)) {
@@ -882,6 +882,18 @@
}
@override
+ void visitNamedType(covariant TypeNameImpl node) {
+ node.typeArguments?.accept(this);
+
+ _typeNameResolver.nameScope = _nameScope;
+ _typeNameResolver.resolve(node);
+
+ if (_typeNameResolver.rewriteResult != null) {
+ _typeNameResolver.rewriteResult!.accept(this);
+ }
+ }
+
+ @override
void visitPartDirective(PartDirective node) {
_withElementWalker(null, () {
super.visitPartDirective(node);
@@ -988,18 +1000,6 @@
}
@override
- void visitTypeName(covariant TypeNameImpl node) {
- node.typeArguments?.accept(this);
-
- _typeNameResolver.nameScope = _nameScope;
- _typeNameResolver.resolve(node);
-
- if (_typeNameResolver.rewriteResult != null) {
- _typeNameResolver.rewriteResult!.accept(this);
- }
- }
-
- @override
void visitTypeParameter(TypeParameter node) {
var element = node.declaredElement as TypeParameterElementImpl;
@@ -1241,7 +1241,7 @@
var redirectedConstructor = node.redirectedConstructor;
if (redirectedConstructor == null) return;
- var namedType = redirectedConstructor.type;
+ var namedType = redirectedConstructor.type2;
_typeNameResolver.redirectedConstructor_namedType = namedType;
redirectedConstructor.accept(this);
@@ -1259,7 +1259,7 @@
void _resolveType(TypeNameImpl namedType, ErrorCode errorCode,
{bool asClass = false}) {
_typeNameResolver.classHierarchy_namedType = namedType;
- visitTypeName(namedType);
+ visitNamedType(namedType);
_typeNameResolver.classHierarchy_namedType = null;
if (_typeNameResolver.hasErrorReported) {
@@ -1276,7 +1276,7 @@
return;
}
- // If the type is not an InterfaceType, then visitTypeName() sets the type
+ // If the type is not an InterfaceType, then visitNamedType() sets the type
// to be a DynamicTypeImpl
Identifier name = namedType.name;
if (!_libraryElement.shouldIgnoreUndefinedIdentifier(name)) {
diff --git a/pkg/analyzer/lib/src/error/best_practices_verifier.dart b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
index fb503dd..62bf4a9 100644
--- a/pkg/analyzer/lib/src/error/best_practices_verifier.dart
+++ b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
@@ -698,6 +698,24 @@
}
@override
+ void visitNamedType(NamedType node) {
+ var question = node.question;
+ if (question != null) {
+ var name = node.name.name;
+ var type = node.typeOrThrow;
+ // Only report non-aliased, non-user-defined `Null?` and `dynamic?`. Do
+ // not report synthetic `dynamic` in place of an unresolved type.
+ if ((type.element == _nullType.element ||
+ (type.isDynamic && name == 'dynamic')) &&
+ type.alias == null) {
+ _errorReporter.reportErrorForToken(
+ HintCode.UNNECESSARY_QUESTION_MARK, question, [name]);
+ }
+ }
+ super.visitNamedType(node);
+ }
+
+ @override
void visitPostfixExpression(PostfixExpression node) {
_deprecatedVerifier.postfixExpression(node);
if (node.operator.type == TokenType.BANG &&
@@ -771,24 +789,6 @@
}
}
- @override
- void visitTypeName(TypeName node) {
- var question = node.question;
- if (question != null) {
- var name = node.name.name;
- var type = node.typeOrThrow;
- // Only report non-aliased, non-user-defined `Null?` and `dynamic?`. Do
- // not report synthetic `dynamic` in place of an unresolved type.
- if ((type.element == _nullType.element ||
- (type.isDynamic && name == 'dynamic')) &&
- type.alias == null) {
- _errorReporter.reportErrorForToken(
- HintCode.UNNECESSARY_QUESTION_MARK, question, [name]);
- }
- }
- super.visitTypeName(node);
- }
-
/// Check for the passed is expression for the unnecessary type check hint
/// codes as well as null checks expressed using an is expression.
///
@@ -1196,7 +1196,7 @@
// TODO(jwren) We should modify ConstructorElement.getDisplayName(), or
// have the logic centralized elsewhere, instead of doing this logic
// here.
- String fullConstructorName = constructorName.type.name.name;
+ String fullConstructorName = constructorName.type2.name.name;
if (constructorName.name != null) {
fullConstructorName = '$fullConstructorName.${constructorName.name}';
}
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 3945838..6427f89 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -2899,6 +2899,18 @@
hasPublishedDocs: true);
/**
+ * No parameters.
+ */
+ static const CompileTimeErrorCode
+ CONST_WITH_TYPE_PARAMETERS_FUNCTION_TEAROFF = CompileTimeErrorCode(
+ 'CONST_WITH_TYPE_PARAMETERS',
+ "A constant function tearoff can't use a type parameter as a type "
+ "argument.",
+ correction: "Try replacing the type parameter with a different type.",
+ uniqueName: 'CONST_WITH_TYPE_PARAMETERS_FUNCTION_TEAROFF',
+ hasPublishedDocs: true);
+
+ /**
* 16.12.2 Const: It is a compile-time error if <i>T.id</i> is not the name of
* a constant constructor declared by the type <i>T</i>.
*
diff --git a/pkg/analyzer/lib/src/error/inheritance_override.dart b/pkg/analyzer/lib/src/error/inheritance_override.dart
index 8c4abb5..0746ffd 100644
--- a/pkg/analyzer/lib/src/error/inheritance_override.dart
+++ b/pkg/analyzer/lib/src/error/inheritance_override.dart
@@ -45,7 +45,7 @@
classNameNode: declaration.name,
implementsClause: declaration.implementsClause,
members: declaration.members,
- superclass: declaration.extendsClause?.superclass,
+ superclass: declaration.extendsClause?.superclass2,
withClause: declaration.withClause,
).verify();
} else if (declaration is ClassTypeAlias) {
@@ -58,7 +58,7 @@
library: library,
classNameNode: declaration.name,
implementsClause: declaration.implementsClause,
- superclass: declaration.superclass,
+ superclass: declaration.superclass2,
withClause: declaration.withClause,
).verify();
} else if (declaration is MixinDeclaration) {
diff --git a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
index c6edd49..83fbc88 100644
--- a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
+++ b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
@@ -33,7 +33,7 @@
_libraryElement.typeSystem as TypeSystemImpl;
void checkConstructorReference(ConstructorReference node) {
- var classElement = node.constructorName.type.name.staticElement;
+ var classElement = node.constructorName.type2.name.staticElement;
List<TypeParameterElement> typeParameters;
if (classElement is TypeAliasElement) {
typeParameters = classElement.typeParameters;
@@ -46,7 +46,7 @@
if (typeParameters.isEmpty) {
return;
}
- var typeArgumentList = node.constructorName.type.typeArguments;
+ var typeArgumentList = node.constructorName.type2.typeArguments;
if (typeArgumentList == null) {
return;
}
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 58f5342..9abd454 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -254,9 +254,8 @@
name: name,
typeParameters: typeParameters,
onKeyword: Tokens.on_(),
- extendedType: ast.typeName(
- _tmpSimpleIdentifier(),
- null,
+ extendedType: ast.namedType(
+ name: _tmpSimpleIdentifier(),
), // extendedType is set in [endExtensionDeclaration]
showClause: null,
hideClause: null,
@@ -1110,8 +1109,16 @@
var constructorName = pop() as SimpleIdentifier?;
var typeArguments = pop() as TypeArgumentList?;
var typeNameIdentifier = pop() as Identifier;
- push(ast.constructorName(ast.typeName(typeNameIdentifier, typeArguments),
- periodBeforeName, constructorName));
+ push(
+ ast.constructorName(
+ ast.namedType(
+ name: typeNameIdentifier,
+ typeArguments: typeArguments,
+ ),
+ periodBeforeName,
+ constructorName,
+ ),
+ );
}
@override
@@ -1988,11 +1995,11 @@
ImplementsClause? implementsClause;
if (implementsKeyword != null) {
- var interfaces = pop() as List<TypeName>;
+ var interfaces = pop() as List<NamedType>;
implementsClause = ast.implementsClause(implementsKeyword, interfaces);
}
var withClause = pop(NullValue.WithClause) as WithClause;
- var superclass = pop() as TypeName;
+ var superclass = pop() as NamedType;
var modifiers = pop() as _Modifiers?;
var typeParameters = pop() as TypeParameterList?;
var name = pop() as SimpleIdentifier;
@@ -2311,7 +2318,7 @@
@override
void endTypeList(int count) {
debugEvent("TypeList");
- push(popTypedList<TypeName>(count) ?? NullValue.TypeList);
+ push(popTypedList<NamedType>(count) ?? NullValue.TypeList);
}
@override
@@ -2531,7 +2538,7 @@
pop();
typeCount--;
}
- var supertype = pop() as TypeName?;
+ var supertype = pop() as NamedType?;
if (supertype != null) {
push(ast.extendsClause(extendsKeyword!, supertype));
} else {
@@ -2592,7 +2599,7 @@
debugEvent("ClassImplements");
if (implementsKeyword != null) {
- var interfaces = popTypedList2<TypeName>(interfacesCount);
+ var interfaces = popTypedList2<NamedType>(interfacesCount);
push(ast.implementsClause(implementsKeyword, interfaces));
} else {
push(NullValue.IdentifierList);
@@ -2602,7 +2609,7 @@
@override
void handleClassWithClause(Token withKeyword) {
assert(optional('with', withKeyword));
- var mixinTypes = pop() as List<TypeName>;
+ var mixinTypes = pop() as List<NamedType>;
push(ast.withClause(withKeyword, mixinTypes));
}
@@ -3248,7 +3255,7 @@
debugEvent("MixinOn");
if (onKeyword != null) {
- var types = popTypedList2<TypeName>(typeCount);
+ var types = popTypedList2<NamedType>(typeCount);
push(ast.onClause(onKeyword, types));
} else {
push(NullValue.IdentifierList);
@@ -3268,7 +3275,7 @@
@override
void handleNamedMixinApplicationWithClause(Token withKeyword) {
assert(optionalOrNull('with', withKeyword));
- var mixinTypes = pop() as List<TypeName>;
+ var mixinTypes = pop() as List<NamedType>;
push(ast.withClause(withKeyword, mixinTypes));
}
@@ -3428,7 +3435,7 @@
var extendsClause = pop(NullValue.ExtendsClause) as ExtendsClause?;
var declaration = declarations.last as ClassDeclarationImpl;
if (extendsClause != null) {
- if (declaration.extendsClause?.superclass == null) {
+ if (declaration.extendsClause?.superclass2 == null) {
declaration.extendsClause = extendsClause;
}
}
@@ -3614,7 +3621,13 @@
var arguments = pop() as TypeArgumentList?;
var name = pop() as Identifier;
- push(ast.typeName(name, arguments, question: questionMark));
+ push(
+ ast.namedType(
+ name: name,
+ typeArguments: arguments,
+ question: questionMark,
+ ),
+ );
}
@override
diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart
index 7785699..7f2a709 100644
--- a/pkg/analyzer/lib/src/generated/element_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/element_resolver.dart
@@ -238,7 +238,7 @@
@override
void visitConstructorName(covariant ConstructorNameImpl node) {
- var type = node.type.type;
+ var type = node.type2.type;
if (type == null) {
return;
}
@@ -476,7 +476,7 @@
// TODO(brianwilkerson) Defer this check until we know there's an error (by
// in-lining _resolveArgumentsToFunction below).
var declaration = node.thisOrAncestorOfType<ClassDeclaration>();
- var superclassName = declaration?.extendsClause?.superclass.name;
+ var superclassName = declaration?.extendsClause?.superclass2.name;
if (superclassName != null &&
_resolver.definingLibrary
.shouldIgnoreUndefinedIdentifier(superclassName)) {
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 029f914..5c03dd2 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -453,7 +453,7 @@
_checkForBuiltInIdentifierAsName(
node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
_checkForConflictingClassTypeVariableErrorCodes();
- var superclass = node.extendsClause?.superclass;
+ var superclass = node.extendsClause?.superclass2;
var implementsClause = node.implementsClause;
var withClause = node.withClause;
@@ -490,7 +490,7 @@
try {
_enclosingClass = node.declaredElement as ClassElementImpl;
_checkClassInheritance(
- node, node.superclass, node.withClause, node.implementsClause);
+ node, node.superclass2, node.withClause, node.implementsClause);
_checkForMainFunction(node.name);
_checkForWrongTypeParameterVarianceInSuperinterfaces();
} finally {
@@ -868,7 +868,7 @@
@override
void visitInstanceCreationExpression(InstanceCreationExpression node) {
ConstructorName constructorName = node.constructorName;
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
DartType type = namedType.typeOrThrow;
if (type is InterfaceType) {
_checkForConstOrNewWithAbstractClass(node, namedType, type);
@@ -1001,6 +1001,12 @@
}
@override
+ void visitNamedType(NamedType node) {
+ _typeArgumentsVerifier.checkNamedType(node);
+ super.visitNamedType(node);
+ }
+
+ @override
void visitNativeClause(NativeClause node) {
// TODO(brianwilkerson) Figure out the right rule for when 'native' is
// allowed.
@@ -1218,12 +1224,6 @@
}
@override
- void visitTypeName(TypeName node) {
- _typeArgumentsVerifier.checkNamedType(node);
- super.visitTypeName(node);
- }
-
- @override
void visitTypeParameter(TypeParameter node) {
_checkForBuiltInIdentifierAsName(node.name,
CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME);
@@ -1436,7 +1436,7 @@
if (redirectedElement == null) {
// If the element is null, we check for the
// REDIRECT_TO_MISSING_CONSTRUCTOR case
- NamedType constructorNamedType = redirectedConstructor.type;
+ NamedType constructorNamedType = redirectedConstructor.type2;
DartType redirectedType = constructorNamedType.typeOrThrow;
if (redirectedType.element != null && !redirectedType.isDynamic) {
// Prepare the constructor name
@@ -1616,10 +1616,10 @@
}
if (extendsClause != null) {
- var superElement = extendsClause.superclass.name.staticElement;
+ var superElement = extendsClause.superclass2.name.staticElement;
if (superElement != null && superElement.name == "Function") {
errorReporter.reportErrorForNode(
- HintCode.DEPRECATED_EXTENDS_FUNCTION, extendsClause.superclass);
+ HintCode.DEPRECATED_EXTENDS_FUNCTION, extendsClause.superclass2);
}
}
@@ -5126,7 +5126,7 @@
_UninstantiatedBoundChecker(this._errorReporter);
@override
- void visitTypeName(TypeName node) {
+ void visitNamedType(NamedType node) {
var typeArgs = node.typeArguments;
if (typeArgs != null) {
typeArgs.accept(this);
diff --git a/pkg/analyzer/lib/src/generated/ffi_verifier.dart b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
index 516a19d..76f07fd 100644
--- a/pkg/analyzer/lib/src/generated/ffi_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
@@ -69,7 +69,7 @@
// Only the Allocator, Opaque and Struct class may be extended.
var extendsClause = node.extendsClause;
if (extendsClause != null) {
- final NamedType superclass = extendsClause.superclass;
+ final NamedType superclass = extendsClause.superclass2;
final ffiClass = superclass.ffiClass;
if (ffiClass != null) {
final className = ffiClass.name;
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index a332a6c..d1b9366 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -248,13 +248,13 @@
return astBuilder.pop() as TypeArgumentList;
}
- TypeName parseTypeName(bool inExpression) {
+ NamedType parseTypeName(bool inExpression) {
Token previous = fastaParser.syntheticPreviousToken(currentToken);
currentToken = fasta
.computeType(previous, true, !inExpression)
.parseType(previous, fastaParser)
.next!;
- return astBuilder.pop() as TypeName;
+ return astBuilder.pop() as NamedType;
}
TypeParameter parseTypeParameter() {
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 8a92e94..4978d9e 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -1242,7 +1242,7 @@
@override
void visitConstructorName(ConstructorName node) {
- node.type.accept(this);
+ node.type2.accept(this);
node.accept(elementResolver);
}
@@ -1737,6 +1737,15 @@
}
@override
+ void visitNamedType(NamedType node) {
+ // All TypeName(s) are already resolved, so we don't resolve it here.
+ // But there might be type arguments with Expression(s), such as default
+ // values for formal parameters of GenericFunctionType(s). These are
+ // invalid, but if they exist, they should be resolved.
+ node.typeArguments?.accept(this);
+ }
+
+ @override
void visitNode(AstNode node) {
checkUnreachableNode(node);
node.visitChildren(this);
@@ -2003,15 +2012,6 @@
}
@override
- void visitTypeName(TypeName node) {
- // All TypeName(s) are already resolved, so we don't resolve it here.
- // But there might be type arguments with Expression(s), such as default
- // values for formal parameters of GenericFunctionType(s). These are
- // invalid, but if they exist, they should be resolved.
- node.typeArguments?.accept(this);
- }
-
- @override
void visitVariableDeclaration(VariableDeclaration node) {
_variableDeclarationResolver.resolve(node as VariableDeclarationImpl);
@@ -2452,7 +2452,7 @@
node.documentationComment?.accept(this);
node.name.accept(this);
node.typeParameters?.accept(this);
- node.superclass.accept(this);
+ node.superclass2.accept(this);
node.withClause.accept(this);
node.implementsClause?.accept(this);
}
@@ -2932,6 +2932,14 @@
}
@override
+ void visitNamedType(NamedType node) {
+ // All TypeName(s) are already resolved, so we don't resolve it here.
+ // But there might be type arguments with Expression(s), such as
+ // annotations on formal parameters of GenericFunctionType(s).
+ node.typeArguments?.accept(this);
+ }
+
+ @override
void visitPrefixedIdentifier(PrefixedIdentifier node) {
// Do not visit the identifier after the `.`, since it is not meant to be
// looked up in the current scope.
@@ -3052,14 +3060,6 @@
}
@override
- void visitTypeName(TypeName node) {
- // All TypeName(s) are already resolved, so we don't resolve it here.
- // But there might be type arguments with Expression(s), such as
- // annotations on formal parameters of GenericFunctionType(s).
- node.typeArguments?.accept(this);
- }
-
- @override
void visitVariableDeclaration(VariableDeclaration node) {
super.visitVariableDeclaration(node);
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index 4c44ba5..bcd3487 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -180,7 +180,7 @@
void visitInstanceCreationExpression(
covariant InstanceCreationExpressionImpl node) {
_inferInstanceCreationExpression(node);
- recordStaticType(node, node.constructorName.type.typeOrThrow);
+ recordStaticType(node, node.constructorName.type2.typeOrThrow);
}
/// <blockquote>
@@ -365,7 +365,7 @@
return;
}
- var typeName = constructorName.type;
+ var typeName = constructorName.type2;
var typeArguments = typeName.typeArguments;
var constructorType = elementToInfer.asType;
diff --git a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
index 921c116..6077d91 100644
--- a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
+++ b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
@@ -1444,13 +1444,19 @@
static TypeNameImpl typeName3(Identifier name,
[List<TypeAnnotation>? arguments]) =>
- astFactory.typeName(name, typeArgumentList(arguments));
+ astFactory.namedType(
+ name: name,
+ typeArguments: typeArgumentList(arguments),
+ );
static TypeNameImpl typeName4(String name,
[List<TypeAnnotation>? arguments, bool question = false]) =>
- astFactory.typeName(identifier3(name), typeArgumentList(arguments),
- question:
- question ? TokenFactory.tokenFromType(TokenType.QUESTION) : null);
+ astFactory.namedType(
+ name: identifier3(name),
+ typeArguments: typeArgumentList(arguments),
+ question:
+ question ? TokenFactory.tokenFromType(TokenType.QUESTION) : null,
+ );
static TypeParameterImpl typeParameter(String name) =>
astFactory.typeParameter(null, null, identifier3(name), null, null);
diff --git a/pkg/analyzer/lib/src/generated/utilities_general.dart b/pkg/analyzer/lib/src/generated/utilities_general.dart
index bfd1e08..d9e6742 100644
--- a/pkg/analyzer/lib/src/generated/utilities_general.dart
+++ b/pkg/analyzer/lib/src/generated/utilities_general.dart
@@ -42,58 +42,6 @@
/// 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;
diff --git a/pkg/analyzer/lib/src/lint/analysis.dart b/pkg/analyzer/lib/src/lint/analysis.dart
index d275458..b43bd0c 100644
--- a/pkg/analyzer/lib/src/lint/analysis.dart
+++ b/pkg/analyzer/lib/src/lint/analysis.dart
@@ -2,23 +2,14 @@
// 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 'dart:collection';
import 'dart:io' as io;
-import 'package:analyzer/dart/analysis/context_locator.dart' as api;
import 'package:analyzer/dart/analysis/results.dart';
-import 'package:analyzer/file_system/file_system.dart'
- show File, Folder, ResourceProvider, ResourceUriResolver;
+import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/file_system/physical_file_system.dart';
import 'package:analyzer/instrumentation/instrumentation.dart';
import 'package:analyzer/src/analysis_options/analysis_options_provider.dart';
-import 'package:analyzer/src/context/packages.dart';
-import 'package:analyzer/src/dart/analysis/byte_store.dart';
-import 'package:analyzer/src/dart/analysis/driver.dart';
-import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart'
- as api;
-import 'package:analyzer/src/dart/analysis/performance_logger.dart';
-import 'package:analyzer/src/dart/sdk/sdk.dart';
+import 'package:analyzer/src/dart/analysis/analysis_context_collection.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/source.dart';
@@ -26,11 +17,7 @@
import 'package:analyzer/src/lint/linter.dart';
import 'package:analyzer/src/lint/project.dart';
import 'package:analyzer/src/lint/registry.dart';
-import 'package:analyzer/src/services/lint.dart';
-import 'package:analyzer/src/source/package_map_resolver.dart';
import 'package:analyzer/src/task/options.dart';
-import 'package:analyzer/src/util/sdk.dart';
-import 'package:path/path.dart' as p;
import 'package:yaml/yaml.dart';
AnalysisOptionsProvider _optionsProvider = AnalysisOptionsProvider();
@@ -47,8 +34,10 @@
io.exit(exitCode);
}
-AnalysisOptionsImpl _buildAnalyzerOptions(LinterOptions options) {
- AnalysisOptionsImpl analysisOptions = AnalysisOptionsImpl();
+void _updateAnalyzerOptions(
+ AnalysisOptionsImpl analysisOptions,
+ LinterOptions options,
+) {
if (options.analysisOptions != null) {
YamlMap map =
_optionsProvider.getOptionsFromString(options.analysisOptions);
@@ -59,7 +48,6 @@
analysisOptions.lint = options.enableLints;
analysisOptions.enableTiming = options.enableTiming;
analysisOptions.lintRules = options.enabledLints.toList(growable: false);
- return analysisOptions;
}
class DriverOptions {
@@ -110,172 +98,78 @@
}
class LintDriver {
- /// The sources which have been analyzed so far. This is used to avoid
- /// analyzing a source more than once, and to compute the total number of
- /// sources analyzed for statistics.
- final Set<Source> _sourcesAnalyzed = HashSet<Source>();
+ /// The files which have been analyzed so far. This is used to compute the
+ /// total number of files analyzed for statistics.
+ final Set<String> _filesAnalyzed = {};
final LinterOptions options;
LintDriver(this.options);
/// Return the number of sources that have been analyzed so far.
- int get numSourcesAnalyzed => _sourcesAnalyzed.length;
-
- List<UriResolver> get resolvers {
- // TODO(brianwilkerson) Use the context builder to compute all of the resolvers.
- ResourceProvider resourceProvider = PhysicalResourceProvider.INSTANCE;
-
- DartSdk sdk = options.mockSdk ??
- FolderBasedDartSdk(
- resourceProvider, resourceProvider.getFolder(sdkDir));
-
- List<UriResolver> resolvers = [DartUriResolver(sdk)];
-
- var packageUriResolver = _getPackageUriResolver();
- if (packageUriResolver != null) {
- resolvers.add(packageUriResolver);
- }
-
- // File URI resolver must come last so that files inside "/lib" are
- // are analyzed via "package:" URI's.
- resolvers.add(ResourceUriResolver(resourceProvider));
- return resolvers;
- }
-
- ResourceProvider get resourceProvider => options.resourceProvider;
-
- String get sdkDir {
- // In case no SDK has been specified, fall back to inferring it.
- return options.dartSdkPath ?? getSdkPath();
- }
+ int get numSourcesAnalyzed => _filesAnalyzed.length;
Future<List<AnalysisErrorInfo>> analyze(Iterable<io.File> files) async {
AnalysisEngine.instance.instrumentationService = StdInstrumentation();
- SourceFactory sourceFactory = SourceFactory(resolvers);
+ // TODO(scheglov) Enforce normalized absolute paths in the config.
+ var packageConfigPath = options.packageConfigPath;
+ packageConfigPath = _absoluteNormalizedPath.ifNotNull(packageConfigPath);
- PerformanceLog log = PerformanceLog(null);
- AnalysisDriverScheduler scheduler = AnalysisDriverScheduler(log);
- AnalysisDriver analysisDriver = AnalysisDriver.tmp1(
- scheduler: scheduler,
- logger: log,
- resourceProvider: resourceProvider,
- byteStore: MemoryByteStore(),
- sourceFactory: sourceFactory,
- analysisOptions: _buildAnalyzerOptions(options),
- packages: Packages.empty,
+ var contextCollection = AnalysisContextCollectionImpl(
+ resourceProvider: options.resourceProvider,
+ packagesFile: packageConfigPath,
+ sdkPath: options.dartSdkPath,
+ includedPaths:
+ files.map((file) => _absoluteNormalizedPath(file.path)).toList(),
+ updateAnalysisOptions: (analysisOptions) {
+ _updateAnalyzerOptions(analysisOptions, options);
+ },
);
- _setAnalysisDriverAnalysisContext(analysisDriver, files);
-
- analysisDriver.results.listen((_) {});
- analysisDriver.exceptions.listen((_) {});
- scheduler.start();
-
- List<Source> sources = [];
+ AnalysisSession? projectAnalysisSession;
for (io.File file in files) {
- File sourceFile =
- resourceProvider.getFile(p.normalize(file.absolute.path));
- Source source = sourceFile.createSource();
- var uri = sourceFactory.restoreUri(source);
- if (uri != null) {
- // Ensure that we analyze the file using its canonical URI (e.g. if
- // it's in "/lib", analyze it using a "package:" URI).
- source = sourceFile.createSource(uri);
- }
-
- sources.add(source);
- analysisDriver.addFile(source.fullName);
+ var path = _absoluteNormalizedPath(file.path);
+ _filesAnalyzed.add(path);
+ var analysisContext = contextCollection.contextFor(path);
+ var analysisSession = analysisContext.currentSession;
+ projectAnalysisSession = analysisSession;
}
- DartProject project = await DartProject.create(analysisDriver, sources);
- Registry.ruleRegistry.forEach((lint) {
- if (lint is ProjectVisitor) {
- (lint as ProjectVisitor).visit(project);
- }
- });
+ if (projectAnalysisSession != null) {
+ var project = await DartProject.create(
+ projectAnalysisSession,
+ _filesAnalyzed.toList(),
+ );
+ Registry.ruleRegistry.forEach((lint) {
+ if (lint is ProjectVisitor) {
+ (lint as ProjectVisitor).visit(project);
+ }
+ });
+ }
- List<AnalysisErrorInfo> errors = [];
- for (Source source in sources) {
- var errorsResult = await analysisDriver.getErrors2(source.fullName);
+ var result = <AnalysisErrorInfo>[];
+ for (var path in _filesAnalyzed) {
+ var analysisContext = contextCollection.contextFor(path);
+ var analysisSession = analysisContext.currentSession;
+ var errorsResult = await analysisSession.getErrors(path);
if (errorsResult is ErrorsResult) {
- errors.add(
+ result.add(
AnalysisErrorInfoImpl(
errorsResult.errors,
errorsResult.lineInfo,
),
);
- _sourcesAnalyzed.add(source);
}
}
-
- return errors;
+ return result;
}
- void registerLinters(AnalysisContext context) {
- if (options.enableLints) {
- setLints(context, options.enabledLints.toList(growable: false));
- }
- }
-
- PackageMapUriResolver? _getPackageUriResolver() {
- var packageConfigPath = options.packageConfigPath;
- if (packageConfigPath != null) {
- var resourceProvider = PhysicalResourceProvider.INSTANCE;
- var pathContext = resourceProvider.pathContext;
- packageConfigPath = pathContext.absolute(packageConfigPath);
- packageConfigPath = pathContext.normalize(packageConfigPath);
-
- try {
- var packages = parsePackagesFile(
- resourceProvider,
- resourceProvider.getFile(packageConfigPath),
- );
-
- var packageMap = <String, List<Folder>>{};
- for (var package in packages.packages) {
- packageMap[package.name] = [package.libFolder];
- }
-
- return PackageMapUriResolver(resourceProvider, packageMap);
- } catch (e) {
- printAndFail(
- 'Unable to read package config data from $packageConfigPath: $e',
- );
- }
- }
- return null;
- }
-
- void _setAnalysisDriverAnalysisContext(
- AnalysisDriver analysisDriver,
- Iterable<io.File> files,
- ) {
- if (files.isEmpty) {
- return;
- }
-
- var rootPath = p.normalize(files.first.absolute.path);
-
- var apiContextRoots = api.ContextLocator(
- resourceProvider: resourceProvider,
- ).locateRoots(
- includedPaths: [rootPath],
- excludedPaths: [],
- );
-
- if (apiContextRoots.isEmpty) {
- return;
- }
-
- analysisDriver.configure(
- analysisContext: api.DriverBasedAnalysisContext(
- resourceProvider,
- apiContextRoots.first,
- analysisDriver,
- ),
- );
+ String _absoluteNormalizedPath(String path) {
+ var pathContext = options.resourceProvider.pathContext;
+ path = pathContext.absolute(path);
+ path = pathContext.normalize(path);
+ return path;
}
}
@@ -306,3 +200,14 @@
}
}
}
+
+extension _UnaryFunctionExtension<T, R> on R Function(T) {
+ /// Invoke this function if [t] is not `null`, otherwise return `null`.
+ R? ifNotNull(T? t) {
+ if (t != null) {
+ return this(t);
+ } else {
+ return null;
+ }
+ }
+}
diff --git a/pkg/analyzer/lib/src/lint/linter_visitor.dart b/pkg/analyzer/lib/src/lint/linter_visitor.dart
index 424d04a..7fe8635 100644
--- a/pkg/analyzer/lib/src/lint/linter_visitor.dart
+++ b/pkg/analyzer/lib/src/lint/linter_visitor.dart
@@ -496,6 +496,12 @@
}
@override
+ void visitNamedType(NamedType node) {
+ _runSubscriptions(node, registry._forNamedType);
+ super.visitNamedType(node);
+ }
+
+ @override
void visitNativeClause(NativeClause node) {
_runSubscriptions(node, registry._forNativeClause);
super.visitNativeClause(node);
@@ -695,12 +701,6 @@
}
@override
- void visitTypeName(TypeName node) {
- _runSubscriptions(node, registry._forTypeName);
- super.visitTypeName(node);
- }
-
- @override
void visitTypeParameter(TypeParameter node) {
_runSubscriptions(node, registry._forTypeParameter);
super.visitTypeParameter(node);
@@ -861,6 +861,7 @@
final List<_Subscription<MethodInvocation>> _forMethodInvocation = [];
final List<_Subscription<MixinDeclaration>> _forMixinDeclaration = [];
final List<_Subscription<NamedExpression>> _forNamedExpression = [];
+ final List<_Subscription<NamedType>> _forNamedType = [];
final List<_Subscription<NativeClause>> _forNativeClause = [];
final List<_Subscription<NativeFunctionBody>> _forNativeFunctionBody = [];
final List<_Subscription<NullLiteral>> _forNullLiteral = [];
@@ -899,7 +900,6 @@
_forTopLevelVariableDeclaration = [];
final List<_Subscription<TryStatement>> _forTryStatement = [];
final List<_Subscription<TypeArgumentList>> _forTypeArgumentList = [];
- final List<_Subscription<TypeName>> _forTypeName = [];
final List<_Subscription<TypeParameter>> _forTypeParameter = [];
final List<_Subscription<TypeParameterList>> _forTypeParameterList = [];
final List<_Subscription<VariableDeclaration>> _forVariableDeclaration = [];
@@ -1263,6 +1263,10 @@
_forNamedExpression.add(_Subscription(linter, visitor, _getTimer(linter)));
}
+ void addNamedType(LintRule linter, AstVisitor visitor) {
+ _forNamedType.add(_Subscription(linter, visitor, _getTimer(linter)));
+ }
+
void addNativeClause(LintRule linter, AstVisitor visitor) {
_forNativeClause.add(_Subscription(linter, visitor, _getTimer(linter)));
}
@@ -1407,8 +1411,9 @@
_forTypeArgumentList.add(_Subscription(linter, visitor, _getTimer(linter)));
}
+ @Deprecated('Use addNamedType() instead')
void addTypeName(LintRule linter, AstVisitor visitor) {
- _forTypeName.add(_Subscription(linter, visitor, _getTimer(linter)));
+ addNamedType(linter, visitor);
}
void addTypeParameter(LintRule linter, AstVisitor visitor) {
diff --git a/pkg/analyzer/lib/src/lint/project.dart b/pkg/analyzer/lib/src/lint/project.dart
index a461bc7..38da850 100644
--- a/pkg/analyzer/lib/src/lint/project.dart
+++ b/pkg/analyzer/lib/src/lint/project.dart
@@ -5,10 +5,9 @@
import 'dart:io';
import 'package:analyzer/dart/analysis/results.dart';
+import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/src/dart/analysis/driver.dart';
import 'package:analyzer/src/dart/resolver/scope.dart';
-import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/lint/io.dart';
import 'package:analyzer/src/lint/pub.dart';
import 'package:collection/collection.dart';
@@ -44,15 +43,16 @@
/// Project root.
final Directory root;
- /// Create a Dart project for the corresponding [driver] and [sources].
+ /// Create a Dart project for the corresponding [analysisSession] and [files].
/// If a [dir] is unspecified the current working directory will be
/// used.
///
/// Note: clients should call [create] which performs API model initialization.
- DartProject._(AnalysisDriver driver, List<Source> sources, {Directory? dir})
+ DartProject._(AnalysisSession analysisSession, List<String> files,
+ {Directory? dir})
: root = dir ?? Directory.current {
_pubspec = _findAndParsePubspec(root);
- _apiModel = _ApiModel(driver, sources, root);
+ _apiModel = _ApiModel(analysisSession, files, root);
}
/// The project's name.
@@ -84,13 +84,14 @@
return p.basename(root.path);
}
- /// Create an initialized Dart project for the corresponding [driver] and
- /// [sources].
+ /// Create an initialized Dart project for the corresponding [analysisSession]
+ /// and [files].
/// If a [dir] is unspecified the current working directory will be
/// used.
- static Future<DartProject> create(AnalysisDriver driver, List<Source> sources,
+ static Future<DartProject> create(
+ AnalysisSession analysisSession, List<String> files,
{Directory? dir}) async {
- DartProject project = DartProject._(driver, sources, dir: dir);
+ DartProject project = DartProject._(analysisSession, files, dir: dir);
await project._apiModel._calculate();
return project;
}
@@ -103,12 +104,12 @@
/// Captures the project's API as defined by pub package layout standards.
class _ApiModel {
- final AnalysisDriver driver;
- final List<Source>? sources;
+ final AnalysisSession analysisSession;
+ final List<String> files;
final Directory root;
final Set<Element> elements = {};
- _ApiModel(this.driver, this.sources, this.root) {
+ _ApiModel(this.analysisSession, this.files, this.root) {
_calculate();
}
@@ -124,17 +125,16 @@
}
Future<void> _calculate() async {
- if (sources == null || sources!.isEmpty) {
+ if (files.isEmpty) {
return;
}
String libDir = root.path + '/lib';
String libSrcDir = libDir + '/src';
- for (Source source in sources!) {
- String path = source.uri.path;
- if (path.startsWith(libDir) && !path.startsWith(libSrcDir)) {
- var result = await driver.getResult2(source.fullName);
+ for (var file in files) {
+ if (file.startsWith(libDir) && !file.startsWith(libSrcDir)) {
+ var result = await analysisSession.getResolvedUnit(file);
if (result is ResolvedUnitResult) {
LibraryElement library = result.libraryElement;
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_flags.dart b/pkg/analyzer/lib/src/summary2/ast_binary_flags.dart
index 8feb2f2..19cf6cf 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_flags.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_flags.dart
@@ -76,8 +76,8 @@
FieldFormalParameter,
GenericFunctionType,
IndexExpression,
+ NamedType,
PropertyAccess,
- TypeName,
);
static final _hasSeparatorColon = _checkBit(
@@ -98,8 +98,8 @@
static final _hasTypeArguments = _checkBit(
0,
+ NamedType,
TypedLiteral,
- TypeName,
);
static final _isAbstract = _checkBit(
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart b/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
index 61f2728..f5a151f 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_reader.dart
@@ -165,8 +165,8 @@
return _readTypeArgumentList();
case Tag.TypeLiteral:
return _readTypeLiteral();
- case Tag.TypeName:
- return _readTypeName();
+ case Tag.NamedType:
+ return _readNamedType();
case Tag.TypeParameter:
return _readTypeParameter();
case Tag.TypeParameterList:
@@ -331,7 +331,7 @@
}
ConstructorName _readConstructorName() {
- var type = readNode() as TypeName;
+ var type = readNode() as NamedType;
var name = _readOptionalNode() as SimpleIdentifier?;
var node = astFactory.constructorName(
@@ -864,6 +864,20 @@
return node;
}
+ NamedType _readNamedType() {
+ var flags = _readByte();
+ var name = readNode() as Identifier;
+ var typeArguments = _readOptionalNode() as TypeArgumentList?;
+
+ var node = astFactory.namedType(
+ name: name,
+ typeArguments: typeArguments,
+ question: AstBinaryFlags.hasQuestion(flags) ? Tokens.question() : null,
+ );
+ node.type = _reader.readType();
+ return node;
+ }
+
List<T> _readNodeList<T>() {
var length = _reader.readUInt30();
return List.generate(length, (_) => readNode() as T);
@@ -1148,26 +1162,12 @@
}
TypeLiteral _readTypeLiteral() {
- var typeName = readNode() as TypeName;
+ var typeName = readNode() as NamedType;
var node = astFactory.typeLiteral(typeName: typeName);
_readExpressionResolution(node);
return node;
}
- TypeName _readTypeName() {
- var flags = _readByte();
- var name = readNode() as Identifier;
- var typeArguments = _readOptionalNode() as TypeArgumentList?;
-
- var node = astFactory.typeName(
- name,
- typeArguments,
- question: AstBinaryFlags.hasQuestion(flags) ? Tokens.question() : null,
- );
- node.type = _reader.readType();
- return node;
- }
-
TypeParameter _readTypeParameter() {
var name = _readDeclarationName();
var bound = _readOptionalNode() as TypeAnnotation?;
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_tag.dart b/pkg/analyzer/lib/src/summary2/ast_binary_tag.dart
index 91f911c..dfb26a2 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_tag.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_tag.dart
@@ -72,6 +72,7 @@
static const int MethodInvocation = 59;
static const int MixinDeclaration = 67;
static const int NamedExpression = 60;
+ static const int NamedType = 39;
static const int NullLiteral = 49;
static const int ParenthesizedExpression = 53;
static const int PostfixExpression = 94;
@@ -93,7 +94,6 @@
static const int ThrowExpression = 81;
static const int TypeArgumentList = 38;
static const int TypeLiteral = 102;
- static const int TypeName = 39;
static const int TypeParameter = 40;
static const int TypeParameterList = 41;
static const int VariableDeclaration = 42;
diff --git a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
index 11fcb12..6ad2224 100644
--- a/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_binary_writer.dart
@@ -166,7 +166,7 @@
// We need to inform the applier about the right shape of the AST.
// _sink.writeByte(node.name != null ? 1 : 0);
- _writeNode(node.type);
+ _writeNode(node.type2);
_writeOptionalNode(node.name);
_sink.writeElement(node.staticElement);
@@ -513,6 +513,23 @@
}
@override
+ void visitNamedType(NamedType node) {
+ _writeByte(Tag.NamedType);
+
+ _writeByte(
+ AstBinaryFlags.encode(
+ hasQuestion: node.question != null,
+ hasTypeArguments: node.typeArguments != null,
+ ),
+ );
+
+ _writeNode(node.name);
+ _writeOptionalNode(node.typeArguments);
+
+ _sink.writeType(node.type);
+ }
+
+ @override
void visitNullLiteral(NullLiteral node) {
_writeByte(Tag.NullLiteral);
_storeExpression(node);
@@ -727,28 +744,11 @@
@override
void visitTypeLiteral(TypeLiteral node) {
_writeByte(Tag.TypeLiteral);
- _writeNode(node.typeName);
+ _writeNode(node.type);
_storeExpression(node);
}
@override
- void visitTypeName(TypeName node) {
- _writeByte(Tag.TypeName);
-
- _writeByte(
- AstBinaryFlags.encode(
- hasQuestion: node.question != null,
- hasTypeArguments: node.typeArguments != null,
- ),
- );
-
- _writeNode(node.name);
- _writeOptionalNode(node.typeArguments);
-
- _sink.writeType(node.type);
- }
-
- @override
void visitTypeParameter(TypeParameter node) {
_writeByte(Tag.TypeParameter);
_writeDeclarationName(node.name);
diff --git a/pkg/analyzer/lib/src/summary2/ast_text_printer.dart b/pkg/analyzer/lib/src/summary2/ast_text_printer.dart
index bb5f5fc..b763df3 100644
--- a/pkg/analyzer/lib/src/summary2/ast_text_printer.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_text_printer.dart
@@ -165,7 +165,7 @@
node.name.accept(this);
node.typeParameters?.accept(this);
_token(node.equals);
- node.superclass.accept(this);
+ node.superclass2.accept(this);
node.withClause.accept(this);
node.implementsClause?.accept(this);
_token(node.semicolon);
@@ -229,7 +229,7 @@
@override
void visitConstructorName(ConstructorName node) {
- node.type.accept(this);
+ node.type2.accept(this);
_token(node.period);
node.name?.accept(this);
}
@@ -336,7 +336,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
_token(node.extendsKeyword);
- node.superclass.accept(this);
+ node.superclass2.accept(this);
}
@override
@@ -711,6 +711,13 @@
}
@override
+ void visitNamedType(NamedType node) {
+ node.name.accept(this);
+ node.typeArguments?.accept(this);
+ _token(node.question);
+ }
+
+ @override
void visitNativeClause(NativeClause node) {
_token(node.nativeKeyword);
node.name?.accept(this);
@@ -944,13 +951,6 @@
}
@override
- void visitTypeName(TypeName node) {
- node.name.accept(this);
- node.typeArguments?.accept(this);
- _token(node.question);
- }
-
- @override
void visitTypeParameter(TypeParameter node) {
_declaration(node);
// TODO (kallentu) : Clean up TypeParameterImpl casting once variance is
diff --git a/pkg/analyzer/lib/src/summary2/element_builder.dart b/pkg/analyzer/lib/src/summary2/element_builder.dart
index fe2b237..d10835a 100644
--- a/pkg/analyzer/lib/src/summary2/element_builder.dart
+++ b/pkg/analyzer/lib/src/summary2/element_builder.dart
@@ -161,7 +161,7 @@
}
});
- node.superclass.accept(this);
+ node.superclass2.accept(this);
node.withClause.accept(this);
node.implementsClause?.accept(this);
}
@@ -240,7 +240,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
- node.superclass.accept(this);
+ node.superclass2.accept(this);
}
@override
@@ -745,6 +745,11 @@
}
@override
+ void visitNamedType(NamedType node) {
+ node.typeArguments?.accept(this);
+ }
+
+ @override
void visitOnClause(OnClause node) {
node.superclassConstraints2.accept(this);
}
@@ -868,11 +873,6 @@
}
@override
- void visitTypeName(TypeName node) {
- node.typeArguments?.accept(this);
- }
-
- @override
void visitTypeParameter(covariant TypeParameterImpl node) {
var nameNode = node.name;
var name = nameNode.name;
diff --git a/pkg/analyzer/lib/src/summary2/informative_data.dart b/pkg/analyzer/lib/src/summary2/informative_data.dart
index 23218d0..3914a90 100644
--- a/pkg/analyzer/lib/src/summary2/informative_data.dart
+++ b/pkg/analyzer/lib/src/summary2/informative_data.dart
@@ -1953,7 +1953,7 @@
@override
void visitConstructorName(ConstructorName node) {
- node.type.accept(this);
+ node.type2.accept(this);
_tokenOrNull(node.period);
node.name?.accept(this);
}
diff --git a/pkg/analyzer/lib/src/summary2/named_type_builder.dart b/pkg/analyzer/lib/src/summary2/named_type_builder.dart
index a7364a7..5c3473b 100644
--- a/pkg/analyzer/lib/src/summary2/named_type_builder.dart
+++ b/pkg/analyzer/lib/src/summary2/named_type_builder.dart
@@ -17,7 +17,7 @@
import 'package:analyzer/src/summary2/link.dart';
import 'package:analyzer/src/summary2/type_builder.dart';
-/// The type builder for a [TypeName].
+/// The type builder for a [NamedType].
class NamedTypeBuilder extends TypeBuilder {
/// TODO(scheglov) Replace with `DartType` in `TypeAliasElementImpl`.
static const _aliasedTypeKey = '_aliasedType';
diff --git a/pkg/analyzer/lib/src/summary2/reference_resolver.dart b/pkg/analyzer/lib/src/summary2/reference_resolver.dart
index 9fccda8..2475bbb 100644
--- a/pkg/analyzer/lib/src/summary2/reference_resolver.dart
+++ b/pkg/analyzer/lib/src/summary2/reference_resolver.dart
@@ -84,7 +84,7 @@
LinkingNodeContext(node, scope);
node.typeParameters?.accept(this);
- node.superclass.accept(this);
+ node.superclass2.accept(this);
node.withClause.accept(this);
node.implementsClause?.accept(this);
nodesToBuildType.addDeclaration(node);
@@ -125,7 +125,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
- node.superclass.accept(this);
+ node.superclass2.accept(this);
}
@override
@@ -315,28 +315,7 @@
}
@override
- void visitOnClause(OnClause node) {
- node.superclassConstraints2.accept(this);
- }
-
- @override
- void visitSimpleFormalParameter(SimpleFormalParameter node) {
- node.type?.accept(this);
- nodesToBuildType.addDeclaration(node);
- }
-
- @override
- void visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
- node.variables.accept(this);
- }
-
- @override
- void visitTypeArgumentList(TypeArgumentList node) {
- node.arguments.accept(this);
- }
-
- @override
- void visitTypeName(covariant TypeNameImpl node) {
+ void visitNamedType(covariant TypeNameImpl node) {
var typeIdentifier = node.name;
Element? element;
@@ -390,6 +369,27 @@
}
@override
+ void visitOnClause(OnClause node) {
+ node.superclassConstraints2.accept(this);
+ }
+
+ @override
+ void visitSimpleFormalParameter(SimpleFormalParameter node) {
+ node.type?.accept(this);
+ nodesToBuildType.addDeclaration(node);
+ }
+
+ @override
+ void visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
+ node.variables.accept(this);
+ }
+
+ @override
+ void visitTypeArgumentList(TypeArgumentList node) {
+ node.arguments.accept(this);
+ }
+
+ @override
void visitTypeParameter(TypeParameter node) {
var bound = node.bound;
if (bound != null) {
diff --git a/pkg/analyzer/lib/src/summary2/types_builder.dart b/pkg/analyzer/lib/src/summary2/types_builder.dart
index b128cfe..48731a7 100644
--- a/pkg/analyzer/lib/src/summary2/types_builder.dart
+++ b/pkg/analyzer/lib/src/summary2/types_builder.dart
@@ -122,7 +122,7 @@
var extendsClause = node.extendsClause;
if (extendsClause != null) {
- var type = extendsClause.superclass.type;
+ var type = extendsClause.superclass2.type;
if (type is InterfaceType && _isInterfaceTypeClass(type)) {
element.supertype = type;
} else {
@@ -146,7 +146,7 @@
void _classTypeAlias(ClassTypeAlias node) {
var element = node.declaredElement as ClassElementImpl;
- var superType = node.superclass.type;
+ var superType = node.superclass2.type;
if (superType is InterfaceType && _isInterfaceTypeInterface(superType)) {
element.supertype = superType;
} else {
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml
index 6a3198e..3b0dae7 100644
--- a/pkg/analyzer/pubspec.yaml
+++ b/pkg/analyzer/pubspec.yaml
@@ -4,7 +4,7 @@
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
diff --git a/pkg/analyzer/test/error/error_test.dart b/pkg/analyzer/test/error/error_test.dart
index afad0dc..0cce128 100644
--- a/pkg/analyzer/test/error/error_test.dart
+++ b/pkg/analyzer/test/error/error_test.dart
@@ -37,7 +37,7 @@
if (declaration is ClassDeclaration) {
var extendsClause = declaration.extendsClause;
if (extendsClause != null &&
- extendsClause.superclass.name.name == 'ErrorCode') {
+ extendsClause.superclass2.name.name == 'ErrorCode') {
String className = declaration.name.name;
for (ClassMember member in declaration.members) {
if (member is FieldDeclaration && member.isStatic) {
diff --git a/pkg/analyzer/test/generated/class_member_parser_test.dart b/pkg/analyzer/test/generated/class_member_parser_test.dart
index fe8509a..28b8faf 100644
--- a/pkg/analyzer/test/generated/class_member_parser_test.dart
+++ b/pkg/analyzer/test/generated/class_member_parser_test.dart
@@ -1137,7 +1137,7 @@
expect(constructor.separator!.type, TokenType.EQ);
expect(constructor.initializers, isEmpty);
expect(constructor.redirectedConstructor, isNotNull);
- expect(constructor.redirectedConstructor!.type.name.name, 'prefix.B');
+ expect(constructor.redirectedConstructor!.type2.name.name, 'prefix.B');
expect(constructor.redirectedConstructor!.period!.type, TokenType.PERIOD);
expect(constructor.redirectedConstructor!.name!.name, 'foo');
expect(constructor.body, isEmptyFunctionBody);
@@ -1187,7 +1187,7 @@
expect(constructor.separator!.type, TokenType.EQ);
expect(constructor.initializers, isEmpty);
expect(constructor.redirectedConstructor, isNotNull);
- expect(constructor.redirectedConstructor!.type.name.name, 'B');
+ expect(constructor.redirectedConstructor!.type2.name.name, 'B');
expect(constructor.redirectedConstructor!.period, isNull);
expect(constructor.redirectedConstructor!.name, isNull);
expect(constructor.body, isEmptyFunctionBody);
diff --git a/pkg/analyzer/test/generated/expression_parser_test.dart b/pkg/analyzer/test/generated/expression_parser_test.dart
index c077772..356ecc9 100644
--- a/pkg/analyzer/test/generated/expression_parser_test.dart
+++ b/pkg/analyzer/test/generated/expression_parser_test.dart
@@ -671,7 +671,7 @@
expect(instanceCreation.keyword, isNotNull);
ConstructorName name = instanceCreation.constructorName;
expect(name, isNotNull);
- expect(name.type, isNotNull);
+ expect(name.type2, isNotNull);
expect(name.period, isNull);
expect(name.name, isNull);
expect(instanceCreation.argumentList, isNotNull);
@@ -1044,7 +1044,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type;
+ NamedType type = name.type2;
expect(type.name.name, 'A.B');
expect(type.typeArguments, isNull);
expect(name.period, isNull);
@@ -1061,7 +1061,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type;
+ NamedType type = name.type2;
expect(type, isNotNull);
expect(type.typeArguments, isNull);
expect(name.period, isNotNull);
@@ -1079,7 +1079,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type;
+ NamedType type = name.type2;
expect(type, isNotNull);
expect(type.typeArguments!.arguments, hasLength(1));
expect(name.period, isNotNull);
@@ -1096,7 +1096,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type;
+ NamedType type = name.type2;
expect(type, isNotNull);
expect(type.typeArguments!.arguments, hasLength(1));
expect(name.period, isNull);
@@ -1113,7 +1113,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type;
+ NamedType type = name.type2;
expect(type, isNotNull);
expect(type.typeArguments, isNull);
expect(name.period, isNull);
@@ -1130,7 +1130,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type;
+ NamedType type = name.type2;
expect(type, isNotNull);
expect(type.typeArguments, isNull);
expect(name.period, isNull);
@@ -1147,7 +1147,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type;
+ NamedType type = name.type2;
expect(type, isNotNull);
expect(type.typeArguments!.arguments, hasLength(1));
expect(name.period, isNotNull);
@@ -1164,7 +1164,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type;
+ NamedType type = name.type2;
expect(type, isNotNull);
expect(type.typeArguments, isNull);
expect(name.period, isNotNull);
@@ -1182,7 +1182,7 @@
expect(expression.keyword!.keyword, Keyword.NEW);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- NamedType type = name.type;
+ NamedType type = name.type2;
expect(type, isNotNull);
expect(type.typeArguments!.arguments, hasLength(1));
expect(name.period, isNull);
@@ -1427,7 +1427,7 @@
expect(expression.keyword, isNotNull);
ConstructorName name = expression.constructorName;
expect(name, isNotNull);
- expect(name.type, isNotNull);
+ expect(name.type2, isNotNull);
expect(name.period, isNull);
expect(name.name, isNull);
expect(expression.argumentList, isNotNull);
@@ -1808,7 +1808,7 @@
var asExpression = expression as AsExpression;
expect(asExpression.expression, isNotNull);
expect(asExpression.asOperator, isNotNull);
- expect(asExpression.type, isTypeName);
+ expect(asExpression.type, isNamedType);
}
void test_parseRelationalExpression_as_simple() {
@@ -1818,7 +1818,7 @@
var asExpression = expression as AsExpression;
expect(asExpression.expression, isNotNull);
expect(asExpression.asOperator, isNotNull);
- expect(asExpression.type, isTypeName);
+ expect(asExpression.type, isNamedType);
}
void test_parseRelationalExpression_as_simple_function() {
@@ -1828,7 +1828,7 @@
var asExpression = expression as AsExpression;
expect(asExpression.expression, isNotNull);
expect(asExpression.asOperator, isNotNull);
- expect(asExpression.type, isTypeName);
+ expect(asExpression.type, isNamedType);
}
void test_parseRelationalExpression_is() {
diff --git a/pkg/analyzer/test/generated/formal_parameter_parser_test.dart b/pkg/analyzer/test/generated/formal_parameter_parser_test.dart
index cfab781..0b5d7b9 100644
--- a/pkg/analyzer/test/generated/formal_parameter_parser_test.dart
+++ b/pkg/analyzer/test/generated/formal_parameter_parser_test.dart
@@ -903,7 +903,7 @@
expect(parameters[0], isSimpleFormalParameter);
var required = parameters[0] as SimpleFormalParameter;
expect(required.identifier, isNull);
- expect(required.type, isTypeName);
+ expect(required.type, isNamedType);
expect((required.type as NamedType).name.name, 'A');
expect(parameters[1], isDefaultFormalParameter);
@@ -911,7 +911,7 @@
expect(named.identifier, isNotNull);
expect(named.parameter, isSimpleFormalParameter);
var simple = named.parameter as SimpleFormalParameter;
- expect(simple.type, isTypeName);
+ expect(simple.type, isNamedType);
expect((simple.type as NamedType).name.name, 'B');
}
diff --git a/pkg/analyzer/test/generated/function_reference_parser_test.dart b/pkg/analyzer/test/generated/function_reference_parser_test.dart
index 07f8755..2c0c918 100644
--- a/pkg/analyzer/test/generated/function_reference_parser_test.dart
+++ b/pkg/analyzer/test/generated/function_reference_parser_test.dart
@@ -113,7 +113,7 @@
parseExpression('f<a, b>.toString()', featureSet: constructorTearoffs)
as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var type = constructorName.type;
+ var type = constructorName.type2;
expect((type.name as SimpleIdentifier).name, 'f');
var typeArgs = type.typeArguments!.arguments;
expect(typeArgs, hasLength(2));
diff --git a/pkg/analyzer/test/generated/new_as_identifier_parser_test.dart b/pkg/analyzer/test/generated/new_as_identifier_parser_test.dart
index 9ce08a4..3f6571e 100644
--- a/pkg/analyzer/test/generated/new_as_identifier_parser_test.dart
+++ b/pkg/analyzer/test/generated/new_as_identifier_parser_test.dart
@@ -51,10 +51,10 @@
// type. Resolution will change the type to `D` and the name to `new` if
// appropriate.
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type.name as PrefixedIdentifier;
+ var typeName = constructorName.type2.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'C');
expect(typeName.identifier.name, 'new');
- expect(constructorName.type.typeArguments, isNull);
+ expect(constructorName.type2.typeArguments, isNull);
expect(constructorName.name, isNull);
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -64,9 +64,9 @@
parseExpression('const C<int>.new()', featureSet: constructorTearoffs)
as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type.name as SimpleIdentifier;
+ var typeName = constructorName.type2.name as SimpleIdentifier;
expect(typeName.name, 'C');
- expect(constructorName.type.typeArguments!.arguments, hasLength(1));
+ expect(constructorName.type2.typeArguments!.arguments, hasLength(1));
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -76,10 +76,10 @@
parseExpression('const prefix.C.new()', featureSet: constructorTearoffs)
as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type.name as PrefixedIdentifier;
+ var typeName = constructorName.type2.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'prefix');
expect(typeName.identifier.name, 'C');
- expect(constructorName.type.typeArguments, isNull);
+ expect(constructorName.type2.typeArguments, isNull);
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -89,10 +89,10 @@
'const prefix.C<int>.new()',
featureSet: constructorTearoffs) as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type.name as PrefixedIdentifier;
+ var typeName = constructorName.type2.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'prefix');
expect(typeName.identifier.name, 'C');
- expect(constructorName.type.typeArguments!.arguments, hasLength(1));
+ expect(constructorName.type2.typeArguments!.arguments, hasLength(1));
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -105,10 +105,10 @@
// type. Resolution will change the type to `D` and the name to `new` if
// appropriate.
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type.name as PrefixedIdentifier;
+ var typeName = constructorName.type2.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'C');
expect(typeName.identifier.name, 'new');
- expect(constructorName.type.typeArguments, isNull);
+ expect(constructorName.type2.typeArguments, isNull);
expect(constructorName.name, isNull);
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -118,9 +118,9 @@
parseExpression('new C<int>.new()', featureSet: constructorTearoffs)
as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type.name as SimpleIdentifier;
+ var typeName = constructorName.type2.name as SimpleIdentifier;
expect(typeName.name, 'C');
- expect(constructorName.type.typeArguments!.arguments, hasLength(1));
+ expect(constructorName.type2.typeArguments!.arguments, hasLength(1));
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -130,10 +130,10 @@
parseExpression('new prefix.C.new()', featureSet: constructorTearoffs)
as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type.name as PrefixedIdentifier;
+ var typeName = constructorName.type2.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'prefix');
expect(typeName.identifier.name, 'C');
- expect(constructorName.type.typeArguments, isNull);
+ expect(constructorName.type2.typeArguments, isNull);
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -142,10 +142,10 @@
var instanceCreationExpression = parseExpression('new prefix.C<int>.new()',
featureSet: constructorTearoffs) as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type.name as PrefixedIdentifier;
+ var typeName = constructorName.type2.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'prefix');
expect(typeName.identifier.name, 'C');
- expect(constructorName.type.typeArguments!.arguments, hasLength(1));
+ expect(constructorName.type2.typeArguments!.arguments, hasLength(1));
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -166,9 +166,9 @@
parseExpression('C<int>.new()', featureSet: constructorTearoffs)
as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type.name as SimpleIdentifier;
+ var typeName = constructorName.type2.name as SimpleIdentifier;
expect(typeName.name, 'C');
- expect(constructorName.type.typeArguments!.arguments, hasLength(1));
+ expect(constructorName.type2.typeArguments!.arguments, hasLength(1));
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -190,10 +190,10 @@
parseExpression('prefix.C<int>.new()', featureSet: constructorTearoffs)
as InstanceCreationExpression;
var constructorName = instanceCreationExpression.constructorName;
- var typeName = constructorName.type.name as PrefixedIdentifier;
+ var typeName = constructorName.type2.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'prefix');
expect(typeName.identifier.name, 'C');
- expect(constructorName.type.typeArguments!.arguments, hasLength(1));
+ expect(constructorName.type2.typeArguments!.arguments, hasLength(1));
expect(constructorName.name!.name, 'new');
expect(instanceCreationExpression.argumentList, isNotNull);
}
@@ -349,10 +349,10 @@
// type. Resolution will change the type to `D` and the name to `new` if
// appropriate.
var redirectedConstructor = constructorDeclaration.redirectedConstructor!;
- var typeName = redirectedConstructor.type.name as PrefixedIdentifier;
+ var typeName = redirectedConstructor.type2.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'D');
expect(typeName.identifier.name, 'new');
- expect(redirectedConstructor.type.typeArguments, isNull);
+ expect(redirectedConstructor.type2.typeArguments, isNull);
expect(redirectedConstructor.name, isNull);
}
@@ -367,9 +367,9 @@
classDeclaration.members.single as ConstructorDeclaration;
expect(constructorDeclaration.initializers, isEmpty);
var redirectedConstructor = constructorDeclaration.redirectedConstructor!;
- var typeName = redirectedConstructor.type.name as SimpleIdentifier;
+ var typeName = redirectedConstructor.type2.name as SimpleIdentifier;
expect(typeName.name, 'D');
- expect(redirectedConstructor.type.typeArguments!.arguments, hasLength(1));
+ expect(redirectedConstructor.type2.typeArguments!.arguments, hasLength(1));
expect(redirectedConstructor.name!.name, 'new');
}
@@ -384,10 +384,10 @@
classDeclaration.members.single as ConstructorDeclaration;
expect(constructorDeclaration.initializers, isEmpty);
var redirectedConstructor = constructorDeclaration.redirectedConstructor!;
- var typeName = redirectedConstructor.type.name as PrefixedIdentifier;
+ var typeName = redirectedConstructor.type2.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'prefix');
expect(typeName.identifier.name, 'D');
- expect(redirectedConstructor.type.typeArguments, isNull);
+ expect(redirectedConstructor.type2.typeArguments, isNull);
expect(redirectedConstructor.name!.name, 'new');
}
@@ -402,10 +402,10 @@
classDeclaration.members.single as ConstructorDeclaration;
expect(constructorDeclaration.initializers, isEmpty);
var redirectedConstructor = constructorDeclaration.redirectedConstructor!;
- var typeName = redirectedConstructor.type.name as PrefixedIdentifier;
+ var typeName = redirectedConstructor.type2.name as PrefixedIdentifier;
expect(typeName.prefix.name, 'prefix');
expect(typeName.identifier.name, 'D');
- expect(redirectedConstructor.type.typeArguments!.arguments, hasLength(1));
+ expect(redirectedConstructor.type2.typeArguments!.arguments, hasLength(1));
expect(redirectedConstructor.name!.name, 'new');
}
diff --git a/pkg/analyzer/test/generated/parser_test_base.dart b/pkg/analyzer/test/generated/parser_test_base.dart
index aa56d56..aed3955 100644
--- a/pkg/analyzer/test/generated/parser_test_base.dart
+++ b/pkg/analyzer/test/generated/parser_test_base.dart
@@ -944,7 +944,7 @@
}
@override
- TypeName parseTypeName(bool inExpression) {
+ NamedType parseTypeName(bool inExpression) {
return _run('unspecified', () => super.parseTypeName(inExpression));
}
diff --git a/pkg/analyzer/test/generated/recovery_parser_test.dart b/pkg/analyzer/test/generated/recovery_parser_test.dart
index dd2b25d..1ae179e 100644
--- a/pkg/analyzer/test/generated/recovery_parser_test.dart
+++ b/pkg/analyzer/test/generated/recovery_parser_test.dart
@@ -1468,7 +1468,7 @@
var expression =
parseExpression("x is", codes: [ParserErrorCode.EXPECTED_TYPE_NAME])
as IsExpression;
- expect(expression.type, isTypeName);
+ expect(expression.type, isNamedType);
expect(expression.type.isSynthetic, isTrue);
}
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 6cf3730..e53b5e8 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -199,6 +199,19 @@
void visitLibraryIdentifier(LibraryIdentifier node) {}
@override
+ void visitNamedType(NamedType node) {
+ // Note: do not visit children from this node, the child SimpleIdentifier in
+ // TypeName (i.e. "String") does not have a static type defined.
+ // TODO(brianwilkerson) Not visiting the children means that we won't catch
+ // type arguments that were not resolved.
+ if (node.type == null) {
+ _unresolvedTypes.add(node);
+ } else {
+ _resolvedTypeCount++;
+ }
+ }
+
+ @override
void visitPrefixedIdentifier(PrefixedIdentifier node) {
// In cases where we have a prefixed identifier where the prefix is dynamic,
// we don't want to assert that the node will have a type.
@@ -243,19 +256,6 @@
super.visitTypeAnnotation(node);
}
- @override
- void visitTypeName(TypeName node) {
- // Note: do not visit children from this node, the child SimpleIdentifier in
- // TypeName (i.e. "String") does not have a static type defined.
- // TODO(brianwilkerson) Not visiting the children means that we won't catch
- // type arguments that were not resolved.
- if (node.type == null) {
- _unresolvedTypes.add(node);
- } else {
- _resolvedTypeCount++;
- }
- }
-
String _getFileName(AstNode? node) {
// TODO (jwren) there are two copies of this method, one here and one in
// ResolutionVerifier, they should be resolved into a single method
diff --git a/pkg/analyzer/test/generated/simple_parser_test.dart b/pkg/analyzer/test/generated/simple_parser_test.dart
index 830df2d..f96e112 100644
--- a/pkg/analyzer/test/generated/simple_parser_test.dart
+++ b/pkg/analyzer/test/generated/simple_parser_test.dart
@@ -1171,7 +1171,7 @@
ConstructorName name = parseConstructorName('A.n');
expectNotNullIfNoErrors(name);
assertNoErrors();
- expect(name.type, isNotNull);
+ expect(name.type2, isNotNull);
expect(name.period, isNull);
expect(name.name, isNull);
}
@@ -1180,7 +1180,7 @@
ConstructorName name = parseConstructorName('p.A.n');
expectNotNullIfNoErrors(name);
assertNoErrors();
- expect(name.type, isNotNull);
+ expect(name.type2, isNotNull);
expect(name.period, isNotNull);
expect(name.name, isNotNull);
}
@@ -1189,7 +1189,7 @@
ConstructorName name = parseConstructorName('A');
expectNotNullIfNoErrors(name);
assertNoErrors();
- expect(name.type, isNotNull);
+ expect(name.type2, isNotNull);
expect(name.period, isNull);
expect(name.name, isNull);
}
@@ -1198,7 +1198,7 @@
ConstructorName name = parseConstructorName('p.A');
expectNotNullIfNoErrors(name);
assertNoErrors();
- expect(name.type, isNotNull);
+ expect(name.type2, isNotNull);
expect(name.period, isNull);
expect(name.name, isNull);
}
@@ -1246,8 +1246,8 @@
expectNotNullIfNoErrors(clause);
assertNoErrors();
expect(clause.extendsKeyword, isNotNull);
- expect(clause.superclass, isNotNull);
- expect(clause.superclass, isTypeName);
+ expect(clause.superclass2, isNotNull);
+ expect(clause.superclass2, isNamedType);
}
void test_parseFunctionBody_block() {
@@ -1432,7 +1432,7 @@
var creation = body.expression as InstanceCreationExpressionImpl;
expect(creation.keyword, isNull);
ConstructorName constructorName = creation.constructorName;
- expect(constructorName.type.toSource(), 'C<E>');
+ expect(constructorName.type2.toSource(), 'C<E>');
expect(constructorName.period, isNotNull);
expect(constructorName.name, isNotNull);
expect(creation.argumentList, isNotNull);
@@ -1467,7 +1467,7 @@
var creation = body.expression as InstanceCreationExpression;
expect(creation.keyword, isNull);
ConstructorName constructorName = creation.constructorName;
- expect(constructorName.type.toSource(), 'p.C<E>');
+ expect(constructorName.type2.toSource(), 'p.C<E>');
expect(constructorName.period, isNotNull);
expect(constructorName.name, isNotNull);
expect(creation.argumentList, isNotNull);
@@ -1604,13 +1604,13 @@
expect(parameters[0], isSimpleFormalParameter);
var parameter = parameters[0] as SimpleFormalParameter;
expect(parameter.identifier, isNull);
- expect(parameter.type, isTypeName);
+ expect(parameter.type, isNamedType);
expect((parameter.type as NamedType).name.name, 'int');
expect(parameters[1], isSimpleFormalParameter);
parameter = parameters[1] as SimpleFormalParameter;
expect(parameter.identifier, isNull);
- expect(parameter.type, isTypeName);
+ expect(parameter.type, isNamedType);
expect((parameter.type as NamedType).name.name, 'int');
}
@@ -1690,14 +1690,14 @@
var parameter = parameters[0] as SimpleFormalParameter;
expect(parameter.identifier, isNotNull);
expect(parameter.identifier!.name, 's');
- expect(parameter.type, isTypeName);
+ expect(parameter.type, isNamedType);
expect((parameter.type as NamedType).name.name, 'String');
expect(parameters[1], isSimpleFormalParameter);
parameter = parameters[1] as SimpleFormalParameter;
expect(parameter.identifier, isNotNull);
expect(parameter.identifier!.name, 'i');
- expect(parameter.type, isTypeName);
+ expect(parameter.type, isNamedType);
expect((parameter.type as NamedType).name.name, 'int');
}
@@ -1892,7 +1892,7 @@
TypeParameter parameter = parser.parseTypeParameter();
expectNotNullIfNoErrors(parameter);
assertNoErrors();
- expect(parameter.bound, isTypeName);
+ expect(parameter.bound, isNamedType);
expect(parameter.extendsKeyword, isNotNull);
expect(parameter.name, isNotNull);
}
@@ -1902,7 +1902,7 @@
TypeParameter parameter = parser.parseTypeParameter();
expectNotNullIfNoErrors(parameter);
assertNoErrors();
- expect(parameter.bound, isTypeName);
+ expect(parameter.bound, isNamedType);
expect(parameter.extendsKeyword, isNotNull);
expect(parameter.name, isNotNull);
}
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index e724509..11b6ce1 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -372,7 +372,7 @@
var exp = stmt.expression as InstanceCreationExpression;
ClassElement elementB = AstFinder.getClass(unit, "B").declaredElement!;
ClassElement elementA = AstFinder.getClass(unit, "A").declaredElement!;
- expect(exp.constructorName.type.typeOrThrow.element, elementB);
+ expect(exp.constructorName.type2.typeOrThrow.element, elementB);
_isInstantiationOf(_hasElement(elementB))([
_isType(elementA.typeParameters[0]
.instantiate(nullabilitySuffix: NullabilitySuffix.star))
@@ -2372,7 +2372,7 @@
var bConstructor = b.members[0] as ConstructorDeclaration;
var redirected = bConstructor.redirectedConstructor as ConstructorName;
- var typeName = redirected.type;
+ var typeName = redirected.type2;
assertType(typeName.type, 'A<T2, U2>');
assertType(typeName.type, 'A<T2, U2>');
@@ -2408,7 +2408,7 @@
var bConstructor = b.members[0] as ConstructorDeclaration;
var redirected = bConstructor.redirectedConstructor as ConstructorName;
- var typeName = redirected.type;
+ var typeName = redirected.type2;
assertType(typeName.type, 'A<T2, U2>');
assertType(typeName.type, 'A<T2, U2>');
diff --git a/pkg/analyzer/test/generated/top_level_parser_test.dart b/pkg/analyzer/test/generated/top_level_parser_test.dart
index 533a43e..bde8059 100644
--- a/pkg/analyzer/test/generated/top_level_parser_test.dart
+++ b/pkg/analyzer/test/generated/top_level_parser_test.dart
@@ -935,7 +935,7 @@
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.equals, isNotNull);
expect(typeAlias.abstractKeyword, isNotNull);
- expect(typeAlias.superclass.name.name, "S");
+ expect(typeAlias.superclass2.name.name, "S");
expect(typeAlias.withClause, isNotNull);
expect(typeAlias.implementsClause, isNull);
expect(typeAlias.semicolon, isNotNull);
@@ -953,7 +953,7 @@
expect(typeAlias.typeParameters!.typeParameters, hasLength(1));
expect(typeAlias.equals, isNotNull);
expect(typeAlias.abstractKeyword, isNull);
- expect(typeAlias.superclass.name.name, "S");
+ expect(typeAlias.superclass2.name.name, "S");
expect(typeAlias.withClause, isNotNull);
expect(typeAlias.implementsClause, isNotNull);
expect(typeAlias.semicolon, isNotNull);
@@ -971,7 +971,7 @@
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.equals, isNotNull);
expect(typeAlias.abstractKeyword, isNull);
- expect(typeAlias.superclass.name.name, "S");
+ expect(typeAlias.superclass2.name.name, "S");
expect(typeAlias.withClause, isNotNull);
expect(typeAlias.implementsClause, isNotNull);
expect(typeAlias.semicolon, isNotNull);
@@ -989,7 +989,7 @@
expect(typeAlias.typeParameters, isNull);
expect(typeAlias.equals, isNotNull);
expect(typeAlias.abstractKeyword, isNull);
- expect(typeAlias.superclass.name.name, "S");
+ expect(typeAlias.superclass2.name.name, "S");
expect(typeAlias.withClause, isNotNull);
expect(typeAlias.implementsClause, isNull);
expect(typeAlias.semicolon, isNotNull);
diff --git a/pkg/analyzer/test/generated/utilities_test.dart b/pkg/analyzer/test/generated/utilities_test.dart
index 4327899..0cbba91c 100644
--- a/pkg/analyzer/test/generated/utilities_test.dart
+++ b/pkg/analyzer/test/generated/utilities_test.dart
@@ -266,7 +266,7 @@
class Getter_NodeReplacerTest_test_classTypeAlias
implements NodeReplacerTest_Getter<ClassTypeAlias, NamedType> {
@override
- NamedType get(ClassTypeAlias node) => node.superclass;
+ NamedType get(ClassTypeAlias node) => node.superclass2;
}
class Getter_NodeReplacerTest_test_classTypeAlias_2
@@ -374,7 +374,7 @@
class Getter_NodeReplacerTest_test_constructorName
implements NodeReplacerTest_Getter<ConstructorName, NamedType> {
@override
- NamedType get(ConstructorName node) => node.type;
+ NamedType get(ConstructorName node) => node.type2;
}
class Getter_NodeReplacerTest_test_constructorName_2
@@ -454,7 +454,7 @@
class Getter_NodeReplacerTest_test_extendsClause
implements NodeReplacerTest_Getter<ExtendsClause, NamedType> {
@override
- NamedType get(ExtendsClause node) => node.superclass;
+ NamedType get(ExtendsClause node) => node.superclass2;
}
class Getter_NodeReplacerTest_test_fieldDeclaration
diff --git a/pkg/analyzer/test/id_tests/inferred_type_arguments_test.dart b/pkg/analyzer/test/id_tests/inferred_type_arguments_test.dart
index 2ba48a6..7401b6c 100644
--- a/pkg/analyzer/test/id_tests/inferred_type_arguments_test.dart
+++ b/pkg/analyzer/test/id_tests/inferred_type_arguments_test.dart
@@ -55,9 +55,9 @@
TypeArgumentList? typeArguments;
List<DartType> typeArgumentTypes;
if (node is InstanceCreationExpression) {
- typeArguments = node.constructorName.type.typeArguments;
+ typeArguments = node.constructorName.type2.typeArguments;
typeArgumentTypes =
- (node.constructorName.type.type as InterfaceType).typeArguments;
+ (node.constructorName.type2.type as InterfaceType).typeArguments;
} else if (node is InvocationExpression) {
typeArguments = node.typeArguments;
typeArgumentTypes = node.typeArgumentTypes!;
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
index d2da736..65e9392 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_resolution_test.dart
@@ -670,7 +670,7 @@
var constructorName = constC.constructorName;
expect(constructorName.staticElement, constructorC);
- expect(constructorName.type.type, interfaceTypeNone(elementC));
+ expect(constructorName.type2.type, interfaceTypeNone(elementC));
}
test_annotation_unprefixed_topLevelVariable() async {
@@ -1309,7 +1309,7 @@
var constructorName = constructor.redirectedConstructor!;
expect(constructorName.staticElement, same(aUnnamed));
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.type, interfaceTypeNone(aElement));
var identifier = namedType.name as SimpleIdentifier;
@@ -1329,7 +1329,7 @@
var constructorName = constructor.redirectedConstructor!;
expect(constructorName.staticElement, same(aNamed));
- var namedType = constructorName.type;
+ var namedType = constructorName.type2;
expect(namedType.type, interfaceTypeNone(aElement));
var identifier = namedType.name as SimpleIdentifier;
@@ -1378,7 +1378,7 @@
var constructorName = constructor.redirectedConstructor!;
expect(constructorName.staticElement, same(actualMember));
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.type, auType);
var identifier = namedType.name as SimpleIdentifier;
@@ -1400,7 +1400,7 @@
var constructorName = constructor.redirectedConstructor!;
expect(constructorName.staticElement, same(actualMember));
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.type, auType);
var identifier = namedType.name as SimpleIdentifier;
@@ -2077,7 +2077,7 @@
expect(constructorName.name, isNull);
expect(constructorName.staticElement, defaultConstructor);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.typeArguments, isNull);
Identifier typeIdentifier = namedType.name;
@@ -2095,7 +2095,7 @@
expect(constructorName.staticElement, namedConstructor);
expect(constructorName.name!.staticType, isNull);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.typeArguments, isNull);
var typeIdentifier = namedType.name as SimpleIdentifier;
@@ -2130,7 +2130,7 @@
expect(constructorName.name, isNull);
expect(constructorName.staticElement, constructorElement);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.typeArguments, isNull);
Identifier typeIdentifier = namedType.name;
@@ -2171,7 +2171,7 @@
expect(constructorName.name, isNull);
expect(constructorName.staticElement, defaultConstructor);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.typeArguments, isNull);
Identifier typeIdentifier = namedType.name;
@@ -2193,7 +2193,7 @@
expect(constructorName.name!.staticElement, namedConstructor);
expect(constructorName.name!.staticType, isNull);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.typeArguments, isNull);
var typeIdentifier = namedType.name as SimpleIdentifier;
@@ -2245,7 +2245,7 @@
expect(constructorName.name, isNull);
expect(constructorName.staticElement, defaultConstructor);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.typeArguments, isNull);
var typeIdentifier = namedType.name as PrefixedIdentifier;
@@ -2275,7 +2275,7 @@
expect(constructorName.name!.staticType, isNull);
expect(constructorName.staticElement, namedConstructor);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.typeArguments, isNull);
var typeIdentifier = namedType.name as PrefixedIdentifier;
@@ -2305,7 +2305,7 @@
expect(constructorName.name!.staticType, isNull);
expect(constructorName.staticElement, namedConstructor);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.typeArguments!.arguments, hasLength(1));
_assertTypeNameSimple(
namedType.typeArguments!.arguments[0], typeProvider.boolType);
@@ -2360,7 +2360,7 @@
expect(constructorName.name, isNull);
expect(constructorName.staticElement, defaultConstructor);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.typeArguments, isNull);
var typeIdentifier = namedType.name as SimpleIdentifier;
@@ -2382,7 +2382,7 @@
expect(constructorName.name, isNull);
expect(constructorName.staticElement, defaultConstructor);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.typeArguments!.arguments, hasLength(1));
_assertTypeNameSimple(
namedType.typeArguments!.arguments[0], typeProvider.boolType);
@@ -2407,7 +2407,7 @@
expect(constructorName.name!.staticType, isNull);
expect(constructorName.staticElement, namedConstructor);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.typeArguments, isNull);
var typeIdentifier = namedType.name as SimpleIdentifier;
@@ -2430,7 +2430,7 @@
expect(constructorName.name!.staticType, isNull);
expect(constructorName.staticElement, namedConstructor);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.typeArguments!.arguments, hasLength(1));
_assertTypeNameSimple(
namedType.typeArguments!.arguments[0], typeProvider.boolType);
@@ -2462,7 +2462,7 @@
assertMember(creation, defaultConstructor, {'K': 'int', 'V': 'double'});
assertType(creation, 'C<int, double>');
- var namedType = creation.constructorName.type;
+ var namedType = creation.constructorName.type2;
assertNamedType(namedType, cElement, 'C<int, double>');
var typeArguments = namedType.typeArguments!.arguments;
@@ -2481,7 +2481,7 @@
assertMember(creation, namedConstructor, {'K': 'num', 'V': 'String'});
assertType(creation, 'C<num, String>');
- var namedType = creation.constructorName.type;
+ var namedType = creation.constructorName.type2;
assertNamedType(namedType, cElement, 'C<num, String>');
var typeArguments = namedType.typeArguments!.arguments;
@@ -3077,7 +3077,7 @@
ConstructorName constructorName = creation.constructorName;
expect(constructorName.name, isNull);
- NamedType type = constructorName.type;
+ NamedType type = constructorName.type2;
expect(type.typeArguments, isNull);
assertElement(type.name, c);
assertTypeNull(type.name);
@@ -3094,7 +3094,7 @@
ConstructorName constructorName = creation.constructorName;
expect(constructorName.name!.name, 'named');
- NamedType type = constructorName.type;
+ NamedType type = constructorName.type2;
expect(type.typeArguments, isNull);
assertElement(type.name, c);
assertType(type.name, 'C<bool>');
@@ -3111,7 +3111,7 @@
ConstructorName constructorName = creation.constructorName;
expect(constructorName.name!.name, 'named2');
- NamedType type = constructorName.type;
+ NamedType type = constructorName.type2;
assertTypeArguments(type.typeArguments!, [doubleType]);
assertElement(type.name, c);
assertType(type.name, 'C<double>');
@@ -5622,7 +5622,7 @@
assertElement(creation, c.unnamedConstructor);
assertType(creation, 'C');
- assertNamedType(creation.constructorName.type, c, 'C');
+ assertNamedType(creation.constructorName.type2, c, 'C');
}
{
@@ -5631,7 +5631,7 @@
assertElement(creation, namedConstructor);
assertType(creation, 'C');
- assertNamedType(creation.constructorName.type, c, 'C');
+ assertNamedType(creation.constructorName.type2, c, 'C');
assertElement(creation.constructorName.name, namedConstructor);
}
}
@@ -5658,7 +5658,7 @@
assertElement(creation, c.unnamedConstructor);
assertType(creation, 'C');
- assertNamedType(creation.constructorName.type, c, 'C',
+ assertNamedType(creation.constructorName.type2, c, 'C',
expectedPrefix: import.prefix);
}
@@ -5668,7 +5668,7 @@
assertElement(creation, namedConstructor);
assertType(creation, 'C');
- assertNamedType(creation.constructorName.type, c, 'C',
+ assertNamedType(creation.constructorName.type2, c, 'C',
expectedPrefix: import.prefix);
assertElement(creation.constructorName.name, namedConstructor);
}
@@ -5692,7 +5692,7 @@
assertMember(creation, c.unnamedConstructor!, {'T': 'int'});
assertType(creation, 'C<int>');
- assertNamedType(creation.constructorName.type, c, 'C<int>');
+ assertNamedType(creation.constructorName.type2, c, 'C<int>');
assertNamedType(findNode.namedType('int>'), intElement, 'int');
}
@@ -5702,7 +5702,7 @@
assertMember(creation, namedConstructor, {'T': 'String'});
assertType(creation, 'C<String>');
- assertNamedType(creation.constructorName.type, c, 'C<String>');
+ assertNamedType(creation.constructorName.type2, c, 'C<String>');
assertNamedType(findNode.namedType('String>'), stringElement, 'String');
assertMember(
@@ -6949,7 +6949,7 @@
nullabilitySuffix: NullabilitySuffix.none,
);
- NamedType superClass = dNode.extendsClause!.superclass;
+ NamedType superClass = dNode.extendsClause!.superclass2;
expect(superClass.type, expectedType);
var identifier = superClass.name as SimpleIdentifier;
@@ -7018,7 +7018,7 @@
nullabilitySuffix: NullabilitySuffix.none,
);
- NamedType superClass = dNode.superclass;
+ NamedType superClass = dNode.superclass2;
expect(superClass.type, expectedType);
var identifier = superClass.name as SimpleIdentifier;
@@ -7951,7 +7951,7 @@
ConstructorName constructorName = creation.constructorName;
expect(constructorName.name, isNull);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.type, isDynamicType);
var typeIdentifier = namedType.name as SimpleIdentifier;
@@ -7983,7 +7983,7 @@
ConstructorName constructorName = creation.constructorName;
expect(constructorName.name, isNull);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.type, isDynamicType);
var typePrefixed = namedType.name as PrefixedIdentifier;
@@ -8027,7 +8027,7 @@
ConstructorName constructorName = creation.constructorName;
expect(constructorName.name, isNull);
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.type, isDynamicType);
var typePrefixed = namedType.name as PrefixedIdentifier;
@@ -8065,7 +8065,7 @@
ConstructorName constructorName = creation.constructorName;
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.type, isDynamicType);
var typePrefixed = namedType.name as PrefixedIdentifier;
@@ -8111,7 +8111,7 @@
ConstructorName constructorName = creation.constructorName;
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
expect(namedType.type, isDynamicType);
var typePrefixed = namedType.name as PrefixedIdentifier;
@@ -8158,7 +8158,7 @@
ConstructorName constructorName = creation.constructorName;
- NamedType namedType = constructorName.type;
+ NamedType namedType = constructorName.type2;
assertType(namedType, 'Random');
var typePrefixed = namedType.name as PrefixedIdentifier;
@@ -8627,7 +8627,7 @@
var constructorElement = classElement.unnamedConstructor;
expect(constructorName.staticElement, constructorElement);
- var namedType = constructorName.type;
+ var namedType = constructorName.type2;
expect(namedType.typeArguments, isNull);
var typeIdentifier = namedType.name as SimpleIdentifier;
diff --git a/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart b/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
index e8c7840..8a4401f 100644
--- a/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/ast_rewrite_test.dart
@@ -197,7 +197,7 @@
expectedSubstitution: {'T': 'int'},
);
_assertTypeArgumentList(
- creation.constructorName.type.typeArguments,
+ creation.constructorName.type2.typeArguments,
['int'],
);
expect((creation as InstanceCreationExpressionImpl).typeArguments, isNull);
diff --git a/pkg/analyzer/test/src/dart/resolution/mixin_test.dart b/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
index 3a5ac26..93fa507 100644
--- a/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
@@ -814,7 +814,7 @@
var creation = findNode.instanceCreation('M.named();');
var m = findElement.mixin('M');
- assertElement(creation.constructorName.type.name, m);
+ assertElement(creation.constructorName.type2.name, m);
}
test_error_onClause_deferredClass() async {
diff --git a/pkg/analyzer/test/src/dart/resolution/optional_const_test.dart b/pkg/analyzer/test/src/dart/resolution/optional_const_test.dart
index daa949c..93e9187 100644
--- a/pkg/analyzer/test/src/dart/resolution/optional_const_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/optional_const_test.dart
@@ -132,7 +132,7 @@
var constructorName = creation.constructorName;
- var typeName = constructorName.type;
+ var typeName = constructorName.type2;
assertType(typeName, 'C<int>');
var pC = typeName.name as PrefixedIdentifier;
diff --git a/pkg/analyzer/test/src/dart/resolution/resolution.dart b/pkg/analyzer/test/src/dart/resolution/resolution.dart
index 5f835d6..9daf620 100644
--- a/pkg/analyzer/test/src/dart/resolution/resolution.dart
+++ b/pkg/analyzer/test/src/dart/resolution/resolution.dart
@@ -181,7 +181,7 @@
assertElement(node, expectedConstructorElement);
assertType(node, expectedType);
- var namedType = node.constructorName.type;
+ var namedType = node.constructorName.type2;
expectedTypeNameElement ??= expectedClassElement;
assertNamedType(namedType, expectedTypeNameElement, null,
expectedPrefix: expectedPrefix);
@@ -461,7 +461,7 @@
assertType(creation, expectedType);
- var namedType = creation.constructorName.type;
+ var namedType = creation.constructorName.type2;
expectedTypeNameElement ??= expectedClassElement;
assertNamedType(namedType, expectedTypeNameElement, expectedType,
expectedPrefix: expectedPrefix);
@@ -828,7 +828,7 @@
TypeLiteral node, Element? expectedElement, String expectedType,
{Element? expectedPrefix}) {
assertType(node, 'Type');
- assertNamedType(node.typeName, expectedElement, expectedType,
+ assertNamedType(node.type, expectedElement, expectedType,
expectedPrefix: expectedPrefix);
}
diff --git a/pkg/analyzer/test/src/diagnostics/const_with_type_parameters_test.dart b/pkg/analyzer/test/src/diagnostics/const_with_type_parameters_test.dart
index 6df3560..6b02405 100644
--- a/pkg/analyzer/test/src/diagnostics/const_with_type_parameters_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/const_with_type_parameters_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:analyzer/src/error/codes.dart';
+import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../dart/resolution/context_collection_resolution.dart';
@@ -10,6 +11,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ConstWithTypeParametersConstructorTearoffTest);
+ defineReflectiveTests(ConstWithTypeParametersFunctionTearoffTest);
defineReflectiveTests(ConstWithTypeParametersTest);
});
}
@@ -84,6 +86,71 @@
}
@reflectiveTest
+class ConstWithTypeParametersFunctionTearoffTest
+ extends PubPackageResolutionTest {
+ @FailingTest(
+ reason: 'The default value of an optional parameter is not considered a '
+ '"constant context". Currently only ConstantVerifier checks '
+ 'CONST_WITH_TYPE_PARAMETERS (and related) errors, and only for '
+ 'constant contexts. These checks should probably be moved to '
+ 'ConstantVisitor (evaluation.dart), so as to check all expressions '
+ 'expected to be constant expressions. Another example of a missing '
+ 'error is a field initializer in a class with a constant constructor.',
+ )
+ test_defaultValue() async {
+ addTestFile('''
+void f<T>(T a) {}
+class A<U> {
+ void m([void Function(U) fn = f<U>]) {}
+}
+''');
+ await resolveTestFile();
+ expect(result.errors, isNotEmpty);
+ }
+
+ test_direct() async {
+ await assertErrorsInCode('''
+void f<T>(T a) {}
+class A<U> {
+ void m() {
+ const c = f<U>;
+ }
+}
+''', [
+ error(HintCode.UNUSED_LOCAL_VARIABLE, 54, 1),
+ error(CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS_FUNCTION_TEAROFF,
+ 60, 1),
+ ]);
+ }
+
+ test_indirect() async {
+ await assertErrorsInCode('''
+void f<T>(T a) {}
+class A<U> {
+ void m() {
+ const c = f<List<U>>;
+ }
+}
+''', [
+ error(HintCode.UNUSED_LOCAL_VARIABLE, 54, 1),
+ error(CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS_FUNCTION_TEAROFF,
+ 65, 1),
+ ]);
+ }
+
+ test_nonConst() async {
+ await assertNoErrorsInCode('''
+void f<T>(T a) {}
+class A<U> {
+ void m() {
+ f<U>;
+ }
+}
+''');
+ }
+}
+
+@reflectiveTest
class ConstWithTypeParametersTest extends PubPackageResolutionTest {
test_direct() async {
await assertErrorsInCode('''
diff --git a/pkg/analyzer/test/src/diagnostics/unignorable_ignore_test.dart b/pkg/analyzer/test/src/diagnostics/unignorable_ignore_test.dart
index 07802b1..151e21f 100644
--- a/pkg/analyzer/test/src/diagnostics/unignorable_ignore_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/unignorable_ignore_test.dart
@@ -84,7 +84,7 @@
void registerNodeProcessors(
NodeLintRegistry registry, LinterContext context) {
final visitor = _AvoidIntVisitor(this);
- registry.addTypeName(this, visitor);
+ registry.addNamedType(this, visitor);
}
}
@@ -94,7 +94,7 @@
_AvoidIntVisitor(this.rule);
@override
- void visitTypeName(TypeName node) {
+ void visitNamedType(NamedType node) {
if (node.name.name == 'int') {
rule.reportLint(node.name);
}
diff --git a/pkg/analyzer/test/src/lint/project_test.dart b/pkg/analyzer/test/src/lint/project_test.dart
index 00e6361..0c0c8dc 100644
--- a/pkg/analyzer/test/src/lint/project_test.dart
+++ b/pkg/analyzer/test/src/lint/project_test.dart
@@ -4,7 +4,7 @@
import 'dart:io';
-import 'package:analyzer/src/dart/analysis/driver.dart';
+import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/src/lint/project.dart';
import 'package:test/test.dart';
@@ -18,7 +18,7 @@
// TODO(brianwilkerson) These tests fail on the bots because the cwd is
// not the same there as when we run tests locally.
group('cwd', () async {
- var project = await DartProject.create(_AnalysisDriverMock(), []);
+ var project = await DartProject.create(_AnalysisSessionMock(), []);
test('name', () {
expect(project.name, 'analyzer');
});
@@ -61,7 +61,7 @@
});
}
-class _AnalysisDriverMock implements AnalysisDriver {
+class _AnalysisSessionMock implements AnalysisSession {
@override
noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}
diff --git a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
index 5f7440a..2160b96 100644
--- a/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
+++ b/pkg/analyzer/test/src/summary/resolved_ast_printer.dart
@@ -361,7 +361,7 @@
properties.addNode('name', node.name);
properties.addToken('period', node.period);
properties.addElement('staticElement', node.staticElement);
- properties.addNode('type', node.type);
+ properties.addNode('type', node.type2);
_writeProperties(properties);
});
}
@@ -522,7 +522,7 @@
_writeln('ExtendsClause');
_withIndent(() {
var properties = _Properties();
- properties.addNode('superclass', node.superclass);
+ properties.addNode('superclass', node.superclass2);
_addAstNode(properties, node);
_writeProperties(properties);
});
@@ -1034,6 +1034,18 @@
}
@override
+ void visitNamedType(NamedType node) {
+ _writeNextCodeLine(node);
+ // TODO(scheglov) Change to NamedType.
+ _writeln('TypeName');
+ _withIndent(() {
+ _writeNode('name', node.name);
+ _writeType('type', node.type);
+ _writeNode('typeArguments', node.typeArguments);
+ });
+ }
+
+ @override
void visitNullLiteral(NullLiteral node) {
_writeNextCodeLine(node);
_writeln('NullLiteral');
@@ -1421,24 +1433,14 @@
_writeln('TypeLiteral');
_withIndent(() {
var properties = _Properties();
- properties.addNode('typeName', node.typeName);
+ // TODO(scheglov) Change to 'type'.
+ properties.addNode('typeName', node.type);
_addExpression(properties, node);
_writeProperties(properties);
});
}
@override
- void visitTypeName(TypeName node) {
- _writeNextCodeLine(node);
- _writeln('TypeName');
- _withIndent(() {
- _writeNode('name', node.name);
- _writeType('type', node.type);
- _writeNode('typeArguments', node.typeArguments);
- });
- }
-
- @override
void visitTypeParameter(TypeParameter node) {
_writeNextCodeLine(node);
_writeln('TypeParameter');
diff --git a/pkg/analyzer/test/util/ast_type_matchers.dart b/pkg/analyzer/test/util/ast_type_matchers.dart
index 71a811d..84567e1 100644
--- a/pkg/analyzer/test/util/ast_type_matchers.dart
+++ b/pkg/analyzer/test/util/ast_type_matchers.dart
@@ -275,8 +275,6 @@
const isTypedLiteral = TypeMatcher<TypedLiteral>();
-const isTypeName = TypeMatcher<TypeName>();
-
const isTypeParameter = TypeMatcher<TypeParameter>();
const isTypeParameterList = TypeMatcher<TypeParameterList>();
diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md
index 9a10697..b519644 100644
--- a/pkg/analyzer/tool/diagnostics/diagnostics.md
+++ b/pkg/analyzer/tool/diagnostics/diagnostics.md
@@ -2648,6 +2648,8 @@
_A constant creation can't use a type parameter as a type argument._
+_A constant function tearoff can't use a type parameter as a type argument._
+
#### Description
The analyzer produces this diagnostic when a type parameter is used as a
diff --git a/pkg/analyzer_plugin/lib/protocol/protocol_common.dart b/pkg/analyzer_plugin/lib/protocol/protocol_common.dart
index 65b6704..2e566d7 100644
--- a/pkg/analyzer_plugin/lib/protocol/protocol_common.dart
+++ b/pkg/analyzer_plugin/lib/protocol/protocol_common.dart
@@ -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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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,
+ );
}
diff --git a/pkg/analyzer_plugin/lib/protocol/protocol_generated.dart b/pkg/analyzer_plugin/lib/protocol/protocol_generated.dart
index 937d5c2..ac23e92 100644
--- a/pkg/analyzer_plugin/lib/protocol/protocol_generated.dart
+++ b/pkg/analyzer_plugin/lib/protocol/protocol_generated.dart
@@ -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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@override
- int get hashCode {
- return 779767607;
- }
+ int get hashCode => 779767607;
}
/// analysis.highlights params
@@ -631,12 +614,10 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@override
- int get hashCode {
- return 969645618;
- }
+ int get hashCode => 969645618;
}
/// analysis.setPriorityFiles params
@@ -1149,11 +1118,7 @@
}
@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 @@
}
@override
- int get hashCode {
- return 330050055;
- }
+ int get hashCode => 330050055;
}
/// analysis.setSubscriptions params
@@ -1252,11 +1215,7 @@
}
@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 @@
}
@override
- int get hashCode {
- return 218088493;
- }
+ int get hashCode => 218088493;
}
/// analysis.updateContent params
@@ -1356,11 +1313,7 @@
}
@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 @@
}
@override
- int get hashCode {
- return 468798730;
- }
+ int get hashCode => 468798730;
}
/// completion.getSuggestions params
@@ -1459,12 +1410,10 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@override
- int get hashCode {
- return 616032599;
- }
+ int get hashCode => 616032599;
}
/// convertGetterToMethod options
@@ -1701,9 +1644,7 @@
}
@override
- int get hashCode {
- return 488848400;
- }
+ int get hashCode => 488848400;
}
/// convertMethodToGetter feedback
@@ -1720,9 +1661,7 @@
}
@override
- int get hashCode {
- return 165291526;
- }
+ int get hashCode => 165291526;
}
/// convertMethodToGetter options
@@ -1739,9 +1678,7 @@
}
@override
- int get hashCode {
- return 27952290;
- }
+ int get hashCode => 27952290;
}
/// edit.getAssists params
@@ -1826,13 +1763,11 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@override
- int get hashCode {
- return 540364977;
- }
+ int get hashCode => 540364977;
}
/// inlineMethod feedback
@@ -3241,13 +3144,11 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@override
- int get hashCode {
- return 438975893;
- }
+ int get hashCode => 438975893;
}
/// moveFile options
@@ -3558,11 +3449,7 @@
}
@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 @@
}
@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 @@
}
@override
- int get hashCode {
- return 478064585;
- }
+ int get hashCode => 478064585;
}
/// plugin.shutdown result
@@ -3709,9 +3592,7 @@
}
@override
- int get hashCode {
- return 9389109;
- }
+ int get hashCode => 9389109;
}
/// plugin.versionCheck params
@@ -3802,13 +3683,11 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@override
- int get hashCode {
- var hash = 0;
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => 0;
}
/// RefactoringOptions
@@ -4091,10 +3963,7 @@
}
@override
- int get hashCode {
- var hash = 0;
- return JenkinsSmiHash.finish(hash);
- }
+ int get hashCode => 0;
}
/// rename feedback
@@ -4184,14 +4053,12 @@
}
@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 @@
}
@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 @@
}
@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 @@
}
@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
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 f7e9777..a9597f7 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
@@ -10,7 +10,6 @@
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 @@
// 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
diff --git a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
index 3a1b365..bc399fb 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/change_builder/change_builder_dart.dart
@@ -950,7 +950,7 @@
name = expression.methodName.name;
} else if (expression is InstanceCreationExpression) {
var constructorName = expression.constructorName;
- var typeName = constructorName.type;
+ var typeName = constructorName.type2;
var typeNameIdentifier = typeName.name;
// new ClassName()
if (typeNameIdentifier is SimpleIdentifier) {
diff --git a/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart b/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
index 0cfeba2..95d5833 100644
--- a/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
+++ b/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart
@@ -254,7 +254,7 @@
if (name != null) {
constructor = name.staticElement;
} else {
- var classElem = parent.constructorName.type.name.staticElement;
+ var classElem = parent.constructorName.type2.name.staticElement;
if (classElem is ClassElement) {
constructor = classElem.unnamedConstructor;
}
@@ -452,7 +452,7 @@
@override
void visitClassTypeAlias(ClassTypeAlias node) {
- if (identical(entity, node.superclass)) {
+ if (identical(entity, node.superclass2)) {
optype.completionLocation = 'ClassTypeAlias_superclass';
optype.includeTypeNameSuggestions = true;
}
@@ -646,7 +646,7 @@
@override
void visitExtendsClause(ExtendsClause node) {
- if (identical(entity, node.superclass)) {
+ if (identical(entity, node.superclass2)) {
optype.completionLocation = 'ExtendsClause_superclass';
optype.includeTypeNameSuggestions = true;
optype.typeNameSuggestionsFilter = _nonMixinClasses;
@@ -1073,6 +1073,16 @@
}
@override
+ void visitNamedType(NamedType node) {
+ // The entity won't be the first child entity (node.name), since
+ // CompletionTarget would have chosen an edge higher in the parse tree. So
+ // it must be node.typeArguments, meaning that the cursor is between the
+ // type name and the "<" that starts the type arguments. In this case,
+ // we have no completions to offer.
+ assert(identical(entity, node.typeArguments));
+ }
+
+ @override
void visitNode(AstNode node) {
// no suggestion by default
}
@@ -1353,16 +1363,6 @@
}
@override
- void visitTypeName(TypeName node) {
- // The entity won't be the first child entity (node.name), since
- // CompletionTarget would have chosen an edge higher in the parse tree. So
- // it must be node.typeArguments, meaning that the cursor is between the
- // type name and the "<" that starts the type arguments. In this case,
- // we have no completions to offer.
- assert(identical(entity, node.typeArguments));
- }
-
- @override
void visitTypeParameter(TypeParameter node) {
if (entity == node.bound) {
optype.completionLocation = 'TypeParameter_bound';
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 4a7dd04..c622af3 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
@@ -12,10 +12,11 @@
/// declarations in those nodes. Consumers typically call [visit] which catches
/// the exception thrown by [finished].
abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor {
- static final NamedType STACKTRACE_TYPE = astFactory.typeName(
- astFactory
- .simpleIdentifier(StringToken(TokenType.IDENTIFIER, 'StackTrace', 0)),
- null);
+ static final NamedType STACKTRACE_TYPE = astFactory.namedType(
+ name: astFactory.simpleIdentifier(
+ StringToken(TokenType.IDENTIFIER, 'StackTrace', 0),
+ ),
+ );
final int offset;
diff --git a/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart b/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
index ec74ce8..532762c 100644
--- a/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
+++ b/pkg/analyzer_plugin/lib/utilities/navigation/navigation_dart.dart
@@ -315,7 +315,7 @@
return;
}
// add regions
- var typeName = node.type;
+ var typeName = node.type2;
// [prefix].ClassName
{
var name = typeName.name;
diff --git a/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart b/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart
index 85fb45a..5f3d9ca 100644
--- a/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart
+++ b/pkg/analyzer_plugin/tool/spec/codegen_dart_protocol.dart
@@ -368,7 +368,6 @@
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 @@
/// 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
diff --git a/pkg/analyzer_plugin/tool/spec/codegen_protocol_common.dart b/pkg/analyzer_plugin/tool/spec/codegen_protocol_common.dart
index a872b10..54062f6 100644
--- a/pkg/analyzer_plugin/tool/spec/codegen_protocol_common.dart
+++ b/pkg/analyzer_plugin/tool/spec/codegen_protocol_common.dart
@@ -45,14 +45,10 @@
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';");
diff --git a/pkg/compiler/README.md b/pkg/compiler/README.md
index 3f493c5..d7e7a1a 100644
--- a/pkg/compiler/README.md
+++ b/pkg/compiler/README.md
@@ -631,8 +631,6 @@
`lib/src/diagnostics`
`lib/src/diagnostics/invariant.dart`
-`lib/src/diagnostics/generated`
-`lib/src/diagnostics/generated/shared_messages.dart`
`lib/src/diagnostics/messages.dart`
`lib/src/diagnostics/source_span.dart`
`lib/src/diagnostics/code_location.dart`
diff --git a/pkg/compiler/lib/src/apiimpl.dart b/pkg/compiler/lib/src/apiimpl.dart
index 951cccc..e5dbb72 100644
--- a/pkg/compiler/lib/src/apiimpl.dart
+++ b/pkg/compiler/lib/src/apiimpl.dart
@@ -37,15 +37,15 @@
{MakeReporterFunction makeReporter})
// NOTE: allocating measurer is done upfront to ensure the wallclock is
// started before other computations.
- : measurer = new Measurer(enableTaskMeasurements: options.verbose),
+ : measurer = Measurer(enableTaskMeasurements: options.verbose),
super(
options: options,
outputProvider: outputProvider,
- environment: new _Environment(options.environment),
+ environment: _Environment(options.environment),
makeReporter: makeReporter) {
tasks.addAll([
- userHandlerTask = new GenericTask('Diagnostic handler', measurer),
- userProviderTask = new GenericTask('Input provider', measurer),
+ userHandlerTask = GenericTask('Diagnostic handler', measurer),
+ userProviderTask = GenericTask('Input provider', measurer),
]);
}
@@ -59,7 +59,7 @@
}
Future setupSdk() {
- var future = new Future.value(null);
+ var future = Future.value(null);
_Environment env = environment;
if (env.supportedLibraries == null) {
future = future.then((_) {
@@ -255,7 +255,7 @@
@override
Map<String, String> toMap() {
if (_completeMap == null) {
- _completeMap = new Map<String, String>.from(definitions);
+ _completeMap = Map<String, String>.from(definitions);
for (String libraryName in supportedLibraries) {
if (!libraryName.startsWith("_")) {
String key = '${_dartLibraryEnvironmentPrefix}${libraryName}';
diff --git a/pkg/compiler/lib/src/closure.dart b/pkg/compiler/lib/src/closure.dart
index 6f26060..af806f9 100644
--- a/pkg/compiler/lib/src/closure.dart
+++ b/pkg/compiler/lib/src/closure.dart
@@ -70,20 +70,20 @@
ScopeInfoKind kind = source.readEnum(ScopeInfoKind.values);
switch (kind) {
case ScopeInfoKind.scopeInfo:
- return new JsScopeInfo.readFromDataSource(source);
+ return JsScopeInfo.readFromDataSource(source);
case ScopeInfoKind.capturedScope:
- return new JsCapturedScope.readFromDataSource(source);
+ return JsCapturedScope.readFromDataSource(source);
case ScopeInfoKind.capturedLoopScope:
- return new JsCapturedLoopScope.readFromDataSource(source);
+ return JsCapturedLoopScope.readFromDataSource(source);
case ScopeInfoKind.closureRepresentationInfo:
- return new JsClosureClassInfo.readFromDataSource(source);
+ return JsClosureClassInfo.readFromDataSource(source);
}
- throw new UnsupportedError('Unexpected ScopeInfoKind $kind');
+ throw UnsupportedError('Unexpected ScopeInfoKind $kind');
}
/// Serializes this [ScopeInfo] to [sink].
void writeToDataSink(DataSink sink) {
- throw new UnsupportedError('${runtimeType}.writeToDataSink');
+ throw UnsupportedError('${runtimeType}.writeToDataSink');
}
/// Convenience reference pointer to the element representing `this`.
@@ -131,13 +131,13 @@
switch (kind) {
case ScopeInfoKind.scopeInfo:
case ScopeInfoKind.closureRepresentationInfo:
- throw new UnsupportedError('Unexpected CapturedScope kind $kind');
+ throw UnsupportedError('Unexpected CapturedScope kind $kind');
case ScopeInfoKind.capturedScope:
- return new JsCapturedScope.readFromDataSource(source);
+ return JsCapturedScope.readFromDataSource(source);
case ScopeInfoKind.capturedLoopScope:
- return new JsCapturedLoopScope.readFromDataSource(source);
+ return JsCapturedLoopScope.readFromDataSource(source);
}
- throw new UnsupportedError('Unexpected ScopeInfoKind $kind');
+ throw UnsupportedError('Unexpected ScopeInfoKind $kind');
}
/// If true, this closure accesses a variable that was defined in an outside
@@ -179,11 +179,11 @@
case ScopeInfoKind.scopeInfo:
case ScopeInfoKind.closureRepresentationInfo:
case ScopeInfoKind.capturedScope:
- throw new UnsupportedError('Unexpected CapturedLoopScope kind $kind');
+ throw UnsupportedError('Unexpected CapturedLoopScope kind $kind');
case ScopeInfoKind.capturedLoopScope:
- return new JsCapturedLoopScope.readFromDataSource(source);
+ return JsCapturedLoopScope.readFromDataSource(source);
}
- throw new UnsupportedError('Unexpected ScopeInfoKind $kind');
+ throw UnsupportedError('Unexpected ScopeInfoKind $kind');
}
/// True if this loop scope declares in the first part of the loop
@@ -247,12 +247,12 @@
case ScopeInfoKind.scopeInfo:
case ScopeInfoKind.capturedScope:
case ScopeInfoKind.capturedLoopScope:
- throw new UnsupportedError(
+ throw UnsupportedError(
'Unexpected ClosureRepresentationInfo kind $kind');
case ScopeInfoKind.closureRepresentationInfo:
- return new JsClosureClassInfo.readFromDataSource(source);
+ return JsClosureClassInfo.readFromDataSource(source);
}
- throw new UnsupportedError('Unexpected ScopeInfoKind $kind');
+ throw UnsupportedError('Unexpected ScopeInfoKind $kind');
}
/// The original local function before any translation.
@@ -376,7 +376,7 @@
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
sb.write('type_variable_local(');
sb.write(typeVariable);
sb.write(')');
diff --git a/pkg/compiler/lib/src/common_elements.dart b/pkg/compiler/lib/src/common_elements.dart
index d2e5709..84c3c2b 100644
--- a/pkg/compiler/lib/src/common_elements.dart
+++ b/pkg/compiler/lib/src/common_elements.dart
@@ -217,7 +217,7 @@
InterfaceType getConstantListTypeFor(InterfaceType sourceType);
InterfaceType getConstantMapTypeFor(InterfaceType sourceType,
- {bool onlyStringKeys: false});
+ {bool onlyStringKeys = false});
InterfaceType getConstantSetTypeFor(InterfaceType sourceType);
@@ -1004,26 +1004,26 @@
}
ClassEntity _findClass(LibraryEntity library, String name,
- {bool required: true}) {
+ {bool required = true}) {
if (library == null) return null;
return _env.lookupClass(library, name, required: required);
}
MemberEntity _findLibraryMember(LibraryEntity library, String name,
- {bool setter: false, bool required: true}) {
+ {bool setter = false, bool required = true}) {
if (library == null) return null;
return _env.lookupLibraryMember(library, name,
setter: setter, required: required);
}
MemberEntity _findClassMember(ClassEntity cls, String name,
- {bool setter: false, bool required: true}) {
+ {bool setter = false, bool required = true}) {
return _env.lookupLocalClassMember(cls, name,
setter: setter, required: required);
}
ConstructorEntity _findConstructor(ClassEntity cls, String name,
- {bool required: true}) {
+ {bool required = true}) {
return _env.lookupConstructor(cls, name, required: required);
}
@@ -1047,7 +1047,7 @@
@override
InterfaceType getConstantMapTypeFor(InterfaceType sourceType,
- {bool onlyStringKeys: false}) {
+ {bool onlyStringKeys = false}) {
ClassEntity classElement =
onlyStringKeys ? constantStringMapClass : generalConstantMapClass;
if (dartTypes.treatAsRawType(sourceType)) {
@@ -2200,7 +2200,7 @@
/// Lookup the library with the canonical [uri], fail if the library is
/// missing and [required];
- LibraryEntity lookupLibrary(Uri uri, {bool required: false});
+ LibraryEntity lookupLibrary(Uri uri, {bool required = false});
/// Calls [f] for every class declared in [library].
void forEachClass(LibraryEntity library, void f(ClassEntity cls));
@@ -2208,7 +2208,7 @@
/// Lookup the class [name] in [library], fail if the class is missing and
/// [required].
ClassEntity lookupClass(LibraryEntity library, String name,
- {bool required: false});
+ {bool required = false});
/// Calls [f] for every top level member in [library].
void forEachLibraryMember(LibraryEntity library, void f(MemberEntity member));
@@ -2216,18 +2216,18 @@
/// Lookup the member [name] in [library], fail if the class is missing and
/// [required].
MemberEntity lookupLibraryMember(LibraryEntity library, String name,
- {bool setter: false, bool required: false});
+ {bool setter = false, bool required = false});
/// Lookup the member [name] in [cls], fail if the class is missing and
/// [required].
MemberEntity lookupLocalClassMember(ClassEntity cls, String name,
- {bool setter: false, bool required: false});
+ {bool setter = false, bool required = false});
/// Lookup the member [name] in [cls] and its superclasses.
///
/// Return `null` if the member is not found in the class or any superclass.
MemberEntity lookupClassMember(ClassEntity cls, String name,
- {bool setter: false}) {
+ {bool setter = false}) {
var entity = lookupLocalClassMember(cls, name, setter: setter);
if (entity != null) return entity;
@@ -2240,7 +2240,7 @@
/// Lookup the constructor [name] in [cls], fail if the class is missing and
/// [required].
ConstructorEntity lookupConstructor(ClassEntity cls, String name,
- {bool required: false});
+ {bool required = false});
/// Calls [f] for each class member declared in [cls].
void forEachLocalClassMember(ClassEntity cls, void f(MemberEntity member));
@@ -2274,7 +2274,7 @@
/// the result of `getSuperClass(C, skipUnnamedMixinApplications: false)` is
/// `S`.
ClassEntity getSuperClass(ClassEntity cls,
- {bool skipUnnamedMixinApplications: false});
+ {bool skipUnnamedMixinApplications = false});
/// Calls [f] for each supertype of [cls].
void forEachSupertype(ClassEntity cls, void f(InterfaceType supertype));
@@ -2380,7 +2380,7 @@
/// Returns the metadata constants declared on [member].
Iterable<ConstantValue> getMemberMetadata(MemberEntity member,
- {bool includeParameterMetadata: false});
+ {bool includeParameterMetadata = false});
}
abstract class JElementEnvironment extends ElementEnvironment {
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 0884b17..06cc227 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -59,7 +59,7 @@
show ImpactStrategy, WorldImpact, WorldImpactBuilderImpl;
import 'world.dart' show JClosedWorld, KClosedWorld;
-typedef CompilerDiagnosticReporter MakeReporterFunction(
+typedef MakeReporterFunction = CompilerDiagnosticReporter Function(
Compiler compiler, CompilerOptions options);
abstract class Compiler {
@@ -138,7 +138,7 @@
Compiler(
{CompilerOptions options,
api.CompilerOutput outputProvider,
- this.environment: const _EmptyEnvironment(),
+ this.environment = const _EmptyEnvironment(),
MakeReporterFunction makeReporter})
: this.options = options {
options.deriveOptions();
@@ -155,38 +155,38 @@
}
CompilerTask kernelFrontEndTask;
- selfTask = new GenericTask('self', measurer);
- _outputProvider = new _CompilerOutput(this, outputProvider);
+ selfTask = GenericTask('self', measurer);
+ _outputProvider = _CompilerOutput(this, outputProvider);
if (makeReporter != null) {
_reporter = makeReporter(this, options);
} else {
- _reporter = new CompilerDiagnosticReporter(this);
+ _reporter = CompilerDiagnosticReporter(this);
}
- kernelFrontEndTask = new GenericTask('Front end', measurer);
- frontendStrategy = new KernelFrontendStrategy(
+ kernelFrontEndTask = GenericTask('Front end', measurer);
+ frontendStrategy = KernelFrontendStrategy(
kernelFrontEndTask, options, reporter, environment);
backendStrategy = createBackendStrategy();
_impactCache = <Entity, WorldImpact>{};
- _impactCacheDeleter = new _MapImpactCacheDeleter(_impactCache);
+ _impactCacheDeleter = _MapImpactCacheDeleter(_impactCache);
if (options.showInternalProgress) {
- progress = new InteractiveProgress();
+ progress = InteractiveProgress();
}
- enqueuer = new EnqueueTask(this);
+ enqueuer = EnqueueTask(this);
tasks = [
- kernelLoader = new KernelLoaderTask(
+ kernelLoader = KernelLoaderTask(
options, provider, _outputProvider, reporter, measurer),
kernelFrontEndTask,
- globalInference = new GlobalTypeInferenceTask(this),
+ globalInference = GlobalTypeInferenceTask(this),
deferredLoadTask = frontendStrategy.createDeferredLoadTask(this),
// [enqueuer] is created earlier because it contains the resolution world
// objects needed by other tasks.
enqueuer,
- dumpInfoTask = new DumpInfoTask(this),
+ dumpInfoTask = DumpInfoTask(this),
selfTask,
- serializationTask = new SerializationTask(
+ serializationTask = SerializationTask(
options, reporter, provider, outputProvider, measurer),
];
@@ -197,7 +197,7 @@
///
/// Override this to mock the backend strategy for testing.
BackendStrategy createBackendStrategy() {
- return new JsBackendStrategy(this);
+ return JsBackendStrategy(this);
}
ResolutionWorldBuilder resolutionWorldBuilderForTesting;
@@ -225,7 +225,7 @@
Future<bool> run(Uri uri) => selfTask.measureSubtask("run", () {
measurer.startWallClock();
- return new Future.sync(() => runInternal(uri))
+ return Future.sync(() => runInternal(uri))
.catchError((error, StackTrace stackTrace) =>
_reporter.onError(uri, error, stackTrace))
.whenComplete(() {
@@ -339,7 +339,7 @@
runCodegenEnqueuer(codegenResults);
} else {
reporter.log('Compiling methods');
- CodegenResults codegenResults = new OnDemandCodegenResults(
+ CodegenResults codegenResults = OnDemandCodegenResults(
globalTypeInferenceResults,
codegenInputs,
backendStrategy.functionCompiler);
@@ -383,7 +383,7 @@
resolutionEnqueuer.worldBuilder.registerClass(cls);
});
}
- WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl();
+ WorldImpactBuilderImpl mainImpact = WorldImpactBuilderImpl();
FunctionEntity mainFunction = frontendStrategy.computeMain(mainImpact);
// In order to see if a library is deferred, we must compute the
@@ -392,8 +392,7 @@
// this until after the resolution queue is processed.
deferredLoadTask.beforeResolution(rootLibraryUri, libraries);
- impactStrategy = new JavaScriptImpactStrategy(
- impactCacheDeleter, dumpInfoTask,
+ impactStrategy = JavaScriptImpactStrategy(impactCacheDeleter, dumpInfoTask,
supportDeferredLoad: deferredLoadTask.isProgramSplit,
supportDumpInfo: options.dumpInfo);
@@ -444,9 +443,9 @@
FunctionEntity mainFunction = closedWorld.elementEnvironment.mainFunction;
reporter.log('Performing global type inference');
GlobalLocalsMap globalLocalsMap =
- new GlobalLocalsMap(closedWorld.closureDataLookup.getEnclosingMember);
+ GlobalLocalsMap(closedWorld.closureDataLookup.getEnclosingMember);
InferredDataBuilder inferredDataBuilder =
- new InferredDataBuilderImpl(closedWorld.annotationsData);
+ InferredDataBuilderImpl(closedWorld.annotationsData);
return globalInference.runGlobalTypeInference(
mainFunction, closedWorld, globalLocalsMap, inferredDataBuilder);
}
@@ -511,7 +510,7 @@
}
void compileFromKernel(Uri rootLibraryUri, Iterable<Uri> libraries) {
- _userCodeLocations.add(new CodeLocation(rootLibraryUri));
+ _userCodeLocations.add(CodeLocation(rootLibraryUri));
selfTask.measureSubtask("compileFromKernel", () {
JsClosedWorld closedWorld = selfTask.measureSubtask("computeClosedWorld",
() => computeClosedWorld(rootLibraryUri, libraries));
@@ -627,7 +626,7 @@
/// Messages for which compile-time errors are reported but compilation
/// continues regardless.
- static const List<MessageKind> BENIGN_ERRORS = const <MessageKind>[
+ static const List<MessageKind> BENIGN_ERRORS = <MessageKind>[
MessageKind.INVALID_METADATA,
MessageKind.INVALID_METADATA_GENERIC,
];
@@ -675,7 +674,7 @@
///
/// If [assumeInUserCode] is `true`, [element] is assumed to be in user code
/// if no entrypoints have been set.
- bool inUserCode(Entity element, {bool assumeInUserCode: false}) {
+ bool inUserCode(Entity element, {bool assumeInUserCode = false}) {
if (element == null) return assumeInUserCode;
Uri libraryUri = _uriFromElement(element);
if (libraryUri == null) return false;
@@ -696,7 +695,7 @@
int slashPos = libraryUri.path.indexOf('/');
if (slashPos != -1) {
String packageName = libraryUri.path.substring(0, slashPos);
- return new Uri(scheme: 'package', path: packageName);
+ return Uri(scheme: 'package', path: packageName);
}
}
return libraryUri;
@@ -769,7 +768,7 @@
SourceSpan span = spanFromSpannable(spannable);
MessageTemplate template = MessageTemplate.TEMPLATES[messageKind];
Message message = template.message(arguments, options);
- return new DiagnosticMessage(span, spannable, message);
+ return DiagnosticMessage(span, spannable, message);
}
@override
@@ -818,8 +817,8 @@
reportDiagnostic(message, infos, kind);
return;
}
- SuppressionInfo info = suppressedWarnings.putIfAbsent(
- uri, () => new SuppressionInfo());
+ SuppressionInfo info =
+ suppressedWarnings.putIfAbsent(uri, () => SuppressionInfo());
if (kind == api.Diagnostic.WARNING) {
info.warnings++;
} else {
@@ -970,7 +969,7 @@
void log(message) {
Message msg = MessageTemplate.TEMPLATES[MessageKind.GENERIC]
.message({'text': '$message'}, options);
- reportDiagnostic(new DiagnosticMessage(null, null, msg),
+ reportDiagnostic(DiagnosticMessage(null, null, msg),
const <DiagnosticMessage>[], api.Diagnostic.VERBOSE_INFO);
}
@@ -991,7 +990,7 @@
} else {
reportDiagnostic(
createMessage(
- new SourceSpan(uri, 0, 0), MessageKind.COMPILER_CRASHED),
+ SourceSpan(uri, 0, 0), MessageKind.COMPILER_CRASHED),
const <DiagnosticMessage>[],
api.Diagnostic.CRASH);
}
@@ -1000,7 +999,7 @@
} catch (doubleFault) {
// Ignoring exceptions in exception handling.
}
- return new Future.error(error, stackTrace);
+ return Future.error(error, stackTrace);
}
@override
@@ -1025,7 +1024,7 @@
'hints': info.hints.toString(),
'uri': uri.toString(),
}, options);
- reportDiagnostic(new DiagnosticMessage(null, null, message),
+ reportDiagnostic(DiagnosticMessage(null, null, message),
const <DiagnosticMessage>[], api.Diagnostic.HINT);
});
}
@@ -1075,7 +1074,7 @@
/// with 500ms intervals.
class ProgressImpl implements Progress {
final DiagnosticReporter _reporter;
- final Stopwatch _stopwatch = new Stopwatch()..start();
+ final Stopwatch _stopwatch = Stopwatch()..start();
ProgressImpl(this._reporter);
@@ -1097,8 +1096,8 @@
/// with 500ms intervals using escape sequences to keep the progress data on a
/// single line.
class InteractiveProgress implements Progress {
- final Stopwatch _stopwatchPhase = new Stopwatch()..start();
- final Stopwatch _stopwatchInterval = new Stopwatch()..start();
+ final Stopwatch _stopwatchPhase = Stopwatch()..start();
+ final Stopwatch _stopwatchInterval = Stopwatch()..start();
@override
void startPhase() {
print('');
@@ -1111,7 +1110,7 @@
if (_stopwatchInterval.elapsedMilliseconds > 500) {
var time = _stopwatchPhase.elapsedMilliseconds / 1000;
var rate = count / _stopwatchPhase.elapsedMilliseconds;
- var s = new StringBuffer('\x1b[1A\x1b[K') // go up and clear the line.
+ var s = StringBuffer('\x1b[1A\x1b[K') // go up and clear the line.
..write('\x1b[48;5;40m\x1b[30m==>\x1b[0m $prefix')
..write(count)
..write('$suffix Elapsed time: ')
diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart
index 8435ff0..bc0d02d 100644
--- a/pkg/compiler/lib/src/dart2js.dart
+++ b/pkg/compiler/lib/src/dart2js.dart
@@ -32,7 +32,7 @@
/// The data passed to the [HandleOption] callback is either a single
/// string argument, or the arguments iterator for multiple arguments
/// handlers.
-typedef void HandleOption(Null data);
+typedef HandleOption = void Function(Null data);
class OptionHandler {
final String pattern;
@@ -43,17 +43,17 @@
(_handle as dynamic)(argument);
}
- OptionHandler(this.pattern, this._handle, {this.multipleArguments: false});
+ OptionHandler(this.pattern, this._handle, {this.multipleArguments = false});
}
/// Extract the parameter of an option.
///
/// For example, in ['--out=fisk.js'] and ['-ohest.js'], the parameters
/// are ['fisk.js'] and ['hest.js'], respectively.
-String extractParameter(String argument, {bool isOptionalArgument: false}) {
+String extractParameter(String argument, {bool isOptionalArgument = false}) {
// m[0] is the entire match (which will be equal to argument). m[1]
// is something like "-o" or "--out=", and m[2] is the parameter.
- Match m = new RegExp('^(-[a-zA-Z]|--.+=)(.*)').firstMatch(argument);
+ Match m = RegExp('^(-[a-zA-Z]|--.+=)(.*)').firstMatch(argument);
if (m == null) {
if (isOptionalArgument) return null;
helpAndFail('Unknown option "$argument".');
@@ -61,7 +61,7 @@
return m[2];
}
-String extractPath(String argument, {bool isDirectory: true}) {
+String extractPath(String argument, {bool isDirectory = true}) {
String path = fe.nativeToUriPath(extractParameter(argument));
return !path.endsWith("/") && isDirectory ? "$path/" : path;
}
@@ -72,7 +72,7 @@
for (OptionHandler handler in handlers) {
patterns.add(handler.pattern);
}
- var pattern = new RegExp('^(${patterns.join(")\$|^(")})\$');
+ var pattern = RegExp('^(${patterns.join(")\$|^(")})\$');
Iterator<String> arguments = argv.iterator;
OUTER:
@@ -99,7 +99,7 @@
Future<api.CompilationResult> compile(List<String> argv,
{fe.InitializedCompilerState kernelInitializedCompilerState}) {
- Stopwatch wallclock = new Stopwatch()..start();
+ Stopwatch wallclock = Stopwatch()..start();
stackTraceFilePrefix = '${Uri.base}';
Uri librariesSpecificationUri = Uri.base.resolve('lib/libraries.json');
bool outputSpecified = false;
@@ -133,7 +133,7 @@
bool enableColors;
int optimizationLevel = null;
Uri platformBinaries;
- Map<String, String> environment = new Map<String, String>();
+ Map<String, String> environment = Map<String, String>();
ReadStrategy readStrategy = ReadStrategy.fromDart;
WriteStrategy writeStrategy = WriteStrategy.toJs;
FeatureOptions features = FeatureOptions();
@@ -501,152 +501,151 @@
List<String> arguments = <String>[];
List<OptionHandler> handlers = <OptionHandler>[
- new OptionHandler('-[chvm?]+', handleShortOptions),
- new OptionHandler('--throw-on-error(?:=[0-9]+)?', handleThrowOnError),
- new OptionHandler(Flags.suppressWarnings, (String argument) {
+ OptionHandler('-[chvm?]+', handleShortOptions),
+ OptionHandler('--throw-on-error(?:=[0-9]+)?', handleThrowOnError),
+ OptionHandler(Flags.suppressWarnings, (String argument) {
showWarnings = false;
passThrough(argument);
}),
- new OptionHandler(Flags.fatalWarnings, passThrough),
- new OptionHandler(Flags.suppressHints, (String argument) {
+ OptionHandler(Flags.fatalWarnings, passThrough),
+ OptionHandler(Flags.suppressHints, (String argument) {
showHints = false;
passThrough(argument);
}),
// TODO(sigmund): remove entirely after Dart 1.20
- new OptionHandler(
+ OptionHandler(
'--output-type=dart|--output-type=dart-multi|--output-type=js',
setOutputType),
- new OptionHandler('--use-kernel', ignoreOption),
- new OptionHandler(Flags.platformBinaries, setPlatformBinaries),
- new OptionHandler(Flags.noFrequencyBasedMinification, passThrough),
- new OptionHandler(Flags.verbose, setVerbose),
- new OptionHandler(Flags.progress, passThrough),
- new OptionHandler(Flags.reportMetrics, passThrough),
- new OptionHandler(Flags.reportAllMetrics, passThrough),
- new OptionHandler(Flags.version, (_) => wantVersion = true),
- new OptionHandler('--library-root=.+', ignoreOption),
- new OptionHandler('--libraries-spec=.+', setLibrarySpecificationUri),
- new OptionHandler('${Flags.dillDependencies}=.+', setDillDependencies),
- new OptionHandler(
- '${Flags.readModularAnalysis}=.+', setModularAnalysisInputs),
- new OptionHandler(
+ OptionHandler('--use-kernel', ignoreOption),
+ OptionHandler(Flags.platformBinaries, setPlatformBinaries),
+ OptionHandler(Flags.noFrequencyBasedMinification, passThrough),
+ OptionHandler(Flags.verbose, setVerbose),
+ OptionHandler(Flags.progress, passThrough),
+ OptionHandler(Flags.reportMetrics, passThrough),
+ OptionHandler(Flags.reportAllMetrics, passThrough),
+ OptionHandler(Flags.version, (_) => wantVersion = true),
+ OptionHandler('--library-root=.+', ignoreOption),
+ OptionHandler('--libraries-spec=.+', setLibrarySpecificationUri),
+ OptionHandler('${Flags.dillDependencies}=.+', setDillDependencies),
+ OptionHandler('${Flags.readModularAnalysis}=.+', setModularAnalysisInputs),
+ OptionHandler(
'${Flags.writeModularAnalysis}|${Flags.writeModularAnalysis}=.+',
setWriteModularAnalysis),
- new OptionHandler('${Flags.readData}|${Flags.readData}=.+', setReadData),
- new OptionHandler('${Flags.writeData}|${Flags.writeData}=.+', setWriteData),
- new OptionHandler(Flags.noClosedWorldInData, passThrough),
- new OptionHandler('${Flags.readClosedWorld}|${Flags.readClosedWorld}=.+',
+ OptionHandler('${Flags.readData}|${Flags.readData}=.+', setReadData),
+ OptionHandler('${Flags.writeData}|${Flags.writeData}=.+', setWriteData),
+ OptionHandler(Flags.noClosedWorldInData, passThrough),
+ OptionHandler('${Flags.readClosedWorld}|${Flags.readClosedWorld}=.+',
setReadClosedWorld),
- new OptionHandler('${Flags.writeClosedWorld}|${Flags.writeClosedWorld}=.+',
+ OptionHandler('${Flags.writeClosedWorld}|${Flags.writeClosedWorld}=.+',
setWriteClosedWorld),
- new OptionHandler(
+ OptionHandler(
'${Flags.readCodegen}|${Flags.readCodegen}=.+', setReadCodegen),
- new OptionHandler(
+ OptionHandler(
'${Flags.writeCodegen}|${Flags.writeCodegen}=.+', setWriteCodegen),
- new OptionHandler('${Flags.codegenShard}=.+', setCodegenShard),
- new OptionHandler('${Flags.codegenShards}=.+', setCodegenShards),
- new OptionHandler(Flags.cfeOnly, setCfeOnly),
- new OptionHandler(Flags.debugGlobalInference, passThrough),
- new OptionHandler('--out=.+|-o.*', setOutput, multipleArguments: true),
- new OptionHandler('-O.*', setOptimizationLevel),
- new OptionHandler(Flags.allowMockCompilation, ignoreOption),
- new OptionHandler(Flags.fastStartup, ignoreOption),
- new OptionHandler(Flags.genericMethodSyntax, ignoreOption),
- new OptionHandler(Flags.initializingFormalAccess, ignoreOption),
- new OptionHandler(Flags.minify, passThrough),
- new OptionHandler(Flags.noMinify, passThrough),
- new OptionHandler(Flags.omitLateNames, passThrough),
- new OptionHandler(Flags.noOmitLateNames, passThrough),
- new OptionHandler(Flags.preserveUris, ignoreOption),
- new OptionHandler(Flags.printLegacyStars, passThrough),
- new OptionHandler('--force-strip=.*', setStrip),
- new OptionHandler(Flags.disableDiagnosticColors, (_) {
+ OptionHandler('${Flags.codegenShard}=.+', setCodegenShard),
+ OptionHandler('${Flags.codegenShards}=.+', setCodegenShards),
+ OptionHandler(Flags.cfeOnly, setCfeOnly),
+ OptionHandler(Flags.debugGlobalInference, passThrough),
+ OptionHandler('--out=.+|-o.*', setOutput, multipleArguments: true),
+ OptionHandler('-O.*', setOptimizationLevel),
+ OptionHandler(Flags.allowMockCompilation, ignoreOption),
+ OptionHandler(Flags.fastStartup, ignoreOption),
+ OptionHandler(Flags.genericMethodSyntax, ignoreOption),
+ OptionHandler(Flags.initializingFormalAccess, ignoreOption),
+ OptionHandler(Flags.minify, passThrough),
+ OptionHandler(Flags.noMinify, passThrough),
+ OptionHandler(Flags.omitLateNames, passThrough),
+ OptionHandler(Flags.noOmitLateNames, passThrough),
+ OptionHandler(Flags.preserveUris, ignoreOption),
+ OptionHandler(Flags.printLegacyStars, passThrough),
+ OptionHandler('--force-strip=.*', setStrip),
+ OptionHandler(Flags.disableDiagnosticColors, (_) {
enableColors = false;
}),
- new OptionHandler(Flags.enableDiagnosticColors, (_) {
+ OptionHandler(Flags.enableDiagnosticColors, (_) {
enableColors = true;
}),
- new OptionHandler('--enable[_-]checked[_-]mode|--checked',
+ OptionHandler('--enable[_-]checked[_-]mode|--checked',
(_) => setCheckedMode(Flags.enableCheckedMode)),
- new OptionHandler(Flags.enableAsserts, passThrough),
- new OptionHandler(Flags.enableNullAssertions, passThrough),
- new OptionHandler(Flags.nativeNullAssertions, passThrough),
- new OptionHandler(Flags.noNativeNullAssertions, passThrough),
- new OptionHandler(Flags.trustTypeAnnotations, setTrustTypeAnnotations),
- new OptionHandler(Flags.trustPrimitives, passThrough),
- new OptionHandler(Flags.trustJSInteropTypeAnnotations, ignoreOption),
- new OptionHandler(r'--help|/\?|/h', (_) => wantHelp = true),
- new OptionHandler('--packages=.+', setPackageConfig),
- new OptionHandler(Flags.noSourceMaps, passThrough),
- new OptionHandler(Option.resolutionInput, ignoreOption),
- new OptionHandler(Option.bazelPaths, setBazelPaths),
- new OptionHandler(Option.multiRoots, setMultiRoots),
- new OptionHandler(Option.multiRootScheme, setMultiRootScheme),
- new OptionHandler(Flags.resolveOnly, ignoreOption),
- new OptionHandler(Flags.disableNativeLiveTypeAnalysis, passThrough),
- new OptionHandler('--categories=.*', setCategories),
- new OptionHandler(Flags.serverMode, passThrough),
- new OptionHandler(Flags.disableInlining, passThrough),
- new OptionHandler(Flags.disableProgramSplit, passThrough),
- new OptionHandler(Flags.stopAfterProgramSplit, passThrough),
- new OptionHandler(Flags.disableTypeInference, passThrough),
- new OptionHandler(Flags.useTrivialAbstractValueDomain, passThrough),
- new OptionHandler(Flags.experimentalWrapped, passThrough),
- new OptionHandler(Flags.experimentalPowersets, passThrough),
- new OptionHandler(Flags.disableRtiOptimization, passThrough),
- new OptionHandler(Flags.terse, passThrough),
- new OptionHandler('--deferred-map=.+', passThrough),
- new OptionHandler('${Flags.writeProgramSplit}=.+', passThrough),
- new OptionHandler('${Flags.readProgramSplit}=.+', passThrough),
- new OptionHandler('${Flags.dumpInfo}|${Flags.dumpInfo}=.+', setDumpInfo),
- new OptionHandler('--disallow-unsafe-eval', ignoreOption),
- new OptionHandler(Option.showPackageWarnings, passThrough),
- new OptionHandler(Option.enableLanguageExperiments, passThrough),
- new OptionHandler(Flags.useContentSecurityPolicy, passThrough),
- new OptionHandler('--enable-experimental-mirrors', ignoreOption),
- new OptionHandler(Flags.enableAssertMessage, passThrough),
- new OptionHandler('--strong', ignoreOption),
- new OptionHandler(Flags.previewDart2, ignoreOption),
- new OptionHandler(Flags.omitImplicitChecks, passThrough),
- new OptionHandler(Flags.omitAsCasts, passThrough),
- new OptionHandler(Flags.laxRuntimeTypeToString, passThrough),
- new OptionHandler(Flags.benchmarkingProduction, passThrough),
- new OptionHandler(Flags.benchmarkingExperiment, passThrough),
- new OptionHandler(Flags.soundNullSafety, setNullSafetyMode),
- new OptionHandler(Flags.noSoundNullSafety, setNullSafetyMode),
+ OptionHandler(Flags.enableAsserts, passThrough),
+ OptionHandler(Flags.enableNullAssertions, passThrough),
+ OptionHandler(Flags.nativeNullAssertions, passThrough),
+ OptionHandler(Flags.noNativeNullAssertions, passThrough),
+ OptionHandler(Flags.trustTypeAnnotations, setTrustTypeAnnotations),
+ OptionHandler(Flags.trustPrimitives, passThrough),
+ OptionHandler(Flags.trustJSInteropTypeAnnotations, ignoreOption),
+ OptionHandler(r'--help|/\?|/h', (_) => wantHelp = true),
+ OptionHandler('--packages=.+', setPackageConfig),
+ OptionHandler(Flags.noSourceMaps, passThrough),
+ OptionHandler(Option.resolutionInput, ignoreOption),
+ OptionHandler(Option.bazelPaths, setBazelPaths),
+ OptionHandler(Option.multiRoots, setMultiRoots),
+ OptionHandler(Option.multiRootScheme, setMultiRootScheme),
+ OptionHandler(Flags.resolveOnly, ignoreOption),
+ OptionHandler(Flags.disableNativeLiveTypeAnalysis, passThrough),
+ OptionHandler('--categories=.*', setCategories),
+ OptionHandler(Flags.serverMode, passThrough),
+ OptionHandler(Flags.disableInlining, passThrough),
+ OptionHandler(Flags.disableProgramSplit, passThrough),
+ OptionHandler(Flags.stopAfterProgramSplit, passThrough),
+ OptionHandler(Flags.disableTypeInference, passThrough),
+ OptionHandler(Flags.useTrivialAbstractValueDomain, passThrough),
+ OptionHandler(Flags.experimentalWrapped, passThrough),
+ OptionHandler(Flags.experimentalPowersets, passThrough),
+ OptionHandler(Flags.disableRtiOptimization, passThrough),
+ OptionHandler(Flags.terse, passThrough),
+ OptionHandler('--deferred-map=.+', passThrough),
+ OptionHandler('${Flags.writeProgramSplit}=.+', passThrough),
+ OptionHandler('${Flags.readProgramSplit}=.+', passThrough),
+ OptionHandler('${Flags.dumpInfo}|${Flags.dumpInfo}=.+', setDumpInfo),
+ OptionHandler('--disallow-unsafe-eval', ignoreOption),
+ OptionHandler(Option.showPackageWarnings, passThrough),
+ OptionHandler(Option.enableLanguageExperiments, passThrough),
+ OptionHandler(Flags.useContentSecurityPolicy, passThrough),
+ OptionHandler('--enable-experimental-mirrors', ignoreOption),
+ OptionHandler(Flags.enableAssertMessage, passThrough),
+ OptionHandler('--strong', ignoreOption),
+ OptionHandler(Flags.previewDart2, ignoreOption),
+ OptionHandler(Flags.omitImplicitChecks, passThrough),
+ OptionHandler(Flags.omitAsCasts, passThrough),
+ OptionHandler(Flags.laxRuntimeTypeToString, passThrough),
+ OptionHandler(Flags.benchmarkingProduction, passThrough),
+ OptionHandler(Flags.benchmarkingExperiment, passThrough),
+ OptionHandler(Flags.soundNullSafety, setNullSafetyMode),
+ OptionHandler(Flags.noSoundNullSafety, setNullSafetyMode),
// TODO(floitsch): remove conditional directives flag.
// We don't provide the info-message yet, since we haven't publicly
// launched the feature yet.
- new OptionHandler(Flags.conditionalDirectives, ignoreOption),
- new OptionHandler('--enable-async', ignoreOption),
- new OptionHandler('--enable-null-aware-operators', ignoreOption),
- new OptionHandler('--enable-enum', ignoreOption),
- new OptionHandler(Flags.allowNativeExtensions, setAllowNativeExtensions),
- new OptionHandler(Flags.generateCodeWithCompileTimeErrors, ignoreOption),
- new OptionHandler(Flags.useMultiSourceInfo, passThrough),
- new OptionHandler(Flags.useNewSourceInfo, passThrough),
- new OptionHandler(Flags.useOldRti, passThrough),
- new OptionHandler(Flags.useSimpleLoadIds, passThrough),
- new OptionHandler(Flags.testMode, passThrough),
- new OptionHandler('${Flags.dumpSsa}=.+', passThrough),
- new OptionHandler('${Flags.cfeInvocationModes}=.+', passThrough),
- new OptionHandler('${Flags.verbosity}=.+', passThrough),
+ OptionHandler(Flags.conditionalDirectives, ignoreOption),
+ OptionHandler('--enable-async', ignoreOption),
+ OptionHandler('--enable-null-aware-operators', ignoreOption),
+ OptionHandler('--enable-enum', ignoreOption),
+ OptionHandler(Flags.allowNativeExtensions, setAllowNativeExtensions),
+ OptionHandler(Flags.generateCodeWithCompileTimeErrors, ignoreOption),
+ OptionHandler(Flags.useMultiSourceInfo, passThrough),
+ OptionHandler(Flags.useNewSourceInfo, passThrough),
+ OptionHandler(Flags.useOldRti, passThrough),
+ OptionHandler(Flags.useSimpleLoadIds, passThrough),
+ OptionHandler(Flags.testMode, passThrough),
+ OptionHandler('${Flags.dumpSsa}=.+', passThrough),
+ OptionHandler('${Flags.cfeInvocationModes}=.+', passThrough),
+ OptionHandler('${Flags.verbosity}=.+', passThrough),
// Experimental features.
// We don't provide documentation for these yet.
// TODO(29574): provide documentation when this feature is supported.
// TODO(29574): provide a warning/hint/error, when profile-based data is
// used without `--fast-startup`.
- new OptionHandler(Flags.experimentalTrackAllocations, passThrough),
+ OptionHandler(Flags.experimentalTrackAllocations, passThrough),
- new OptionHandler(Flags.experimentLocalNames, ignoreOption),
- new OptionHandler(Flags.experimentStartupFunctions, passThrough),
- new OptionHandler(Flags.experimentToBoolean, passThrough),
- new OptionHandler(Flags.experimentUnreachableMethodsThrow, passThrough),
- new OptionHandler(Flags.experimentCallInstrumentation, passThrough),
- new OptionHandler(Flags.experimentNewRti, ignoreOption),
- new OptionHandler('${Flags.mergeFragmentsThreshold}=.+', passThrough),
+ OptionHandler(Flags.experimentLocalNames, ignoreOption),
+ OptionHandler(Flags.experimentStartupFunctions, passThrough),
+ OptionHandler(Flags.experimentToBoolean, passThrough),
+ OptionHandler(Flags.experimentUnreachableMethodsThrow, passThrough),
+ OptionHandler(Flags.experimentCallInstrumentation, passThrough),
+ OptionHandler(Flags.experimentNewRti, ignoreOption),
+ OptionHandler('${Flags.mergeFragmentsThreshold}=.+', passThrough),
// Wire up feature flags.
OptionHandler(Flags.canary, passThrough),
@@ -661,12 +660,12 @@
OptionHandler('--no-${feature.flag}', passThrough),
// The following three options must come last.
- new OptionHandler('-D.+=.*|--define=.+=.*|--define', addInEnvironment,
+ OptionHandler('-D.+=.*|--define=.+=.*|--define', addInEnvironment,
multipleArguments: true),
- new OptionHandler('-.*', (String argument) {
+ OptionHandler('-.*', (String argument) {
helpAndFail("Unknown option '$argument'.");
}),
- new OptionHandler('.*', (String argument) {
+ OptionHandler('.*', (String argument) {
arguments.add(fe.nativeToUriPath(argument));
})
];
@@ -681,14 +680,14 @@
'The options --bazel-root and --multi-root cannot be supplied '
'together, please choose one or the other.');
}
- inputProvider = new BazelInputProvider(bazelPaths);
+ inputProvider = BazelInputProvider(bazelPaths);
} else if (multiRoots != null) {
- inputProvider = new MultiRootInputProvider(multiRootScheme, multiRoots);
+ inputProvider = MultiRootInputProvider(multiRootScheme, multiRoots);
} else {
- inputProvider = new CompilerSourceFileProvider();
+ inputProvider = CompilerSourceFileProvider();
}
- diagnosticHandler = new FormattingDiagnosticHandler(inputProvider);
+ diagnosticHandler = FormattingDiagnosticHandler(inputProvider);
if (verbose != null) {
diagnosticHandler.verbose = verbose;
}
@@ -880,7 +879,7 @@
}
RandomAccessFileOutputProvider outputProvider =
- new RandomAccessFileOutputProvider(out, sourceMapOut,
+ RandomAccessFileOutputProvider(out, sourceMapOut,
onInfo: diagnosticHandler.info, onFailure: fail);
api.CompilationResult compilationDone(api.CompilationResult result) {
@@ -1378,8 +1377,8 @@
return File(path).readAsLinesSync().where((line) => line.isNotEmpty);
}
-typedef void ExitFunc(int exitCode);
-typedef Future<api.CompilationResult> CompileFunc(
+typedef ExitFunc = void Function(int exitCode);
+typedef CompileFunc = Future<api.CompilationResult> Function(
CompilerOptions compilerOptions,
api.CompilerInput compilerInput,
api.CompilerDiagnostics compilerDiagnostics,
@@ -1412,7 +1411,7 @@
} finally {
exitFunc(253); // 253 is recognized as a crash by our test scripts.
}
- return new Future.error(exception, trace);
+ return Future.error(exception, trace);
}
try {
@@ -1428,7 +1427,7 @@
const _ExitSignal();
}
-const _EXIT_SIGNAL = const _ExitSignal();
+const _EXIT_SIGNAL = _ExitSignal();
void batchMain(List<String> batchArguments) {
int exitCode;
@@ -1441,11 +1440,11 @@
throw _EXIT_SIGNAL;
};
- var stream = stdin.transform(utf8.decoder).transform(new LineSplitter());
+ var stream = stdin.transform(utf8.decoder).transform(LineSplitter());
var subscription;
fe.InitializedCompilerState kernelInitializedCompilerState;
subscription = stream.listen((line) {
- new Future.sync(() {
+ Future.sync(() {
subscription.pause();
exitCode = 0;
if (line == null) exit(0);
diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
index e4cf222..4e3f803 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -23,7 +23,6 @@
/// Keys for the [MessageTemplate]s.
enum MessageKind {
- ABSTRACT_GETTER,
COMPILER_CRASHED,
COMPLEX_RETURNING_NSM,
COMPLEX_THROWING_NSM,
@@ -114,21 +113,6 @@
MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT,
"Argument for 'JS_INTERCEPTOR_CONSTANT' must be a type constant."),
- MessageKind.ABSTRACT_GETTER: MessageTemplate(
- MessageKind.ABSTRACT_GETTER,
- "The getter '#{name}' has no implementation in "
- "class '#{class}'.",
- howToFix: "Try adding a body to '#{name}' or declaring "
- "'#{class}' to be 'abstract'.",
- examples: [
- """
-class Class {
- get getter;
-}
-main() => new Class();
-"""
- ]),
-
MessageKind.INVALID_METADATA: MessageTemplate(
MessageKind.INVALID_METADATA,
"A metadata annotation must be either a reference to a compile-time "
diff --git a/pkg/compiler/lib/src/dump_info.dart b/pkg/compiler/lib/src/dump_info.dart
index 5b78296..c636bea 100644
--- a/pkg/compiler/lib/src/dump_info.dart
+++ b/pkg/compiler/lib/src/dump_info.dart
@@ -41,7 +41,7 @@
JElementEnvironment get environment => closedWorld.elementEnvironment;
CodegenWorldBuilder get codegenWorldBuilder => compiler.codegenWorldBuilder;
- final AllInfo result = new AllInfo();
+ final AllInfo result = AllInfo();
final Map<Entity, Info> _entityToInfo = <Entity, Info>{};
final Map<ConstantValue, Info> _constantToInfo = <ConstantValue, Info>{};
final Map<OutputUnit, OutputUnitInfo> _outputToInfo = {};
@@ -53,7 +53,7 @@
dumpInfoTask._constantToNode.forEach((constant, node) {
// TODO(sigmund): add dependencies on other constants
var span = dumpInfoTask._nodeData[node];
- var info = new ConstantInfo(
+ var info = ConstantInfo(
size: span.end - span.start,
code: [span],
outputUnit: _unitInfoForConstant(constant));
@@ -79,7 +79,7 @@
libname = '<unnamed>';
}
int size = dumpInfoTask.sizeOf(lib);
- LibraryInfo info = new LibraryInfo(libname, lib.canonicalUri, null, size);
+ LibraryInfo info = LibraryInfo(libname, lib.canonicalUri, null, size);
_entityToInfo[lib] = info;
environment.forEachLibraryMember(lib, (MemberEntity member) {
@@ -133,7 +133,7 @@
// TODO(het): Why doesn't `size` account for the code size already?
if (code != null) size += code.length;
- FieldInfo info = new FieldInfo(
+ FieldInfo info = FieldInfo(
name: field.name,
type: '${environment.getFieldType(field)}',
inferredType: '$inferredType',
@@ -161,7 +161,7 @@
ClassInfo visitClass(ClassEntity clazz) {
// Omit class if it is not needed.
- ClassInfo classInfo = new ClassInfo(
+ ClassInfo classInfo = ClassInfo(
name: clazz.name,
isAbstract: clazz.isAbstract,
outputUnit: _unitInfoForClass(clazz));
@@ -188,7 +188,7 @@
}
}
} else {
- throw new StateError('Class member not a function or field');
+ throw StateError('Class member not a function or field');
}
});
environment.forEachConstructor(clazz, (constructor) {
@@ -215,7 +215,7 @@
}
ClosureInfo visitClosureClass(ClassEntity element) {
- ClosureInfo closureInfo = new ClosureInfo(
+ ClosureInfo closureInfo = ClosureInfo(
name: element.name,
outputUnit: _unitInfoForClass(element),
size: dumpInfoTask.sizeOf(element));
@@ -257,7 +257,7 @@
assert(kind != null);
- FunctionModifiers modifiers = new FunctionModifiers(
+ FunctionModifiers modifiers = FunctionModifiers(
isStatic: function.isStatic,
isConst: function.isConst,
isFactory: function.isConstructor
@@ -278,7 +278,7 @@
closedWorld.elementEnvironment.forEachParameter(function, (type, name, _) {
// Synthesized parameters have no name. This can happen on parameters of
// setters derived from lowering late fields.
- parameters.add(new ParameterInfo(name ?? '#t${parameterIndex}',
+ parameters.add(ParameterInfo(name ?? '#t${parameterIndex}',
inferredParameterTypes[parameterIndex++], '$type'));
});
@@ -292,7 +292,7 @@
int inlinedCount = dumpInfoTask.inlineCount[function];
if (inlinedCount == null) inlinedCount = 0;
- FunctionInfo info = new FunctionInfo(
+ FunctionInfo info = FunctionInfo(
name: name,
functionKind: kind,
modifiers: modifiers,
@@ -351,7 +351,7 @@
var filename = outputUnit.isMainOutput
? compiler.options.outputUri.pathSegments.last
: deferredPartFileName(compiler.options, outputUnit.name);
- OutputUnitInfo info = new OutputUnitInfo(filename, outputUnit.name,
+ OutputUnitInfo info = OutputUnitInfo(filename, outputUnit.name,
backendStrategy.emitterTask.emitter.generatedSize(outputUnit));
info.imports
.addAll(closedWorld.outputUnitData.getImportNames(outputUnit));
@@ -398,7 +398,7 @@
}
class DumpInfoTask extends CompilerTask implements InfoReporter {
- static const ImpactUseCase IMPACT_USE = const ImpactUseCase('Dump info');
+ static const ImpactUseCase IMPACT_USE = ImpactUseCase('Dump info');
final Compiler compiler;
final bool useBinaryFormat;
@@ -467,15 +467,15 @@
compiler.impactStrategy.visitImpact(
entity,
impact,
- new WorldImpactVisitorImpl(visitDynamicUse: (member, dynamicUse) {
+ WorldImpactVisitorImpl(visitDynamicUse: (member, dynamicUse) {
AbstractValue mask = dynamicUse.receiverConstraint;
selections.addAll(closedWorld
// TODO(het): Handle `call` on `Closure` through
// `world.includesClosureCall`.
.locateMembers(dynamicUse.selector, mask)
- .map((MemberEntity e) => new Selection(e, mask)));
+ .map((MemberEntity e) => Selection(e, mask)));
}, visitStaticUse: (member, staticUse) {
- selections.add(new Selection(staticUse.element, null));
+ selections.add(Selection(staticUse.element, null));
}),
IMPACT_USE);
return selections;
@@ -487,7 +487,7 @@
{LibraryEntity library}) {
if (compiler.options.dumpInfo) {
_entityToNodes.putIfAbsent(entity, () => <jsAst.Node>[]).add(code);
- _nodeData[code] ??= useBinaryFormat ? new CodeSpan() : new _CodeData();
+ _nodeData[code] ??= useBinaryFormat ? CodeSpan() : _CodeData();
}
}
@@ -496,7 +496,7 @@
assert(_constantToNode[constant] == null ||
_constantToNode[constant] == code);
_constantToNode[constant] = code;
- _nodeData[code] ??= useBinaryFormat ? new CodeSpan() : new _CodeData();
+ _nodeData[code] ??= useBinaryFormat ? CodeSpan() : _CodeData();
}
}
@@ -556,7 +556,7 @@
void dumpInfo(JClosedWorld closedWorld,
GlobalTypeInferenceResults globalInferenceResults) {
measure(() {
- infoCollector = new ElementInfoCollector(
+ infoCollector = ElementInfoCollector(
compiler, this, closedWorld, globalInferenceResults)
..run();
@@ -570,11 +570,11 @@
}
void dumpInfoJson(AllInfo data) {
- StringBuffer jsonBuffer = new StringBuffer();
+ StringBuffer jsonBuffer = StringBuffer();
JsonEncoder encoder = const JsonEncoder.withIndent(' ');
ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
- new StringConversionSink.fromStringSink(jsonBuffer));
- sink.add(new AllInfoJsonCodec(isBackwardCompatible: true).encode(data));
+ StringConversionSink.fromStringSink(jsonBuffer));
+ sink.add(AllInfoJsonCodec(isBackwardCompatible: true).encode(data));
compiler.outputProvider.createOutputSink(
compiler.options.outputUri.pathSegments.last,
'info.json',
@@ -590,7 +590,7 @@
void dumpInfoBinary(AllInfo data) {
var name = compiler.options.outputUri.pathSegments.last + ".info.data";
- Sink<List<int>> sink = new BinaryOutputSinkAdapter(compiler.outputProvider
+ Sink<List<int>> sink = BinaryOutputSinkAdapter(compiler.outputProvider
.createBinarySink(compiler.options.outputUri.resolve(name)));
dump_info.encode(data, sink);
compiler.reporter
@@ -601,7 +601,7 @@
}
AllInfo buildDumpInfoData(JClosedWorld closedWorld) {
- Stopwatch stopwatch = new Stopwatch();
+ Stopwatch stopwatch = Stopwatch();
stopwatch.start();
AllInfo result = infoCollector.result;
@@ -617,8 +617,8 @@
// Don't register dart2js builtin functions that are not recorded.
Info useInfo = infoCollector._entityToInfo[selection.selectedEntity];
if (useInfo == null) continue;
- info.uses.add(new DependencyInfo(
- useInfo, selection.receiverConstraint?.toString()));
+ info.uses.add(
+ DependencyInfo(useInfo, selection.receiverConstraint?.toString()));
}
}
@@ -632,8 +632,8 @@
for (Selection selection in uses) {
Info useInfo = infoCollector._entityToInfo[selection.selectedEntity];
if (useInfo == null) continue;
- info.uses.add(new DependencyInfo(
- useInfo, selection.receiverConstraint?.toString()));
+ info.uses.add(
+ DependencyInfo(useInfo, selection.receiverConstraint?.toString()));
}
}
@@ -647,7 +647,7 @@
for (Entity inlined in inlineMap[entity]) {
Info inlinedInfo = infoCollector._entityToInfo[inlined];
if (inlinedInfo == null) continue;
- outerInfo.uses.add(new DependencyInfo(inlinedInfo, 'inlined'));
+ outerInfo.uses.add(DependencyInfo(inlinedInfo, 'inlined'));
}
}
@@ -658,17 +658,16 @@
result.deferredFiles = fragmentMerger.computeDeferredMap(fragmentsToLoad);
stopwatch.stop();
- result.program = new ProgramInfo(
+ result.program = ProgramInfo(
entrypoint: infoCollector
._entityToInfo[closedWorld.elementEnvironment.mainFunction],
size: _programSize,
dart2jsVersion:
compiler.options.hasBuildId ? compiler.options.buildId : null,
- compilationMoment: new DateTime.now(),
+ compilationMoment: DateTime.now(),
compilationDuration: compiler.measurer.elapsedWallClock,
- toJsonDuration:
- new Duration(milliseconds: stopwatch.elapsedMilliseconds),
- dumpInfoDuration: new Duration(milliseconds: this.timing),
+ toJsonDuration: Duration(milliseconds: stopwatch.elapsedMilliseconds),
+ dumpInfoDuration: Duration(milliseconds: this.timing),
noSuchMethodEnabled: closedWorld.backendUsage.isNoSuchMethodUsed,
isRuntimeTypeUsed: closedWorld.backendUsage.isRuntimeTypeUsed,
isIsolateInUse: false,
@@ -683,7 +682,7 @@
/// Helper class to store what dump-info will show for a piece of code.
// TODO(sigmund): delete once we no longer emit text by default.
class _CodeData extends CodeSpan {
- StringBuffer _text = new StringBuffer();
+ StringBuffer _text = StringBuffer();
@override
String get text => '$_text';
int get length => end - start;
diff --git a/pkg/compiler/lib/src/enqueue.dart b/pkg/compiler/lib/src/enqueue.dart
index c3c07e6..1de1c68 100644
--- a/pkg/compiler/lib/src/enqueue.dart
+++ b/pkg/compiler/lib/src/enqueue.dart
@@ -54,7 +54,7 @@
_resolutionEnqueuerCreated = true;
ResolutionEnqueuer enqueuer = compiler.frontendStrategy
.createResolutionEnqueuer(this, compiler)
- ..onEmptyForTesting = compiler.onResolutionQueueEmptyForTesting;
+ ..onEmptyForTesting = compiler.onResolutionQueueEmptyForTesting;
if (retainDataForTesting) {
resolutionEnqueuerForTesting = enqueuer;
}
@@ -121,7 +121,7 @@
abstract class EnqueuerListener {
/// Called to instruct to the backend that [type] has been instantiated.
void registerInstantiatedType(InterfaceType type,
- {bool isGlobal: false, bool nativeUsage: false});
+ {bool isGlobal = false, bool nativeUsage = false});
/// Called to notify to the backend that a class is being instantiated. Any
/// backend specific [WorldImpact] of this is returned.
@@ -224,8 +224,7 @@
/// [Enqueuer] which is specific to resolution.
class ResolutionEnqueuer extends EnqueuerImpl {
- static const ImpactUseCase IMPACT_USE =
- const ImpactUseCase('ResolutionEnqueuer');
+ static const ImpactUseCase IMPACT_USE = ImpactUseCase('ResolutionEnqueuer');
@override
final CompilerTask task;
@@ -233,7 +232,7 @@
@override
final EnqueuerListener listener;
- final Set<ClassEntity> _recentClasses = new Setlet<ClassEntity>();
+ final Set<ClassEntity> _recentClasses = Setlet<ClassEntity>();
bool _recentConstants = false;
final ResolutionEnqueuerWorldBuilder _worldBuilder;
WorkItemBuilder _workItemBuilder;
@@ -245,7 +244,7 @@
WorldImpactVisitor _impactVisitor;
- final Queue<WorkItem> _queue = new Queue<WorkItem>();
+ final Queue<WorkItem> _queue = Queue<WorkItem>();
// If not `null` this is called when the queue has been emptied. It allows for
// applying additional impacts before re-emptying the queue.
@@ -254,7 +253,7 @@
ResolutionEnqueuer(this.task, this._reporter, this.listener,
this._worldBuilder, this._workItemBuilder, this._annotationsData,
[this.name = 'resolution enqueuer']) {
- _impactVisitor = new EnqueuerImplImpactVisitor(this);
+ _impactVisitor = EnqueuerImplImpactVisitor(this);
}
@override
@@ -282,8 +281,8 @@
void _registerInstantiatedType(InterfaceType type,
{ConstructorEntity constructor,
- bool nativeUsage: false,
- bool globalDependency: false}) {
+ bool nativeUsage = false,
+ bool globalDependency = false}) {
task.measureSubtask('resolution.typeUse', () {
_worldBuilder.registerTypeInstantiation(type, _applyClassUse,
constructor: constructor);
diff --git a/pkg/compiler/lib/src/null_compiler_output.dart b/pkg/compiler/lib/src/null_compiler_output.dart
index b01e544..a6443e7 100644
--- a/pkg/compiler/lib/src/null_compiler_output.dart
+++ b/pkg/compiler/lib/src/null_compiler_output.dart
@@ -19,7 +19,7 @@
@override
BinaryOutputSink createBinarySink(Uri uri) {
- return new NullBinarySink(uri);
+ return NullBinarySink(uri);
}
}
@@ -41,7 +41,7 @@
/// Convenience method for getting an [api.CompilerOutputProvider].
static NullSink outputProvider(
String name, String extension, OutputType type) {
- return new NullSink('$name.$extension.$type');
+ return NullSink('$name.$extension.$type');
}
}
diff --git a/pkg/compiler/lib/src/old_to_new_api.dart b/pkg/compiler/lib/src/old_to_new_api.dart
index a5d7c45..73ab528 100644
--- a/pkg/compiler/lib/src/old_to_new_api.dart
+++ b/pkg/compiler/lib/src/old_to_new_api.dart
@@ -22,7 +22,7 @@
LegacyCompilerInput(this._inputProvider);
@override
- Future<Input> readFromUri(Uri uri, {InputKind inputKind: InputKind.UTF8}) {
+ Future<Input> readFromUri(Uri uri, {InputKind inputKind = InputKind.UTF8}) {
// The switch handles all enum values, but not null.
// ignore: missing_return
return _inputProvider(uri).then((/*String|List<int>*/ data) {
@@ -30,9 +30,9 @@
case InputKind.UTF8:
SourceFile sourceFile;
if (data is List<int>) {
- sourceFile = new Utf8BytesSourceFile(uri, data);
+ sourceFile = Utf8BytesSourceFile(uri, data);
} else if (data is String) {
- sourceFile = new StringSourceFile.fromUri(uri, data);
+ sourceFile = StringSourceFile.fromUri(uri, data);
} else {
throw "Expected a 'String' or a 'List<int>' from the input "
"provider, but got: ${Error.safeToString(data)}.";
@@ -42,7 +42,7 @@
if (data is String) {
data = utf8.encode(data);
}
- return new Binary(uri, data);
+ return Binary(uri, data);
}
});
}
@@ -82,14 +82,14 @@
break;
default:
}
- return new LegacyOutputSink(_outputProvider(name, extension));
+ return LegacyOutputSink(_outputProvider(name, extension));
}
return NullSink.outputProvider(name, extension, type);
}
@override
BinaryOutputSink createBinarySink(Uri uri) {
- throw new UnsupportedError("LegacyCompilerOutput.createBinarySink");
+ throw UnsupportedError("LegacyCompilerOutput.createBinarySink");
}
}
diff --git a/pkg/compiler/lib/src/options.dart b/pkg/compiler/lib/src/options.dart
index 3c5ee61..5bacb0e 100644
--- a/pkg/compiler/lib/src/options.dart
+++ b/pkg/compiler/lib/src/options.dart
@@ -677,18 +677,18 @@
// null? In unittests we use the same compiler to analyze or build multiple
// entrypoints.
if (librariesSpecificationUri == null) {
- throw new ArgumentError("[librariesSpecificationUri] is null.");
+ throw ArgumentError("[librariesSpecificationUri] is null.");
}
if (librariesSpecificationUri!.path.endsWith('/')) {
- throw new ArgumentError(
+ throw ArgumentError(
"[librariesSpecificationUri] should be a file: $librariesSpecificationUri");
}
Map<fe.ExperimentalFlag, bool> experimentalFlags =
- new Map.from(fe.defaultExperimentalFlags);
+ Map.from(fe.defaultExperimentalFlags);
experimentalFlags.addAll(explicitExperimentalFlags);
if (platformBinaries == null &&
equalMaps(experimentalFlags, fe.defaultExperimentalFlags)) {
- throw new ArgumentError("Missing required ${Flags.platformBinaries}");
+ throw ArgumentError("Missing required ${Flags.platformBinaries}");
}
if (_soundNullSafety && _noSoundNullSafety) {
throw ArgumentError("'${Flags.soundNullSafety}' incompatible with "
@@ -809,10 +809,10 @@
/// Whether the type assertion should be emitted and checked.
final bool isEmitted;
- const CheckPolicy({this.isTrusted: false, this.isEmitted: false});
+ const CheckPolicy({this.isTrusted = false, this.isEmitted = false});
- static const trusted = const CheckPolicy(isTrusted: true);
- static const checked = const CheckPolicy(isEmitted: true);
+ static const trusted = CheckPolicy(isTrusted: true);
+ static const checked = CheckPolicy(isEmitted: true);
@override
String toString() => 'CheckPolicy(isTrusted=$isTrusted,'
@@ -872,7 +872,7 @@
{void Function(String)? onError, void Function(String)? onWarning}) {
List<String>? experiments =
_extractOptionalCsvOption(options, Flags.enableLanguageExperiments);
- onError ??= (String error) => throw new ArgumentError(error);
+ onError ??= (String error) => throw ArgumentError(error);
onWarning ??= (String warning) => print(warning);
return fe.parseExperimentalFlags(fe.parseExperimentalArguments(experiments),
onError: onError, onWarning: onWarning);
diff --git a/pkg/compiler/lib/src/ordered_typeset.dart b/pkg/compiler/lib/src/ordered_typeset.dart
index 8be4970..dc2b669 100644
--- a/pkg/compiler/lib/src/ordered_typeset.dart
+++ b/pkg/compiler/lib/src/ordered_typeset.dart
@@ -43,8 +43,7 @@
// internal links like the original type sets do?
source.begin(tag);
int typesCount = source.readInt();
- LinkBuilder<InterfaceType> typeLinkBuilder =
- new LinkBuilder<InterfaceType>();
+ LinkBuilder<InterfaceType> typeLinkBuilder = LinkBuilder<InterfaceType>();
List<Link<InterfaceType>> links = [];
for (int i = 0; i < typesCount; i++) {
links.add(typeLinkBuilder.addLast(source.readDartType()));
@@ -55,12 +54,12 @@
int levelCount = source.readInt();
List<Link<InterfaceType>> levels =
- new List<Link<InterfaceType>>.filled(levelCount, null);
+ List<Link<InterfaceType>>.filled(levelCount, null);
for (int i = 0; i < levelCount; i++) {
levels[i] = links[source.readInt()];
}
source.end(tag);
- return new OrderedTypeSet.internal(levels, types);
+ return OrderedTypeSet.internal(levels, types);
}
/// Serializes this [OrderedTypeSet] to [sink].
@@ -89,11 +88,10 @@
factory OrderedTypeSet.singleton(InterfaceType type) {
Link<InterfaceType> types =
- new LinkEntry<InterfaceType>(type, const Link<InterfaceType>());
- List<Link<InterfaceType>> list =
- new List<Link<InterfaceType>>.filled(1, null);
+ LinkEntry<InterfaceType>(type, const Link<InterfaceType>());
+ List<Link<InterfaceType>> list = List<Link<InterfaceType>>.filled(1, null);
list[0] = types;
- return new OrderedTypeSet.internal(list, types);
+ return OrderedTypeSet.internal(list, types);
}
/// Creates a new [OrderedTypeSet] for [type] when it directly extends the
@@ -106,15 +104,14 @@
type.element,
'Cannot extend generic class ${types.head} using '
'OrderedTypeSet.extendClass'));
- Link<InterfaceType> extendedTypes =
- new LinkEntry<InterfaceType>(type, types);
+ Link<InterfaceType> extendedTypes = LinkEntry<InterfaceType>(type, types);
List<Link<InterfaceType>> list =
- new List<Link<InterfaceType>>.filled(levels + 1, null);
+ List<Link<InterfaceType>>.filled(levels + 1, null);
for (int i = 0; i < levels; i++) {
list[i] = _levels[i];
}
list[levels] = extendedTypes;
- return new OrderedTypeSet.internal(list, extendedTypes);
+ return OrderedTypeSet.internal(list, extendedTypes);
}
Link<InterfaceType> get supertypes => types.tail;
@@ -132,7 +129,7 @@
/// Returns the offsets into [types] at which each level begins.
List<int> get levelOffsets {
- List<int> offsets = new List.filled(levels, -1);
+ List<int> offsets = List.filled(levels, -1);
int offset = 0;
Link<InterfaceType> pointer = types;
for (int depth = maxDepth; depth >= 0; depth--) {
@@ -201,8 +198,7 @@
}
abstract class OrderedTypeSetBuilderBase implements OrderedTypeSetBuilder {
- Map<int, LinkEntry<InterfaceType>> map =
- new Map<int, LinkEntry<InterfaceType>>();
+ Map<int, LinkEntry<InterfaceType>> map = Map<int, LinkEntry<InterfaceType>>();
int maxDepth = -1;
final ClassEntity cls;
@@ -245,7 +241,7 @@
prev = link;
link = link.tail;
}
- LinkEntry<InterfaceType> next = new LinkEntry<InterfaceType>(type);
+ LinkEntry<InterfaceType> next = LinkEntry<InterfaceType>(type);
next.tail = null;
if (prev == null) {
map[depth] = next;
@@ -259,9 +255,9 @@
OrderedTypeSet toTypeSet() {
List<Link<InterfaceType>> levels =
- new List<Link<InterfaceType>>.filled(maxDepth + 1, null);
+ List<Link<InterfaceType>>.filled(maxDepth + 1, null);
if (maxDepth < 0) {
- return new OrderedTypeSet.internal(levels, const Link<InterfaceType>());
+ return OrderedTypeSet.internal(levels, const Link<InterfaceType>());
}
Link<InterfaceType> next = const Link<InterfaceType>();
for (int depth = 0; depth <= maxDepth; depth++) {
@@ -278,12 +274,12 @@
next = first;
}
}
- return new OrderedTypeSet.internal(levels, levels.last);
+ return OrderedTypeSet.internal(levels, levels.last);
}
@override
String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuffer sb = StringBuffer();
for (int depth = 0; depth <= maxDepth; depth++) {
sb.write('$depth: ');
LinkEntry<InterfaceType> first = map[depth];
diff --git a/pkg/compiler/lib/src/script.dart b/pkg/compiler/lib/src/script.dart
index 5adbdae..cacd79f 100644
--- a/pkg/compiler/lib/src/script.dart
+++ b/pkg/compiler/lib/src/script.dart
@@ -27,7 +27,7 @@
Script.synthetic(Uri uri)
: readableUri = uri,
resourceUri = uri,
- file = new StringSourceFile.fromUri(
+ file = StringSourceFile.fromUri(
uri, "// Synthetic source file generated for '$uri'."),
isSynthesized = true;
@@ -36,6 +36,6 @@
/// Creates a new [Script] with the same URIs, but new content ([file]).
Script copyWithFile(SourceFile file) {
- return new Script(readableUri, resourceUri, file);
+ return Script(readableUri, resourceUri, file);
}
}
diff --git a/pkg/compiler/lib/src/source_file_provider.dart b/pkg/compiler/lib/src/source_file_provider.dart
index 54da609..cc5e875 100644
--- a/pkg/compiler/lib/src/source_file_provider.dart
+++ b/pkg/compiler/lib/src/source_file_provider.dart
@@ -38,14 +38,14 @@
input = binarySourceFiles[resourceUri];
break;
}
- if (input != null) return new Future.value(input);
+ if (input != null) return Future.value(input);
if (resourceUri.scheme == 'file') {
return _readFromFile(resourceUri, inputKind);
} else if (resourceUri.scheme == 'http' || resourceUri.scheme == 'https') {
return _readFromHttp(resourceUri, inputKind);
} else {
- throw new ArgumentError("Unknown scheme in uri '$resourceUri'");
+ throw ArgumentError("Unknown scheme in uri '$resourceUri'");
}
}
@@ -64,12 +64,11 @@
api.Input input;
switch (inputKind) {
case api.InputKind.UTF8:
- input = utf8SourceFiles[resourceUri] = new CachingUtf8BytesSourceFile(
+ input = utf8SourceFiles[resourceUri] = CachingUtf8BytesSourceFile(
resourceUri, relativizeUri(resourceUri), source);
break;
case api.InputKind.binary:
- input =
- binarySourceFiles[resourceUri] = new Binary(resourceUri, source);
+ input = binarySourceFiles[resourceUri] = Binary(resourceUri, source);
break;
}
return input;
@@ -93,15 +92,15 @@
try {
input = _readFromFileSync(resourceUri, inputKind);
} catch (e) {
- return new Future.error(e);
+ return Future.error(e);
}
- return new Future.value(input);
+ return Future.value(input);
}
Future<api.Input<List<int>>> _readFromHttp(
Uri resourceUri, api.InputKind inputKind) {
assert(resourceUri.scheme == 'http');
- HttpClient client = new HttpClient();
+ HttpClient client = HttpClient();
return client
.getUrl(resourceUri)
.then((HttpClientRequest request) => request.close())
@@ -116,7 +115,7 @@
int totalLength = splitContent.fold(0, (int old, List list) {
return old + list.length;
});
- Uint8List result = new Uint8List(totalLength);
+ Uint8List result = Uint8List(totalLength);
int offset = 0;
for (List<int> contentPart in splitContent) {
result.setRange(offset, offset + contentPart.length, contentPart);
@@ -126,12 +125,11 @@
api.Input<List<int>> input;
switch (inputKind) {
case api.InputKind.UTF8:
- input = utf8SourceFiles[resourceUri] = new CachingUtf8BytesSourceFile(
+ input = utf8SourceFiles[resourceUri] = CachingUtf8BytesSourceFile(
resourceUri, resourceUri.toString(), result);
break;
case api.InputKind.binary:
- input =
- binarySourceFiles[resourceUri] = new Binary(resourceUri, result);
+ input = binarySourceFiles[resourceUri] = Binary(resourceUri, result);
break;
}
return input;
@@ -151,14 +149,14 @@
}
Iterable<Uri> getSourceUris() {
- Set<Uri> uris = new Set<Uri>();
+ Set<Uri> uris = Set<Uri>();
uris.addAll(utf8SourceFiles.keys);
uris.addAll(binarySourceFiles.keys);
return uris;
}
}
-List<int> readAll(String filename, {bool zeroTerminated: true}) {
+List<int> readAll(String filename, {bool zeroTerminated = true}) {
RandomAccessFile file = File(filename).openSync();
int length = file.lengthSync();
int bufferLength = length;
@@ -166,7 +164,7 @@
// +1 to have a 0 terminated list, see [Scanner].
bufferLength++;
}
- var buffer = new Uint8List(bufferLength);
+ var buffer = Uint8List(bufferLength);
file.readIntoSync(buffer, 0, length);
file.closeSync();
return buffer;
@@ -181,7 +179,7 @@
@override
Future<api.Input<List<int>>> readFromUri(Uri uri,
- {InputKind inputKind: InputKind.UTF8}) =>
+ {InputKind inputKind = InputKind.UTF8}) =>
readBytesFromUri(uri, inputKind);
}
@@ -204,7 +202,7 @@
FormattingDiagnosticHandler([SourceFileProvider provider])
: this.provider =
- (provider == null) ? new CompilerSourceFileProvider() : provider;
+ (provider == null) ? CompilerSourceFileProvider() : provider;
void info(var message, [api.Diagnostic kind = api.Diagnostic.VERBOSE_INFO]) {
if (!verbose && kind == api.Diagnostic.VERBOSE_INFO) return;
@@ -301,7 +299,7 @@
}
if (fatal && ++fatalCount >= throwOnErrorCount && throwOnError) {
isAborting = true;
- throw new AbortLeg(message);
+ throw AbortLeg(message);
}
}
@@ -312,7 +310,7 @@
}
}
-typedef void MessageCallback(String message);
+typedef MessageCallback = void Function(String message);
class RandomAccessFileOutputProvider implements CompilerOutput {
final Uri out;
@@ -420,7 +418,7 @@
}
}
- return new _OutputSinkWrapper(writeStringSync, onDone);
+ return _OutputSinkWrapper(writeStringSync, onDone);
}
@override
@@ -453,7 +451,7 @@
totalDataWritten += bytesWritten;
}
- return new _BinaryOutputSinkWrapper(writeBytesSync, onDone);
+ return _BinaryOutputSinkWrapper(writeBytesSync, onDone);
}
}
@@ -461,7 +459,7 @@
final RandomAccessFile output;
RandomAccessBinaryOutputSink(Uri uri)
- : output = new File.fromUri(uri).openSync(mode: FileMode.write);
+ : output = File.fromUri(uri).openSync(mode: FileMode.write);
@override
void write(List<int> buffer, [int start = 0, int end]) {
@@ -546,14 +544,14 @@
@override
Future<api.Input<List<int>>> readFromUri(Uri uri,
- {InputKind inputKind: InputKind.UTF8}) async {
+ {InputKind inputKind = InputKind.UTF8}) async {
var resolvedUri = uri;
var path = uri.path;
if (path.startsWith('/bazel-root')) {
path = path.substring('/bazel-root/'.length);
for (var dir in dirs) {
var file = dir.resolve(path);
- if (await new File.fromUri(file).exists()) {
+ if (await File.fromUri(file).exists()) {
resolvedUri = file;
break;
}
@@ -579,7 +577,7 @@
path = path.substring('/bazel-root/'.length);
for (var dir in dirs) {
var file = dir.resolve(path);
- if (new File.fromUri(file).existsSync()) {
+ if (File.fromUri(file).existsSync()) {
return super.autoReadFromFile(file);
}
}
@@ -607,14 +605,14 @@
@override
Future<api.Input<List<int>>> readFromUri(Uri uri,
- {InputKind inputKind: InputKind.UTF8}) async {
+ {InputKind inputKind = InputKind.UTF8}) async {
var resolvedUri = uri;
if (resolvedUri.scheme == markerScheme) {
var path = resolvedUri.path;
if (path.startsWith('/')) path = path.substring(1);
for (var dir in roots) {
var fileUri = dir.resolve(path);
- if (await new File.fromUri(fileUri).exists()) {
+ if (await File.fromUri(fileUri).exists()) {
resolvedUri = fileUri;
break;
}
@@ -639,7 +637,7 @@
var path = resourceUri.path;
for (var dir in roots) {
var file = dir.resolve(path);
- if (new File.fromUri(file).existsSync()) {
+ if (File.fromUri(file).existsSync()) {
return super.autoReadFromFile(file);
}
}
diff --git a/pkg/compiler/lib/src/tracer.dart b/pkg/compiler/lib/src/tracer.dart
index c2c5c5f..3386c81 100644
--- a/pkg/compiler/lib/src/tracer.dart
+++ b/pkg/compiler/lib/src/tracer.dart
@@ -44,14 +44,14 @@
tag("compilation", () {
printProperty("name", methodName);
printProperty("method", methodName);
- printProperty("date", new DateTime.now().millisecondsSinceEpoch);
+ printProperty("date", DateTime.now().millisecondsSinceEpoch);
});
}
void traceGraph(String name, var irObject) {
if (!traceActive) return;
if (irObject is ssa.HGraph) {
- new HTracer(output, closedWorld).traceGraph(name, irObject);
+ HTracer(output, closedWorld).traceGraph(name, irObject);
}
}
@@ -64,7 +64,7 @@
abstract class TracerUtil {
api.OutputSink get output;
- final Indentation _ind = new Indentation();
+ final Indentation _ind = Indentation();
void tag(String tagName, Function f) {
println("begin_$tagName");
diff --git a/pkg/compiler/test/jsinterop/declaration_test.dart b/pkg/compiler/test/jsinterop/declaration_test.dart
index fd61ba4..4d9cb2a 100644
--- a/pkg/compiler/test/jsinterop/declaration_test.dart
+++ b/pkg/compiler/test/jsinterop/declaration_test.dart
@@ -94,23 +94,6 @@
main() => new A();
'''),
- const Test(
- 'Js-interop class with abstract getter.',
- '''
-@JS()
-library test;
-
-import 'package:js/js.dart';
-
-@JS()
-class A {
- get foo;
-}
-
-main() => new A();
-''',
- warnings: const [MessageKind.ABSTRACT_GETTER],
- skipForKernel: true),
const Test('Js-interop class that extends a js-interop class.', '''
@JS()
library test;
@@ -392,18 +375,15 @@
final Map<String, String> _sources;
final List<MessageKind> errors;
final List<MessageKind> warnings;
- final bool skipForKernel;
const Test(this.name, this._source,
{this.errors: const <MessageKind>[],
- this.warnings: const <MessageKind>[],
- this.skipForKernel: false})
+ this.warnings: const <MessageKind>[]})
: _sources = null;
const Test.multi(this.name, this._sources,
{this.errors: const <MessageKind>[],
- this.warnings: const <MessageKind>[],
- this.skipForKernel: false})
+ this.warnings: const <MessageKind>[]})
: _source = null;
String get source => _source != null ? _source : _sources['main.dart'];
@@ -415,9 +395,7 @@
runTest(Test test) async {
print('==${test.name}======================================================');
print(test.source);
- if (!test.skipForKernel) {
- await runTestInternal(test);
- }
+ await runTestInternal(test);
}
runTestInternal(Test test) async {
diff --git a/pkg/dev_compiler/lib/src/compiler/shared_command.dart b/pkg/dev_compiler/lib/src/compiler/shared_command.dart
index c0a9c24..77fc615 100644
--- a/pkg/dev_compiler/lib/src/compiler/shared_command.dart
+++ b/pkg/dev_compiler/lib/src/compiler/shared_command.dart
@@ -23,34 +23,6 @@
/// This file should only implement functionality that does not depend on
/// Analyzer/Kernel imports.
-/// Variables that indicate which libraries are available in dev compiler.
-// TODO(jmesserly): provide an option to compile without dart:html & friends?
-Map<String, String> sdkLibraryVariables = {
- 'dart.isVM': 'false',
- 'dart.library.async': 'true',
- 'dart.library.core': 'true',
- 'dart.library.collection': 'true',
- 'dart.library.convert': 'true',
- // TODO(jmesserly): this is not really supported in dart4web other than
- // `debugger()`
- 'dart.library.developer': 'true',
- 'dart.library.io': 'false',
- 'dart.library.isolate': 'false',
- 'dart.library.js': 'true',
- 'dart.library.js_util': 'true',
- 'dart.library.math': 'true',
- 'dart.library.mirrors': 'false',
- 'dart.library.typed_data': 'true',
- 'dart.library.indexed_db': 'true',
- 'dart.library.html': 'true',
- 'dart.library.html_common': 'true',
- 'dart.library.svg': 'true',
- 'dart.library.ui': 'false',
- 'dart.library.web_audio': 'true',
- 'dart.library.web_gl': 'true',
- 'dart.library.web_sql': 'true',
-};
-
/// Compiler options for the `dartdevc` backend.
class SharedCompilerOptions {
/// Whether to emit the source mapping file.
diff --git a/pkg/dev_compiler/lib/src/kernel/command.dart b/pkg/dev_compiler/lib/src/kernel/command.dart
index 0fff027..d8435ca 100644
--- a/pkg/dev_compiler/lib/src/kernel/command.dart
+++ b/pkg/dev_compiler/lib/src/kernel/command.dart
@@ -819,7 +819,8 @@
}
// Add platform defined variables
- declaredVariables.addAll(sdkLibraryVariables);
+ // TODO(47243) Remove when all code paths read these from the `Target`.
+ declaredVariables.addAll(sdkLibraryEnvironmentDefines);
return declaredVariables;
}
diff --git a/pkg/dev_compiler/lib/src/kernel/expression_compiler_worker.dart b/pkg/dev_compiler/lib/src/kernel/expression_compiler_worker.dart
index 06310f6..6f11aa6 100644
--- a/pkg/dev_compiler/lib/src/kernel/expression_compiler_worker.dart
+++ b/pkg/dev_compiler/lib/src/kernel/expression_compiler_worker.dart
@@ -12,6 +12,8 @@
import 'package:args/args.dart';
import 'package:build_integration/file_system/multi_root.dart';
import 'package:dev_compiler/dev_compiler.dart';
+import 'package:dev_compiler/src/kernel/target.dart'
+ show sdkLibraryEnvironmentDefines;
import 'package:front_end/src/api_prototype/file_system.dart';
import 'package:front_end/src/api_unstable/ddc.dart';
import 'package:kernel/ast.dart' show Component, Library;
@@ -206,7 +208,7 @@
@required Uri sdkSummary,
@required FileSystem fileSystem,
Uri packagesFile,
- Map<String, String> environmentDefines = const {},
+ Map<String, String> environmentDefines,
Map<ExperimentalFlag, bool> explicitExperimentalFlags = const {},
Uri sdkRoot,
bool trackWidgetCreation = false,
@@ -228,7 +230,11 @@
TargetFlags(trackWidgetCreation: trackWidgetCreation))
..fileSystem = fileSystem
..omitPlatform = true
- ..environmentDefines = environmentDefines
+ ..environmentDefines = {
+ if (environmentDefines != null) ...environmentDefines,
+ // TODO(47243) Remove when all code paths read these from the `Target`.
+ ...sdkLibraryEnvironmentDefines
+ }
..explicitExperimentalFlags = explicitExperimentalFlags
..onDiagnostic = _onDiagnosticHandler(errors, warnings, infos)
..nnbdMode = soundNullSafety ? NnbdMode.Strong : NnbdMode.Weak
diff --git a/pkg/dev_compiler/lib/src/kernel/target.dart b/pkg/dev_compiler/lib/src/kernel/target.dart
index 0ee8532..47cd497 100644
--- a/pkg/dev_compiler/lib/src/kernel/target.dart
+++ b/pkg/dev_compiler/lib/src/kernel/target.dart
@@ -19,6 +19,35 @@
import 'constants.dart' show DevCompilerConstantsBackend;
import 'kernel_helpers.dart';
+/// Boolean environment variables that indicate which libraries are available in
+/// dev compiler.
+// TODO(jmesserly): provide an option to compile without dart:html & friends?
+const sdkLibraryEnvironmentDefines = {
+ 'dart.isVM': 'false',
+ 'dart.library.async': 'true',
+ 'dart.library.core': 'true',
+ 'dart.library.collection': 'true',
+ 'dart.library.convert': 'true',
+ // TODO(jmesserly): this is not really supported in dart4web other than
+ // `debugger()`
+ 'dart.library.developer': 'true',
+ 'dart.library.io': 'false',
+ 'dart.library.isolate': 'false',
+ 'dart.library.js': 'true',
+ 'dart.library.js_util': 'true',
+ 'dart.library.math': 'true',
+ 'dart.library.mirrors': 'false',
+ 'dart.library.typed_data': 'true',
+ 'dart.library.indexed_db': 'true',
+ 'dart.library.html': 'true',
+ 'dart.library.html_common': 'true',
+ 'dart.library.svg': 'true',
+ 'dart.library.ui': 'false',
+ 'dart.library.web_audio': 'true',
+ 'dart.library.web_gl': 'true',
+ 'dart.library.web_sql': 'true',
+};
+
/// A kernel [Target] to configure the Dart Front End for dartdevc.
class DevCompilerTarget extends Target {
DevCompilerTarget(this.flags);
@@ -31,6 +60,10 @@
Map<String, Class>? _nativeClasses;
@override
+ Map<String, String> updateEnvironmentDefines(Map<String, String> map) =>
+ map..addAll(sdkLibraryEnvironmentDefines);
+
+ @override
bool get enableSuperMixins => true;
@override
diff --git a/pkg/dev_compiler/test/expression_compiler/expression_compiler_worker_shared.dart b/pkg/dev_compiler/test/expression_compiler/expression_compiler_worker_shared.dart
index b1a4eac..cd8a9ef 100644
--- a/pkg/dev_compiler/test/expression_compiler/expression_compiler_worker_shared.dart
+++ b/pkg/dev_compiler/test/expression_compiler/expression_compiler_worker_shared.dart
@@ -175,6 +175,40 @@
]));
});
+ test('compile expressions include "dart.library..." environment defines.',
+ () async {
+ driver.requestController.add({
+ 'command': 'UpdateDeps',
+ 'inputs': driver.inputs,
+ });
+
+ driver.requestController.add({
+ 'command': 'CompileExpression',
+ 'expression': 'const bool.fromEnvironment("dart.library.html")',
+ 'line': 5,
+ 'column': 1,
+ 'jsModules': {},
+ 'jsScope': {'formal': 'formal'},
+ 'libraryUri': driver.config.testModule.libraryUri,
+ 'moduleName': driver.config.testModule.moduleName,
+ });
+
+ expect(
+ driver.responseController.stream,
+ emitsInOrder([
+ equals({
+ 'succeeded': true,
+ }),
+ equals({
+ 'succeeded': true,
+ 'errors': isEmpty,
+ 'warnings': isEmpty,
+ 'infos': isEmpty,
+ 'compiledProcedure': contains('true'),
+ })
+ ]));
+ });
+
test('can compile expressions in main', () async {
driver.requestController.add({
'command': 'UpdateDeps',
diff --git a/pkg/front_end/lib/src/fasta/diagnostics.md b/pkg/front_end/lib/src/fasta/diagnostics.md
index 4307597..9ae63d6 100644
--- a/pkg/front_end/lib/src/fasta/diagnostics.md
+++ b/pkg/front_end/lib/src/fasta/diagnostics.md
@@ -8,7 +8,6 @@
-- Note: if you move this file to a different location, please make sure that
-- you also update these references to it:
-- * pkg/compiler/lib/src/diagnostics/messages.dart
- -- * pkg/dart_messages/lib/shared_messages.dart
-- * pkg/_fe_analyzer_shared/lib/src/base/errors.dart
-- * https://github.com/dart-lang/linter/
-->
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 38edea3..3bf6051 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -56,7 +56,6 @@
import '../builder/extension_builder.dart';
import '../builder/factory_builder.dart';
import '../builder/field_builder.dart';
-import '../builder/fixed_type_builder.dart';
import '../builder/formal_parameter_builder.dart';
import '../builder/function_builder.dart';
import '../builder/function_type_builder.dart';
@@ -219,7 +218,10 @@
/// When parsing this initializer `x = x`, `x` must be resolved in two
/// different scopes. The first `x` must be resolved in the class' scope, the
/// second in the formal parameter scope.
- bool inInitializer = false;
+ bool inInitializerLeftHandSide = false;
+
+ /// This is set to true when we are parsing constructor initializers.
+ bool inConstructorInitializer = false;
/// Set to `true` when we are parsing a field initializer either directly
/// or within an initializer list.
@@ -264,7 +266,6 @@
Link<bool> _isOrAsOperatorTypeState = const Link<bool>().prepend(false);
- @override
bool get inIsOrAsOperatorType => _isOrAsOperatorTypeState.head;
Link<bool> _localInitializerState = const Link<bool>().prepend(false);
@@ -294,7 +295,7 @@
@override
ConstantContext constantContext = ConstantContext.none;
- UnresolvedType? currentLocalVariableType;
+ DartType? currentLocalVariableType;
// Using non-null value to initialize this field based on performance advice
// from VM engineers. TODO(ahe): Does this still apply?
@@ -478,7 +479,7 @@
if (node is DartType) {
unhandled("DartType", "push", -1, uri);
}
- inInitializer = false;
+ inInitializerLeftHandSide = false;
super.push(node);
}
@@ -852,7 +853,7 @@
// `invalid-type`.
UnresolvedType? type = pop() as UnresolvedType?;
if (type != null) {
- buildDartType(type);
+ buildDartType(type, allowPotentiallyConstantType: false);
}
}
pop(); // Annotations.
@@ -956,6 +957,7 @@
if (functionNestingLevel == 0) {
prepareInitializers();
}
+ inConstructorInitializer = true;
}
@override
@@ -964,12 +966,13 @@
if (functionNestingLevel == 0) {
scope = formalParameterScope ?? new Scope.immutable();
}
+ inConstructorInitializer = false;
}
@override
void beginInitializer(Token token) {
debugEvent("beginInitializer");
- inInitializer = true;
+ inInitializerLeftHandSide = true;
inFieldInitializer = true;
}
@@ -985,7 +988,7 @@
debugEvent("endInitializer");
inFieldInitializer = false;
- assert(!inInitializer);
+ assert(!inInitializerLeftHandSide);
Object? node = pop();
List<Initializer> initializers;
@@ -1805,7 +1808,9 @@
if (isInForest) {
assert(forest.argumentsTypeArguments(arguments).isEmpty);
forest.argumentsSetTypeArguments(
- arguments, buildDartTypeArguments(typeArguments));
+ arguments,
+ buildDartTypeArguments(typeArguments,
+ allowPotentiallyConstantType: false));
} else {
assert(typeArguments == null ||
(receiver is TypeUseGenerator &&
@@ -2357,25 +2362,15 @@
debugEvent("handleIdentifier");
String name = token.lexeme;
if (context.isScopeReference) {
- assert(!inInitializer ||
+ assert(!inInitializerLeftHandSide ||
this.scope == enclosingScope ||
this.scope.parent == enclosingScope);
// This deals with this kind of initializer: `C(a) : a = a;`
- Scope scope = inInitializer ? enclosingScope : this.scope;
+ Scope scope = inInitializerLeftHandSide ? enclosingScope : this.scope;
push(scopeLookup(scope, name, token));
} else {
- if (context.inDeclaration) {
- if (context == IdentifierContext.topLevelVariableDeclaration ||
- context == IdentifierContext.fieldDeclaration) {
- constantContext = member.isConst
- ? ConstantContext.inferred
- : !member.isStatic &&
- classBuilder != null &&
- classBuilder!.declaresConstConstructor
- ? ConstantContext.required
- : ConstantContext.none;
- }
- } else if (constantContext != ConstantContext.none &&
+ if (!context.inDeclaration &&
+ constantContext != ConstantContext.none &&
!context.allowedInConstantExpression) {
addProblem(fasta.messageNotAConstantExpression, token.charOffset,
token.length);
@@ -2446,7 +2441,7 @@
if (declaration != null &&
declaration.isDeclarationInstanceMember &&
(inFieldInitializer && !inLateFieldInitializer) &&
- !inInitializer) {
+ !inInitializerLeftHandSide) {
// We cannot access a class instance member in an initializer of a
// field.
//
@@ -2469,7 +2464,8 @@
if (!isQualified && isDeclarationInstanceContext) {
assert(declaration == null);
if (constantContext != ConstantContext.none ||
- (inFieldInitializer && !inLateFieldInitializer) && !inInitializer) {
+ (inFieldInitializer && !inLateFieldInitializer) &&
+ !inInitializerLeftHandSide) {
return new UnresolvedNameGenerator(this, token, n,
unresolvedReadKind: UnresolvedKind.Unknown);
}
@@ -2521,7 +2517,7 @@
}
} else if (declaration.isClassInstanceMember) {
if (constantContext != ConstantContext.none &&
- !inInitializer &&
+ !inInitializerLeftHandSide &&
// TODO(ahe): This is a hack because Fasta sets up the scope
// "this.field" parameters according to old semantics. Under the new
// semantics, such parameters introduces a new parameter with that
@@ -2884,9 +2880,7 @@
identifier.name, functionNestingLevel,
forSyntheticToken: identifier.token.isSynthetic,
initializer: initializer,
- type: currentLocalVariableType != null
- ? buildDartType(currentLocalVariableType!)
- : null,
+ type: currentLocalVariableType,
isFinal: isFinal,
isConst: isConst,
isLate: isLate,
@@ -2906,6 +2900,13 @@
@override
void beginFieldInitializer(Token token) {
inFieldInitializer = true;
+ constantContext = member.isConst
+ ? ConstantContext.inferred
+ : !member.isStatic &&
+ classBuilder != null &&
+ classBuilder!.declaresConstConstructor
+ ? ConstantContext.required
+ : ConstantContext.none;
if (member is FieldBuilder) {
FieldBuilder fieldBuilder = member as FieldBuilder;
inLateFieldInitializer = fieldBuilder.isLate;
@@ -2928,17 +2929,26 @@
inLateFieldInitializer = false;
assert(assignmentOperator.stringValue == "=");
push(popForValue());
+ constantContext = ConstantContext.none;
}
@override
void handleNoFieldInitializer(Token token) {
debugEvent("NoFieldInitializer");
+ constantContext = member.isConst
+ ? ConstantContext.inferred
+ : !member.isStatic &&
+ classBuilder != null &&
+ classBuilder!.declaresConstConstructor
+ ? ConstantContext.required
+ : ConstantContext.none;
if (constantContext == ConstantContext.inferred) {
// Creating a null value to prevent the Dart VM from crashing.
push(forest.createNullLiteral(offsetForToken(token)));
} else {
push(NullValue.FieldInitializer);
}
+ constantContext = ConstantContext.none;
}
@override
@@ -2963,7 +2973,11 @@
if (!libraryBuilder.isNonNullableByDefault) {
reportNonNullableModifierError(lateToken);
}
- UnresolvedType? type = pop() as UnresolvedType?;
+ UnresolvedType? unresolvedType =
+ pop(NullValue.UnresolvedType) as UnresolvedType?;
+ DartType? type = unresolvedType != null
+ ? buildDartType(unresolvedType, allowPotentiallyConstantType: false)
+ : null;
int modifiers = (lateToken != null ? lateMask : 0) |
Modifier.validateVarFinalOrConst(varFinalOrConst?.lexeme);
_enterLocalState(inLateLocalInitializer: lateToken != null);
@@ -2983,7 +2997,7 @@
if (count == 1) {
Object? node = pop();
constantContext = pop() as ConstantContext;
- currentLocalVariableType = pop() as UnresolvedType?;
+ currentLocalVariableType = pop(NullValue.Type) as DartType?;
currentLocalVariableModifiers = pop() as int;
List<Expression>? annotations = pop() as List<Expression>?;
if (node is ParserRecovery) {
@@ -3003,7 +3017,7 @@
const FixedNullableList<VariableDeclaration>()
.popNonNullable(stack, count, dummyVariableDeclaration);
constantContext = pop() as ConstantContext;
- currentLocalVariableType = pop() as UnresolvedType?;
+ currentLocalVariableType = pop(NullValue.Type) as DartType?;
currentLocalVariableModifiers = pop() as int;
List<Expression>? annotations = pop() as List<Expression>?;
if (variables == null) {
@@ -3404,7 +3418,8 @@
lengthOfSpan(leftBracket, leftBracket.endGroup));
typeArgument = const InvalidType();
} else {
- typeArgument = buildDartType(typeArguments.single);
+ typeArgument = buildDartType(typeArguments.single,
+ allowPotentiallyConstantType: false);
typeArgument = instantiateToBounds(
typeArgument, coreTypes.objectClass, libraryBuilder.library);
}
@@ -3428,7 +3443,8 @@
Token leftBrace, List<dynamic>? setOrMapEntries) {
DartType typeArgument;
if (typeArguments != null) {
- typeArgument = buildDartType(typeArguments.single);
+ typeArgument = buildDartType(typeArguments.single,
+ allowPotentiallyConstantType: false);
typeArgument = instantiateToBounds(
typeArgument, coreTypes.objectClass, libraryBuilder.library);
} else {
@@ -3568,8 +3584,10 @@
keyType = const InvalidType();
valueType = const InvalidType();
} else {
- keyType = buildDartType(typeArguments[0]);
- valueType = buildDartType(typeArguments[1]);
+ keyType = buildDartType(typeArguments[0],
+ allowPotentiallyConstantType: false);
+ valueType = buildDartType(typeArguments[1],
+ allowPotentiallyConstantType: false);
keyType = instantiateToBounds(
keyType, coreTypes.objectClass, libraryBuilder.library);
valueType = instantiateToBounds(
@@ -3698,8 +3716,19 @@
}
TypeBuilder? result;
if (name is Generator) {
+ bool allowPotentiallyConstantType;
+ if (libraryBuilder.isNonNullableByDefault) {
+ if (enableConstructorTearOffsInLibrary) {
+ allowPotentiallyConstantType = true;
+ } else {
+ allowPotentiallyConstantType = inIsOrAsOperatorType;
+ }
+ } else {
+ allowPotentiallyConstantType = false;
+ }
result = name.buildTypeWithResolvedArguments(
- libraryBuilder.nullableBuilderIfTrue(isMarkedAsNullable), arguments);
+ libraryBuilder.nullableBuilderIfTrue(isMarkedAsNullable), arguments,
+ allowPotentiallyConstantType: allowPotentiallyConstantType);
// ignore: unnecessary_null_comparison
if (result == null) {
unhandled("null", "result", beginToken.charOffset, uri);
@@ -3944,7 +3973,7 @@
// where not calling [buildDartType] leads to a missing compile-time
// error. Also, notice that the type of the problematic parameter isn't
// `invalid-type`.
- buildDartType(type);
+ buildDartType(type, allowPotentiallyConstantType: false);
}
int modifiers = pop() as int;
if (inCatchClause) {
@@ -4152,7 +4181,8 @@
popIfNotNull(onKeyword) as UnresolvedType?;
DartType exceptionType;
if (unresolvedExceptionType != null) {
- exceptionType = buildDartType(unresolvedExceptionType);
+ exceptionType = buildDartType(unresolvedExceptionType,
+ allowPotentiallyConstantType: false);
} else {
exceptionType = (libraryBuilder.isNonNullableByDefault
? coreTypes.objectNonNullableRawType
@@ -4855,8 +4885,11 @@
if (enableConstructorTearOffsInLibrary && inImplicitCreationContext) {
Expression receiver = receiverFunction();
if (typeArguments != null) {
- receiver = forest.createInstantiation(instantiationOffset, receiver,
- buildDartTypeArguments(typeArguments));
+ receiver = forest.createInstantiation(
+ instantiationOffset,
+ receiver,
+ buildDartTypeArguments(typeArguments,
+ allowPotentiallyConstantType: true));
}
return forest.createMethodInvocation(invocationOffset, receiver,
new Name(constructorName, libraryBuilder.nameOrigin), arguments);
@@ -4864,7 +4897,9 @@
if (typeArguments != null) {
assert(forest.argumentsTypeArguments(arguments).isEmpty);
forest.argumentsSetTypeArguments(
- arguments, buildDartTypeArguments(typeArguments));
+ arguments,
+ buildDartTypeArguments(typeArguments,
+ allowPotentiallyConstantType: false));
}
return buildUnresolvedError(
forest.createNullLiteral(instantiationOffset),
@@ -5085,7 +5120,9 @@
if (typeArguments != null && !isTypeArgumentsInForest) {
assert(forest.argumentsTypeArguments(arguments).isEmpty);
forest.argumentsSetTypeArguments(
- arguments, buildDartTypeArguments(typeArguments));
+ arguments,
+ buildDartTypeArguments(typeArguments,
+ allowPotentiallyConstantType: false));
}
}
if (type is ClassBuilder) {
@@ -5319,7 +5356,7 @@
push(_createReadOnlyVariableAccess(extensionThis!, token,
offsetForToken(token), 'this', ReadOnlyAccessKind.ExtensionThis));
} else {
- push(new ThisAccessGenerator(this, token, inInitializer,
+ push(new ThisAccessGenerator(this, token, inInitializerLeftHandSide,
inFieldInitializer, inLateFieldInitializer));
}
} else {
@@ -5336,7 +5373,7 @@
extensionThis == null) {
MemberBuilder memberBuilder = member as MemberBuilder;
memberBuilder.member.transformerFlags |= TransformerFlag.superCalls;
- push(new ThisAccessGenerator(this, token, inInitializer,
+ push(new ThisAccessGenerator(this, token, inInitializerLeftHandSide,
inFieldInitializer, inLateFieldInitializer,
isSuper: true));
} else {
@@ -5979,7 +6016,7 @@
// If in an assert initializer, make sure [inInitializer] is false so we
// use the formal parameter scope. If this is any other kind of assert,
// inInitializer should be false anyway.
- inInitializer = false;
+ inInitializerLeftHandSide = false;
}
@override
@@ -6765,7 +6802,9 @@
openAngleBracket.charOffset, noLength));
} else {
push(new Instantiation(
- toValue(operand), buildDartTypeArguments(typeArguments))
+ toValue(operand),
+ buildDartTypeArguments(typeArguments,
+ allowPotentiallyConstantType: true))
..fileOffset = openAngleBracket.charOffset);
}
} else {
@@ -6780,94 +6819,72 @@
}
@override
- UnresolvedType validateTypeUse(UnresolvedType unresolved,
- {required bool nonInstanceAccessIsError,
- required bool allowPotentiallyConstantType}) {
- // ignore: unnecessary_null_comparison
- assert(nonInstanceAccessIsError != null);
+ UnresolvedType validateTypeVariableUse(UnresolvedType unresolved,
+ {required bool allowPotentiallyConstantType}) {
// ignore: unnecessary_null_comparison
assert(allowPotentiallyConstantType != null);
- TypeBuilder builder = unresolved.builder;
- if (builder is NamedTypeBuilder && builder.declaration!.isTypeVariable) {
- TypeVariableBuilder typeParameterBuilder =
- builder.declaration as TypeVariableBuilder;
- TypeParameter typeParameter = typeParameterBuilder.parameter;
- LocatedMessage? message = _validateTypeUseIsInternal(
- builder, unresolved.fileUri, unresolved.charOffset,
- allowPotentiallyConstantType: allowPotentiallyConstantType);
- if (message == null) return unresolved;
- return new UnresolvedType(
- new NamedTypeBuilder(typeParameter.name!, builder.nullabilityBuilder,
- /* arguments = */ null, unresolved.fileUri, unresolved.charOffset)
- ..bind(new InvalidTypeDeclarationBuilder(
- typeParameter.name!, message)),
- unresolved.charOffset,
- unresolved.fileUri);
- } else if (builder is FunctionTypeBuilder) {
- LocatedMessage? message = _validateTypeUseIsInternal(
- builder, unresolved.fileUri, unresolved.charOffset,
- allowPotentiallyConstantType: allowPotentiallyConstantType);
- if (message == null) return unresolved;
- // TODO(johnniwinther): We should either remove this method completely and
- // fully handle this with `nonInstanceContext`, or fully handle all types
- // and remove `nonInstanceContext`.
- return new UnresolvedType(
- new FixedTypeBuilder(
- const InvalidType(), unresolved.fileUri, unresolved.charOffset),
- unresolved.charOffset,
- unresolved.fileUri);
- }
+ _validateTypeVariableUseInternal(
+ unresolved.builder, unresolved.fileUri, unresolved.charOffset,
+ allowPotentiallyConstantType: allowPotentiallyConstantType);
return unresolved;
}
- LocatedMessage? _validateTypeUseIsInternal(
+ void _validateTypeVariableUseInternal(
TypeBuilder? builder, Uri fileUri, int charOffset,
{required bool allowPotentiallyConstantType}) {
// ignore: unnecessary_null_comparison
assert(allowPotentiallyConstantType != null);
- if (builder is NamedTypeBuilder && builder.declaration!.isTypeVariable) {
- TypeVariableBuilder typeParameterBuilder =
- builder.declaration as TypeVariableBuilder;
- TypeParameter typeParameter = typeParameterBuilder.parameter;
- LocatedMessage message;
- bool extensionField =
- member.isExtensionMember && member.isField && !member.isExternal;
- if ((extensionField || !isDeclarationInstanceContext) &&
- (typeParameter.parent is Class ||
- typeParameter.parent is Extension)) {
- message = fasta.messageTypeVariableInStaticContext.withLocation(
- builder.fileUri ?? fileUri,
- builder.charOffset ?? charOffset,
- typeParameter.name!.length);
- } else if (constantContext == ConstantContext.inferred &&
- !allowPotentiallyConstantType) {
- message = fasta.messageTypeVariableInConstantContext
- .withLocation(fileUri, charOffset, typeParameter.name!.length);
- } else {
- return null;
+ if (builder is NamedTypeBuilder) {
+ if (builder.declaration!.isTypeVariable) {
+ TypeVariableBuilder typeParameterBuilder =
+ builder.declaration as TypeVariableBuilder;
+ TypeParameter typeParameter = typeParameterBuilder.parameter;
+ bool extensionField =
+ member.isExtensionMember && member.isField && !member.isExternal;
+ if ((extensionField || !isDeclarationInstanceContext) &&
+ (typeParameter.parent is Class ||
+ typeParameter.parent is Extension)) {
+ // TODO(johnniwinther): Can we unify this check with the similar check
+ // in NamedTypeBuilder.buildTypeInternal. If we skip it here, the
+ // error below (type variable in constant context) will be emitted
+ // _instead_ of this (type variable in static context), which seems
+ // like an odd prioritization.
+ LocatedMessage message = fasta.messageTypeVariableInStaticContext
+ .withLocation(builder.fileUri ?? fileUri,
+ builder.charOffset ?? charOffset, typeParameter.name!.length);
+ builder.bind(
+ new InvalidTypeDeclarationBuilder(typeParameter.name!, message));
+ addProblem(message.messageObject, message.charOffset, message.length);
+ } else if (constantContext != ConstantContext.none &&
+ (!inConstructorInitializer || !allowPotentiallyConstantType)) {
+ LocatedMessage message = fasta.messageTypeVariableInConstantContext
+ .withLocation(fileUri, charOffset, typeParameter.name!.length);
+ builder.bind(
+ new InvalidTypeDeclarationBuilder(typeParameter.name!, message));
+ addProblem(message.messageObject, message.charOffset, message.length);
+ }
}
- addProblem(message.messageObject, message.charOffset, message.length);
- return message;
+ if (builder.arguments != null) {
+ for (TypeBuilder typeBuilder in builder.arguments!) {
+ _validateTypeVariableUseInternal(
+ typeBuilder,
+ typeBuilder.fileUri ?? fileUri,
+ typeBuilder.charOffset ?? charOffset,
+ allowPotentiallyConstantType: allowPotentiallyConstantType);
+ }
+ }
} else if (builder is FunctionTypeBuilder) {
- LocatedMessage? result = _validateTypeUseIsInternal(
- builder.returnType, fileUri, charOffset,
+ _validateTypeVariableUseInternal(builder.returnType, fileUri, charOffset,
allowPotentiallyConstantType: allowPotentiallyConstantType);
- if (result != null) {
- return result;
- }
if (builder.formals != null) {
for (FormalParameterBuilder formalParameterBuilder
in builder.formals!) {
- result = _validateTypeUseIsInternal(
+ _validateTypeVariableUseInternal(
formalParameterBuilder.type, fileUri, charOffset,
allowPotentiallyConstantType: allowPotentiallyConstantType);
- if (result != null) {
- return result;
- }
}
}
}
- return null;
}
@override
@@ -7026,10 +7043,8 @@
@override
DartType buildDartType(UnresolvedType unresolvedType,
- {bool nonInstanceAccessIsError: false,
- bool allowPotentiallyConstantType: false}) {
- return validateTypeUse(unresolvedType,
- nonInstanceAccessIsError: nonInstanceAccessIsError,
+ {required bool allowPotentiallyConstantType}) {
+ return validateTypeVariableUse(unresolvedType,
allowPotentiallyConstantType: allowPotentiallyConstantType)
.builder
.build(libraryBuilder);
@@ -7037,20 +7052,21 @@
@override
DartType buildTypeLiteralDartType(UnresolvedType unresolvedType,
- {bool nonInstanceAccessIsError: false,
- bool allowPotentiallyConstantType: false}) {
- return validateTypeUse(unresolvedType,
- nonInstanceAccessIsError: nonInstanceAccessIsError,
+ {required bool allowPotentiallyConstantType}) {
+ return validateTypeVariableUse(unresolvedType,
allowPotentiallyConstantType: allowPotentiallyConstantType)
.builder
.buildTypeLiteralType(libraryBuilder);
}
@override
- List<DartType> buildDartTypeArguments(List<UnresolvedType>? unresolvedTypes) {
+ List<DartType> buildDartTypeArguments(List<UnresolvedType>? unresolvedTypes,
+ {required bool allowPotentiallyConstantType}) {
if (unresolvedTypes == null) return <DartType>[];
return new List<DartType>.generate(
- unresolvedTypes.length, (int i) => buildDartType(unresolvedTypes[i]),
+ unresolvedTypes.length,
+ (int i) => buildDartType(unresolvedTypes[i],
+ allowPotentiallyConstantType: allowPotentiallyConstantType),
growable: true);
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
index 930527d..04979e2 100644
--- a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
@@ -260,7 +260,9 @@
Expression_Generator applyTypeArguments(
int fileOffset, List<UnresolvedType>? typeArguments) {
return new Instantiation(
- buildSimpleRead(), _helper.buildDartTypeArguments(typeArguments))
+ buildSimpleRead(),
+ _helper.buildDartTypeArguments(typeArguments,
+ allowPotentiallyConstantType: true))
..fileOffset = fileOffset;
}
@@ -270,7 +272,8 @@
/// The type arguments have not been resolved and should be resolved to
/// create a [TypeBuilder] for a valid type.
TypeBuilder buildTypeWithResolvedArguments(
- NullabilityBuilder nullabilityBuilder, List<UnresolvedType>? arguments) {
+ NullabilityBuilder nullabilityBuilder, List<UnresolvedType>? arguments,
+ {required bool allowPotentiallyConstantType}) {
// TODO(johnniwinther): Could we use a FixedTypeBuilder(InvalidType()) here?
NamedTypeBuilder result = new NamedTypeBuilder(
token.lexeme,
@@ -2897,11 +2900,13 @@
@override
TypeBuilder buildTypeWithResolvedArguments(
- NullabilityBuilder nullabilityBuilder, List<UnresolvedType>? arguments) {
+ NullabilityBuilder nullabilityBuilder, List<UnresolvedType>? arguments,
+ {required bool allowPotentiallyConstantType}) {
String name = "${prefixGenerator._plainNameForRead}."
"${suffixGenerator._plainNameForRead}";
TypeBuilder type = suffixGenerator.buildTypeWithResolvedArguments(
- nullabilityBuilder, arguments);
+ nullabilityBuilder, arguments,
+ allowPotentiallyConstantType: allowPotentiallyConstantType);
LocatedMessage message;
if (type is NamedTypeBuilder &&
type.declaration is InvalidTypeDeclarationBuilder) {
@@ -2912,7 +2917,8 @@
int charOffset = offsetForToken(prefixGenerator.token);
message = templateDeferredTypeAnnotation
.withArguments(
- _helper.buildDartType(new UnresolvedType(type, charOffset, _uri)),
+ _helper.buildDartType(new UnresolvedType(type, charOffset, _uri),
+ allowPotentiallyConstantType: allowPotentiallyConstantType),
prefixGenerator._plainNameForRead,
_helper.libraryBuilder.isNonNullableByDefault)
.withLocation(
@@ -3022,17 +3028,19 @@
@override
TypeBuilder buildTypeWithResolvedArguments(
- NullabilityBuilder nullabilityBuilder, List<UnresolvedType>? arguments) {
+ NullabilityBuilder nullabilityBuilder, List<UnresolvedType>? arguments,
+ {required bool allowPotentiallyConstantType}) {
if (declaration.isExtension && !_helper.enableExtensionTypesInLibrary) {
// Extension declarations cannot be used as types.
- return super
- .buildTypeWithResolvedArguments(nullabilityBuilder, arguments);
+ return super.buildTypeWithResolvedArguments(nullabilityBuilder, arguments,
+ allowPotentiallyConstantType: allowPotentiallyConstantType);
}
if (arguments != null) {
int expected = declaration.typeVariablesCount;
if (arguments.length != expected) {
// Build the type arguments to report any errors they may have.
- _helper.buildDartTypeArguments(arguments);
+ _helper.buildDartTypeArguments(arguments,
+ allowPotentiallyConstantType: allowPotentiallyConstantType);
_helper.warnTypeArgumentsMismatch(
declaration.name, expected, fileOffset);
// We ignore the provided arguments, which will in turn return the
@@ -3048,11 +3056,8 @@
argumentBuilders =
new List<TypeBuilder>.generate(arguments.length, (int i) {
return _helper
- .validateTypeUse(arguments![i],
- nonInstanceAccessIsError: false,
- allowPotentiallyConstantType:
- _helper.libraryBuilder.isNonNullableByDefault &&
- _helper.inIsOrAsOperatorType)
+ .validateTypeVariableUse(arguments![i],
+ allowPotentiallyConstantType: allowPotentiallyConstantType)
.builder;
}, growable: false);
}
@@ -3105,10 +3110,12 @@
new UnresolvedType(
buildTypeWithResolvedArguments(
_helper.libraryBuilder.nonNullableBuilder,
- typeArguments),
+ typeArguments,
+ allowPotentiallyConstantType: true),
fileOffset,
_uri),
- nonInstanceAccessIsError: true));
+ allowPotentiallyConstantType:
+ _helper.enableConstructorTearOffsInLibrary));
}
}
return _expression!;
@@ -3131,8 +3138,16 @@
isUsedAsClass: true,
usedAsClassCharOffset: this.fileOffset,
usedAsClassFileUri: _uri);
- List<TypeBuilder>? aliasedTypeArguments =
- typeArguments?.map((unknownType) => unknownType.builder).toList();
+
+ bool isConstructorTearOff = send is PropertySelector &&
+ _helper.enableConstructorTearOffsInLibrary &&
+ declarationBuilder is ClassBuilder;
+ List<TypeBuilder>? aliasedTypeArguments = typeArguments
+ ?.map((unknownType) => _helper
+ .validateTypeVariableUse(unknownType,
+ allowPotentiallyConstantType: isConstructorTearOff)
+ .builder)
+ .toList();
if (aliasedTypeArguments != null &&
aliasedTypeArguments.length != aliasBuilder.typeVariablesCount) {
_helper.libraryBuilder.addProblem(
@@ -3236,8 +3251,9 @@
_helper.libraryBuilder, unaliasedTypeArguments);
}
} else if (typeArguments != null) {
- builtTypeArguments =
- _helper.buildDartTypeArguments(typeArguments);
+ builtTypeArguments = _helper.buildDartTypeArguments(
+ typeArguments,
+ allowPotentiallyConstantType: true);
}
if (isGenericTypedefTearOff) {
if (isProperRenameForClass(_helper.typeEnvironment,
@@ -3670,7 +3686,9 @@
if (typeArguments != null) {
assert(_forest.argumentsTypeArguments(arguments).isEmpty);
_forest.argumentsSetTypeArguments(
- arguments, _helper.buildDartTypeArguments(typeArguments));
+ arguments,
+ _helper.buildDartTypeArguments(typeArguments,
+ allowPotentiallyConstantType: false));
}
return buildError(arguments, kind: UnresolvedKind.Constructor);
}
@@ -4145,7 +4163,8 @@
@override
TypeBuilder buildTypeWithResolvedArguments(
- NullabilityBuilder nullabilityBuilder, List<UnresolvedType>? arguments) {
+ NullabilityBuilder nullabilityBuilder, List<UnresolvedType>? arguments,
+ {required bool allowPotentiallyConstantType}) {
Template<Message Function(String, String)> template = isUnresolved
? templateUnresolvedPrefixInTypeAnnotation
: templateNotAPrefixInTypeAnnotation;
@@ -4269,7 +4288,8 @@
@override
TypeBuilder buildTypeWithResolvedArguments(
- NullabilityBuilder nullabilityBuilder, List<UnresolvedType>? arguments) {
+ NullabilityBuilder nullabilityBuilder, List<UnresolvedType>? arguments,
+ {required bool allowPotentiallyConstantType}) {
// TODO(johnniwinther): Could we use a FixedTypeBuilder(InvalidType()) here?
NamedTypeBuilder result = new NamedTypeBuilder(
token.lexeme,
diff --git a/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart b/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
index c80be43..96e8b7f 100644
--- a/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/expression_generator_helper.dart
@@ -48,9 +48,6 @@
Member? lookupInstanceMember(Name name, {bool isSetter, bool isSuper});
- /// `true` if we are in the type of an as expression.
- bool get inIsOrAsOperatorType;
-
bool get enableExtensionTypesInLibrary;
bool get enableConstFunctionsInLibrary;
@@ -125,9 +122,8 @@
TypeDeclarationBuilder? typeAliasBuilder,
required UnresolvedKind unresolvedKind});
- UnresolvedType validateTypeUse(UnresolvedType unresolved,
- {required bool nonInstanceAccessIsError,
- required bool allowPotentiallyConstantType});
+ UnresolvedType validateTypeVariableUse(UnresolvedType unresolved,
+ {required bool allowPotentiallyConstantType});
void addProblemErrorIfConst(Message message, int charOffset, int length);
@@ -150,12 +146,13 @@
Arguments arguments, Expression expression);
DartType buildDartType(UnresolvedType unresolvedType,
- {bool nonInstanceAccessIsError: false});
+ {required bool allowPotentiallyConstantType});
DartType buildTypeLiteralDartType(UnresolvedType unresolvedType,
- {bool nonInstanceAccessIsError});
+ {required bool allowPotentiallyConstantType});
- List<DartType> buildDartTypeArguments(List<UnresolvedType>? unresolvedTypes);
+ List<DartType> buildDartTypeArguments(List<UnresolvedType>? unresolvedTypes,
+ {required bool allowPotentiallyConstantType});
void reportDuplicatedDeclaration(
Builder existing, String name, int charOffset);
diff --git a/pkg/front_end/lib/src/fasta/source/value_kinds.dart b/pkg/front_end/lib/src/fasta/source/value_kinds.dart
index 85426fc..2c88740 100644
--- a/pkg/front_end/lib/src/fasta/source/value_kinds.dart
+++ b/pkg/front_end/lib/src/fasta/source/value_kinds.dart
@@ -108,7 +108,7 @@
static const ValueKind TokenOrNull =
const SingleValueKind<type.Token>(NullValue.Token);
static const ValueKind TypeOrNull =
- const SingleValueKind<type.UnresolvedType>(NullValue.Type);
+ const SingleValueKind<type.UnresolvedType>(NullValue.UnresolvedType);
static const ValueKind TypeArguments =
const SingleValueKind<List<type.UnresolvedType>>();
static const ValueKind TypeArgumentsOrNull =
@@ -116,7 +116,7 @@
static const ValueKind TypeBuilder =
const SingleValueKind<type.TypeBuilder>();
static const ValueKind TypeBuilderOrNull =
- const SingleValueKind<type.TypeBuilder>(NullValue.Type);
+ const SingleValueKind<type.TypeBuilder>(NullValue.UnresolvedType);
static const ValueKind TypeBuilderListOrNull =
const SingleValueKind<List<type.TypeBuilder>>(NullValue.TypeBuilderList);
static const ValueKind TypeVariableListOrNull =
diff --git a/pkg/front_end/test/spell_checking_list_code.txt b/pkg/front_end/test/spell_checking_list_code.txt
index 1197e88..69249ea 100644
--- a/pkg/front_end/test/spell_checking_list_code.txt
+++ b/pkg/front_end/test/spell_checking_list_code.txt
@@ -935,6 +935,7 @@
printer
printf
println
+prioritization
proc
producers
product
diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart
new file mode 100644
index 0000000..26bd054
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+// A potentially constant type expression is supported for `as` (and `is`)
+class A<X> {
+ final List<X> x;
+ const A(x) : x = x is List<X> ? x : x as List<X>;
+}
+
+void m<X>(X x) {}
+
+// Generic function instantiation to a type parameter is supported implicitly.
+class B<X> {
+ final void Function(X) f;
+ const B() : f = m;
+}
+
+// But it is not supported explicitly.
+class C<X> {
+ final f;
+ const C() : f = m<X>; // Error, but should be accepted.
+}
+
+void main() {
+ const A<int>(<int>[1]); // OK.
+ const b = B<String>(); // OK.
+ print(b.f.runtimeType); // OK: 'String => void'.
+ const c = C<
+ String>(); // Compile-time error in `C`, but should be accepted when it works.
+ print(c.f.runtimeType); // (Never executed, so we don't know).
+}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.strong.expect
new file mode 100644
index 0000000..f4cf0df
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.strong.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field core::List<self::A::X%> x;
+ const constructor •(dynamic x) → self::A<self::A::X%>
+ : self::A::x = x is{ForNonNullableByDefault} core::List<self::A::X%> ?{core::List<self::A::X%>} x{core::List<self::A::X%>} : x as{ForNonNullableByDefault} core::List<self::A::X%>, super core::Object::•()
+ ;
+}
+class B<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field (self::B::X%) → void f;
+ const constructor •() → self::B<self::B::X%>
+ : self::B::f = #C1<self::B::X%>, super core::Object::•()
+ ;
+}
+class C<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field dynamic f;
+ const constructor •() → self::C<self::C::X%>
+ : self::C::f = #C1<self::C::X%>, super core::Object::•()
+ ;
+}
+static method m<X extends core::Object? = dynamic>(self::m::X% x) → void {}
+static method main() → void {
+ #C4;
+ core::print((#C6.{self::B::f}{(core::String) → void} as{TypeError,CovarianceCheck,ForNonNullableByDefault} (core::String) → void).{core::Object::runtimeType}{core::Type});
+ core::print(#C7.{self::C::f}{dynamic}.{core::Object::runtimeType}{core::Type});
+}
+
+constants {
+ #C1 = static-tearoff self::m
+ #C2 = 1
+ #C3 = <core::int>[#C2]
+ #C4 = self::A<core::int> {x:#C3}
+ #C5 = instantiation self::m <core::String>
+ #C6 = self::B<core::String> {f:#C5}
+ #C7 = self::C<core::String> {f:#C5}
+}
+
+
+Constructor coverage from constants:
+org-dartlang-testcase:///issue47154c.dart:
+- A. (from org-dartlang-testcase:///issue47154c.dart:8:9)
+- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
+- B. (from org-dartlang-testcase:///issue47154c.dart:16:9)
+- C. (from org-dartlang-testcase:///issue47154c.dart:22:9)
diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.strong.transformed.expect
new file mode 100644
index 0000000..f4cf0df
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.strong.transformed.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field core::List<self::A::X%> x;
+ const constructor •(dynamic x) → self::A<self::A::X%>
+ : self::A::x = x is{ForNonNullableByDefault} core::List<self::A::X%> ?{core::List<self::A::X%>} x{core::List<self::A::X%>} : x as{ForNonNullableByDefault} core::List<self::A::X%>, super core::Object::•()
+ ;
+}
+class B<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field (self::B::X%) → void f;
+ const constructor •() → self::B<self::B::X%>
+ : self::B::f = #C1<self::B::X%>, super core::Object::•()
+ ;
+}
+class C<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field dynamic f;
+ const constructor •() → self::C<self::C::X%>
+ : self::C::f = #C1<self::C::X%>, super core::Object::•()
+ ;
+}
+static method m<X extends core::Object? = dynamic>(self::m::X% x) → void {}
+static method main() → void {
+ #C4;
+ core::print((#C6.{self::B::f}{(core::String) → void} as{TypeError,CovarianceCheck,ForNonNullableByDefault} (core::String) → void).{core::Object::runtimeType}{core::Type});
+ core::print(#C7.{self::C::f}{dynamic}.{core::Object::runtimeType}{core::Type});
+}
+
+constants {
+ #C1 = static-tearoff self::m
+ #C2 = 1
+ #C3 = <core::int>[#C2]
+ #C4 = self::A<core::int> {x:#C3}
+ #C5 = instantiation self::m <core::String>
+ #C6 = self::B<core::String> {f:#C5}
+ #C7 = self::C<core::String> {f:#C5}
+}
+
+
+Constructor coverage from constants:
+org-dartlang-testcase:///issue47154c.dart:
+- A. (from org-dartlang-testcase:///issue47154c.dart:8:9)
+- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
+- B. (from org-dartlang-testcase:///issue47154c.dart:16:9)
+- C. (from org-dartlang-testcase:///issue47154c.dart:22:9)
diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.textual_outline.expect
new file mode 100644
index 0000000..31e8d36
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.textual_outline.expect
@@ -0,0 +1,18 @@
+class A<X> {
+ final List<X> x;
+ const A(x) : x = x is List<X> ? x : x as List<X>;
+}
+
+void m<X>(X x) {}
+
+class B<X> {
+ final void Function(X) f;
+ const B() : f = m;
+}
+
+class C<X> {
+ final f;
+ const C() : f = m<X>;
+}
+
+void main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..1a39222
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.textual_outline_modelled.expect
@@ -0,0 +1,17 @@
+class A<X> {
+ const A(x) : x = x is List<X> ? x : x as List<X>;
+ final List<X> x;
+}
+
+class B<X> {
+ const B() : f = m;
+ final void Function(X) f;
+}
+
+class C<X> {
+ const C() : f = m<X>;
+ final f;
+}
+
+void m<X>(X x) {}
+void main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.weak.expect b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.weak.expect
new file mode 100644
index 0000000..78d6475
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.weak.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field core::List<self::A::X%> x;
+ const constructor •(dynamic x) → self::A<self::A::X%>
+ : self::A::x = x is{ForNonNullableByDefault} core::List<self::A::X%> ?{core::List<self::A::X%>} x{core::List<self::A::X%>} : x as{ForNonNullableByDefault} core::List<self::A::X%>, super core::Object::•()
+ ;
+}
+class B<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field (self::B::X%) → void f;
+ const constructor •() → self::B<self::B::X%>
+ : self::B::f = #C1<self::B::X%>, super core::Object::•()
+ ;
+}
+class C<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field dynamic f;
+ const constructor •() → self::C<self::C::X%>
+ : self::C::f = #C1<self::C::X%>, super core::Object::•()
+ ;
+}
+static method m<X extends core::Object? = dynamic>(self::m::X% x) → void {}
+static method main() → void {
+ #C4;
+ core::print((#C6.{self::B::f}{(core::String) → void} as{TypeError,CovarianceCheck,ForNonNullableByDefault} (core::String) → void).{core::Object::runtimeType}{core::Type});
+ core::print(#C7.{self::C::f}{dynamic}.{core::Object::runtimeType}{core::Type});
+}
+
+constants {
+ #C1 = static-tearoff self::m
+ #C2 = 1
+ #C3 = <core::int*>[#C2]
+ #C4 = self::A<core::int*> {x:#C3}
+ #C5 = instantiation self::m <core::String*>
+ #C6 = self::B<core::String*> {f:#C5}
+ #C7 = self::C<core::String*> {f:#C5}
+}
+
+
+Constructor coverage from constants:
+org-dartlang-testcase:///issue47154c.dart:
+- A. (from org-dartlang-testcase:///issue47154c.dart:8:9)
+- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
+- B. (from org-dartlang-testcase:///issue47154c.dart:16:9)
+- C. (from org-dartlang-testcase:///issue47154c.dart:22:9)
diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.weak.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.weak.outline.expect
new file mode 100644
index 0000000..3c229cc
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.weak.outline.expect
@@ -0,0 +1,32 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field core::List<self::A::X%> x;
+ const constructor •(dynamic x) → self::A<self::A::X%>
+ : self::A::x = x is{ForNonNullableByDefault} core::List<self::A::X%> ?{core::List<self::A::X%>} x{core::List<self::A::X%>} : x as{ForNonNullableByDefault} core::List<self::A::X%>, super core::Object::•()
+ ;
+}
+class B<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field (self::B::X%) → void f;
+ const constructor •() → self::B<self::B::X%>
+ : self::B::f = self::m<self::B::X%>, super core::Object::•()
+ ;
+}
+class C<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field dynamic f;
+ const constructor •() → self::C<self::C::X%>
+ : self::C::f = self::m<self::C::X%>, super core::Object::•()
+ ;
+}
+static method m<X extends core::Object? = dynamic>(self::m::X% x) → void
+ ;
+static method main() → void
+ ;
+
+
+Extra constant evaluation status:
+Evaluated: StaticTearOff @ org-dartlang-testcase:///issue47154c.dart:16:19 -> StaticTearOffConstant(m)
+Evaluated: StaticTearOff @ org-dartlang-testcase:///issue47154c.dart:22:19 -> StaticTearOffConstant(m)
+Extra constant evaluation: evaluated: 10, effectively constant: 2
diff --git a/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.weak.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.weak.transformed.expect
new file mode 100644
index 0000000..78d6475
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/issue47154c.dart.weak.transformed.expect
@@ -0,0 +1,46 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+class A<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field core::List<self::A::X%> x;
+ const constructor •(dynamic x) → self::A<self::A::X%>
+ : self::A::x = x is{ForNonNullableByDefault} core::List<self::A::X%> ?{core::List<self::A::X%>} x{core::List<self::A::X%>} : x as{ForNonNullableByDefault} core::List<self::A::X%>, super core::Object::•()
+ ;
+}
+class B<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field (self::B::X%) → void f;
+ const constructor •() → self::B<self::B::X%>
+ : self::B::f = #C1<self::B::X%>, super core::Object::•()
+ ;
+}
+class C<X extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field dynamic f;
+ const constructor •() → self::C<self::C::X%>
+ : self::C::f = #C1<self::C::X%>, super core::Object::•()
+ ;
+}
+static method m<X extends core::Object? = dynamic>(self::m::X% x) → void {}
+static method main() → void {
+ #C4;
+ core::print((#C6.{self::B::f}{(core::String) → void} as{TypeError,CovarianceCheck,ForNonNullableByDefault} (core::String) → void).{core::Object::runtimeType}{core::Type});
+ core::print(#C7.{self::C::f}{dynamic}.{core::Object::runtimeType}{core::Type});
+}
+
+constants {
+ #C1 = static-tearoff self::m
+ #C2 = 1
+ #C3 = <core::int*>[#C2]
+ #C4 = self::A<core::int*> {x:#C3}
+ #C5 = instantiation self::m <core::String*>
+ #C6 = self::B<core::String*> {f:#C5}
+ #C7 = self::C<core::String*> {f:#C5}
+}
+
+
+Constructor coverage from constants:
+org-dartlang-testcase:///issue47154c.dart:
+- A. (from org-dartlang-testcase:///issue47154c.dart:8:9)
+- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
+- B. (from org-dartlang-testcase:///issue47154c.dart:16:9)
+- C. (from org-dartlang-testcase:///issue47154c.dart:22:9)
diff --git a/pkg/front_end/testcases/general/constants/potentially_constant_type.dart b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart
new file mode 100644
index 0000000..9cb3ac2
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart
@@ -0,0 +1,75 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+// Pre-nnbd language version
+// @dart=2.9
+
+import 'potentially_constant_type_lib1.dart';
+import 'potentially_constant_type_lib2.dart';
+
+T id<T>(T t) => t;
+
+class Class<T> {
+ final field1;
+ final field5;
+ final field6;
+ final field7;
+ final field8;
+ final field9;
+ final field10;
+ final field11;
+ final field15;
+
+ const Class(o)
+ // Potentially constant context:
+ : field1 = T,
+ field5 = <T>[],
+ field6 = <T>{},
+ field7 = <T, T>{},
+ field8 = o is T,
+ field9 = o is Class<T>,
+ field10 = o as T,
+ field11 = o as Class<T>,
+ field15 = <Class<T>>[];
+
+ void method() {
+ const o = null;
+
+ // Required constant context:
+ const local1 = T;
+ const local5 = <T>[];
+ const local6 = <T>{};
+ const local7 = <T, T>{};
+ const local8 = o is T;
+ const local9 = o is Class<T>;
+ const local10 = o as T;
+ const local11 = o as Class<T>;
+ const local15 = <Class<T>>[];
+ const List<T> listOfNever = []; // ok
+
+ print(local1);
+ print(local5);
+ print(local6);
+ print(local7);
+ print(local8);
+ print(local9);
+ print(local10);
+ print(local11);
+ print(local15);
+ print(listOfNever);
+
+ // Inferred constant context:
+ print(const [T]);
+ print(const [<T>[]]);
+ print(const [<T>{}]);
+ print(const [<T, T>{}]);
+ print(const [o is T]);
+ print(const [o is Class<T>]);
+ print(const [o as T]);
+ print(const [o as Class<T>]);
+ print(const [<Class<T>>[]]);
+ }
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.textual_outline.expect
new file mode 100644
index 0000000..94d8409
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.textual_outline.expect
@@ -0,0 +1,30 @@
+// @dart = 2.9
+import 'potentially_constant_type_lib1.dart';
+import 'potentially_constant_type_lib2.dart';
+
+T id<T>(T t) => t;
+
+class Class<T> {
+ final field1;
+ final field5;
+ final field6;
+ final field7;
+ final field8;
+ final field9;
+ final field10;
+ final field11;
+ final field15;
+ const Class(o)
+ : field1 = T,
+ field5 = <T>[],
+ field6 = <T>{},
+ field7 = <T, T>{},
+ field8 = o is T,
+ field9 = o is Class<T>,
+ field10 = o as T,
+ field11 = o as Class<T>,
+ field15 = <Class<T>>[];
+ void method() {}
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..80bc031
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.textual_outline_modelled.expect
@@ -0,0 +1,30 @@
+// @dart = 2.9
+import 'potentially_constant_type_lib1.dart';
+import 'potentially_constant_type_lib2.dart';
+
+T id<T>(T t) => t;
+
+class Class<T> {
+ const Class(o)
+ : field1 = T,
+ field5 = <T>[],
+ field6 = <T>{},
+ field7 = <T, T>{},
+ field8 = o is T,
+ field9 = o is Class<T>,
+ field10 = o as T,
+ field11 = o as Class<T>,
+ field15 = <Class<T>>[];
+ final field1;
+ final field10;
+ final field11;
+ final field15;
+ final field5;
+ final field6;
+ final field7;
+ final field8;
+ final field9;
+ void method() {}
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.expect b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.expect
new file mode 100644
index 0000000..e7b3e08
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.expect
@@ -0,0 +1,666 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:26:18: Error: Type variables can't be used as constants.
+// : field1 = T,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:27:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:27:19: Error: Type variables can't be used as constants.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:28:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:28:19: Error: Type variables can't be used as constants.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:29:24: Error: Constant expression expected.
+// Try inserting 'const'.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:29:19: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:29:22: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:30:23: Error: Type variables can't be used as constants.
+// field8 = o is T,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:31:29: Error: Type variables can't be used as constants.
+// field9 = o is Class<T>,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:32:24: Error: Type variables can't be used as constants.
+// field10 = o as T,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:33:30: Error: Type variables can't be used as constants.
+// field11 = o as Class<T>,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:29: Error: Constant expression expected.
+// Try inserting 'const'.
+// field15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:40:20: Error: Type variables can't be used as constants.
+// const local1 = T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:41:21: Error: Type variables can't be used as constants.
+// const local5 = <T>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:42:21: Error: Type variables can't be used as constants.
+// const local6 = <T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:43:21: Error: Type variables can't be used as constants.
+// const local7 = <T, T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:43:24: Error: Type variables can't be used as constants.
+// const local7 = <T, T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:44:25: Error: Type variables can't be used as constants.
+// const local8 = o is T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:45:31: Error: Type variables can't be used as constants.
+// const local9 = o is Class<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:46:26: Error: Type variables can't be used as constants.
+// const local10 = o as T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:47:32: Error: Type variables can't be used as constants.
+// const local11 = o as Class<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:48:28: Error: Type variables can't be used as constants.
+// const local15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:63:18: Error: Type variables can't be used as constants.
+// print(const [T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:64:19: Error: Type variables can't be used as constants.
+// print(const [<T>[]]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:65:19: Error: Type variables can't be used as constants.
+// print(const [<T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:66:19: Error: Type variables can't be used as constants.
+// print(const [<T, T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:66:22: Error: Type variables can't be used as constants.
+// print(const [<T, T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:67:23: Error: Type variables can't be used as constants.
+// print(const [o is T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:68:29: Error: Type variables can't be used as constants.
+// print(const [o is Class<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:69:23: Error: Type variables can't be used as constants.
+// print(const [o as T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:70:29: Error: Type variables can't be used as constants.
+// print(const [o as Class<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:71:25: Error: Type variables can't be used as constants.
+// print(const [<Class<T>>[]]);
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///potentially_constant_type_lib1.dart";
+import "org-dartlang-testcase:///potentially_constant_type_lib2.dart";
+
+class Class<T extends core::Object* = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field dynamic field1;
+ final field dynamic field5;
+ final field dynamic field6;
+ final field dynamic field7;
+ final field dynamic field8;
+ final field dynamic field9;
+ final field dynamic field10;
+ final field dynamic field11;
+ final field dynamic field15;
+ const constructor •(dynamic o) → self::Class<self::Class::T*>*
+ : self::Class::field1 = #C1, self::Class::field5 = #C2, self::Class::field6 = #C3, self::Class::field7 = #C4, self::Class::field8 = o is invalid-type, self::Class::field9 = o is self::Class<invalid-type>*, self::Class::field10 = o as invalid-type, self::Class::field11 = o as self::Class<invalid-type>*, self::Class::field15 = #C5, super core::Object::•()
+ ;
+ method method() → void {
+ core::print(#C1);
+ core::print(#C2);
+ core::print(#C3);
+ core::print(#C4);
+ core::print(#C6);
+ core::print(#C7);
+ core::print(#C8);
+ core::print(#C8);
+ core::print(#C5);
+ core::print(#C9);
+ core::print(#C10);
+ core::print(#C11);
+ core::print(#C12);
+ core::print(#C13);
+ core::print(#C14);
+ core::print(#C15);
+ core::print(#C16);
+ core::print(#C17);
+ core::print(#C18);
+ }
+ abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
+ abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
+ abstract member-signature method toString() → core::String*; -> core::Object::toString
+ abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+static method id<T extends core::Object* = dynamic>(self::id::T* t) → self::id::T*
+ return t;
+static method main() → dynamic {}
+
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:23:18: Error: Type variables can't be used as constants.
+// : field1 = T,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:24:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:24:19: Error: Type variables can't be used as constants.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:25:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:25:19: Error: Type variables can't be used as constants.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:26:24: Error: Constant expression expected.
+// Try inserting 'const'.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:26:19: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:26:22: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:29: Error: Constant expression expected.
+// Try inserting 'const'.
+// field15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:37:20: Error: Type variables can't be used as constants.
+// const local1 = T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:38:21: Error: Type variables can't be used as constants.
+// const local5 = <T>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:39:21: Error: Type variables can't be used as constants.
+// const local6 = <T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:40:21: Error: Type variables can't be used as constants.
+// const local7 = <T, T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:40:24: Error: Type variables can't be used as constants.
+// const local7 = <T, T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:41:25: Error: Type variables can't be used as constants.
+// const local8 = o is T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:42:31: Error: Type variables can't be used as constants.
+// const local9 = o is Class<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:43:26: Error: Type variables can't be used as constants.
+// const local10 = o as T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:44:32: Error: Type variables can't be used as constants.
+// const local11 = o as Class<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:45:28: Error: Type variables can't be used as constants.
+// const local15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:60:18: Error: Type variables can't be used as constants.
+// print(const [T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:61:19: Error: Type variables can't be used as constants.
+// print(const [<T>[]]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:62:19: Error: Type variables can't be used as constants.
+// print(const [<T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:63:19: Error: Type variables can't be used as constants.
+// print(const [<T, T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:63:22: Error: Type variables can't be used as constants.
+// print(const [<T, T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:64:23: Error: Type variables can't be used as constants.
+// print(const [o is T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:65:29: Error: Type variables can't be used as constants.
+// print(const [o is Class<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:66:23: Error: Type variables can't be used as constants.
+// print(const [o as T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:67:29: Error: Type variables can't be used as constants.
+// print(const [o as Class<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:68:25: Error: Type variables can't be used as constants.
+// print(const [<Class<T>>[]]);
+// ^
+//
+import self as self2;
+import "dart:core" as core;
+
+class Class<T extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field dynamic field1;
+ final field dynamic field5;
+ final field dynamic field6;
+ final field dynamic field7;
+ final field dynamic field8;
+ final field dynamic field9;
+ final field dynamic field10;
+ final field dynamic field11;
+ final field dynamic field15;
+ const constructor •(dynamic o) → self2::Class<self2::Class::T%>
+ : self2::Class::field1 = #C1, self2::Class::field5 = #C2, self2::Class::field6 = #C3, self2::Class::field7 = #C4, self2::Class::field8 = o is{ForNonNullableByDefault} self2::Class::T%, self2::Class::field9 = o is{ForNonNullableByDefault} self2::Class<self2::Class::T%>, self2::Class::field10 = o as{ForNonNullableByDefault} self2::Class::T%, self2::Class::field11 = o{self2::Class::T%} as{ForNonNullableByDefault} self2::Class<self2::Class::T%>, self2::Class::field15 = #C19, super core::Object::•()
+ ;
+ method method() → void {
+ core::print(#C1);
+ core::print(#C2);
+ core::print(#C3);
+ core::print(#C4);
+ core::print(#C6);
+ core::print(#C7);
+ core::print(#C8);
+ core::print(#C8);
+ core::print(#C19);
+ core::print(#C20);
+ core::print(#C10);
+ core::print(#C11);
+ core::print(#C12);
+ core::print(#C13);
+ core::print(#C14);
+ core::print(#C15);
+ core::print(#C21);
+ core::print(#C22);
+ core::print(#C23);
+ }
+}
+static method id<T extends core::Object? = dynamic>(self2::id::T% t) → self2::id::T%
+ return t;
+static method main() → dynamic {}
+
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:34:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:34:19: Error: Type variables can't be used as constants.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:35:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:35:19: Error: Type variables can't be used as constants.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:36:24: Error: Constant expression expected.
+// Try inserting 'const'.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:36:19: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:36:22: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:44:29: Error: Constant expression expected.
+// Try inserting 'const'.
+// field15 = <Class<T>>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:44:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:51:20: Error: Type variables can't be used as constants.
+// const local1 = T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:52:26: Error: Type variables can't be used as constants.
+// const local2 = Class<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:53:23: Error: Type variables can't be used as constants.
+// const local3 = id<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:54:25: Error: Type variables can't be used as constants.
+// const local4 = (id)<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:55:21: Error: Type variables can't be used as constants.
+// const local5 = <T>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:56:21: Error: Type variables can't be used as constants.
+// const local6 = <T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:57:21: Error: Type variables can't be used as constants.
+// const local7 = <T, T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:57:24: Error: Type variables can't be used as constants.
+// const local7 = <T, T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:58:25: Error: Type variables can't be used as constants.
+// const local8 = o is T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:59:31: Error: Type variables can't be used as constants.
+// const local9 = o is Class<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:60:26: Error: Type variables can't be used as constants.
+// const local10 = o as T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:61:32: Error: Type variables can't be used as constants.
+// const local11 = o as Class<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:62:27: Error: Type variables can't be used as constants.
+// const local12 = Class<T>.new;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:63:23: Error: Type variables can't be used as constants.
+// const local13 = F<T, T>.new;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:63:26: Error: Type variables can't be used as constants.
+// const local13 = F<T, T>.new;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:64:30: Error: Type variables can't be used as constants.
+// const local14 = id<Class<T>>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:65:28: Error: Type variables can't be used as constants.
+// const local15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:66:23: Error: Type variables can't be used as constants.
+// const local16 = G<T>.new;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:88:18: Error: Type variables can't be used as constants.
+// print(const [T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:89:24: Error: Type variables can't be used as constants.
+// print(const [Class<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:90:21: Error: Type variables can't be used as constants.
+// print(const [id<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:91:23: Error: Type variables can't be used as constants.
+// print(const [(id)<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:92:19: Error: Type variables can't be used as constants.
+// print(const [<T>[]]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:93:19: Error: Type variables can't be used as constants.
+// print(const [<T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:94:19: Error: Type variables can't be used as constants.
+// print(const [<T, T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:94:22: Error: Type variables can't be used as constants.
+// print(const [<T, T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:95:23: Error: Type variables can't be used as constants.
+// print(const [o is T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:96:29: Error: Type variables can't be used as constants.
+// print(const [o is Class<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:97:23: Error: Type variables can't be used as constants.
+// print(const [o as T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:98:29: Error: Type variables can't be used as constants.
+// print(const [o as Class<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:99:24: Error: Type variables can't be used as constants.
+// print(const [Class<T>.new]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:100:20: Error: Type variables can't be used as constants.
+// print(const [F<T, T>.new]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:100:23: Error: Type variables can't be used as constants.
+// print(const [F<T, T>.new]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:101:27: Error: Type variables can't be used as constants.
+// print(const [id<Class<T>>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:102:25: Error: Type variables can't be used as constants.
+// print(const [<Class<T>>[]]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:103:20: Error: Type variables can't be used as constants.
+// print(const [G<T>.new]);
+// ^
+//
+import self as self3;
+import "dart:core" as core;
+
+typedef F<X extends core::Object? = dynamic, unrelated Y extends core::Object? = dynamic> = self3::Class<X%>;
+typedef G<unrelated X extends core::Object? = dynamic> = self3::Class<core::int>;
+class Class<T extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field dynamic field1;
+ final field dynamic field2;
+ final field dynamic field3;
+ final field dynamic field4;
+ final field dynamic field5;
+ final field dynamic field6;
+ final field dynamic field7;
+ final field dynamic field8;
+ final field dynamic field9;
+ final field dynamic field10;
+ final field dynamic field11;
+ final field dynamic field12;
+ final field dynamic field13;
+ final field dynamic field14;
+ final field dynamic field15;
+ final field dynamic field16;
+ const constructor •(dynamic o) → self3::Class<self3::Class::T%>
+ : self3::Class::field1 = self3::Class::T%, self3::Class::field2 = self3::Class<self3::Class::T%>, self3::Class::field3 = #C24<self3::Class::T%>, self3::Class::field4 = #C24<self3::Class::T%>, self3::Class::field5 = #C2, self3::Class::field6 = #C3, self3::Class::field7 = #C4, self3::Class::field8 = o is{ForNonNullableByDefault} self3::Class::T%, self3::Class::field9 = o is{ForNonNullableByDefault} self3::Class<self3::Class::T%>, self3::Class::field10 = o as{ForNonNullableByDefault} self3::Class::T%, self3::Class::field11 = o{self3::Class::T%} as{ForNonNullableByDefault} self3::Class<self3::Class::T%>, self3::Class::field12 = #C25<self3::Class::T%>, self3::Class::field13 = #C25<self3::Class::T%>, self3::Class::field14 = #C24<self3::Class<self3::Class::T%>>, self3::Class::field15 = #C26, self3::Class::field16 = #C27, super core::Object::•()
+ ;
+ method method() → void {
+ core::print(#C1);
+ core::print(#C28);
+ core::print(#C29);
+ core::print(#C29);
+ core::print(#C2);
+ core::print(#C3);
+ core::print(#C4);
+ core::print(#C6);
+ core::print(#C7);
+ core::print(#C8);
+ core::print(#C8);
+ core::print(#C30);
+ core::print(#C30);
+ core::print(#C31);
+ core::print(#C26);
+ core::print(#C27);
+ core::print(#C20);
+ core::print(#C10);
+ core::print(#C32);
+ core::print(#C33);
+ core::print(#C33);
+ core::print(#C11);
+ core::print(#C12);
+ core::print(#C13);
+ core::print(#C14);
+ core::print(#C15);
+ core::print(#C21);
+ core::print(#C34);
+ core::print(#C35);
+ core::print(#C35);
+ core::print(#C36);
+ core::print(#C37);
+ core::print(#C38);
+ }
+}
+static method id<T extends core::Object? = dynamic>(self3::id::T% t) → self3::id::T%
+ return t;
+static method main() → dynamic {}
+static method _#F#new#tearOff<X extends core::Object? = dynamic, unrelated Y extends core::Object? = dynamic>(dynamic o) → self3::Class<self3::_#F#new#tearOff::X%>
+ return new self3::Class::•<self3::_#F#new#tearOff::X%>(o);
+static method _#G#new#tearOff<unrelated X extends core::Object? = dynamic>(dynamic o) → self3::Class<core::int>
+ return new self3::Class::•<core::int>(o);
+
+constants {
+ #C1 = TypeLiteralConstant(invalid-type)
+ #C2 = <invalid-type>[]
+ #C3 = <invalid-type>{}
+ #C4 = <invalid-type, invalid-type>{)
+ #C5 = <self::Class<invalid-type>*>[]
+ #C6 = true
+ #C7 = false
+ #C8 = null
+ #C9 = <Null>[]
+ #C10 = <core::Type*>[#C1]
+ #C11 = <core::List<invalid-type>*>[#C2]
+ #C12 = <core::Set<invalid-type>*>[#C3]
+ #C13 = <core::Map<invalid-type, invalid-type>*>[#C4]
+ #C14 = <core::bool*>[#C6]
+ #C15 = <core::bool*>[#C7]
+ #C16 = <invalid-type>[#C8]
+ #C17 = <self::Class<invalid-type>*>[#C8]
+ #C18 = <core::List<self::Class<invalid-type>*>*>[#C5]
+ #C19 = <self2::Class<invalid-type>*>[]
+ #C20 = <Never*>[]
+ #C21 = <dynamic>[#C8]
+ #C22 = <self2::Class<invalid-type>*>[#C8]
+ #C23 = <core::List<self2::Class<invalid-type>*>*>[#C19]
+ #C24 = static-tearoff self3::id
+ #C25 = constructor-tearoff self3::Class::•
+ #C26 = <self3::Class<invalid-type>*>[]
+ #C27 = instantiation self3::Class::• <core::int*>
+ #C28 = TypeLiteralConstant(self3::Class<invalid-type>*)
+ #C29 = instantiation self3::id <invalid-type>
+ #C30 = instantiation self3::Class::• <invalid-type>
+ #C31 = instantiation self3::id <self3::Class<invalid-type>*>
+ #C32 = <core::Type*>[#C28]
+ #C33 = <(invalid-type) →* invalid-type>[#C29]
+ #C34 = <self3::Class<invalid-type>*>[#C8]
+ #C35 = <(dynamic) →* self3::Class<invalid-type>*>[#C30]
+ #C36 = <(self3::Class<invalid-type>*) →* self3::Class<invalid-type>*>[#C31]
+ #C37 = <core::List<self3::Class<invalid-type>*>*>[#C26]
+ #C38 = <(dynamic) →* self3::Class<core::int*>*>[#C27]
+}
diff --git a/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.outline.expect b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.outline.expect
new file mode 100644
index 0000000..559f6ba
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.outline.expect
@@ -0,0 +1,274 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:26:18: Error: Type variables can't be used as constants.
+// : field1 = T,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:27:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:27:19: Error: Type variables can't be used as constants.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:28:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:28:19: Error: Type variables can't be used as constants.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:29:24: Error: Constant expression expected.
+// Try inserting 'const'.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:29:19: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:29:22: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:30:23: Error: Type variables can't be used as constants.
+// field8 = o is T,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:31:29: Error: Type variables can't be used as constants.
+// field9 = o is Class<T>,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:32:24: Error: Type variables can't be used as constants.
+// field10 = o as T,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:33:30: Error: Type variables can't be used as constants.
+// field11 = o as Class<T>,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:29: Error: Constant expression expected.
+// Try inserting 'const'.
+// field15 = <Class<T>>[];
+// ^
+//
+import self as self;
+import "dart:core" as core;
+import "dart:collection" as col;
+
+import "org-dartlang-testcase:///potentially_constant_type_lib1.dart";
+import "org-dartlang-testcase:///potentially_constant_type_lib2.dart";
+
+class Class<T extends core::Object* = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field dynamic field1;
+ final field dynamic field5;
+ final field dynamic field6;
+ final field dynamic field7;
+ final field dynamic field8;
+ final field dynamic field9;
+ final field dynamic field10;
+ final field dynamic field11;
+ final field dynamic field15;
+ const constructor •(dynamic o) → self::Class<self::Class::T*>*
+ : self::Class::field1 = invalid-type, self::Class::field5 = <invalid-type>[], self::Class::field6 = block {
+ final core::Set<invalid-type>* #t1 = col::LinkedHashSet::•<invalid-type>();
+ } =>#t1, self::Class::field7 = <invalid-type, invalid-type>{}, self::Class::field8 = o is invalid-type, self::Class::field9 = o is self::Class<invalid-type>*, self::Class::field10 = o as invalid-type, self::Class::field11 = o as self::Class<invalid-type>*, self::Class::field15 = <self::Class<invalid-type>*>[], super core::Object::•()
+ ;
+ method method() → void
+ ;
+ abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
+ abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
+ abstract member-signature method toString() → core::String*; -> core::Object::toString
+ abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+static method id<T extends core::Object* = dynamic>(self::id::T* t) → self::id::T*
+ ;
+static method main() → dynamic
+ ;
+
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:23:18: Error: Type variables can't be used as constants.
+// : field1 = T,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:24:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:24:19: Error: Type variables can't be used as constants.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:25:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:25:19: Error: Type variables can't be used as constants.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:26:24: Error: Constant expression expected.
+// Try inserting 'const'.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:26:19: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:26:22: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:29: Error: Constant expression expected.
+// Try inserting 'const'.
+// field15 = <Class<T>>[];
+// ^
+//
+import self as self2;
+import "dart:core" as core;
+import "dart:collection" as col;
+
+class Class<T extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field dynamic field1;
+ final field dynamic field5;
+ final field dynamic field6;
+ final field dynamic field7;
+ final field dynamic field8;
+ final field dynamic field9;
+ final field dynamic field10;
+ final field dynamic field11;
+ final field dynamic field15;
+ const constructor •(dynamic o) → self2::Class<self2::Class::T%>
+ : self2::Class::field1 = invalid-type, self2::Class::field5 = <invalid-type>[], self2::Class::field6 = block {
+ final core::Set<invalid-type> #t2 = col::LinkedHashSet::•<invalid-type>();
+ } =>#t2, self2::Class::field7 = <invalid-type, invalid-type>{}, self2::Class::field8 = o is{ForNonNullableByDefault} self2::Class::T%, self2::Class::field9 = o is{ForNonNullableByDefault} self2::Class<self2::Class::T%>, self2::Class::field10 = o as{ForNonNullableByDefault} self2::Class::T%, self2::Class::field11 = o{self2::Class::T%} as{ForNonNullableByDefault} self2::Class<self2::Class::T%>, self2::Class::field15 = <self2::Class<invalid-type>>[], super core::Object::•()
+ ;
+ method method() → void
+ ;
+}
+static method id<T extends core::Object? = dynamic>(self2::id::T% t) → self2::id::T%
+ ;
+static method main() → dynamic
+ ;
+
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:34:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:34:19: Error: Type variables can't be used as constants.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:35:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:35:19: Error: Type variables can't be used as constants.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:36:24: Error: Constant expression expected.
+// Try inserting 'const'.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:36:19: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:36:22: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:44:29: Error: Constant expression expected.
+// Try inserting 'const'.
+// field15 = <Class<T>>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:44:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[],
+// ^
+//
+import self as self3;
+import "dart:core" as core;
+import "dart:collection" as col;
+
+typedef F<X extends core::Object? = dynamic, unrelated Y extends core::Object? = dynamic> = self3::Class<X%>;
+typedef G<unrelated X extends core::Object? = dynamic> = self3::Class<core::int>;
+class Class<T extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field dynamic field1;
+ final field dynamic field2;
+ final field dynamic field3;
+ final field dynamic field4;
+ final field dynamic field5;
+ final field dynamic field6;
+ final field dynamic field7;
+ final field dynamic field8;
+ final field dynamic field9;
+ final field dynamic field10;
+ final field dynamic field11;
+ final field dynamic field12;
+ final field dynamic field13;
+ final field dynamic field14;
+ final field dynamic field15;
+ final field dynamic field16;
+ const constructor •(dynamic o) → self3::Class<self3::Class::T%>
+ : self3::Class::field1 = self3::Class::T%, self3::Class::field2 = self3::Class<self3::Class::T%>, self3::Class::field3 = self3::id<self3::Class::T%>, self3::Class::field4 = self3::id<self3::Class::T%>, self3::Class::field5 = <invalid-type>[], self3::Class::field6 = block {
+ final core::Set<invalid-type> #t3 = col::LinkedHashSet::•<invalid-type>();
+ } =>#t3, self3::Class::field7 = <invalid-type, invalid-type>{}, self3::Class::field8 = o is{ForNonNullableByDefault} self3::Class::T%, self3::Class::field9 = o is{ForNonNullableByDefault} self3::Class<self3::Class::T%>, self3::Class::field10 = o as{ForNonNullableByDefault} self3::Class::T%, self3::Class::field11 = o{self3::Class::T%} as{ForNonNullableByDefault} self3::Class<self3::Class::T%>, self3::Class::field12 = self3::Class::•<self3::Class::T%>, self3::Class::field13 = self3::Class::•<self3::Class::T%>, self3::Class::field14 = self3::id<self3::Class<self3::Class::T%>>, self3::Class::field15 = <self3::Class<invalid-type>>[], self3::Class::field16 = self3::Class::•<core::int>, super core::Object::•()
+ ;
+ method method() → void
+ ;
+}
+static method id<T extends core::Object? = dynamic>(self3::id::T% t) → self3::id::T%
+ ;
+static method main() → dynamic
+ ;
+static method _#F#new#tearOff<X extends core::Object? = dynamic, unrelated Y extends core::Object? = dynamic>(dynamic o) → self3::Class<self3::_#F#new#tearOff::X%>
+ return new self3::Class::•<self3::_#F#new#tearOff::X%>(o);
+static method _#G#new#tearOff<unrelated X extends core::Object? = dynamic>(dynamic o) → self3::Class<core::int>
+ return new self3::Class::•<core::int>(o);
+
+
+Extra constant evaluation status:
+Evaluated: TypeLiteral @ org-dartlang-testcase:///potentially_constant_type.dart:26:18 -> TypeLiteralConstant(<invalid>)
+Evaluated: TypeLiteral @ org-dartlang-testcase:///potentially_constant_type_lib1.dart:23:18 -> TypeLiteralConstant(<invalid>)
+Evaluated: StaticTearOff @ org-dartlang-testcase:///potentially_constant_type_lib2.dart:32:18 -> StaticTearOffConstant(id)
+Evaluated: StaticTearOff @ org-dartlang-testcase:///potentially_constant_type_lib2.dart:33:19 -> StaticTearOffConstant(id)
+Evaluated: ConstructorTearOff @ org-dartlang-testcase:///potentially_constant_type_lib2.dart:41:19 -> ConstructorTearOffConstant(Class.)
+Evaluated: ConstructorTearOff @ org-dartlang-testcase:///potentially_constant_type_lib2.dart:42:19 -> ConstructorTearOffConstant(Class.)
+Evaluated: StaticTearOff @ org-dartlang-testcase:///potentially_constant_type_lib2.dart:43:19 -> StaticTearOffConstant(id)
+Evaluated: Instantiation @ org-dartlang-testcase:///potentially_constant_type_lib2.dart:45:19 -> InstantiationConstant(Class.<int*>)
+Extra constant evaluation: evaluated: 61, effectively constant: 8
diff --git a/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.transformed.expect b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.transformed.expect
new file mode 100644
index 0000000..e7b3e08
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/potentially_constant_type.dart.weak.transformed.expect
@@ -0,0 +1,666 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:26:18: Error: Type variables can't be used as constants.
+// : field1 = T,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:27:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:27:19: Error: Type variables can't be used as constants.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:28:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:28:19: Error: Type variables can't be used as constants.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:29:24: Error: Constant expression expected.
+// Try inserting 'const'.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:29:19: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:29:22: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:30:23: Error: Type variables can't be used as constants.
+// field8 = o is T,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:31:29: Error: Type variables can't be used as constants.
+// field9 = o is Class<T>,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:32:24: Error: Type variables can't be used as constants.
+// field10 = o as T,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:33:30: Error: Type variables can't be used as constants.
+// field11 = o as Class<T>,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:34:29: Error: Constant expression expected.
+// Try inserting 'const'.
+// field15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:40:20: Error: Type variables can't be used as constants.
+// const local1 = T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:41:21: Error: Type variables can't be used as constants.
+// const local5 = <T>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:42:21: Error: Type variables can't be used as constants.
+// const local6 = <T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:43:21: Error: Type variables can't be used as constants.
+// const local7 = <T, T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:43:24: Error: Type variables can't be used as constants.
+// const local7 = <T, T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:44:25: Error: Type variables can't be used as constants.
+// const local8 = o is T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:45:31: Error: Type variables can't be used as constants.
+// const local9 = o is Class<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:46:26: Error: Type variables can't be used as constants.
+// const local10 = o as T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:47:32: Error: Type variables can't be used as constants.
+// const local11 = o as Class<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:48:28: Error: Type variables can't be used as constants.
+// const local15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:63:18: Error: Type variables can't be used as constants.
+// print(const [T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:64:19: Error: Type variables can't be used as constants.
+// print(const [<T>[]]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:65:19: Error: Type variables can't be used as constants.
+// print(const [<T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:66:19: Error: Type variables can't be used as constants.
+// print(const [<T, T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:66:22: Error: Type variables can't be used as constants.
+// print(const [<T, T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:67:23: Error: Type variables can't be used as constants.
+// print(const [o is T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:68:29: Error: Type variables can't be used as constants.
+// print(const [o is Class<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:69:23: Error: Type variables can't be used as constants.
+// print(const [o as T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:70:29: Error: Type variables can't be used as constants.
+// print(const [o as Class<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type.dart:71:25: Error: Type variables can't be used as constants.
+// print(const [<Class<T>>[]]);
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+import "org-dartlang-testcase:///potentially_constant_type_lib1.dart";
+import "org-dartlang-testcase:///potentially_constant_type_lib2.dart";
+
+class Class<T extends core::Object* = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field dynamic field1;
+ final field dynamic field5;
+ final field dynamic field6;
+ final field dynamic field7;
+ final field dynamic field8;
+ final field dynamic field9;
+ final field dynamic field10;
+ final field dynamic field11;
+ final field dynamic field15;
+ const constructor •(dynamic o) → self::Class<self::Class::T*>*
+ : self::Class::field1 = #C1, self::Class::field5 = #C2, self::Class::field6 = #C3, self::Class::field7 = #C4, self::Class::field8 = o is invalid-type, self::Class::field9 = o is self::Class<invalid-type>*, self::Class::field10 = o as invalid-type, self::Class::field11 = o as self::Class<invalid-type>*, self::Class::field15 = #C5, super core::Object::•()
+ ;
+ method method() → void {
+ core::print(#C1);
+ core::print(#C2);
+ core::print(#C3);
+ core::print(#C4);
+ core::print(#C6);
+ core::print(#C7);
+ core::print(#C8);
+ core::print(#C8);
+ core::print(#C5);
+ core::print(#C9);
+ core::print(#C10);
+ core::print(#C11);
+ core::print(#C12);
+ core::print(#C13);
+ core::print(#C14);
+ core::print(#C15);
+ core::print(#C16);
+ core::print(#C17);
+ core::print(#C18);
+ }
+ abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode
+ abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf
+ abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf
+ abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue
+ abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse
+ abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::==
+ abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode
+ abstract member-signature method toString() → core::String*; -> core::Object::toString
+ abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+static method id<T extends core::Object* = dynamic>(self::id::T* t) → self::id::T*
+ return t;
+static method main() → dynamic {}
+
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:23:18: Error: Type variables can't be used as constants.
+// : field1 = T,
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:24:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:24:19: Error: Type variables can't be used as constants.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:25:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:25:19: Error: Type variables can't be used as constants.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:26:24: Error: Constant expression expected.
+// Try inserting 'const'.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:26:19: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:26:22: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:31:29: Error: Constant expression expected.
+// Try inserting 'const'.
+// field15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:37:20: Error: Type variables can't be used as constants.
+// const local1 = T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:38:21: Error: Type variables can't be used as constants.
+// const local5 = <T>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:39:21: Error: Type variables can't be used as constants.
+// const local6 = <T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:40:21: Error: Type variables can't be used as constants.
+// const local7 = <T, T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:40:24: Error: Type variables can't be used as constants.
+// const local7 = <T, T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:41:25: Error: Type variables can't be used as constants.
+// const local8 = o is T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:42:31: Error: Type variables can't be used as constants.
+// const local9 = o is Class<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:43:26: Error: Type variables can't be used as constants.
+// const local10 = o as T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:44:32: Error: Type variables can't be used as constants.
+// const local11 = o as Class<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:45:28: Error: Type variables can't be used as constants.
+// const local15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:60:18: Error: Type variables can't be used as constants.
+// print(const [T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:61:19: Error: Type variables can't be used as constants.
+// print(const [<T>[]]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:62:19: Error: Type variables can't be used as constants.
+// print(const [<T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:63:19: Error: Type variables can't be used as constants.
+// print(const [<T, T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:63:22: Error: Type variables can't be used as constants.
+// print(const [<T, T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:64:23: Error: Type variables can't be used as constants.
+// print(const [o is T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:65:29: Error: Type variables can't be used as constants.
+// print(const [o is Class<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:66:23: Error: Type variables can't be used as constants.
+// print(const [o as T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:67:29: Error: Type variables can't be used as constants.
+// print(const [o as Class<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart:68:25: Error: Type variables can't be used as constants.
+// print(const [<Class<T>>[]]);
+// ^
+//
+import self as self2;
+import "dart:core" as core;
+
+class Class<T extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field dynamic field1;
+ final field dynamic field5;
+ final field dynamic field6;
+ final field dynamic field7;
+ final field dynamic field8;
+ final field dynamic field9;
+ final field dynamic field10;
+ final field dynamic field11;
+ final field dynamic field15;
+ const constructor •(dynamic o) → self2::Class<self2::Class::T%>
+ : self2::Class::field1 = #C1, self2::Class::field5 = #C2, self2::Class::field6 = #C3, self2::Class::field7 = #C4, self2::Class::field8 = o is{ForNonNullableByDefault} self2::Class::T%, self2::Class::field9 = o is{ForNonNullableByDefault} self2::Class<self2::Class::T%>, self2::Class::field10 = o as{ForNonNullableByDefault} self2::Class::T%, self2::Class::field11 = o{self2::Class::T%} as{ForNonNullableByDefault} self2::Class<self2::Class::T%>, self2::Class::field15 = #C19, super core::Object::•()
+ ;
+ method method() → void {
+ core::print(#C1);
+ core::print(#C2);
+ core::print(#C3);
+ core::print(#C4);
+ core::print(#C6);
+ core::print(#C7);
+ core::print(#C8);
+ core::print(#C8);
+ core::print(#C19);
+ core::print(#C20);
+ core::print(#C10);
+ core::print(#C11);
+ core::print(#C12);
+ core::print(#C13);
+ core::print(#C14);
+ core::print(#C15);
+ core::print(#C21);
+ core::print(#C22);
+ core::print(#C23);
+ }
+}
+static method id<T extends core::Object? = dynamic>(self2::id::T% t) → self2::id::T%
+ return t;
+static method main() → dynamic {}
+
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:34:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:34:19: Error: Type variables can't be used as constants.
+// field5 = <T>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:35:21: Error: Constant expression expected.
+// Try inserting 'const'.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:35:19: Error: Type variables can't be used as constants.
+// field6 = <T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:36:24: Error: Constant expression expected.
+// Try inserting 'const'.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:36:19: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:36:22: Error: Type variables can't be used as constants.
+// field7 = <T, T>{},
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:44:29: Error: Constant expression expected.
+// Try inserting 'const'.
+// field15 = <Class<T>>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:44:26: Error: Type variables can't be used as constants.
+// field15 = <Class<T>>[],
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:51:20: Error: Type variables can't be used as constants.
+// const local1 = T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:52:26: Error: Type variables can't be used as constants.
+// const local2 = Class<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:53:23: Error: Type variables can't be used as constants.
+// const local3 = id<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:54:25: Error: Type variables can't be used as constants.
+// const local4 = (id)<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:55:21: Error: Type variables can't be used as constants.
+// const local5 = <T>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:56:21: Error: Type variables can't be used as constants.
+// const local6 = <T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:57:21: Error: Type variables can't be used as constants.
+// const local7 = <T, T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:57:24: Error: Type variables can't be used as constants.
+// const local7 = <T, T>{};
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:58:25: Error: Type variables can't be used as constants.
+// const local8 = o is T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:59:31: Error: Type variables can't be used as constants.
+// const local9 = o is Class<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:60:26: Error: Type variables can't be used as constants.
+// const local10 = o as T;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:61:32: Error: Type variables can't be used as constants.
+// const local11 = o as Class<T>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:62:27: Error: Type variables can't be used as constants.
+// const local12 = Class<T>.new;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:63:23: Error: Type variables can't be used as constants.
+// const local13 = F<T, T>.new;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:63:26: Error: Type variables can't be used as constants.
+// const local13 = F<T, T>.new;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:64:30: Error: Type variables can't be used as constants.
+// const local14 = id<Class<T>>;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:65:28: Error: Type variables can't be used as constants.
+// const local15 = <Class<T>>[];
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:66:23: Error: Type variables can't be used as constants.
+// const local16 = G<T>.new;
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:88:18: Error: Type variables can't be used as constants.
+// print(const [T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:89:24: Error: Type variables can't be used as constants.
+// print(const [Class<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:90:21: Error: Type variables can't be used as constants.
+// print(const [id<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:91:23: Error: Type variables can't be used as constants.
+// print(const [(id)<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:92:19: Error: Type variables can't be used as constants.
+// print(const [<T>[]]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:93:19: Error: Type variables can't be used as constants.
+// print(const [<T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:94:19: Error: Type variables can't be used as constants.
+// print(const [<T, T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:94:22: Error: Type variables can't be used as constants.
+// print(const [<T, T>{}]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:95:23: Error: Type variables can't be used as constants.
+// print(const [o is T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:96:29: Error: Type variables can't be used as constants.
+// print(const [o is Class<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:97:23: Error: Type variables can't be used as constants.
+// print(const [o as T]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:98:29: Error: Type variables can't be used as constants.
+// print(const [o as Class<T>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:99:24: Error: Type variables can't be used as constants.
+// print(const [Class<T>.new]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:100:20: Error: Type variables can't be used as constants.
+// print(const [F<T, T>.new]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:100:23: Error: Type variables can't be used as constants.
+// print(const [F<T, T>.new]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:101:27: Error: Type variables can't be used as constants.
+// print(const [id<Class<T>>]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:102:25: Error: Type variables can't be used as constants.
+// print(const [<Class<T>>[]]);
+// ^
+//
+// pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart:103:20: Error: Type variables can't be used as constants.
+// print(const [G<T>.new]);
+// ^
+//
+import self as self3;
+import "dart:core" as core;
+
+typedef F<X extends core::Object? = dynamic, unrelated Y extends core::Object? = dynamic> = self3::Class<X%>;
+typedef G<unrelated X extends core::Object? = dynamic> = self3::Class<core::int>;
+class Class<T extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field dynamic field1;
+ final field dynamic field2;
+ final field dynamic field3;
+ final field dynamic field4;
+ final field dynamic field5;
+ final field dynamic field6;
+ final field dynamic field7;
+ final field dynamic field8;
+ final field dynamic field9;
+ final field dynamic field10;
+ final field dynamic field11;
+ final field dynamic field12;
+ final field dynamic field13;
+ final field dynamic field14;
+ final field dynamic field15;
+ final field dynamic field16;
+ const constructor •(dynamic o) → self3::Class<self3::Class::T%>
+ : self3::Class::field1 = self3::Class::T%, self3::Class::field2 = self3::Class<self3::Class::T%>, self3::Class::field3 = #C24<self3::Class::T%>, self3::Class::field4 = #C24<self3::Class::T%>, self3::Class::field5 = #C2, self3::Class::field6 = #C3, self3::Class::field7 = #C4, self3::Class::field8 = o is{ForNonNullableByDefault} self3::Class::T%, self3::Class::field9 = o is{ForNonNullableByDefault} self3::Class<self3::Class::T%>, self3::Class::field10 = o as{ForNonNullableByDefault} self3::Class::T%, self3::Class::field11 = o{self3::Class::T%} as{ForNonNullableByDefault} self3::Class<self3::Class::T%>, self3::Class::field12 = #C25<self3::Class::T%>, self3::Class::field13 = #C25<self3::Class::T%>, self3::Class::field14 = #C24<self3::Class<self3::Class::T%>>, self3::Class::field15 = #C26, self3::Class::field16 = #C27, super core::Object::•()
+ ;
+ method method() → void {
+ core::print(#C1);
+ core::print(#C28);
+ core::print(#C29);
+ core::print(#C29);
+ core::print(#C2);
+ core::print(#C3);
+ core::print(#C4);
+ core::print(#C6);
+ core::print(#C7);
+ core::print(#C8);
+ core::print(#C8);
+ core::print(#C30);
+ core::print(#C30);
+ core::print(#C31);
+ core::print(#C26);
+ core::print(#C27);
+ core::print(#C20);
+ core::print(#C10);
+ core::print(#C32);
+ core::print(#C33);
+ core::print(#C33);
+ core::print(#C11);
+ core::print(#C12);
+ core::print(#C13);
+ core::print(#C14);
+ core::print(#C15);
+ core::print(#C21);
+ core::print(#C34);
+ core::print(#C35);
+ core::print(#C35);
+ core::print(#C36);
+ core::print(#C37);
+ core::print(#C38);
+ }
+}
+static method id<T extends core::Object? = dynamic>(self3::id::T% t) → self3::id::T%
+ return t;
+static method main() → dynamic {}
+static method _#F#new#tearOff<X extends core::Object? = dynamic, unrelated Y extends core::Object? = dynamic>(dynamic o) → self3::Class<self3::_#F#new#tearOff::X%>
+ return new self3::Class::•<self3::_#F#new#tearOff::X%>(o);
+static method _#G#new#tearOff<unrelated X extends core::Object? = dynamic>(dynamic o) → self3::Class<core::int>
+ return new self3::Class::•<core::int>(o);
+
+constants {
+ #C1 = TypeLiteralConstant(invalid-type)
+ #C2 = <invalid-type>[]
+ #C3 = <invalid-type>{}
+ #C4 = <invalid-type, invalid-type>{)
+ #C5 = <self::Class<invalid-type>*>[]
+ #C6 = true
+ #C7 = false
+ #C8 = null
+ #C9 = <Null>[]
+ #C10 = <core::Type*>[#C1]
+ #C11 = <core::List<invalid-type>*>[#C2]
+ #C12 = <core::Set<invalid-type>*>[#C3]
+ #C13 = <core::Map<invalid-type, invalid-type>*>[#C4]
+ #C14 = <core::bool*>[#C6]
+ #C15 = <core::bool*>[#C7]
+ #C16 = <invalid-type>[#C8]
+ #C17 = <self::Class<invalid-type>*>[#C8]
+ #C18 = <core::List<self::Class<invalid-type>*>*>[#C5]
+ #C19 = <self2::Class<invalid-type>*>[]
+ #C20 = <Never*>[]
+ #C21 = <dynamic>[#C8]
+ #C22 = <self2::Class<invalid-type>*>[#C8]
+ #C23 = <core::List<self2::Class<invalid-type>*>*>[#C19]
+ #C24 = static-tearoff self3::id
+ #C25 = constructor-tearoff self3::Class::•
+ #C26 = <self3::Class<invalid-type>*>[]
+ #C27 = instantiation self3::Class::• <core::int*>
+ #C28 = TypeLiteralConstant(self3::Class<invalid-type>*)
+ #C29 = instantiation self3::id <invalid-type>
+ #C30 = instantiation self3::Class::• <invalid-type>
+ #C31 = instantiation self3::id <self3::Class<invalid-type>*>
+ #C32 = <core::Type*>[#C28]
+ #C33 = <(invalid-type) →* invalid-type>[#C29]
+ #C34 = <self3::Class<invalid-type>*>[#C8]
+ #C35 = <(dynamic) →* self3::Class<invalid-type>*>[#C30]
+ #C36 = <(self3::Class<invalid-type>*) →* self3::Class<invalid-type>*>[#C31]
+ #C37 = <core::List<self3::Class<invalid-type>*>*>[#C26]
+ #C38 = <(dynamic) →* self3::Class<core::int*>*>[#C27]
+}
diff --git a/pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart b/pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart
new file mode 100644
index 0000000..f85279e
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/potentially_constant_type_lib1.dart
@@ -0,0 +1,72 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+// Pre nonfunction-type-alias language version:
+// @dart=2.12
+
+T id<T>(T t) => t;
+
+class Class<T> {
+ final field1;
+ final field5;
+ final field6;
+ final field7;
+ final field8;
+ final field9;
+ final field10;
+ final field11;
+ final field15;
+
+ const Class(o)
+ // Potentially constant context:
+ : field1 = T,
+ field5 = <T>[],
+ field6 = <T>{},
+ field7 = <T, T>{},
+ field8 = o is T,
+ field9 = o is Class<T>,
+ field10 = o as T,
+ field11 = o as Class<T>,
+ field15 = <Class<T>>[];
+
+ void method() {
+ const o = null;
+
+ // Required constant context:
+ const local1 = T;
+ const local5 = <T>[];
+ const local6 = <T>{};
+ const local7 = <T, T>{};
+ const local8 = o is T;
+ const local9 = o is Class<T>;
+ const local10 = o as T;
+ const local11 = o as Class<T>;
+ const local15 = <Class<T>>[];
+ const List<T> listOfNever = []; // ok
+
+ print(local1);
+ print(local5);
+ print(local6);
+ print(local7);
+ print(local8);
+ print(local9);
+ print(local10);
+ print(local11);
+ print(local15);
+ print(listOfNever);
+
+ // Inferred constant context:
+ print(const [T]);
+ print(const [<T>[]]);
+ print(const [<T>{}]);
+ print(const [<T, T>{}]);
+ print(const [o is T]);
+ print(const [o is Class<T>]);
+ print(const [o as T]);
+ print(const [o as Class<T>]);
+ print(const [<Class<T>>[]]);
+ }
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart b/pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart
new file mode 100644
index 0000000..4b31d55
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/potentially_constant_type_lib2.dart
@@ -0,0 +1,107 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+T id<T>(T t) => t;
+
+typedef F<X, Y> = Class<X>;
+typedef G<X> = Class<int>;
+
+class Class<T> {
+ final field1;
+ final field2;
+ final field3;
+ final field4;
+ final field5;
+ final field6;
+ final field7;
+ final field8;
+ final field9;
+ final field10;
+ final field11;
+ final field12;
+ final field13;
+ final field14;
+ final field15;
+ final field16;
+
+ const Class(o)
+ // Potentially constant context:
+ : field1 = T,
+ field2 = Class<T>,
+ field3 = id<T>,
+ field4 = (id)<T>,
+ field5 = <T>[],
+ field6 = <T>{},
+ field7 = <T, T>{},
+ field8 = o is T,
+ field9 = o is Class<T>,
+ field10 = o as T,
+ field11 = o as Class<T>,
+ field12 = Class<T>.new,
+ field13 = F<T, T>.new,
+ field14 = id<Class<T>>,
+ field15 = <Class<T>>[],
+ field16 = G<T>.new;
+
+ void method() {
+ const o = null;
+
+ // Required constant context:
+ const local1 = T;
+ const local2 = Class<T>;
+ const local3 = id<T>;
+ const local4 = (id)<T>;
+ const local5 = <T>[];
+ const local6 = <T>{};
+ const local7 = <T, T>{};
+ const local8 = o is T;
+ const local9 = o is Class<T>;
+ const local10 = o as T;
+ const local11 = o as Class<T>;
+ const local12 = Class<T>.new;
+ const local13 = F<T, T>.new;
+ const local14 = id<Class<T>>;
+ const local15 = <Class<T>>[];
+ const local16 = G<T>.new;
+ const List<T> listOfNever = []; // ok
+
+ print(local1);
+ print(local2);
+ print(local3);
+ print(local4);
+ print(local5);
+ print(local6);
+ print(local7);
+ print(local8);
+ print(local9);
+ print(local10);
+ print(local11);
+ print(local12);
+ print(local13);
+ print(local14);
+ print(local15);
+ print(local16);
+ print(listOfNever);
+
+ // Inferred constant context:
+ print(const [T]);
+ print(const [Class<T>]);
+ print(const [id<T>]);
+ print(const [(id)<T>]);
+ print(const [<T>[]]);
+ print(const [<T>{}]);
+ print(const [<T, T>{}]);
+ print(const [o is T]);
+ print(const [o is Class<T>]);
+ print(const [o as T]);
+ print(const [o as Class<T>]);
+ print(const [Class<T>.new]);
+ print(const [F<T, T>.new]);
+ print(const [id<Class<T>>]);
+ print(const [<Class<T>>[]]);
+ print(const [G<T>.new]);
+ }
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_class.dart.weak.expect b/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_class.dart.weak.expect
index 6b52872..cb0d959 100644
--- a/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_class.dart.weak.expect
+++ b/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_class.dart.weak.expect
@@ -156,7 +156,7 @@
return null;
function foo6Prime() → core::List<invalid-type>*
return null;
- invalid-type foo7 = (invalid-type y) → invalid-type => y;
+ (invalid-type) →* void foo7 = (invalid-type y) → invalid-type => y;
(core::List<invalid-type>*) →* void foo7Prime = (core::List<invalid-type>* y) → core::List<invalid-type>* => y;
}
static method foo8() → () →* invalid-type {
diff --git a/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_class.dart.weak.transformed.expect b/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_class.dart.weak.transformed.expect
index 6b52872..cb0d959 100644
--- a/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_class.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_class.dart.weak.transformed.expect
@@ -156,7 +156,7 @@
return null;
function foo6Prime() → core::List<invalid-type>*
return null;
- invalid-type foo7 = (invalid-type y) → invalid-type => y;
+ (invalid-type) →* void foo7 = (invalid-type y) → invalid-type => y;
(core::List<invalid-type>*) →* void foo7Prime = (core::List<invalid-type>* y) → core::List<invalid-type>* => y;
}
static method foo8() → () →* invalid-type {
diff --git a/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_extension.dart.weak.expect b/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_extension.dart.weak.expect
index e6c02fb..d4e95b2 100644
--- a/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_extension.dart.weak.expect
+++ b/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_extension.dart.weak.expect
@@ -174,7 +174,7 @@
return null;
function foo6Prime() → core::List<invalid-type>*
return null;
- invalid-type foo7 = (invalid-type y) → invalid-type => y;
+ (invalid-type) →* void foo7 = (invalid-type y) → invalid-type => y;
(core::List<invalid-type>*) →* void foo7Prime = (core::List<invalid-type>* y) → core::List<invalid-type>* => y;
}
static method Foo|foo8() → () →* invalid-type {
diff --git a/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_extension.dart.weak.transformed.expect b/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_extension.dart.weak.transformed.expect
index e6c02fb..d4e95b2 100644
--- a/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_extension.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/type_parameter_usage_in_static_method_in_extension.dart.weak.transformed.expect
@@ -174,7 +174,7 @@
return null;
function foo6Prime() → core::List<invalid-type>*
return null;
- invalid-type foo7 = (invalid-type y) → invalid-type => y;
+ (invalid-type) →* void foo7 = (invalid-type y) → invalid-type => y;
(core::List<invalid-type>*) →* void foo7Prime = (core::List<invalid-type>* y) → core::List<invalid-type>* => y;
}
static method Foo|foo8() → () →* invalid-type {
diff --git a/pkg/frontend_server/test/frontend_server_test.dart b/pkg/frontend_server/test/frontend_server_test.dart
index 8205380..a586bf7 100644
--- a/pkg/frontend_server/test/frontend_server_test.dart
+++ b/pkg/frontend_server/test/frontend_server_test.dart
@@ -2327,6 +2327,116 @@
expect(count, 3);
});
+ test('compiled Javascript includes web library environment defines',
+ () async {
+ var file = File('${tempDir.path}/foo.dart')..createSync();
+ file.writeAsStringSync(
+ "main() {print(const bool.fromEnvironment('dart.library.html'));}\n");
+ var package_config =
+ File('${tempDir.path}/.dart_tool/package_config.json')
+ ..createSync(recursive: true)
+ ..writeAsStringSync('''
+ {
+ "configVersion": 2,
+ "packages": [
+ {
+ "name": "hello",
+ "rootUri": "../",
+ "packageUri": "./"
+ }
+ ]
+ }
+ ''');
+
+ var library = 'package:hello/foo.dart';
+ var module = 'packages/hello/foo.dart';
+
+ var dillFile = File('${tempDir.path}/foo.dart.dill');
+ var sourceFile = File('${dillFile.path}.sources');
+ var manifestFile = File('${dillFile.path}.json');
+ var sourceMapsFile = File('${dillFile.path}.map');
+
+ expect(dillFile.existsSync(), false);
+
+ final List<String> args = <String>[
+ '--sdk-root=${sdkRoot.toFilePath()}',
+ '--incremental',
+ '--platform=${ddcPlatformKernel.path}',
+ '--output-dill=${dillFile.path}',
+ '--target=dartdevc',
+ '--packages=${package_config.path}',
+ ];
+
+ final StreamController<List<int>> streamController =
+ StreamController<List<int>>();
+ final StreamController<List<int>> stdoutStreamController =
+ StreamController<List<int>>();
+ final IOSink ioSink = IOSink(stdoutStreamController.sink);
+ StreamController<Result> receivedResults = StreamController<Result>();
+ final outputParser = OutputParser(receivedResults);
+ stdoutStreamController.stream
+ .transform(utf8.decoder)
+ .transform(const LineSplitter())
+ .listen(outputParser.listener);
+
+ Future<int> result =
+ starter(args, input: streamController.stream, output: ioSink);
+ streamController.add('compile $library\n'.codeUnits);
+ int count = 0;
+ receivedResults.stream.listen((Result compiledResult) {
+ CompilationResult result =
+ CompilationResult.parse(compiledResult.status);
+ if (count == 0) {
+ // Request to 'compile', which results in full JavaScript.
+ expect(result.errorsCount, equals(0));
+ expect(sourceFile.existsSync(), equals(true));
+ expect(manifestFile.existsSync(), equals(true));
+ expect(sourceMapsFile.existsSync(), equals(true));
+ expect(result.filename, dillFile.path);
+
+ var compiledOutput = sourceFile.readAsStringSync();
+ // The constant environment variable should be inlined as a boolean
+ // literal.
+ expect(compiledOutput, contains('print(true);'));
+
+ streamController.add('accept\n'.codeUnits);
+
+ // 'compile-expression-to-js <boundarykey>
+ // libraryUri
+ // line
+ // column
+ // jsModules (one k-v pair per line)
+ // ...
+ // <boundarykey>
+ // jsFrameValues (one k-v pair per line)
+ // ...
+ // <boundarykey>
+ // moduleName
+ // expression
+ outputParser.expectSources = false;
+ streamController.add('compile-expression-to-js abc\n'
+ '$library\n2\n1\nabc\nabc\n$module\n'
+ 'const bool.fromEnvironment("dart.library.html")\n'
+ .codeUnits);
+ count += 1;
+ } else {
+ expect(count, 1);
+ // Second request is to 'compile-expression-to-js' that should
+ // result in a literal `true` .
+ expect(result.errorsCount, 0);
+ var resultFile = File(result.filename);
+ // The constant environment variable should be inlined as a boolean
+ // literal.
+ expect(resultFile.readAsStringSync(), contains('return true;'));
+ outputParser.expectSources = false;
+ count += 1;
+ streamController.add('quit\n'.codeUnits);
+ }
+ });
+ expect(await result, 0);
+ expect(count, 2);
+ });
+
test('mixed compile expression commands with web target', () async {
var file = File('${tempDir.path}/foo.dart')..createSync();
file.writeAsStringSync("main() {\n\n}\n");
diff --git a/pkg/nnbd_migration/lib/fix_reason_target.dart b/pkg/nnbd_migration/lib/fix_reason_target.dart
index 9f9c91c..c9c876b 100644
--- a/pkg/nnbd_migration/lib/fix_reason_target.dart
+++ b/pkg/nnbd_migration/lib/fix_reason_target.dart
@@ -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 @@
: 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 @@
: 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 @@
_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 @@
: 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 @@
_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) =>
diff --git a/pkg/nnbd_migration/lib/nnbd_migration.dart b/pkg/nnbd_migration/lib/nnbd_migration.dart
index aaa17c7..d184cb0 100644
--- a/pkg/nnbd_migration/lib/nnbd_migration.dart
+++ b/pkg/nnbd_migration/lib/nnbd_migration.dart
@@ -7,7 +7,6 @@
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 @@
{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) =>
diff --git a/pkg/nnbd_migration/lib/src/edge_builder.dart b/pkg/nnbd_migration/lib/src/edge_builder.dart
index e355526..e3e703b 100644
--- a/pkg/nnbd_migration/lib/src/edge_builder.dart
+++ b/pkg/nnbd_migration/lib/src/edge_builder.dart
@@ -221,7 +221,7 @@
/// initializer in the constructor declaration.
Set<FieldElement?>? _fieldsNotInitializedByConstructor;
- /// Current nesting depth of [visitTypeName]
+ /// Current nesting depth of [visitNamedType]
int _typeNameNesting = 0;
final Set<PromotableElement> _lateHintedLocals = {};
@@ -681,7 +681,7 @@
@override
DecoratedType? visitClassTypeAlias(ClassTypeAlias node) {
- _dispatch(node.superclass);
+ _dispatch(node.superclass2);
_dispatch(node.implementsClause);
_dispatch(node.withClause);
var classElement = node.declaredElement!;
@@ -775,7 +775,7 @@
DecoratedType? visitConstructorDeclaration(ConstructorDeclaration node) {
_fieldsNotInitializedByConstructor =
_fieldsNotInitializedAtDeclaration!.toSet();
- _dispatch(node.redirectedConstructor?.type.typeArguments);
+ _dispatch(node.redirectedConstructor?.type2.typeArguments);
_handleExecutableDeclaration(
node,
node.declaredElement!,
@@ -1181,7 +1181,7 @@
var typeParameters = callee.enclosingElement.typeParameters;
Iterable<DartType?> typeArgumentTypes;
List<DecoratedType> decoratedTypeArguments;
- var typeArguments = node.constructorName.type.typeArguments;
+ var typeArguments = node.constructorName.type2.typeArguments;
late List<EdgeOrigin> parameterEdgeOrigins;
var target =
NullabilityNodeTarget.text('constructed type').withCodeRef(node);
@@ -1412,6 +1412,82 @@
}
@override
+ DecoratedType? visitNamedType(NamedType node) {
+ try {
+ _typeNameNesting++;
+ var typeArguments = node.typeArguments?.arguments;
+ var element = node.name.staticElement;
+ if (element is TypeAliasElement) {
+ var aliasedElement =
+ element.aliasedElement as GenericFunctionTypeElement;
+ final typedefType = _variables!.decoratedElementType(aliasedElement);
+ final typeNameType = _variables!.decoratedTypeAnnotation(source, node);
+
+ Map<TypeParameterElement, DecoratedType> substitutions;
+ if (node.typeArguments == null) {
+ // TODO(mfairhurst): substitute instantiations to bounds
+ substitutions = {};
+ } else {
+ substitutions =
+ Map<TypeParameterElement, DecoratedType>.fromIterables(
+ element.typeParameters,
+ node.typeArguments!.arguments.map(
+ (t) => _variables!.decoratedTypeAnnotation(source, t)));
+ }
+
+ final decoratedType = typedefType.substitute(substitutions);
+ final origin = TypedefReferenceOrigin(source, node);
+ _linkDecoratedTypeParameters(decoratedType, typeNameType, origin,
+ isUnion: true);
+ _linkDecoratedTypes(
+ decoratedType.returnType!, typeNameType.returnType, origin,
+ isUnion: true);
+ } else if (element is TypeParameterizedElement) {
+ if (typeArguments == null) {
+ var instantiatedType =
+ _variables!.decoratedTypeAnnotation(source, node);
+ var origin = InstantiateToBoundsOrigin(source, node);
+ for (int i = 0; i < instantiatedType.typeArguments.length; i++) {
+ _linkDecoratedTypes(
+ instantiatedType.typeArguments[i]!,
+ _variables!
+ .decoratedTypeParameterBound(element.typeParameters[i]),
+ origin,
+ isUnion: false);
+ }
+ } else {
+ for (int i = 0; i < typeArguments.length; i++) {
+ DecoratedType? bound;
+ bound = _variables!
+ .decoratedTypeParameterBound(element.typeParameters[i]);
+ assert(bound != null);
+ var argumentType =
+ _variables!.decoratedTypeAnnotation(source, typeArguments[i]);
+ _checkAssignment(
+ TypeParameterInstantiationOrigin(source, typeArguments[i]),
+ FixReasonTarget.root,
+ source: argumentType,
+ destination: bound!,
+ hard: true);
+ }
+ }
+ }
+ node.visitChildren(this);
+ // If the type name is followed by a `/*!*/` comment, it is considered to
+ // apply to the type and not to the "as" expression. In order to prevent
+ // a future call to _handleNullCheck from interpreting it as applying to
+ // the "as" expression, we need to store the `/*!*/` comment in
+ // _nullCheckHints.
+ var token = node.endToken;
+ _nullCheckHints[token] = getPostfixHint(token);
+ namedTypeVisited(node); // Note this has been visited to TypeNameTracker.
+ return null;
+ } finally {
+ _typeNameNesting--;
+ }
+ }
+
+ @override
DecoratedType? visitNamespaceDirective(NamespaceDirective node) {
// skip directives, but not their metadata
_dispatchList(node.metadata);
@@ -1865,84 +1941,6 @@
}
@override
- DecoratedType? visitTypeName(TypeName typeName) {
- try {
- _typeNameNesting++;
- var typeArguments = typeName.typeArguments?.arguments;
- var element = typeName.name.staticElement;
- if (element is TypeAliasElement) {
- var aliasedElement =
- element.aliasedElement as GenericFunctionTypeElement;
- final typedefType = _variables!.decoratedElementType(aliasedElement);
- final typeNameType =
- _variables!.decoratedTypeAnnotation(source, typeName);
-
- Map<TypeParameterElement, DecoratedType> substitutions;
- if (typeName.typeArguments == null) {
- // TODO(mfairhurst): substitute instantiations to bounds
- substitutions = {};
- } else {
- substitutions =
- Map<TypeParameterElement, DecoratedType>.fromIterables(
- element.typeParameters,
- typeName.typeArguments!.arguments.map(
- (t) => _variables!.decoratedTypeAnnotation(source, t)));
- }
-
- final decoratedType = typedefType.substitute(substitutions);
- final origin = TypedefReferenceOrigin(source, typeName);
- _linkDecoratedTypeParameters(decoratedType, typeNameType, origin,
- isUnion: true);
- _linkDecoratedTypes(
- decoratedType.returnType!, typeNameType.returnType, origin,
- isUnion: true);
- } else if (element is TypeParameterizedElement) {
- if (typeArguments == null) {
- var instantiatedType =
- _variables!.decoratedTypeAnnotation(source, typeName);
- var origin = InstantiateToBoundsOrigin(source, typeName);
- for (int i = 0; i < instantiatedType.typeArguments.length; i++) {
- _linkDecoratedTypes(
- instantiatedType.typeArguments[i]!,
- _variables!
- .decoratedTypeParameterBound(element.typeParameters[i]),
- origin,
- isUnion: false);
- }
- } else {
- for (int i = 0; i < typeArguments.length; i++) {
- DecoratedType? bound;
- bound = _variables!
- .decoratedTypeParameterBound(element.typeParameters[i]);
- assert(bound != null);
- var argumentType =
- _variables!.decoratedTypeAnnotation(source, typeArguments[i]);
- _checkAssignment(
- TypeParameterInstantiationOrigin(source, typeArguments[i]),
- FixReasonTarget.root,
- source: argumentType,
- destination: bound!,
- hard: true);
- }
- }
- }
- typeName.visitChildren(this);
- // If the type name is followed by a `/*!*/` comment, it is considered to
- // apply to the type and not to the "as" expression. In order to prevent
- // a future call to _handleNullCheck from interpreting it as applying to
- // the "as" expression, we need to store the `/*!*/` comment in
- // _nullCheckHints.
- var token = typeName.endToken;
- _nullCheckHints[token] = getPostfixHint(token);
- namedTypeVisited(
- typeName); // Note this has been visited to TypeNameTracker.
- return null;
- } finally {
- _typeNameNesting--;
- }
- }
-
- @override
DecoratedType? visitVariableDeclarationList(VariableDeclarationList node) {
var parent = node.parent;
bool isTopLevel =
@@ -2532,7 +2530,7 @@
var callee = redirectedConstructor.staticElement!.declaration;
var redirectedClass = callee.enclosingElement;
var calleeType = _variables!.decoratedElementType(callee);
- var typeArguments = redirectedConstructor.type.typeArguments;
+ var typeArguments = redirectedConstructor.type2.typeArguments;
var typeArgumentTypes =
typeArguments?.arguments.map((t) => t.type).toList();
_handleInvocationArguments(
diff --git a/pkg/nnbd_migration/lib/src/fix_aggregator.dart b/pkg/nnbd_migration/lib/src/fix_aggregator.dart
index ddf1bb4..ddb14d6 100644
--- a/pkg/nnbd_migration/lib/src/fix_aggregator.dart
+++ b/pkg/nnbd_migration/lib/src/fix_aggregator.dart
@@ -1459,6 +1459,9 @@
NodeChangeForMethodInvocation();
@override
+ NodeChange visitNamedType(NamedType node) => NodeChangeForTypeAnnotation();
+
+ @override
NodeChange visitNode(AstNode node) =>
throw StateError('Unexpected node type: ${node.runtimeType}');
@@ -1493,9 +1496,6 @@
}
@override
- NodeChange visitTypeName(TypeName node) => NodeChangeForTypeAnnotation();
-
- @override
NodeChange visitVariableDeclarationList(VariableDeclarationList node) =>
NodeChangeForVariableDeclarationList();
}
diff --git a/pkg/nnbd_migration/lib/src/fix_builder.dart b/pkg/nnbd_migration/lib/src/fix_builder.dart
index 5f81f25..21b38d4 100644
--- a/pkg/nnbd_migration/lib/src/fix_builder.dart
+++ b/pkg/nnbd_migration/lib/src/fix_builder.dart
@@ -1223,7 +1223,7 @@
}
@override
- void visitTypeName(TypeName node) {
+ void visitNamedType(NamedType node) {
var decoratedType = _fixBuilder._variables!
.decoratedTypeAnnotation(_fixBuilder.source, node);
if (!typeIsNonNullableByContext(node)) {
@@ -1233,7 +1233,7 @@
}
(node as TypeNameImpl).type =
_fixBuilder._variables!.toFinalType(decoratedType);
- super.visitTypeName(node);
+ super.visitNamedType(node);
}
void _addRequiredKeyword(DefaultFormalParameter parameter,
diff --git a/pkg/nnbd_migration/lib/src/front_end/migration_info.dart b/pkg/nnbd_migration/lib/src/front_end/migration_info.dart
index bef2c3a..02ea5e1 100644
--- a/pkg/nnbd_migration/lib/src/front_end/migration_info.dart
+++ b/pkg/nnbd_migration/lib/src/front_end/migration_info.dart
@@ -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 @@
: 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) {
diff --git a/pkg/nnbd_migration/lib/src/node_builder.dart b/pkg/nnbd_migration/lib/src/node_builder.dart
index afbcf02..6673352 100644
--- a/pkg/nnbd_migration/lib/src/node_builder.dart
+++ b/pkg/nnbd_migration/lib/src/node_builder.dart
@@ -131,7 +131,7 @@
node.nativeClause?.accept(this);
node.members.accept(this);
var classElement = node.declaredElement!;
- _handleSupertypeClauses(node, classElement, node.extendsClause?.superclass,
+ _handleSupertypeClauses(node, classElement, node.extendsClause?.superclass2,
node.withClause, node.implementsClause, null);
var constructors = classElement.constructors;
if (constructors.length == 1) {
@@ -157,7 +157,7 @@
node.name.accept(this);
node.typeParameters?.accept(this);
var classElement = node.declaredElement!;
- _handleSupertypeClauses(node, classElement, node.superclass,
+ _handleSupertypeClauses(node, classElement, node.superclass2,
node.withClause, node.implementsClause, null);
for (var constructorElement in classElement.constructors) {
assert(constructorElement.isSynthetic);
@@ -203,7 +203,7 @@
@override
DecoratedType? visitConstructorName(ConstructorName node) {
_pushNullabilityNodeTarget(NullabilityNodeTarget.text('constructed type'),
- () => node.type.accept(this));
+ () => node.type2.accept(this));
node.name?.accept(this);
return null;
}
@@ -499,6 +499,12 @@
}
@override
+ DecoratedType visitNamedType(NamedType node) {
+ namedTypeVisited(node); // Note this has been visited to NamedTypeTracker.
+ return visitTypeAnnotation(node);
+ }
+
+ @override
DecoratedType? visitSetOrMapLiteral(SetOrMapLiteral node) {
var typeArguments = node.typeArguments;
if (typeArguments != null) {
@@ -620,12 +626,6 @@
}
@override
- DecoratedType visitTypeName(TypeName node) {
- namedTypeVisited(node); // Note this has been visited to TypeNameTracker.
- return visitTypeAnnotation(node);
- }
-
- @override
DecoratedType? visitTypeParameter(TypeParameter node) {
var element = node.declaredElement!;
var bound = node.bound;
diff --git a/pkg/nnbd_migration/lib/src/utilities/named_type_tracker.dart b/pkg/nnbd_migration/lib/src/utilities/named_type_tracker.dart
index 3aab8bc..5c2e296 100644
--- a/pkg/nnbd_migration/lib/src/utilities/named_type_tracker.dart
+++ b/pkg/nnbd_migration/lib/src/utilities/named_type_tracker.dart
@@ -9,22 +9,8 @@
class NamedTypeTracker extends RecursiveAstVisitor<void> {
final Set<NamedType> _nodes = {};
- bool _isTrueNamedType(NamedType node) {
- final parent = node.parent;
- if (parent is ConstructorName) {
- // We only need to visit C in `new C()`, just `int` in `new C<int>()`.
- return parent.type != node;
- }
-
- return true;
- }
-
- @override
- void visitTypeName(TypeName node) {
- if (_isTrueNamedType(node)) {
- _nodes.add(node);
- }
- super.visitTypeName(node);
+ void finalize() {
+ assert(_nodes.isEmpty, 'Annotation nodes not visited: $_nodes');
}
void nodeVisited(NamedType node) {
@@ -33,7 +19,21 @@
}
}
- void finalize() {
- assert(_nodes.isEmpty, 'Annotation nodes not visited: $_nodes');
+ @override
+ void visitNamedType(NamedType node) {
+ if (_isTrueNamedType(node)) {
+ _nodes.add(node);
+ }
+ super.visitNamedType(node);
+ }
+
+ bool _isTrueNamedType(NamedType node) {
+ final parent = node.parent;
+ if (parent is ConstructorName) {
+ // We only need to visit C in `new C()`, just `int` in `new C<int>()`.
+ return parent.type2 != node;
+ }
+
+ return true;
}
}
diff --git a/pkg/nnbd_migration/pubspec.yaml b/pkg/nnbd_migration/pubspec.yaml
index 18fffd3..6d8ac9d 100644
--- a/pkg/nnbd_migration/pubspec.yaml
+++ b/pkg/nnbd_migration/pubspec.yaml
@@ -4,7 +4,7 @@
publish_to: none
environment:
- sdk: '>=2.12.0 <3.0.0'
+ sdk: '>=2.14.0 <3.0.0'
dependencies:
_fe_analyzer_shared:
diff --git a/pkg/telemetry/pubspec.yaml b/pkg/telemetry/pubspec.yaml
index 98d68d6..b5b6b30 100644
--- a/pkg/telemetry/pubspec.yaml
+++ b/pkg/telemetry/pubspec.yaml
@@ -7,7 +7,7 @@
sdk: '>=2.12.0 <3.0.0'
dependencies:
- http: ^0.12.0
+ http: ^0.13.0
meta:
path: ../meta
path: ^1.4.0
diff --git a/runtime/vm/globals.h b/runtime/vm/globals.h
index 986c3a2..2e63f76 100644
--- a/runtime/vm/globals.h
+++ b/runtime/vm/globals.h
@@ -111,7 +111,7 @@
#endif // defined(DART_PRECOMPILED_RUNTIME)
#if !defined(PRODUCT) || defined(DART_HOST_OS_FUCHSIA) || \
- defined(DART_TARGET_OS_FUCHSIA)
+ defined(DART_TARGET_OS_FUCHSIA) || defined(DART_TARGET_OS_ANDROID)
#define SUPPORT_TIMELINE 1
#endif
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 8d03455..59b3461 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -11447,8 +11447,7 @@
width == other.width &&
height == other.height;
- int get hashCode => _JenkinsSmiHash.hash4(
- left.hashCode, top.hashCode, width.hashCode, height.hashCode);
+ int get hashCode => Object.hash(left, top, width, height);
/**
* Computes the intersection of `this` and [other].
@@ -34578,8 +34577,7 @@
width == other.width &&
height == other.height;
- int get hashCode => _JenkinsSmiHash.hash4(
- left.hashCode, top.hashCode, width.hashCode, height.hashCode);
+ int get hashCode => Object.hash(left, top, width, height);
/**
* Computes the intersection of `this` and [other].
@@ -34718,43 +34716,6 @@
set y(num? value) native;
}
-
-/**
- * This is the [Jenkins hash function][1] but using masking to keep
- * values in SMI range.
- *
- * [1]: http://en.wikipedia.org/wiki/Jenkins_hash_function
- *
- * Use:
- * Hash each value with the hash of the previous value, then get the final
- * hash by calling finish.
- *
- * var hash = 0;
- * for (var value in values) {
- * hash = JenkinsSmiHash.combine(hash, value.hashCode);
- * }
- * hash = JenkinsSmiHash.finish(hash);
- */
-class _JenkinsSmiHash {
- // TODO(11617): This class should be optimized and standardized elsewhere.
-
- static int combine(int hash, int value) {
- hash = 0x1fffffff & (hash + value);
- hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
- return hash ^ (hash >> 6);
- }
-
- static int finish(int hash) {
- hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
- hash = hash ^ (hash >> 11);
- return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
- }
-
- static int hash2(a, b) => finish(combine(combine(0, a), b));
-
- static int hash4(a, b, c, d) =>
- finish(combine(combine(combine(combine(0, a), b), c), d));
-}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// 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.
@@ -36633,8 +36594,7 @@
right == other.right &&
bottom == other.bottom;
- int get hashCode => _JenkinsSmiHash.hash4(
- left.hashCode, top.hashCode, right.hashCode, bottom.hashCode);
+ int get hashCode => Object.hash(left, top, right, bottom);
/**
* Computes the intersection of `this` and [other].
diff --git a/tests/language/const/constant_type_variable_error_test.dart b/tests/language/const/constant_type_variable_error_test.dart
new file mode 100644
index 0000000..c0e7770
--- /dev/null
+++ b/tests/language/const/constant_type_variable_error_test.dart
@@ -0,0 +1,58 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+
+// Test the support for errors about type parameters as potentially
+// constant expressions or potentially constant type expressions.
+
+class A<X> {
+ final Object x1, x2, x3, x4, x5, x6, x7, x8, x9;
+
+ const A()
+ : x1 = const [X],
+ //^
+ // [analyzer] unspecified
+ // [cfe] unspecified
+ x2 = const <X>[],
+ //^
+ // [analyzer] unspecified
+ // [cfe] unspecified
+ x3 = const {X},
+ //^
+ // [analyzer] unspecified
+ // [cfe] unspecified
+ x4 = const <X>{},
+ //^
+ // [analyzer] unspecified
+ // [cfe] unspecified
+ x5 = const {X: null},
+ //^
+ // [analyzer] unspecified
+ // [cfe] unspecified
+ x6 = const <X, String?>{},
+ //^
+ // [analyzer] unspecified
+ // [cfe] unspecified
+ x7 = const B<X>(),
+ //^
+ // [analyzer] unspecified
+ // [cfe] unspecified
+ x8 = const C(X);
+ //^
+ // [analyzer] unspecified
+ // [cfe] unspecified
+}
+
+class B<X> {
+ const B();
+}
+
+class C {
+ const C(Object o);
+}
+
+void main() {
+ const A<int>();
+}
diff --git a/tests/language/const/constant_type_variable_test.dart b/tests/language/const/constant_type_variable_test.dart
new file mode 100644
index 0000000..b8436a5
--- /dev/null
+++ b/tests/language/const/constant_type_variable_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+
+// Test the support for type parameters as potentially constant expressions
+// and potentially constant type expressions. The cast to dynamic is included
+// in order to avoid a diagnostic message about an unnecessary cast.
+
+class A<X> {
+ final Type t1, t2;
+ final Object x1, x2;
+
+ const A()
+ : t1 = X,
+ t2 = List<X>,
+ x1 = 1 is X,
+ x2 = (const <Never>[] as dynamic) as List<X>;
+}
+
+void main() {
+ const A<int>();
+}
diff --git a/tests/lib/js/external_extension_members_test.dart b/tests/lib/js/external_extension_members_test.dart
index 6c9caa2..823861c 100644
--- a/tests/lib/js/external_extension_members_test.dart
+++ b/tests/lib/js/external_extension_members_test.dart
@@ -33,6 +33,14 @@
external set setter(_);
@JS('setterAnnotation')
external set annotatedSetter(_);
+
+ external num getField();
+ @JS('toString')
+ external String extToString();
+ external dynamic getFirstEl(list);
+ external num sumFn(a, b);
+ @JS('sumFn')
+ external num otherSumFn(a, b);
}
@JS('module.Bar')
@@ -56,6 +64,22 @@
this.getterAnnotation = a;
}
+ Foo.prototype.toString = function() {
+ return "Foo: " + this.field;
+ }
+
+ Foo.prototype.getField = function() {
+ return this.field;
+ }
+
+ Foo.prototype.getFirstEl = function(list) {
+ return list[0];
+ }
+
+ Foo.prototype.sumFn = function(a, b) {
+ return a + b;
+ }
+
var module = {Bar: Foo};
""");
@@ -94,6 +118,16 @@
expect(js_util.getProperty(foo, 'setterAnnotation'), equals('whale'));
});
+ test('methods', () {
+ var foo = Foo(42);
+
+ expect(foo.getField(), equals(42));
+ expect(foo.extToString(), equals('Foo: 42'));
+ expect(foo.getFirstEl([1, 2, 3]), equals(1));
+ expect(foo.sumFn(2, 3), equals(5));
+ expect(foo.otherSumFn(10, 5), equals(15));
+ });
+
test('module class', () {
var bar = Bar(5);
expect(js_util.getProperty(bar, 'fieldAnnotation'), equals(5));
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index 9e573fb..ccc6171 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -38,6 +38,7 @@
isolate/deferred_in_isolate2_test: Skip # Issue 16898. Deferred loading does not work from an isolate in CSP-mode
js/extends_test/extends_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
js/extends_test/extends_with_es6_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
+js/external_extension_members_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
js/instanceof_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
js/is_check_and_as_cast_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
js/js_util/async_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
diff --git a/tests/lib_2/js/external_extension_members_test.dart b/tests/lib_2/js/external_extension_members_test.dart
index a2c08a1..b1b0cfe 100644
--- a/tests/lib_2/js/external_extension_members_test.dart
+++ b/tests/lib_2/js/external_extension_members_test.dart
@@ -30,6 +30,14 @@
external set setter(_);
@JS('setterAnnotation')
external set annotatedSetter(_);
+
+ external num getField();
+ @JS('toString')
+ external String extToString();
+ external dynamic getFirstEl(list);
+ external num sumFn(a, b);
+ @JS('sumFn')
+ external num otherSumFn(a, b);
}
@JS('module.Bar')
@@ -55,6 +63,22 @@
this.getterAnnotation = a;
}
+ Foo.prototype.toString = function() {
+ return "Foo: " + this.field;
+ }
+
+ Foo.prototype.getField = function() {
+ return this.field;
+ }
+
+ Foo.prototype.getFirstEl = function(list) {
+ return list[0];
+ }
+
+ Foo.prototype.sumFn = function(a, b) {
+ return a + b;
+ }
+
var module = {Bar: Foo};
""");
@@ -76,6 +100,16 @@
expect(js_util.getProperty(foo, 'setterAnnotation'), equals('whale'));
});
+ test('methods', () {
+ var foo = Foo(42);
+
+ expect(foo.getField(), equals(42));
+ expect(foo.extToString(), equals('Foo: 42'));
+ expect(foo.getFirstEl([1, 2, 3]), equals(1));
+ expect(foo.sumFn(2, 3), equals(5));
+ expect(foo.otherSumFn(10, 5), equals(15));
+ });
+
test('module class', () {
var bar = Bar(5);
expect(js_util.getProperty(bar, 'fieldAnnotation'), equals(5));
diff --git a/tests/lib_2/lib_2.status b/tests/lib_2/lib_2.status
index fb8a8bf..d79f2ba 100644
--- a/tests/lib_2/lib_2.status
+++ b/tests/lib_2/lib_2.status
@@ -38,6 +38,7 @@
isolate/deferred_in_isolate2_test: Skip # Issue 16898. Deferred loading does not work from an isolate in CSP-mode
js/extends_test/extends_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
js/extends_test/extends_with_es6_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
+js/external_extension_members_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
js/instanceof_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
js/is_check_and_as_cast_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
js/js_util/async_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
diff --git a/tools/VERSION b/tools/VERSION
index 460779d..b752d93 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 139
+PRERELEASE 140
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/dom/src/CssRectangle.dart b/tools/dom/src/CssRectangle.dart
index 6aa6393..21205d1 100644
--- a/tools/dom/src/CssRectangle.dart
+++ b/tools/dom/src/CssRectangle.dart
@@ -287,8 +287,7 @@
right == other.right &&
bottom == other.bottom;
- int get hashCode => _JenkinsSmiHash.hash4(
- left.hashCode, top.hashCode, right.hashCode, bottom.hashCode);
+ int get hashCode => Object.hash(left, top, right, bottom);
/**
* Computes the intersection of `this` and [other].
diff --git a/tools/dom/templates/html/impl/impl_DOMRect.darttemplate b/tools/dom/templates/html/impl/impl_DOMRect.darttemplate
index 861096c..60f40c9 100644
--- a/tools/dom/templates/html/impl/impl_DOMRect.darttemplate
+++ b/tools/dom/templates/html/impl/impl_DOMRect.darttemplate
@@ -18,8 +18,7 @@
width == other.width &&
height == other.height;
- int get hashCode => _JenkinsSmiHash.hash4(left.hashCode, top.hashCode,
- width.hashCode, height.hashCode);
+ int get hashCode => Object.hash(left, top, width, height);
/**
* Computes the intersection of `this` and [other].
@@ -97,40 +96,3 @@
this.top + this.height);
$!MEMBERS}
-
-/**
- * This is the [Jenkins hash function][1] but using masking to keep
- * values in SMI range.
- *
- * [1]: http://en.wikipedia.org/wiki/Jenkins_hash_function
- *
- * Use:
- * Hash each value with the hash of the previous value, then get the final
- * hash by calling finish.
- *
- * var hash = 0;
- * for (var value in values) {
- * hash = JenkinsSmiHash.combine(hash, value.hashCode);
- * }
- * hash = JenkinsSmiHash.finish(hash);
- */
-class _JenkinsSmiHash {
- // TODO(11617): This class should be optimized and standardized elsewhere.
-
- static int combine(int hash, int value) {
- hash = 0x1fffffff & (hash + value);
- hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
- return hash ^ (hash >> 6);
- }
-
- static int finish(int hash) {
- hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
- hash = hash ^ (hash >> 11);
- return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
- }
-
- static int hash2(a, b) => finish(combine(combine(0, a), b));
-
- static int hash4(a, b, c, d) =>
- finish(combine(combine(combine(combine(0, a), b), c), d));
-}
diff --git a/tools/dom/templates/html/impl/impl_DOMRectReadOnly.darttemplate b/tools/dom/templates/html/impl/impl_DOMRectReadOnly.darttemplate
index e1febe3..357e764 100644
--- a/tools/dom/templates/html/impl/impl_DOMRectReadOnly.darttemplate
+++ b/tools/dom/templates/html/impl/impl_DOMRectReadOnly.darttemplate
@@ -18,8 +18,7 @@
width == other.width &&
height == other.height;
- int get hashCode => _JenkinsSmiHash.hash4(left.hashCode, top.hashCode,
- width.hashCode, height.hashCode);
+ int get hashCode => Object.hash(left, top, width, height);
/**
* Computes the intersection of `this` and [other].