mirror of
https://github.com/dart-lang/sdk
synced 2024-09-04 16:03:44 +00:00
[cfe] Remove unnecessary_null_comparison code
The frontend is now run with sound null safety so these are no longer needed. TEST=existing Change-Id: I6c1776845854695ff34e310a3bb5bc9d86715f06 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307901 Reviewed-by: Jens Johansen <jensj@google.com> Reviewed-by: Srujan Gaddam <srujzs@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
e8f370ca4e
commit
82e3a751a9
|
@ -53,11 +53,7 @@ abstract class ErrorCode {
|
||||||
required String problemMessage,
|
required String problemMessage,
|
||||||
required this.uniqueName,
|
required this.uniqueName,
|
||||||
}) : _correctionMessage = correctionMessage,
|
}) : _correctionMessage = correctionMessage,
|
||||||
_problemMessage = problemMessage,
|
_problemMessage = problemMessage;
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(hasPublishedDocs != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isUnresolvedIdentifier != null);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The template used to create the correction to be displayed for this error,
|
* The template used to create the correction to be displayed for this error,
|
||||||
|
|
|
@ -1501,8 +1501,7 @@ const Code<Message Function(String nameOKEmpty)> codeConstEvalDeferredLibrary =
|
||||||
|
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsConstEvalDeferredLibrary(String nameOKEmpty) {
|
Message _withArgumentsConstEvalDeferredLibrary(String nameOKEmpty) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
||||||
if (nameOKEmpty == null || nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
|
||||||
return new Message(codeConstEvalDeferredLibrary,
|
return new Message(codeConstEvalDeferredLibrary,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
"""'${nameOKEmpty}' can't be used in a constant expression because it's marked as 'deferred' which means it isn't available until loaded.""",
|
"""'${nameOKEmpty}' can't be used in a constant expression because it's marked as 'deferred' which means it isn't available until loaded.""",
|
||||||
|
@ -1588,8 +1587,7 @@ const Code<Message Function(String stringOKEmpty)>
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsConstEvalFailedAssertionWithMessage(
|
Message _withArgumentsConstEvalFailedAssertionWithMessage(
|
||||||
String stringOKEmpty) {
|
String stringOKEmpty) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||||
if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
|
||||||
return new Message(codeConstEvalFailedAssertionWithMessage,
|
return new Message(codeConstEvalFailedAssertionWithMessage,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
"""This assertion failed with message: ${stringOKEmpty}""",
|
"""This assertion failed with message: ${stringOKEmpty}""",
|
||||||
|
@ -1622,8 +1620,7 @@ const Code<Message Function(String nameOKEmpty)> codeConstEvalGetterNotFound =
|
||||||
|
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsConstEvalGetterNotFound(String nameOKEmpty) {
|
Message _withArgumentsConstEvalGetterNotFound(String nameOKEmpty) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
||||||
if (nameOKEmpty == null || nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
|
||||||
return new Message(codeConstEvalGetterNotFound,
|
return new Message(codeConstEvalGetterNotFound,
|
||||||
problemMessage: """Variable get not found: '${nameOKEmpty}'""",
|
problemMessage: """Variable get not found: '${nameOKEmpty}'""",
|
||||||
arguments: {'nameOKEmpty': nameOKEmpty});
|
arguments: {'nameOKEmpty': nameOKEmpty});
|
||||||
|
@ -1646,8 +1643,7 @@ const Code<Message Function(String nameOKEmpty)>
|
||||||
|
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsConstEvalInvalidStaticInvocation(String nameOKEmpty) {
|
Message _withArgumentsConstEvalInvalidStaticInvocation(String nameOKEmpty) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
||||||
if (nameOKEmpty == null || nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
|
||||||
return new Message(codeConstEvalInvalidStaticInvocation,
|
return new Message(codeConstEvalInvalidStaticInvocation,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
"""The invocation of '${nameOKEmpty}' is not allowed in a constant expression.""",
|
"""The invocation of '${nameOKEmpty}' is not allowed in a constant expression.""",
|
||||||
|
@ -1704,8 +1700,7 @@ const Code<Message Function(String nameOKEmpty)>
|
||||||
|
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsConstEvalNonConstantVariableGet(String nameOKEmpty) {
|
Message _withArgumentsConstEvalNonConstantVariableGet(String nameOKEmpty) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
||||||
if (nameOKEmpty == null || nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
|
||||||
return new Message(codeConstEvalNonConstantVariableGet,
|
return new Message(codeConstEvalNonConstantVariableGet,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
"""The variable '${nameOKEmpty}' is not a constant, only constant expressions are allowed.""",
|
"""The variable '${nameOKEmpty}' is not a constant, only constant expressions are allowed.""",
|
||||||
|
@ -1809,8 +1804,7 @@ const Code<Message Function(String stringOKEmpty)>
|
||||||
|
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsConstEvalUnhandledCoreException(String stringOKEmpty) {
|
Message _withArgumentsConstEvalUnhandledCoreException(String stringOKEmpty) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||||
if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
|
||||||
return new Message(codeConstEvalUnhandledCoreException,
|
return new Message(codeConstEvalUnhandledCoreException,
|
||||||
problemMessage: """Unhandled core exception: ${stringOKEmpty}""",
|
problemMessage: """Unhandled core exception: ${stringOKEmpty}""",
|
||||||
arguments: {'stringOKEmpty': stringOKEmpty});
|
arguments: {'stringOKEmpty': stringOKEmpty});
|
||||||
|
@ -2464,18 +2458,8 @@ const Code<
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsDillOutlineSummary(
|
Message _withArgumentsDillOutlineSummary(
|
||||||
int count, int count2, num _num1, num _num2, num _num3) {
|
int count, int count2, num _num1, num _num2, num _num3) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count == null) throw 'No count provided';
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count2 == null) throw 'No count provided';
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (_num1 == null) throw 'No number provided';
|
|
||||||
String num1 = _num1.toStringAsFixed(3);
|
String num1 = _num1.toStringAsFixed(3);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (_num2 == null) throw 'No number provided';
|
|
||||||
String num2 = _num2.toStringAsFixed(3).padLeft(12);
|
String num2 = _num2.toStringAsFixed(3).padLeft(12);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (_num3 == null) throw 'No number provided';
|
|
||||||
String num3 = _num3.toStringAsFixed(3).padLeft(12);
|
String num3 = _num3.toStringAsFixed(3).padLeft(12);
|
||||||
return new Message(codeDillOutlineSummary,
|
return new Message(codeDillOutlineSummary,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
|
@ -4070,8 +4054,6 @@ Message _withArgumentsExplicitExtensionTypeArgumentMismatch(
|
||||||
String name, int count) {
|
String name, int count) {
|
||||||
if (name.isEmpty) throw 'No name provided';
|
if (name.isEmpty) throw 'No name provided';
|
||||||
name = demangleMixinApplicationName(name);
|
name = demangleMixinApplicationName(name);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count == null) throw 'No count provided';
|
|
||||||
return new Message(codeExplicitExtensionTypeArgumentMismatch,
|
return new Message(codeExplicitExtensionTypeArgumentMismatch,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
"""Explicit extension application of extension '${name}' takes '${count}' type argument(s).""",
|
"""Explicit extension application of extension '${name}' takes '${count}' type argument(s).""",
|
||||||
|
@ -4917,10 +4899,6 @@ const Code<Message Function(int count, int count2)>
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsFfiNativeUnexpectedNumberOfParameters(
|
Message _withArgumentsFfiNativeUnexpectedNumberOfParameters(
|
||||||
int count, int count2) {
|
int count, int count2) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count == null) throw 'No count provided';
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count2 == null) throw 'No count provided';
|
|
||||||
return new Message(codeFfiNativeUnexpectedNumberOfParameters,
|
return new Message(codeFfiNativeUnexpectedNumberOfParameters,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
"""Unexpected number of FfiNative annotation parameters. Expected ${count} but has ${count2}.""",
|
"""Unexpected number of FfiNative annotation parameters. Expected ${count} but has ${count2}.""",
|
||||||
|
@ -4946,10 +4924,6 @@ const Code<Message Function(int count, int count2)>
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsFfiNativeUnexpectedNumberOfParametersWithReceiver(
|
Message _withArgumentsFfiNativeUnexpectedNumberOfParametersWithReceiver(
|
||||||
int count, int count2) {
|
int count, int count2) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count == null) throw 'No count provided';
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count2 == null) throw 'No count provided';
|
|
||||||
return new Message(codeFfiNativeUnexpectedNumberOfParametersWithReceiver,
|
return new Message(codeFfiNativeUnexpectedNumberOfParametersWithReceiver,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
"""Unexpected number of FfiNative annotation parameters. Expected ${count} but has ${count2}. FfiNative instance method annotation must have receiver as first argument.""",
|
"""Unexpected number of FfiNative annotation parameters. Expected ${count} but has ${count2}. FfiNative instance method annotation must have receiver as first argument.""",
|
||||||
|
@ -5871,8 +5845,6 @@ const Code<Message Function(String name, int count)> codeImplementsRepeated =
|
||||||
Message _withArgumentsImplementsRepeated(String name, int count) {
|
Message _withArgumentsImplementsRepeated(String name, int count) {
|
||||||
if (name.isEmpty) throw 'No name provided';
|
if (name.isEmpty) throw 'No name provided';
|
||||||
name = demangleMixinApplicationName(name);
|
name = demangleMixinApplicationName(name);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count == null) throw 'No count provided';
|
|
||||||
return new Message(codeImplementsRepeated,
|
return new Message(codeImplementsRepeated,
|
||||||
problemMessage: """'${name}' can only be implemented once.""",
|
problemMessage: """'${name}' can only be implemented once.""",
|
||||||
correctionMessage: """Try removing ${count} of the occurrences.""",
|
correctionMessage: """Try removing ${count} of the occurrences.""",
|
||||||
|
@ -6430,10 +6402,6 @@ const Code<Message Function(int count, int count2)>
|
||||||
|
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsInstantiationTooFewArguments(int count, int count2) {
|
Message _withArgumentsInstantiationTooFewArguments(int count, int count2) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count == null) throw 'No count provided';
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count2 == null) throw 'No count provided';
|
|
||||||
return new Message(codeInstantiationTooFewArguments,
|
return new Message(codeInstantiationTooFewArguments,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
"""Too few type arguments: ${count} required, ${count2} given.""",
|
"""Too few type arguments: ${count} required, ${count2} given.""",
|
||||||
|
@ -6460,10 +6428,6 @@ const Code<Message Function(int count, int count2)>
|
||||||
|
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsInstantiationTooManyArguments(int count, int count2) {
|
Message _withArgumentsInstantiationTooManyArguments(int count, int count2) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count == null) throw 'No count provided';
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count2 == null) throw 'No count provided';
|
|
||||||
return new Message(codeInstantiationTooManyArguments,
|
return new Message(codeInstantiationTooManyArguments,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
"""Too many type arguments: ${count} allowed, but ${count2} found.""",
|
"""Too many type arguments: ${count} allowed, but ${count2} found.""",
|
||||||
|
@ -8621,10 +8585,6 @@ const Code<Message Function(int count, int count2)> codeLanguageVersionTooHigh =
|
||||||
|
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsLanguageVersionTooHigh(int count, int count2) {
|
Message _withArgumentsLanguageVersionTooHigh(int count, int count2) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count == null) throw 'No count provided';
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count2 == null) throw 'No count provided';
|
|
||||||
return new Message(codeLanguageVersionTooHigh,
|
return new Message(codeLanguageVersionTooHigh,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
"""The specified language version is too high. The highest supported language version is ${count}.${count2}.""",
|
"""The specified language version is too high. The highest supported language version is ${count}.${count2}.""",
|
||||||
|
@ -11849,18 +11809,8 @@ const Code<
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsSourceBodySummary(
|
Message _withArgumentsSourceBodySummary(
|
||||||
int count, int count2, num _num1, num _num2, num _num3) {
|
int count, int count2, num _num1, num _num2, num _num3) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count == null) throw 'No count provided';
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count2 == null) throw 'No count provided';
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (_num1 == null) throw 'No number provided';
|
|
||||||
String num1 = _num1.toStringAsFixed(3);
|
String num1 = _num1.toStringAsFixed(3);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (_num2 == null) throw 'No number provided';
|
|
||||||
String num2 = _num2.toStringAsFixed(3).padLeft(12);
|
String num2 = _num2.toStringAsFixed(3).padLeft(12);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (_num3 == null) throw 'No number provided';
|
|
||||||
String num3 = _num3.toStringAsFixed(3).padLeft(12);
|
String num3 = _num3.toStringAsFixed(3).padLeft(12);
|
||||||
return new Message(codeSourceBodySummary,
|
return new Message(codeSourceBodySummary,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
|
@ -11904,18 +11854,8 @@ const Code<
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsSourceOutlineSummary(
|
Message _withArgumentsSourceOutlineSummary(
|
||||||
int count, int count2, num _num1, num _num2, num _num3) {
|
int count, int count2, num _num1, num _num2, num _num3) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count == null) throw 'No count provided';
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count2 == null) throw 'No count provided';
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (_num1 == null) throw 'No number provided';
|
|
||||||
String num1 = _num1.toStringAsFixed(3);
|
String num1 = _num1.toStringAsFixed(3);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (_num2 == null) throw 'No number provided';
|
|
||||||
String num2 = _num2.toStringAsFixed(3).padLeft(12);
|
String num2 = _num2.toStringAsFixed(3).padLeft(12);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (_num3 == null) throw 'No number provided';
|
|
||||||
String num3 = _num3.toStringAsFixed(3).padLeft(12);
|
String num3 = _num3.toStringAsFixed(3).padLeft(12);
|
||||||
return new Message(codeSourceOutlineSummary,
|
return new Message(codeSourceOutlineSummary,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
|
@ -12553,10 +12493,6 @@ const Code<Message Function(int count, int count2)> codeTooFewArguments =
|
||||||
|
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsTooFewArguments(int count, int count2) {
|
Message _withArgumentsTooFewArguments(int count, int count2) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count == null) throw 'No count provided';
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count2 == null) throw 'No count provided';
|
|
||||||
return new Message(codeTooFewArguments,
|
return new Message(codeTooFewArguments,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
"""Too few positional arguments: ${count} required, ${count2} given.""",
|
"""Too few positional arguments: ${count} required, ${count2} given.""",
|
||||||
|
@ -12583,10 +12519,6 @@ const Code<Message Function(int count, int count2)> codeTooManyArguments =
|
||||||
|
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsTooManyArguments(int count, int count2) {
|
Message _withArgumentsTooManyArguments(int count, int count2) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count == null) throw 'No count provided';
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count2 == null) throw 'No count provided';
|
|
||||||
return new Message(codeTooManyArguments,
|
return new Message(codeTooManyArguments,
|
||||||
problemMessage:
|
problemMessage:
|
||||||
"""Too many positional arguments: ${count} allowed, but ${count2} found.""",
|
"""Too many positional arguments: ${count} allowed, but ${count2} found.""",
|
||||||
|
@ -12628,8 +12560,6 @@ const Code<Message Function(int count)> codeTypeArgumentMismatch =
|
||||||
|
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsTypeArgumentMismatch(int count) {
|
Message _withArgumentsTypeArgumentMismatch(int count) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count == null) throw 'No count provided';
|
|
||||||
return new Message(codeTypeArgumentMismatch,
|
return new Message(codeTypeArgumentMismatch,
|
||||||
problemMessage: """Expected ${count} type arguments.""",
|
problemMessage: """Expected ${count} type arguments.""",
|
||||||
arguments: {'count': count});
|
arguments: {'count': count});
|
||||||
|
|
|
@ -1897,8 +1897,6 @@ class Parser {
|
||||||
/// ```
|
/// ```
|
||||||
Token parseFormalParameter(
|
Token parseFormalParameter(
|
||||||
Token token, FormalParameterKind parameterKind, MemberKind memberKind) {
|
Token token, FormalParameterKind parameterKind, MemberKind memberKind) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(parameterKind != null);
|
|
||||||
token = parseMetadataStar(token);
|
token = parseMetadataStar(token);
|
||||||
|
|
||||||
Token? skippedNonRequiredRequired;
|
Token? skippedNonRequiredRequired;
|
||||||
|
@ -3159,14 +3157,10 @@ class Parser {
|
||||||
/// identifier in the given [context], create a synthetic identifier, report
|
/// identifier in the given [context], create a synthetic identifier, report
|
||||||
/// an error, and return the synthetic identifier.
|
/// an error, and return the synthetic identifier.
|
||||||
Token ensureIdentifier(Token token, IdentifierContext context) {
|
Token ensureIdentifier(Token token, IdentifierContext context) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(context != null);
|
|
||||||
_tryRewriteNewToIdentifier(token, context);
|
_tryRewriteNewToIdentifier(token, context);
|
||||||
Token identifier = token.next!;
|
Token identifier = token.next!;
|
||||||
if (identifier.kind != IDENTIFIER_TOKEN) {
|
if (identifier.kind != IDENTIFIER_TOKEN) {
|
||||||
identifier = context.ensureIdentifier(token, this);
|
identifier = context.ensureIdentifier(token, this);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(identifier != null);
|
|
||||||
assert(identifier.isKeywordOrIdentifier);
|
assert(identifier.isKeywordOrIdentifier);
|
||||||
}
|
}
|
||||||
listener.handleIdentifier(identifier, context);
|
listener.handleIdentifier(identifier, context);
|
||||||
|
@ -3224,14 +3218,10 @@ class Parser {
|
||||||
/// to use the token as an identifier, even if it isn't a valid identifier.
|
/// to use the token as an identifier, even if it isn't a valid identifier.
|
||||||
Token ensureIdentifierPotentiallyRecovered(
|
Token ensureIdentifierPotentiallyRecovered(
|
||||||
Token token, IdentifierContext context, bool isRecovered) {
|
Token token, IdentifierContext context, bool isRecovered) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(context != null);
|
|
||||||
Token identifier = token.next!;
|
Token identifier = token.next!;
|
||||||
if (identifier.kind != IDENTIFIER_TOKEN) {
|
if (identifier.kind != IDENTIFIER_TOKEN) {
|
||||||
identifier = context.ensureIdentifierPotentiallyRecovered(
|
identifier = context.ensureIdentifierPotentiallyRecovered(
|
||||||
token, this, isRecovered);
|
token, this, isRecovered);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(identifier != null);
|
|
||||||
assert(identifier.isKeywordOrIdentifier);
|
assert(identifier.isKeywordOrIdentifier);
|
||||||
}
|
}
|
||||||
listener.handleIdentifier(identifier, context);
|
listener.handleIdentifier(identifier, context);
|
||||||
|
|
|
@ -521,10 +521,7 @@ class ComplexTypeInfo implements TypeInfo {
|
||||||
|
|
||||||
ComplexTypeInfo(Token beforeStart, this.typeArguments)
|
ComplexTypeInfo(Token beforeStart, this.typeArguments)
|
||||||
: this.start = beforeStart.next!,
|
: this.start = beforeStart.next!,
|
||||||
recovered = typeArguments.recovered {
|
recovered = typeArguments.recovered;
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(typeArguments != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
ComplexTypeInfo._nonNullable(
|
ComplexTypeInfo._nonNullable(
|
||||||
this.start,
|
this.start,
|
||||||
|
@ -1226,10 +1223,6 @@ class ComplexTypeParamOrArgInfo extends TypeParamOrArgInfo {
|
||||||
ComplexTypeParamOrArgInfo(
|
ComplexTypeParamOrArgInfo(
|
||||||
Token token, this.inDeclaration, this.allowsVariance)
|
Token token, this.inDeclaration, this.allowsVariance)
|
||||||
: assert(optional('<', token.next!)),
|
: assert(optional('<', token.next!)),
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(inDeclaration != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(allowsVariance != null),
|
|
||||||
start = token.next!;
|
start = token.next!;
|
||||||
|
|
||||||
/// Parse the tokens and return the receiver or [noTypeParamOrArg] if there
|
/// Parse the tokens and return the receiver or [noTypeParamOrArg] if there
|
||||||
|
|
|
@ -85,8 +85,6 @@ ScannerResult scanString(String source,
|
||||||
{ScannerConfiguration? configuration,
|
{ScannerConfiguration? configuration,
|
||||||
bool includeComments = false,
|
bool includeComments = false,
|
||||||
LanguageVersionChanged? languageVersionChanged}) {
|
LanguageVersionChanged? languageVersionChanged}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(source != null, 'source must not be null');
|
|
||||||
StringScanner scanner = new StringScanner(source,
|
StringScanner scanner = new StringScanner(source,
|
||||||
configuration: configuration,
|
configuration: configuration,
|
||||||
includeComments: includeComments,
|
includeComments: includeComments,
|
||||||
|
|
|
@ -37,9 +37,7 @@ class Annotation {
|
||||||
|
|
||||||
Annotation(this.index, this.lineNo, this.columnNo, this.offset, this.prefix,
|
Annotation(this.index, this.lineNo, this.columnNo, this.offset, this.prefix,
|
||||||
this.text, this.suffix)
|
this.text, this.suffix)
|
||||||
// ignore: unnecessary_null_comparison
|
: assert(offset >= 0);
|
||||||
: assert(offset != null),
|
|
||||||
assert(offset >= 0);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() =>
|
String toString() =>
|
||||||
|
|
|
@ -305,11 +305,7 @@ class NodeId implements Id {
|
||||||
@override
|
@override
|
||||||
final IdKind kind;
|
final IdKind kind;
|
||||||
|
|
||||||
const NodeId(this.value, this.kind)
|
const NodeId(this.value, this.kind) : assert(value >= 0);
|
||||||
:
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(value != null),
|
|
||||||
assert(value >= 0);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get isGlobal => false;
|
bool get isGlobal => false;
|
||||||
|
|
|
@ -43,12 +43,6 @@ Map<Uri, List<Annotation>> computeAnnotationsPerUri<T>(
|
||||||
actualData
|
actualData
|
||||||
.forEach((String marker, Map<Uri, Map<Id, ActualData<T>>> dataPerUri) {
|
.forEach((String marker, Map<Uri, Map<Id, ActualData<T>>> dataPerUri) {
|
||||||
dataPerUri.forEach((Uri uri, Map<Id, ActualData<T>> dataMap) {
|
dataPerUri.forEach((Uri uri, Map<Id, ActualData<T>> dataMap) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (uri == null) {
|
|
||||||
// TODO(johnniwinther): Avoid `null` URIs.
|
|
||||||
assert(dataMap.isEmpty, "Non-empty data for `null` uri: $dataMap");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
uriSet.add(uri);
|
uriSet.add(uri);
|
||||||
dataMap.forEach((Id id, ActualData<T> data) {
|
dataMap.forEach((Id id, ActualData<T> data) {
|
||||||
Map<Id, Map<String, ActualData<T>>> actualDataPerId =
|
Map<Id, Map<String, ActualData<T>>> actualDataPerId =
|
||||||
|
@ -88,9 +82,6 @@ List<Annotation> _computeAnnotations<T>(
|
||||||
bool sortMarkers = true,
|
bool sortMarkers = true,
|
||||||
Annotation? Function(Annotation? expected, Annotation? actual)? createDiff,
|
Annotation? Function(Annotation? expected, Annotation? actual)? createDiff,
|
||||||
bool forceUpdate = false}) {
|
bool forceUpdate = false}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(annotatedCode != null);
|
|
||||||
|
|
||||||
Annotation createAnnotationFromData(
|
Annotation createAnnotationFromData(
|
||||||
ActualData<T> actualData, Annotation? annotation) {
|
ActualData<T> actualData, Annotation? annotation) {
|
||||||
String getIndentationFromOffset(int offset) {
|
String getIndentationFromOffset(int offset) {
|
||||||
|
|
|
@ -225,8 +225,6 @@ void computeExpectedMap(Uri sourceUri, String filename, AnnotatedCode code,
|
||||||
|
|
||||||
split.forEach((String marker, AnnotatedCode code) {
|
split.forEach((String marker, AnnotatedCode code) {
|
||||||
MemberAnnotations<IdValue> fileAnnotations = maps[marker]!;
|
MemberAnnotations<IdValue> fileAnnotations = maps[marker]!;
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileAnnotations != null, "No annotations for $marker in $maps");
|
|
||||||
Map<Id, IdValue> expectedValues = fileAnnotations[sourceUri]!;
|
Map<Id, IdValue> expectedValues = fileAnnotations[sourceUri]!;
|
||||||
for (Annotation annotation in code.annotations) {
|
for (Annotation annotation in code.annotations) {
|
||||||
String text = annotation.text;
|
String text = annotation.text;
|
||||||
|
@ -940,13 +938,9 @@ Future<void> runTests<T>(Directory dataDir,
|
||||||
actualData[marker] = {};
|
actualData[marker] = {};
|
||||||
|
|
||||||
void addActualData(Uri uri, Map<Id, ActualData<T>> actualData) {
|
void addActualData(Uri uri, Map<Id, ActualData<T>> actualData) {
|
||||||
assert(
|
assert(testData.code.containsKey(uri) || actualData.isEmpty,
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
uri != null && testData.code.containsKey(uri) ||
|
|
||||||
actualData.isEmpty,
|
|
||||||
"Unexpected data ${actualData} for $uri");
|
"Unexpected data ${actualData} for $uri");
|
||||||
// ignore: unnecessary_null_comparison
|
if (actualData.isEmpty) {
|
||||||
if (uri == null || actualData.isEmpty) {
|
|
||||||
// TODO(johnniwinther): Avoid collecting data without
|
// TODO(johnniwinther): Avoid collecting data without
|
||||||
// invalid uris.
|
// invalid uris.
|
||||||
return;
|
return;
|
||||||
|
@ -969,8 +963,6 @@ Future<void> runTests<T>(Directory dataDir,
|
||||||
dataInterpreter!,
|
dataInterpreter!,
|
||||||
forceUpdate: forceUpdate);
|
forceUpdate: forceUpdate);
|
||||||
annotations.forEach((Uri uri, List<Annotation> annotations) {
|
annotations.forEach((Uri uri, List<Annotation> annotations) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(uri != null, "Annotations without uri: $annotations");
|
|
||||||
AnnotatedCode? code = testData.code[uri];
|
AnnotatedCode? code = testData.code[uri];
|
||||||
assert(code != null,
|
assert(code != null,
|
||||||
"No annotated code for $uri with annotations: $annotations");
|
"No annotated code for $uri with annotations: $annotations");
|
||||||
|
|
|
@ -87,8 +87,6 @@ bool get enableColors => _enableColors ??= _computeEnableColors();
|
||||||
/// Allows the client to override the decision of whether to disable ANSI
|
/// Allows the client to override the decision of whether to disable ANSI
|
||||||
/// colors.
|
/// colors.
|
||||||
void set enableColors(bool value) {
|
void set enableColors(bool value) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(value != null);
|
|
||||||
_enableColors = value;
|
_enableColors = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -551,9 +551,7 @@ void testGeneral<T>(DataInterpreter<T> dataInterpreter, String text,
|
||||||
code.annotatedCode, code.sourceCode, annotations[mainUri]!);
|
code.annotatedCode, code.sourceCode, annotations[mainUri]!);
|
||||||
String actualResult = generated.toText();
|
String actualResult = generated.toText();
|
||||||
if (expectedResult != actualResult) {
|
if (expectedResult != actualResult) {
|
||||||
print("Unexpected result for '$text'"
|
print("Unexpected result for '$text' with actualData=$actualData");
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
"${actualData != null ? ' with actualData=$actualData' : ''}");
|
|
||||||
print('---expected-------------------------------------------------------');
|
print('---expected-------------------------------------------------------');
|
||||||
print(expectedResult);
|
print(expectedResult);
|
||||||
print('---actual---------------------------------------------------------');
|
print('---actual---------------------------------------------------------');
|
||||||
|
|
|
@ -177,8 +177,6 @@ Statement forEachWithNonVariable(Expression iterable, List<Statement> body) {
|
||||||
/// }
|
/// }
|
||||||
Statement forEachWithVariableDecl(
|
Statement forEachWithVariableDecl(
|
||||||
Var variable, Expression iterable, List<Statement> body) {
|
Var variable, Expression iterable, List<Statement> body) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(variable != null);
|
|
||||||
return new ForEach._(variable, iterable, block(body), true,
|
return new ForEach._(variable, iterable, block(body), true,
|
||||||
location: computeLocation());
|
location: computeLocation());
|
||||||
}
|
}
|
||||||
|
@ -193,8 +191,6 @@ Statement forEachWithVariableDecl(
|
||||||
/// }
|
/// }
|
||||||
Statement forEachWithVariableSet(
|
Statement forEachWithVariableSet(
|
||||||
Var variable, Expression iterable, List<Statement> body) {
|
Var variable, Expression iterable, List<Statement> body) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(variable != null);
|
|
||||||
var location = computeLocation();
|
var location = computeLocation();
|
||||||
return new ForEach._(
|
return new ForEach._(
|
||||||
variable, iterable, Block._(body, location: location), false,
|
variable, iterable, Block._(body, location: location), false,
|
||||||
|
|
|
@ -792,8 +792,7 @@ class JsInteropChecks extends RecursiveVisitor {
|
||||||
|
|
||||||
/// Reports an error if [functionNode] has named parameters.
|
/// Reports an error if [functionNode] has named parameters.
|
||||||
void _checkNoNamedParameters(FunctionNode functionNode) {
|
void _checkNoNamedParameters(FunctionNode functionNode) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (functionNode.namedParameters.isNotEmpty) {
|
||||||
if (functionNode != null && functionNode.namedParameters.isNotEmpty) {
|
|
||||||
final firstNamedParam = functionNode.namedParameters[0];
|
final firstNamedParam = functionNode.namedParameters[0];
|
||||||
_reporter.report(
|
_reporter.report(
|
||||||
messageJsInteropNamedParameters,
|
messageJsInteropNamedParameters,
|
||||||
|
|
|
@ -158,8 +158,6 @@ Version getExperimentEnabledVersionInLibrary(ExperimentalFlag flag,
|
||||||
}
|
}
|
||||||
version ??= flag.experimentEnabledVersion;
|
version ??= flag.experimentEnabledVersion;
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(version != null, "No version for enabling $flag in $canonicalUri.");
|
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,14 +40,11 @@ Future<VersionAndPackageUri> languageVersionForUri(
|
||||||
bool good = false;
|
bool good = false;
|
||||||
late final int currentSdkVersionMajor;
|
late final int currentSdkVersionMajor;
|
||||||
late final int currentSdkVersionMinor;
|
late final int currentSdkVersionMinor;
|
||||||
// ignore: unnecessary_null_comparison
|
List<String> dotSeparatedParts = currentSdkVersion.split(".");
|
||||||
if (currentSdkVersion != null) {
|
if (dotSeparatedParts.length >= 2) {
|
||||||
List<String> dotSeparatedParts = currentSdkVersion.split(".");
|
currentSdkVersionMajor = int.parse(dotSeparatedParts[0]);
|
||||||
if (dotSeparatedParts.length >= 2) {
|
currentSdkVersionMinor = int.parse(dotSeparatedParts[1]);
|
||||||
currentSdkVersionMajor = int.parse(dotSeparatedParts[0]);
|
good = true;
|
||||||
currentSdkVersionMinor = int.parse(dotSeparatedParts[1]);
|
|
||||||
good = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!good) {
|
if (!good) {
|
||||||
throw new StateError("Unparsable sdk version given: $currentSdkVersion");
|
throw new StateError("Unparsable sdk version given: $currentSdkVersion");
|
||||||
|
@ -67,9 +64,7 @@ Future<VersionAndPackageUri> languageVersionForUri(
|
||||||
Uri packageUri = uri;
|
Uri packageUri = uri;
|
||||||
if (!packageUri.isScheme('dart') &&
|
if (!packageUri.isScheme('dart') &&
|
||||||
!packageUri.isScheme('package') &&
|
!packageUri.isScheme('package') &&
|
||||||
package != null &&
|
package != null) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
package.name != null) {
|
|
||||||
packageUri = new Uri(scheme: 'package', path: package.name);
|
packageUri = new Uri(scheme: 'package', path: package.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,6 @@ export '../fasta/kernel/constructor_tearoff_lowering.dart'
|
||||||
/// The default value of this field is `null`.
|
/// The default value of this field is `null`.
|
||||||
bool isLateLoweredField(Field node) {
|
bool isLateLoweredField(Field node) {
|
||||||
return node.isInternalImplementation &&
|
return node.isInternalImplementation &&
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
node.name != null &&
|
|
||||||
node.name.text.startsWith(lateFieldPrefix) &&
|
node.name.text.startsWith(lateFieldPrefix) &&
|
||||||
!node.name.text.endsWith(lateIsSetSuffix);
|
!node.name.text.endsWith(lateIsSetSuffix);
|
||||||
}
|
}
|
||||||
|
@ -87,8 +85,6 @@ Name extractFieldNameFromLateLoweredField(Field node) {
|
||||||
/// The default value of this field is `false`.
|
/// The default value of this field is `false`.
|
||||||
bool isLateLoweredIsSetField(Field node) {
|
bool isLateLoweredIsSetField(Field node) {
|
||||||
return node.isInternalImplementation &&
|
return node.isInternalImplementation &&
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
node.name != null &&
|
|
||||||
node.name.text.startsWith(lateFieldPrefix) &&
|
node.name.text.startsWith(lateFieldPrefix) &&
|
||||||
node.name.text.endsWith(lateIsSetSuffix);
|
node.name.text.endsWith(lateIsSetSuffix);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,9 +88,7 @@ class DdcResult {
|
||||||
final Set<Library>? neededDillLibraries;
|
final Set<Library>? neededDillLibraries;
|
||||||
|
|
||||||
DdcResult(this.component, this.sdkSummary, this.additionalDills,
|
DdcResult(this.component, this.sdkSummary, this.additionalDills,
|
||||||
this.classHierarchy, this.neededDillLibraries)
|
this.classHierarchy, this.neededDillLibraries);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(classHierarchy != null);
|
|
||||||
|
|
||||||
Set<Library> computeLibrariesFromDill() {
|
Set<Library> computeLibrariesFromDill() {
|
||||||
Set<Library> librariesFromDill = new Set<Library>();
|
Set<Library> librariesFromDill = new Set<Library>();
|
||||||
|
@ -123,8 +121,6 @@ InitializedCompilerState initializeCompiler(
|
||||||
Map<ExperimentalFlag, bool>? explicitExperimentalFlags,
|
Map<ExperimentalFlag, bool>? explicitExperimentalFlags,
|
||||||
Map<String, String>? environmentDefines,
|
Map<String, String>? environmentDefines,
|
||||||
required NnbdMode nnbdMode}) {
|
required NnbdMode nnbdMode}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(nnbdMode != null, "No NnbdMode provided.");
|
|
||||||
additionalDills.sort((a, b) => a.toString().compareTo(b.toString()));
|
additionalDills.sort((a, b) => a.toString().compareTo(b.toString()));
|
||||||
|
|
||||||
if (oldState != null &&
|
if (oldState != null &&
|
||||||
|
|
|
@ -439,8 +439,7 @@ class ProcessedOptions {
|
||||||
Future<List<Component>> loadAdditionalDills(CanonicalName? nameRoot) async {
|
Future<List<Component>> loadAdditionalDills(CanonicalName? nameRoot) async {
|
||||||
if (_additionalDillComponents == null) {
|
if (_additionalDillComponents == null) {
|
||||||
List<Uri> uris = _raw.additionalDills;
|
List<Uri> uris = _raw.additionalDills;
|
||||||
// ignore: unnecessary_null_comparison
|
if (uris.isEmpty) return const <Component>[];
|
||||||
if (uris == null || uris.isEmpty) return const <Component>[];
|
|
||||||
// TODO(sigmund): throttle # of concurrent operations.
|
// TODO(sigmund): throttle # of concurrent operations.
|
||||||
List<List<int>?> allBytes = await Future.wait(
|
List<List<int>?> allBytes = await Future.wait(
|
||||||
uris.map((uri) => _readAsBytes(fileSystem.entityForUri(uri))));
|
uris.map((uri) => _readAsBytes(fileSystem.entityForUri(uri))));
|
||||||
|
|
|
@ -125,14 +125,11 @@ Uri translateSdk(Uri uri) {
|
||||||
if (sdkRoot == null) {
|
if (sdkRoot == null) {
|
||||||
sdkRoot = (options.sdkSummary ?? computePlatformBinariesLocation())
|
sdkRoot = (options.sdkSummary ?? computePlatformBinariesLocation())
|
||||||
.resolve("../../");
|
.resolve("../../");
|
||||||
// ignore: unnecessary_null_comparison
|
if (!isExistingFile(sdkRoot.resolve("lib/libraries.json"))) {
|
||||||
if (sdkRoot != null) {
|
if (isExistingFile(sdkRoot.resolve("sdk/lib/libraries.json"))) {
|
||||||
if (!isExistingFile(sdkRoot.resolve("lib/libraries.json"))) {
|
sdkRoot = sdkRoot.resolve("sdk/");
|
||||||
if (isExistingFile(sdkRoot.resolve("sdk/lib/libraries.json"))) {
|
} else {
|
||||||
sdkRoot = sdkRoot.resolve("sdk/");
|
sdkRoot = null;
|
||||||
} else {
|
|
||||||
sdkRoot = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,8 +193,6 @@ class FormalParameterBuilder extends ModifierBuilderImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
FormalParameterBuilder forFormalParameterInitializerScope() {
|
FormalParameterBuilder forFormalParameterInitializerScope() {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(variable != null);
|
|
||||||
if (isInitializingFormal) {
|
if (isInitializingFormal) {
|
||||||
return new FormalParameterBuilder(
|
return new FormalParameterBuilder(
|
||||||
metadata,
|
metadata,
|
||||||
|
|
|
@ -188,10 +188,7 @@ abstract class BuilderClassMember implements ClassMember {
|
||||||
String get fullName {
|
String get fullName {
|
||||||
String suffix = isSetter ? "=" : "";
|
String suffix = isSetter ? "=" : "";
|
||||||
String className = classBuilder.fullNameForErrors;
|
String className = classBuilder.fullNameForErrors;
|
||||||
// ignore: unnecessary_null_comparison
|
return "${className}.${fullNameForErrors}$suffix";
|
||||||
return className == null
|
|
||||||
? "${fullNameForErrors}$suffix"
|
|
||||||
: "${className}.${fullNameForErrors}$suffix";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -382,9 +382,7 @@ abstract class NamedTypeBuilder extends TypeBuilder {
|
||||||
if (declaration!.isTypeVariable) {
|
if (declaration!.isTypeVariable) {
|
||||||
message =
|
message =
|
||||||
templateSupertypeIsTypeVariable.withArguments(fullNameForErrors);
|
templateSupertypeIsTypeVariable.withArguments(fullNameForErrors);
|
||||||
} else
|
} else if (type.nullability == Nullability.nullable) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (type != null && type.nullability == Nullability.nullable) {
|
|
||||||
message = templateSupertypeIsNullableAliased.withArguments(
|
message = templateSupertypeIsNullableAliased.withArguments(
|
||||||
fullNameForErrors, type, library.isNonNullableByDefault);
|
fullNameForErrors, type, library.isNonNullableByDefault);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -55,9 +55,6 @@ class NullabilityBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
Nullability build(LibraryBuilder libraryBuilder) {
|
Nullability build(LibraryBuilder libraryBuilder) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(libraryBuilder != null);
|
|
||||||
|
|
||||||
switch (_syntacticNullability) {
|
switch (_syntacticNullability) {
|
||||||
case SyntacticNullability.legacy:
|
case SyntacticNullability.legacy:
|
||||||
return Nullability.legacy;
|
return Nullability.legacy;
|
||||||
|
|
|
@ -76,9 +76,7 @@ abstract class TypeDeclarationBuilderImpl extends ModifierBuilderImpl
|
||||||
|
|
||||||
TypeDeclarationBuilderImpl(
|
TypeDeclarationBuilderImpl(
|
||||||
this.metadata, this.modifiers, this.name, Builder? parent, int charOffset)
|
this.metadata, this.modifiers, this.name, Builder? parent, int charOffset)
|
||||||
// ignore: unnecessary_null_comparison
|
: super(parent, charOffset);
|
||||||
: assert(modifiers != null),
|
|
||||||
super(parent, charOffset);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
TypeDeclarationBuilder get origin => this;
|
TypeDeclarationBuilder get origin => this;
|
||||||
|
|
|
@ -98,20 +98,17 @@ Future<T> reportCrash<T>(error, StackTrace trace,
|
||||||
new Crash(uri, charOffset, error, trace).._hasBeenReported = true,
|
new Crash(uri, charOffset, error, trace).._hasBeenReported = true,
|
||||||
trace);
|
trace);
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
await note("\nSending crash report data");
|
||||||
if (request != null) {
|
request.persistentConnection = false;
|
||||||
await note("\nSending crash report data");
|
request.bufferOutput = false;
|
||||||
request.persistentConnection = false;
|
String? host = request.connectionInfo?.remoteAddress.host;
|
||||||
request.bufferOutput = false;
|
int? port = request.connectionInfo?.remotePort;
|
||||||
String? host = request.connectionInfo?.remoteAddress.host;
|
await note(" to $host:$port");
|
||||||
int? port = request.connectionInfo?.remotePort;
|
await request
|
||||||
await note(" to $host:$port");
|
..headers.contentType = ContentType.json
|
||||||
await request
|
..write(json);
|
||||||
..headers.contentType = ContentType.json
|
await request.close();
|
||||||
..write(json);
|
await note(".");
|
||||||
await request.close();
|
|
||||||
await note(".");
|
|
||||||
}
|
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
await note("\n${safeToString(e)}\n$s\n");
|
await note("\n${safeToString(e)}\n$s\n");
|
||||||
await note("\n\n\nFE::ERROR::$json\n\n\n");
|
await note("\n\n\nFE::ERROR::$json\n\n\n");
|
||||||
|
|
|
@ -234,8 +234,7 @@ int computeModifiers(Class cls) {
|
||||||
if (cls.isAbstract) {
|
if (cls.isAbstract) {
|
||||||
modifiers |= abstractMask;
|
modifiers |= abstractMask;
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
if (cls.isMixinApplication) {
|
||||||
if (cls.isMixinApplication && cls.name != null) {
|
|
||||||
modifiers |= namedMixinApplicationMask;
|
modifiers |= namedMixinApplicationMask;
|
||||||
}
|
}
|
||||||
return modifiers;
|
return modifiers;
|
||||||
|
|
|
@ -340,8 +340,6 @@ class DillLibraryBuilder extends LibraryBuilderImpl {
|
||||||
String name;
|
String name;
|
||||||
if (sourceBuildersMap?.containsKey(reference) == true) {
|
if (sourceBuildersMap?.containsKey(reference) == true) {
|
||||||
declaration = sourceBuildersMap![reference]!;
|
declaration = sourceBuildersMap![reference]!;
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(declaration != null);
|
|
||||||
if (declaration is ModifierBuilder) {
|
if (declaration is ModifierBuilder) {
|
||||||
name = declaration.name!;
|
name = declaration.name!;
|
||||||
} else {
|
} else {
|
||||||
|
@ -395,14 +393,6 @@ class DillLibraryBuilder extends LibraryBuilderImpl {
|
||||||
library.exportScope.lookupLocalMember(name, setter: false)!;
|
library.exportScope.lookupLocalMember(name, setter: false)!;
|
||||||
exportScope.addLocalMember(name, declaration, setter: false);
|
exportScope.addLocalMember(name, declaration, setter: false);
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (declaration == null) {
|
|
||||||
internalProblem(
|
|
||||||
templateUnspecified.withArguments(
|
|
||||||
"Exported element '$name' not found in '$libraryUri'."),
|
|
||||||
-1,
|
|
||||||
fileUri);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
|
|
|
@ -32,7 +32,7 @@ import '../messages.dart'
|
||||||
messagePlatformPrivateLibraryAccess,
|
messagePlatformPrivateLibraryAccess,
|
||||||
templateInternalProblemContextSeverity;
|
templateInternalProblemContextSeverity;
|
||||||
|
|
||||||
import '../problems.dart' show internalProblem, unhandled;
|
import '../problems.dart' show internalProblem;
|
||||||
|
|
||||||
import '../source/source_loader.dart' show SourceLoader;
|
import '../source/source_loader.dart' show SourceLoader;
|
||||||
|
|
||||||
|
@ -118,7 +118,6 @@ class DillLoader extends Loader {
|
||||||
DillLibraryBuilder? libraryBuilder = _builders[uri];
|
DillLibraryBuilder? libraryBuilder = _builders[uri];
|
||||||
if (libraryBuilder == null) {
|
if (libraryBuilder == null) {
|
||||||
libraryBuilder = _knownLibraryBuilders.remove(uri);
|
libraryBuilder = _knownLibraryBuilders.remove(uri);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(libraryBuilder != null, "No library found for $uri.");
|
assert(libraryBuilder != null, "No library found for $uri.");
|
||||||
_builders[uri] = libraryBuilder!;
|
_builders[uri] = libraryBuilder!;
|
||||||
assert(libraryBuilder.loader == this);
|
assert(libraryBuilder.loader == this);
|
||||||
|
@ -311,10 +310,6 @@ severity: $severity
|
||||||
}
|
}
|
||||||
|
|
||||||
void buildOutline(DillLibraryBuilder builder) {
|
void buildOutline(DillLibraryBuilder builder) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (builder.library == null) {
|
|
||||||
unhandled("null", "builder.library", 0, builder.fileUri);
|
|
||||||
}
|
|
||||||
builder.markAsReadyToBuild();
|
builder.markAsReadyToBuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -262,9 +262,7 @@ class DillClassMember extends BuilderClassMember {
|
||||||
@override
|
@override
|
||||||
final bool forSetter;
|
final bool forSetter;
|
||||||
|
|
||||||
DillClassMember(this.memberBuilder, {required this.forSetter})
|
DillClassMember(this.memberBuilder, {required this.forSetter});
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(forSetter != null);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get isSourceDeclaration => false;
|
bool get isSourceDeclaration => false;
|
||||||
|
|
|
@ -45,13 +45,7 @@ class DillTarget extends TargetImplementation {
|
||||||
final Benchmarker? benchmarker;
|
final Benchmarker? benchmarker;
|
||||||
|
|
||||||
DillTarget(this.ticker, this.uriTranslator, this.backendTarget,
|
DillTarget(this.ticker, this.uriTranslator, this.backendTarget,
|
||||||
{this.benchmarker})
|
{this.benchmarker}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(ticker != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(uriTranslator != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(backendTarget != null) {
|
|
||||||
loader = new DillLoader(this);
|
loader = new DillLoader(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -589,8 +589,7 @@ Message _withArgumentsConstEvalInvalidBinaryOperandType(
|
||||||
DartType _type,
|
DartType _type,
|
||||||
DartType _type2,
|
DartType _type2,
|
||||||
bool isNonNullableByDefault) {
|
bool isNonNullableByDefault) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||||
if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
|
||||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||||
List<Object> constantParts = labeler.labelConstant(_constant);
|
List<Object> constantParts = labeler.labelConstant(_constant);
|
||||||
List<Object> typeParts = labeler.labelType(_type);
|
List<Object> typeParts = labeler.labelType(_type);
|
||||||
|
@ -673,8 +672,7 @@ const Code<
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsConstEvalInvalidMethodInvocation(
|
Message _withArgumentsConstEvalInvalidMethodInvocation(
|
||||||
String stringOKEmpty, Constant _constant, bool isNonNullableByDefault) {
|
String stringOKEmpty, Constant _constant, bool isNonNullableByDefault) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||||
if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
|
||||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||||
List<Object> constantParts = labeler.labelConstant(_constant);
|
List<Object> constantParts = labeler.labelConstant(_constant);
|
||||||
String constant = constantParts.join();
|
String constant = constantParts.join();
|
||||||
|
@ -711,8 +709,7 @@ const Code<
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsConstEvalInvalidPropertyGet(
|
Message _withArgumentsConstEvalInvalidPropertyGet(
|
||||||
String stringOKEmpty, Constant _constant, bool isNonNullableByDefault) {
|
String stringOKEmpty, Constant _constant, bool isNonNullableByDefault) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||||
if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
|
||||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||||
List<Object> constantParts = labeler.labelConstant(_constant);
|
List<Object> constantParts = labeler.labelConstant(_constant);
|
||||||
String constant = constantParts.join();
|
String constant = constantParts.join();
|
||||||
|
@ -749,8 +746,7 @@ const Code<
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsConstEvalInvalidRecordIndexGet(
|
Message _withArgumentsConstEvalInvalidRecordIndexGet(
|
||||||
String stringOKEmpty, Constant _constant, bool isNonNullableByDefault) {
|
String stringOKEmpty, Constant _constant, bool isNonNullableByDefault) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||||
if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
|
||||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||||
List<Object> constantParts = labeler.labelConstant(_constant);
|
List<Object> constantParts = labeler.labelConstant(_constant);
|
||||||
String constant = constantParts.join();
|
String constant = constantParts.join();
|
||||||
|
@ -787,8 +783,7 @@ const Code<
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsConstEvalInvalidRecordNameGet(
|
Message _withArgumentsConstEvalInvalidRecordNameGet(
|
||||||
String stringOKEmpty, Constant _constant, bool isNonNullableByDefault) {
|
String stringOKEmpty, Constant _constant, bool isNonNullableByDefault) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||||
if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
|
||||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||||
List<Object> constantParts = labeler.labelConstant(_constant);
|
List<Object> constantParts = labeler.labelConstant(_constant);
|
||||||
String constant = constantParts.join();
|
String constant = constantParts.join();
|
||||||
|
@ -2039,10 +2034,6 @@ const Code<
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
Message _withArgumentsIndexOutOfBoundInRecordIndexGet(
|
Message _withArgumentsIndexOutOfBoundInRecordIndexGet(
|
||||||
int count, int count2, DartType _type, bool isNonNullableByDefault) {
|
int count, int count2, DartType _type, bool isNonNullableByDefault) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count == null) throw 'No count provided';
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (count2 == null) throw 'No count provided';
|
|
||||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||||
List<Object> typeParts = labeler.labelType(_type);
|
List<Object> typeParts = labeler.labelType(_type);
|
||||||
String type = typeParts.join();
|
String type = typeParts.join();
|
||||||
|
|
|
@ -1465,11 +1465,9 @@ class IncrementalCompiler implements IncrementalKernelGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (childReplacementMap == null) return;
|
if (childReplacementMap == null) return;
|
||||||
Builder replacement = childReplacementMap[declaration.name]!;
|
Builder? replacement = childReplacementMap[declaration.name];
|
||||||
assert(
|
assert(
|
||||||
// ignore: unnecessary_null_comparison
|
replacement != null, "Didn't find the replacement for $typeBuilder");
|
||||||
replacement != null,
|
|
||||||
"Didn't find the replacement for $typeBuilder");
|
|
||||||
typeBuilder.bind(
|
typeBuilder.bind(
|
||||||
parent as LibraryBuilder, replacement as TypeDeclarationBuilder);
|
parent as LibraryBuilder, replacement as TypeDeclarationBuilder);
|
||||||
}
|
}
|
||||||
|
@ -2366,18 +2364,7 @@ class ReusageResult {
|
||||||
this.directlyInvalidated,
|
this.directlyInvalidated,
|
||||||
this.invalidatedBecauseOfPackageUpdate,
|
this.invalidatedBecauseOfPackageUpdate,
|
||||||
this.reusedLibraries,
|
this.reusedLibraries,
|
||||||
this.partUriToParent)
|
this.partUriToParent);
|
||||||
:
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(notReusedLibraries != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(directlyInvalidated != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(invalidatedBecauseOfPackageUpdate != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(reusedLibraries != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(partUriToParent != null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ExperimentalInvalidation {
|
class ExperimentalInvalidation {
|
||||||
|
@ -2386,13 +2373,7 @@ class ExperimentalInvalidation {
|
||||||
final Set<Uri> missingSources;
|
final Set<Uri> missingSources;
|
||||||
|
|
||||||
ExperimentalInvalidation(
|
ExperimentalInvalidation(
|
||||||
this.rebuildBodies, this.originalNotReusedLibraries, this.missingSources)
|
this.rebuildBodies, this.originalNotReusedLibraries, this.missingSources);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(rebuildBodies != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(originalNotReusedLibraries != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(missingSources != null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class IncrementalKernelTarget extends KernelTarget
|
class IncrementalKernelTarget extends KernelTarget
|
||||||
|
@ -2637,8 +2618,7 @@ class _InitializationFromUri extends _InitializationFromSdkSummary {
|
||||||
context.options.fileSystem.entityForUri(initializeFromDillUri);
|
context.options.fileSystem.entityForUri(initializeFromDillUri);
|
||||||
if (await entity.exists()) {
|
if (await entity.exists()) {
|
||||||
List<int> initializationBytes = await entity.readAsBytes();
|
List<int> initializationBytes = await entity.readAsBytes();
|
||||||
// ignore: unnecessary_null_comparison
|
if (initializationBytes.isNotEmpty) {
|
||||||
if (initializationBytes != null && initializationBytes.isNotEmpty) {
|
|
||||||
dillLoadedData.ticker.logMs("Read $initializeFromDillUri");
|
dillLoadedData.ticker.logMs("Read $initializeFromDillUri");
|
||||||
data.initializationBytes = initializationBytes;
|
data.initializationBytes = initializationBytes;
|
||||||
|
|
||||||
|
|
|
@ -424,8 +424,6 @@ class BodyBuilder extends StackListenerImpl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scope = pop() as Scope;
|
scope = pop() as Scope;
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(scope != null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void enterBreakTarget(int charOffset, [JumpTarget? target]) {
|
void enterBreakTarget(int charOffset, [JumpTarget? target]) {
|
||||||
|
@ -1497,20 +1495,11 @@ class BodyBuilder extends StackListenerImpl
|
||||||
// set its inferredType field. If type inference is disabled, reach to
|
// set its inferredType field. If type inference is disabled, reach to
|
||||||
// the outermost parent to check if the node is a dead code.
|
// the outermost parent to check if the node is a dead code.
|
||||||
if (invocation.parent == null) continue;
|
if (invocation.parent == null) continue;
|
||||||
// ignore: unnecessary_null_comparison
|
if (!invocation.hasBeenInferred) {
|
||||||
if (typeInferrer != null) {
|
if (allowFurtherDelays) {
|
||||||
if (!invocation.hasBeenInferred) {
|
delayedRedirectingFactoryInvocations.add(invocation);
|
||||||
if (allowFurtherDelays) {
|
|
||||||
delayedRedirectingFactoryInvocations.add(invocation);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
} else {
|
continue;
|
||||||
TreeNode? parent = invocation.parent;
|
|
||||||
while (parent is! Component && parent != null) {
|
|
||||||
parent = parent.parent;
|
|
||||||
}
|
|
||||||
if (parent == null) continue;
|
|
||||||
}
|
}
|
||||||
Expression? replacement = _resolveRedirectingFactoryTarget(
|
Expression? replacement = _resolveRedirectingFactoryTarget(
|
||||||
invocation.target,
|
invocation.target,
|
||||||
|
@ -6400,8 +6389,7 @@ class BodyBuilder extends StackListenerImpl
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DartType> typeArgumentsToCheck = const <DartType>[];
|
List<DartType> typeArgumentsToCheck = const <DartType>[];
|
||||||
// ignore: unnecessary_null_comparison
|
if (typeArgumentBuilders.isNotEmpty) {
|
||||||
if (typeArgumentBuilders != null && typeArgumentBuilders.isNotEmpty) {
|
|
||||||
typeArgumentsToCheck = new List.filled(
|
typeArgumentsToCheck = new List.filled(
|
||||||
typeArgumentBuilders.length, const DynamicType(),
|
typeArgumentBuilders.length, const DynamicType(),
|
||||||
growable: false);
|
growable: false);
|
||||||
|
@ -8925,8 +8913,6 @@ class BodyBuilder extends StackListenerImpl
|
||||||
@override
|
@override
|
||||||
TypeBuilder validateTypeVariableUse(TypeBuilder typeBuilder,
|
TypeBuilder validateTypeVariableUse(TypeBuilder typeBuilder,
|
||||||
{required bool allowPotentiallyConstantType}) {
|
{required bool allowPotentiallyConstantType}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(allowPotentiallyConstantType != null);
|
|
||||||
_validateTypeVariableUseInternal(typeBuilder,
|
_validateTypeVariableUseInternal(typeBuilder,
|
||||||
allowPotentiallyConstantType: allowPotentiallyConstantType);
|
allowPotentiallyConstantType: allowPotentiallyConstantType);
|
||||||
return typeBuilder;
|
return typeBuilder;
|
||||||
|
@ -8934,8 +8920,6 @@ class BodyBuilder extends StackListenerImpl
|
||||||
|
|
||||||
void _validateTypeVariableUseInternal(TypeBuilder? builder,
|
void _validateTypeVariableUseInternal(TypeBuilder? builder,
|
||||||
{required bool allowPotentiallyConstantType}) {
|
{required bool allowPotentiallyConstantType}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(allowPotentiallyConstantType != null);
|
|
||||||
if (builder is NamedTypeBuilder) {
|
if (builder is NamedTypeBuilder) {
|
||||||
if (builder.declaration!.isTypeVariable) {
|
if (builder.declaration!.isTypeVariable) {
|
||||||
TypeVariableBuilder typeParameterBuilder =
|
TypeVariableBuilder typeParameterBuilder =
|
||||||
|
|
|
@ -67,11 +67,7 @@ class SpreadElement extends Expression with ControlFlowElement {
|
||||||
/// during the desugaring.
|
/// during the desugaring.
|
||||||
DartType? elementType;
|
DartType? elementType;
|
||||||
|
|
||||||
SpreadElement(this.expression, {required this.isNullAware})
|
SpreadElement(this.expression, {required this.isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(expression != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null) {
|
|
||||||
expression.parent = this;
|
expression.parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,20 +78,14 @@ class SpreadElement extends Expression with ControlFlowElement {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void transformChildren(Transformer v) {
|
void transformChildren(Transformer v) {
|
||||||
// ignore: unnecessary_null_comparison
|
expression = v.transform(expression);
|
||||||
if (expression != null) {
|
expression.parent = this;
|
||||||
expression = v.transform(expression);
|
|
||||||
expression.parent = this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void transformOrRemoveChildren(RemovingTransformer v) {
|
void transformOrRemoveChildren(RemovingTransformer v) {
|
||||||
// ignore: unnecessary_null_comparison
|
expression = v.transform(expression);
|
||||||
if (expression != null) {
|
expression.parent = this;
|
||||||
expression = v.transform(expression);
|
|
||||||
expression.parent = this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -126,11 +116,7 @@ class IfElement extends Expression with ControlFlowElement {
|
||||||
Expression then;
|
Expression then;
|
||||||
Expression? otherwise;
|
Expression? otherwise;
|
||||||
|
|
||||||
IfElement(this.condition, this.then, this.otherwise)
|
IfElement(this.condition, this.then, this.otherwise) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(condition != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(then != null) {
|
|
||||||
condition.parent = this;
|
condition.parent = this;
|
||||||
then.parent = this;
|
then.parent = this;
|
||||||
otherwise?.parent = this;
|
otherwise?.parent = this;
|
||||||
|
@ -145,16 +131,10 @@ class IfElement extends Expression with ControlFlowElement {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void transformChildren(Transformer v) {
|
void transformChildren(Transformer v) {
|
||||||
// ignore: unnecessary_null_comparison
|
condition = v.transform(condition);
|
||||||
if (condition != null) {
|
condition.parent = this;
|
||||||
condition = v.transform(condition);
|
then = v.transform(then);
|
||||||
condition.parent = this;
|
then.parent = this;
|
||||||
}
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (then != null) {
|
|
||||||
then = v.transform(then);
|
|
||||||
then.parent = this;
|
|
||||||
}
|
|
||||||
if (otherwise != null) {
|
if (otherwise != null) {
|
||||||
otherwise = v.transform(otherwise!);
|
otherwise = v.transform(otherwise!);
|
||||||
otherwise?.parent = this;
|
otherwise?.parent = this;
|
||||||
|
@ -163,16 +143,10 @@ class IfElement extends Expression with ControlFlowElement {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void transformOrRemoveChildren(RemovingTransformer v) {
|
void transformOrRemoveChildren(RemovingTransformer v) {
|
||||||
// ignore: unnecessary_null_comparison
|
condition = v.transform(condition);
|
||||||
if (condition != null) {
|
condition.parent = this;
|
||||||
condition = v.transform(condition);
|
then = v.transform(then);
|
||||||
condition.parent = this;
|
then.parent = this;
|
||||||
}
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (then != null) {
|
|
||||||
then = v.transform(then);
|
|
||||||
then.parent = this;
|
|
||||||
}
|
|
||||||
if (otherwise != null) {
|
if (otherwise != null) {
|
||||||
otherwise = v.transformOrRemoveExpression(otherwise!);
|
otherwise = v.transformOrRemoveExpression(otherwise!);
|
||||||
otherwise?.parent = this;
|
otherwise?.parent = this;
|
||||||
|
@ -229,9 +203,7 @@ class ForElement extends Expression with ControlFlowElement {
|
||||||
final List<Expression> updates; // May be empty, but not null.
|
final List<Expression> updates; // May be empty, but not null.
|
||||||
Expression body;
|
Expression body;
|
||||||
|
|
||||||
ForElement(this.variables, this.condition, this.updates, this.body)
|
ForElement(this.variables, this.condition, this.updates, this.body) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(body != null) {
|
|
||||||
setParents(variables, this);
|
setParents(variables, this);
|
||||||
condition?.parent = this;
|
condition?.parent = this;
|
||||||
setParents(updates, this);
|
setParents(updates, this);
|
||||||
|
@ -254,11 +226,8 @@ class ForElement extends Expression with ControlFlowElement {
|
||||||
condition?.parent = this;
|
condition?.parent = this;
|
||||||
}
|
}
|
||||||
v.transformList(updates, this);
|
v.transformList(updates, this);
|
||||||
// ignore: unnecessary_null_comparison
|
body = v.transform(body);
|
||||||
if (body != null) {
|
body.parent = this;
|
||||||
body = v.transform(body);
|
|
||||||
body.parent = this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -269,11 +238,8 @@ class ForElement extends Expression with ControlFlowElement {
|
||||||
condition?.parent = this;
|
condition?.parent = this;
|
||||||
}
|
}
|
||||||
v.transformExpressionList(updates, this);
|
v.transformExpressionList(updates, this);
|
||||||
// ignore: unnecessary_null_comparison
|
body = v.transform(body);
|
||||||
if (body != null) {
|
body.parent = this;
|
||||||
body = v.transform(body);
|
|
||||||
body.parent = this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -331,13 +297,7 @@ class ForInElement extends Expression with ControlFlowElement {
|
||||||
|
|
||||||
ForInElement(this.variable, this.iterable, this.syntheticAssignment,
|
ForInElement(this.variable, this.iterable, this.syntheticAssignment,
|
||||||
this.expressionEffects, this.body, this.problem,
|
this.expressionEffects, this.body, this.problem,
|
||||||
{this.isAsync = false})
|
{this.isAsync = false}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(variable != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(iterable != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(body != null) {
|
|
||||||
variable.parent = this;
|
variable.parent = this;
|
||||||
iterable.parent = this;
|
iterable.parent = this;
|
||||||
syntheticAssignment?.parent = this;
|
syntheticAssignment?.parent = this;
|
||||||
|
@ -363,16 +323,10 @@ class ForInElement extends Expression with ControlFlowElement {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void transformChildren(Transformer v) {
|
void transformChildren(Transformer v) {
|
||||||
// ignore: unnecessary_null_comparison
|
variable = v.transform(variable);
|
||||||
if (variable != null) {
|
variable.parent = this;
|
||||||
variable = v.transform(variable);
|
iterable = v.transform(iterable);
|
||||||
variable.parent = this;
|
iterable.parent = this;
|
||||||
}
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (iterable != null) {
|
|
||||||
iterable = v.transform(iterable);
|
|
||||||
iterable.parent = this;
|
|
||||||
}
|
|
||||||
if (syntheticAssignment != null) {
|
if (syntheticAssignment != null) {
|
||||||
syntheticAssignment = v.transform(syntheticAssignment!);
|
syntheticAssignment = v.transform(syntheticAssignment!);
|
||||||
syntheticAssignment?.parent = this;
|
syntheticAssignment?.parent = this;
|
||||||
|
@ -381,11 +335,8 @@ class ForInElement extends Expression with ControlFlowElement {
|
||||||
expressionEffects = v.transform(expressionEffects!);
|
expressionEffects = v.transform(expressionEffects!);
|
||||||
expressionEffects?.parent = this;
|
expressionEffects?.parent = this;
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
body = v.transform(body);
|
||||||
if (body != null) {
|
body.parent = this;
|
||||||
body = v.transform(body);
|
|
||||||
body.parent = this;
|
|
||||||
}
|
|
||||||
if (problem != null) {
|
if (problem != null) {
|
||||||
problem = v.transform(problem!);
|
problem = v.transform(problem!);
|
||||||
problem?.parent = this;
|
problem?.parent = this;
|
||||||
|
@ -394,16 +345,10 @@ class ForInElement extends Expression with ControlFlowElement {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void transformOrRemoveChildren(RemovingTransformer v) {
|
void transformOrRemoveChildren(RemovingTransformer v) {
|
||||||
// ignore: unnecessary_null_comparison
|
variable = v.transform(variable);
|
||||||
if (variable != null) {
|
variable.parent = this;
|
||||||
variable = v.transform(variable);
|
iterable = v.transform(iterable);
|
||||||
variable.parent = this;
|
iterable.parent = this;
|
||||||
}
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (iterable != null) {
|
|
||||||
iterable = v.transform(iterable);
|
|
||||||
iterable.parent = this;
|
|
||||||
}
|
|
||||||
if (syntheticAssignment != null) {
|
if (syntheticAssignment != null) {
|
||||||
syntheticAssignment = v.transformOrRemoveExpression(syntheticAssignment!);
|
syntheticAssignment = v.transformOrRemoveExpression(syntheticAssignment!);
|
||||||
syntheticAssignment?.parent = this;
|
syntheticAssignment?.parent = this;
|
||||||
|
@ -412,11 +357,8 @@ class ForInElement extends Expression with ControlFlowElement {
|
||||||
expressionEffects = v.transformOrRemoveStatement(expressionEffects!);
|
expressionEffects = v.transformOrRemoveStatement(expressionEffects!);
|
||||||
expressionEffects?.parent = this;
|
expressionEffects?.parent = this;
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
body = v.transform(body);
|
||||||
if (body != null) {
|
body.parent = this;
|
||||||
body = v.transform(body);
|
|
||||||
body.parent = this;
|
|
||||||
}
|
|
||||||
if (problem != null) {
|
if (problem != null) {
|
||||||
problem = v.transformOrRemoveExpression(problem!);
|
problem = v.transformOrRemoveExpression(problem!);
|
||||||
problem?.parent = this;
|
problem?.parent = this;
|
||||||
|
@ -493,11 +435,7 @@ class SpreadMapEntry extends TreeNode with ControlFlowMapEntry {
|
||||||
/// during the desugaring.
|
/// during the desugaring.
|
||||||
DartType? entryType;
|
DartType? entryType;
|
||||||
|
|
||||||
SpreadMapEntry(this.expression, {required this.isNullAware})
|
SpreadMapEntry(this.expression, {required this.isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(expression != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null) {
|
|
||||||
expression.parent = this;
|
expression.parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,20 +446,14 @@ class SpreadMapEntry extends TreeNode with ControlFlowMapEntry {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void transformChildren(Transformer v) {
|
void transformChildren(Transformer v) {
|
||||||
// ignore: unnecessary_null_comparison
|
expression = v.transform(expression);
|
||||||
if (expression != null) {
|
expression.parent = this;
|
||||||
expression = v.transform(expression);
|
|
||||||
expression.parent = this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void transformOrRemoveChildren(RemovingTransformer v) {
|
void transformOrRemoveChildren(RemovingTransformer v) {
|
||||||
// ignore: unnecessary_null_comparison
|
expression = v.transform(expression);
|
||||||
if (expression != null) {
|
expression.parent = this;
|
||||||
expression = v.transform(expression);
|
|
||||||
expression.parent = this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -542,11 +474,7 @@ class IfMapEntry extends TreeNode with ControlFlowMapEntry {
|
||||||
MapLiteralEntry then;
|
MapLiteralEntry then;
|
||||||
MapLiteralEntry? otherwise;
|
MapLiteralEntry? otherwise;
|
||||||
|
|
||||||
IfMapEntry(this.condition, this.then, this.otherwise)
|
IfMapEntry(this.condition, this.then, this.otherwise) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(condition != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(then != null) {
|
|
||||||
condition.parent = this;
|
condition.parent = this;
|
||||||
then.parent = this;
|
then.parent = this;
|
||||||
otherwise?.parent = this;
|
otherwise?.parent = this;
|
||||||
|
@ -561,16 +489,10 @@ class IfMapEntry extends TreeNode with ControlFlowMapEntry {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void transformChildren(Transformer v) {
|
void transformChildren(Transformer v) {
|
||||||
// ignore: unnecessary_null_comparison
|
condition = v.transform(condition);
|
||||||
if (condition != null) {
|
condition.parent = this;
|
||||||
condition = v.transform(condition);
|
then = v.transform(then);
|
||||||
condition.parent = this;
|
then.parent = this;
|
||||||
}
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (then != null) {
|
|
||||||
then = v.transform(then);
|
|
||||||
then.parent = this;
|
|
||||||
}
|
|
||||||
if (otherwise != null) {
|
if (otherwise != null) {
|
||||||
otherwise = v.transform(otherwise!);
|
otherwise = v.transform(otherwise!);
|
||||||
otherwise?.parent = this;
|
otherwise?.parent = this;
|
||||||
|
@ -579,16 +501,10 @@ class IfMapEntry extends TreeNode with ControlFlowMapEntry {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void transformOrRemoveChildren(RemovingTransformer v) {
|
void transformOrRemoveChildren(RemovingTransformer v) {
|
||||||
// ignore: unnecessary_null_comparison
|
condition = v.transform(condition);
|
||||||
if (condition != null) {
|
condition.parent = this;
|
||||||
condition = v.transform(condition);
|
then = v.transform(then);
|
||||||
condition.parent = this;
|
then.parent = this;
|
||||||
}
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (then != null) {
|
|
||||||
then = v.transform(then);
|
|
||||||
then.parent = this;
|
|
||||||
}
|
|
||||||
if (otherwise != null) {
|
if (otherwise != null) {
|
||||||
otherwise = v.transformOrRemove(otherwise!, dummyMapLiteralEntry);
|
otherwise = v.transformOrRemove(otherwise!, dummyMapLiteralEntry);
|
||||||
otherwise?.parent = this;
|
otherwise?.parent = this;
|
||||||
|
@ -620,9 +536,7 @@ class ForMapEntry extends TreeNode with ControlFlowMapEntry {
|
||||||
final List<Expression> updates; // May be empty, but not null.
|
final List<Expression> updates; // May be empty, but not null.
|
||||||
MapLiteralEntry body;
|
MapLiteralEntry body;
|
||||||
|
|
||||||
ForMapEntry(this.variables, this.condition, this.updates, this.body)
|
ForMapEntry(this.variables, this.condition, this.updates, this.body) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(body != null) {
|
|
||||||
setParents(variables, this);
|
setParents(variables, this);
|
||||||
condition?.parent = this;
|
condition?.parent = this;
|
||||||
setParents(updates, this);
|
setParents(updates, this);
|
||||||
|
@ -645,11 +559,8 @@ class ForMapEntry extends TreeNode with ControlFlowMapEntry {
|
||||||
condition?.parent = this;
|
condition?.parent = this;
|
||||||
}
|
}
|
||||||
v.transformList(updates, this);
|
v.transformList(updates, this);
|
||||||
// ignore: unnecessary_null_comparison
|
body = v.transform(body);
|
||||||
if (body != null) {
|
body.parent = this;
|
||||||
body = v.transform(body);
|
|
||||||
body.parent = this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -660,11 +571,8 @@ class ForMapEntry extends TreeNode with ControlFlowMapEntry {
|
||||||
condition?.parent = this;
|
condition?.parent = this;
|
||||||
}
|
}
|
||||||
v.transformExpressionList(updates, this);
|
v.transformExpressionList(updates, this);
|
||||||
// ignore: unnecessary_null_comparison
|
body = v.transform(body);
|
||||||
if (body != null) {
|
body.parent = this;
|
||||||
body = v.transform(body);
|
|
||||||
body.parent = this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -705,13 +613,7 @@ class ForInMapEntry extends TreeNode with ControlFlowMapEntry {
|
||||||
|
|
||||||
ForInMapEntry(this.variable, this.iterable, this.syntheticAssignment,
|
ForInMapEntry(this.variable, this.iterable, this.syntheticAssignment,
|
||||||
this.expressionEffects, this.body, this.problem,
|
this.expressionEffects, this.body, this.problem,
|
||||||
{required this.isAsync})
|
{required this.isAsync}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(iterable != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(body != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isAsync != null) {
|
|
||||||
variable.parent = this;
|
variable.parent = this;
|
||||||
iterable.parent = this;
|
iterable.parent = this;
|
||||||
syntheticAssignment?.parent = this;
|
syntheticAssignment?.parent = this;
|
||||||
|
@ -737,16 +639,10 @@ class ForInMapEntry extends TreeNode with ControlFlowMapEntry {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void transformChildren(Transformer v) {
|
void transformChildren(Transformer v) {
|
||||||
// ignore: unnecessary_null_comparison
|
variable = v.transform(variable);
|
||||||
if (variable != null) {
|
variable.parent = this;
|
||||||
variable = v.transform(variable);
|
iterable = v.transform(iterable);
|
||||||
variable.parent = this;
|
iterable.parent = this;
|
||||||
}
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (iterable != null) {
|
|
||||||
iterable = v.transform(iterable);
|
|
||||||
iterable.parent = this;
|
|
||||||
}
|
|
||||||
if (syntheticAssignment != null) {
|
if (syntheticAssignment != null) {
|
||||||
syntheticAssignment = v.transform(syntheticAssignment!);
|
syntheticAssignment = v.transform(syntheticAssignment!);
|
||||||
syntheticAssignment?.parent = this;
|
syntheticAssignment?.parent = this;
|
||||||
|
@ -755,11 +651,8 @@ class ForInMapEntry extends TreeNode with ControlFlowMapEntry {
|
||||||
expressionEffects = v.transform(expressionEffects!);
|
expressionEffects = v.transform(expressionEffects!);
|
||||||
expressionEffects?.parent = this;
|
expressionEffects?.parent = this;
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
body = v.transform(body);
|
||||||
if (body != null) {
|
body.parent = this;
|
||||||
body = v.transform(body);
|
|
||||||
body.parent = this;
|
|
||||||
}
|
|
||||||
if (problem != null) {
|
if (problem != null) {
|
||||||
problem = v.transform(problem!);
|
problem = v.transform(problem!);
|
||||||
problem?.parent = this;
|
problem?.parent = this;
|
||||||
|
@ -768,16 +661,10 @@ class ForInMapEntry extends TreeNode with ControlFlowMapEntry {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void transformOrRemoveChildren(RemovingTransformer v) {
|
void transformOrRemoveChildren(RemovingTransformer v) {
|
||||||
// ignore: unnecessary_null_comparison
|
variable = v.transform(variable);
|
||||||
if (variable != null) {
|
variable.parent = this;
|
||||||
variable = v.transform(variable);
|
iterable = v.transform(iterable);
|
||||||
variable.parent = this;
|
iterable.parent = this;
|
||||||
}
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (iterable != null) {
|
|
||||||
iterable = v.transform(iterable);
|
|
||||||
iterable.parent = this;
|
|
||||||
}
|
|
||||||
if (syntheticAssignment != null) {
|
if (syntheticAssignment != null) {
|
||||||
syntheticAssignment = v.transformOrRemoveExpression(syntheticAssignment!);
|
syntheticAssignment = v.transformOrRemoveExpression(syntheticAssignment!);
|
||||||
syntheticAssignment?.parent = this;
|
syntheticAssignment?.parent = this;
|
||||||
|
@ -786,11 +673,8 @@ class ForInMapEntry extends TreeNode with ControlFlowMapEntry {
|
||||||
expressionEffects = v.transformOrRemoveStatement(expressionEffects!);
|
expressionEffects = v.transformOrRemoveStatement(expressionEffects!);
|
||||||
expressionEffects?.parent = this;
|
expressionEffects?.parent = this;
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
body = v.transform(body);
|
||||||
if (body != null) {
|
body.parent = this;
|
||||||
body = v.transform(body);
|
|
||||||
body.parent = this;
|
|
||||||
}
|
|
||||||
if (problem != null) {
|
if (problem != null) {
|
||||||
problem = v.transformOrRemoveExpression(problem!);
|
problem = v.transformOrRemoveExpression(problem!);
|
||||||
problem?.parent = this;
|
problem?.parent = this;
|
||||||
|
|
|
@ -104,9 +104,7 @@ abstract class CombinedMemberSignatureBase<T> {
|
||||||
/// Creates a [CombinedClassMemberSignature] whose canonical member is already
|
/// Creates a [CombinedClassMemberSignature] whose canonical member is already
|
||||||
/// defined.
|
/// defined.
|
||||||
CombinedMemberSignatureBase.internal(
|
CombinedMemberSignatureBase.internal(
|
||||||
this.classBuilder, this._canonicalMemberIndex, this.forSetter)
|
this.classBuilder, this._canonicalMemberIndex, this.forSetter);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(forSetter != null);
|
|
||||||
|
|
||||||
/// Creates a [CombinedClassMemberSignature] for [members] inherited into
|
/// Creates a [CombinedClassMemberSignature] for [members] inherited into
|
||||||
/// [classBuilder].
|
/// [classBuilder].
|
||||||
|
@ -115,8 +113,6 @@ abstract class CombinedMemberSignatureBase<T> {
|
||||||
/// compute the most specific member type. Otherwise covariance of the getter
|
/// compute the most specific member type. Otherwise covariance of the getter
|
||||||
/// types or function types is used.
|
/// types or function types is used.
|
||||||
CombinedMemberSignatureBase(this.classBuilder, {required this.forSetter}) {
|
CombinedMemberSignatureBase(this.classBuilder, {required this.forSetter}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forSetter != null);
|
|
||||||
int? bestSoFarIndex;
|
int? bestSoFarIndex;
|
||||||
if (members.length == 1) {
|
if (members.length == 1) {
|
||||||
bestSoFarIndex = 0;
|
bestSoFarIndex = 0;
|
||||||
|
@ -292,9 +288,6 @@ abstract class CombinedMemberSignatureBase<T> {
|
||||||
DartType? candidateType = _memberTypes![index];
|
DartType? candidateType = _memberTypes![index];
|
||||||
if (candidateType == null) {
|
if (candidateType == null) {
|
||||||
Member target = _getMember(index);
|
Member target = _getMember(index);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(target != null,
|
|
||||||
"No member computed for index ${index} in ${members}");
|
|
||||||
candidateType = _computeMemberType(thisType, target);
|
candidateType = _computeMemberType(thisType, target);
|
||||||
if (!classBuilder.libraryBuilder.isNonNullableByDefault) {
|
if (!classBuilder.libraryBuilder.isNonNullableByDefault) {
|
||||||
DartType? legacyErasure;
|
DartType? legacyErasure;
|
||||||
|
@ -526,8 +519,6 @@ abstract class CombinedMemberSignatureBase<T> {
|
||||||
/// [type].
|
/// [type].
|
||||||
Procedure _createGetterMemberSignature(Member member, DartType type,
|
Procedure _createGetterMemberSignature(Member member, DartType type,
|
||||||
{required bool copyLocation}) {
|
{required bool copyLocation}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(copyLocation != null);
|
|
||||||
Class enclosingClass = classBuilder.cls;
|
Class enclosingClass = classBuilder.cls;
|
||||||
Reference? reference =
|
Reference? reference =
|
||||||
classBuilder.referencesFromIndexed?.lookupGetterReference(member.name);
|
classBuilder.referencesFromIndexed?.lookupGetterReference(member.name);
|
||||||
|
@ -570,12 +561,6 @@ abstract class CombinedMemberSignatureBase<T> {
|
||||||
required bool isCovariantByClass,
|
required bool isCovariantByClass,
|
||||||
VariableDeclaration? parameter,
|
VariableDeclaration? parameter,
|
||||||
required bool copyLocation}) {
|
required bool copyLocation}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isCovariantByDeclaration != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isCovariantByClass != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(copyLocation != null);
|
|
||||||
Class enclosingClass = classBuilder.cls;
|
Class enclosingClass = classBuilder.cls;
|
||||||
Reference? reference =
|
Reference? reference =
|
||||||
classBuilder.referencesFromIndexed?.lookupSetterReference(member.name);
|
classBuilder.referencesFromIndexed?.lookupSetterReference(member.name);
|
||||||
|
@ -620,8 +605,6 @@ abstract class CombinedMemberSignatureBase<T> {
|
||||||
Procedure _createMethodSignature(
|
Procedure _createMethodSignature(
|
||||||
Procedure procedure, FunctionType functionType,
|
Procedure procedure, FunctionType functionType,
|
||||||
{required bool copyLocation}) {
|
{required bool copyLocation}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(copyLocation != null);
|
|
||||||
Class enclosingClass = classBuilder.cls;
|
Class enclosingClass = classBuilder.cls;
|
||||||
Reference? reference = classBuilder.referencesFromIndexed
|
Reference? reference = classBuilder.referencesFromIndexed
|
||||||
?.lookupGetterReference(procedure.name);
|
?.lookupGetterReference(procedure.name);
|
||||||
|
@ -778,21 +761,13 @@ class CombinedClassMemberSignature
|
||||||
@override
|
@override
|
||||||
Member _getMember(int index) {
|
Member _getMember(int index) {
|
||||||
ClassMember candidate = members[index];
|
ClassMember candidate = members[index];
|
||||||
Member target = candidate.getMember(membersBuilder);
|
return candidate.getMember(membersBuilder);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(target != null,
|
|
||||||
"No member computed for ${candidate} (${candidate.runtimeType})");
|
|
||||||
return target;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Covariance _getMemberCovariance(int index) {
|
Covariance _getMemberCovariance(int index) {
|
||||||
ClassMember candidate = members[index];
|
ClassMember candidate = members[index];
|
||||||
Covariance covariance = candidate.getCovariance(membersBuilder);
|
return candidate.getCovariance(membersBuilder);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(covariance != null,
|
|
||||||
"No covariance computed for ${candidate} (${candidate.runtimeType})");
|
|
||||||
return covariance;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,18 +64,6 @@ Component transformComponent(
|
||||||
CoreTypes? coreTypes,
|
CoreTypes? coreTypes,
|
||||||
ClassHierarchy? hierarchy,
|
ClassHierarchy? hierarchy,
|
||||||
ExhaustivenessDataForTesting? exhaustivenessDataForTesting}) {
|
ExhaustivenessDataForTesting? exhaustivenessDataForTesting}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(evaluateAnnotations != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(desugarSets != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(enableTripleShift != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(enableConstFunctions != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(errorOnUnevaluatedConstant != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(enableConstructorTearOff != null);
|
|
||||||
coreTypes ??= new CoreTypes(component);
|
coreTypes ??= new CoreTypes(component);
|
||||||
hierarchy ??= new ClassHierarchy(component, coreTypes);
|
hierarchy ??= new ClassHierarchy(component, coreTypes);
|
||||||
|
|
||||||
|
@ -106,16 +94,6 @@ ConstantEvaluationData transformLibraries(
|
||||||
required bool errorOnUnevaluatedConstant,
|
required bool errorOnUnevaluatedConstant,
|
||||||
required bool enableConstructorTearOff,
|
required bool enableConstructorTearOff,
|
||||||
ExhaustivenessDataForTesting? exhaustivenessDataForTesting}) {
|
ExhaustivenessDataForTesting? exhaustivenessDataForTesting}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(evaluateAnnotations != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(enableTripleShift != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(enableConstFunctions != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(errorOnUnevaluatedConstant != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(enableConstructorTearOff != null);
|
|
||||||
final ConstantsTransformer constantsTransformer = new ConstantsTransformer(
|
final ConstantsTransformer constantsTransformer = new ConstantsTransformer(
|
||||||
target,
|
target,
|
||||||
environmentDefines,
|
environmentDefines,
|
||||||
|
@ -151,16 +129,6 @@ void transformProcedure(
|
||||||
required bool enableConstFunctions,
|
required bool enableConstFunctions,
|
||||||
required bool enableConstructorTearOff,
|
required bool enableConstructorTearOff,
|
||||||
required bool errorOnUnevaluatedConstant}) {
|
required bool errorOnUnevaluatedConstant}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(evaluateAnnotations != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(enableTripleShift != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(enableConstFunctions != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(errorOnUnevaluatedConstant != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(enableConstructorTearOff != null);
|
|
||||||
final ConstantsTransformer constantsTransformer = new ConstantsTransformer(
|
final ConstantsTransformer constantsTransformer = new ConstantsTransformer(
|
||||||
target,
|
target,
|
||||||
environmentDefines,
|
environmentDefines,
|
||||||
|
@ -657,10 +625,7 @@ class ConstantsTransformer extends RemovingTransformer {
|
||||||
TreeNode visitFunctionDeclaration(
|
TreeNode visitFunctionDeclaration(
|
||||||
FunctionDeclaration node, TreeNode? removalSentinel) {
|
FunctionDeclaration node, TreeNode? removalSentinel) {
|
||||||
if (enableConstFunctions) {
|
if (enableConstFunctions) {
|
||||||
// ignore: unnecessary_null_comparison
|
node.function = transform(node.function)..parent = node;
|
||||||
if (node.function != null) {
|
|
||||||
node.function = transform(node.function)..parent = node;
|
|
||||||
}
|
|
||||||
constantEvaluator.env.addVariableValue(
|
constantEvaluator.env.addVariableValue(
|
||||||
node.variable, new FunctionValue(node.function, null));
|
node.variable, new FunctionValue(node.function, null));
|
||||||
} else {
|
} else {
|
||||||
|
@ -1609,27 +1574,23 @@ class ConstantsTransformer extends RemovingTransformer {
|
||||||
TreeNode visitSwitchStatement(
|
TreeNode visitSwitchStatement(
|
||||||
SwitchStatement node, TreeNode? removalSentinel) {
|
SwitchStatement node, TreeNode? removalSentinel) {
|
||||||
TreeNode result = super.visitSwitchStatement(node, removalSentinel);
|
TreeNode result = super.visitSwitchStatement(node, removalSentinel);
|
||||||
Library library = currentLibrary;
|
for (SwitchCase switchCase in node.cases) {
|
||||||
// ignore: unnecessary_null_comparison
|
for (Expression caseExpression in switchCase.expressions) {
|
||||||
if (library != null) {
|
if (caseExpression is ConstantExpression) {
|
||||||
for (SwitchCase switchCase in node.cases) {
|
if (!constantEvaluator.hasPrimitiveEqual(caseExpression.constant,
|
||||||
for (Expression caseExpression in switchCase.expressions) {
|
staticTypeContext: staticTypeContext)) {
|
||||||
if (caseExpression is ConstantExpression) {
|
constantEvaluator.errorReporter.report(
|
||||||
if (!constantEvaluator.hasPrimitiveEqual(caseExpression.constant,
|
constantEvaluator.createLocatedMessage(
|
||||||
staticTypeContext: staticTypeContext)) {
|
caseExpression,
|
||||||
constantEvaluator.errorReporter.report(
|
templateConstEvalCaseImplementsEqual.withArguments(
|
||||||
constantEvaluator.createLocatedMessage(
|
caseExpression.constant,
|
||||||
caseExpression,
|
staticTypeContext.nonNullable ==
|
||||||
templateConstEvalCaseImplementsEqual.withArguments(
|
Nullability.nonNullable)),
|
||||||
caseExpression.constant,
|
null);
|
||||||
staticTypeContext.nonNullable ==
|
|
||||||
Nullability.nonNullable)),
|
|
||||||
null);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// If caseExpression is not ConstantExpression, an error is
|
|
||||||
// reported elsewhere.
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// If caseExpression is not ConstantExpression, an error is
|
||||||
|
// reported elsewhere.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2871,8 +2832,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(type != null);
|
|
||||||
return canonicalize(new TypeLiteralConstant(type));
|
return canonicalize(new TypeLiteralConstant(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2912,8 +2871,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(type != null);
|
|
||||||
|
|
||||||
final ListConstantBuilder builder = new ListConstantBuilder(
|
final ListConstantBuilder builder = new ListConstantBuilder(
|
||||||
node, convertType(type), this,
|
node, convertType(type), this,
|
||||||
|
@ -2949,8 +2906,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(positional != null);
|
|
||||||
|
|
||||||
Map<String, Constant>? named = _evaluateNamedArguments(node.named);
|
Map<String, Constant>? named = _evaluateNamedArguments(node.named);
|
||||||
if (named == null) {
|
if (named == null) {
|
||||||
|
@ -2959,8 +2914,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(named != null);
|
|
||||||
|
|
||||||
if (shouldBeUnevaluated) {
|
if (shouldBeUnevaluated) {
|
||||||
return unevaluated(
|
return unevaluated(
|
||||||
|
@ -3003,8 +2956,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(type != null);
|
|
||||||
|
|
||||||
final SetConstantBuilder builder =
|
final SetConstantBuilder builder =
|
||||||
new SetConstantBuilder(node, convertType(type), this);
|
new SetConstantBuilder(node, convertType(type), this);
|
||||||
|
@ -3050,8 +3001,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(keyType != null);
|
|
||||||
|
|
||||||
DartType? valueType = _evaluateDartType(node, node.valueType);
|
DartType? valueType = _evaluateDartType(node, node.valueType);
|
||||||
if (valueType == null) {
|
if (valueType == null) {
|
||||||
|
@ -3060,8 +3009,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(valueType != null);
|
|
||||||
|
|
||||||
final MapConstantBuilder builder = new MapConstantBuilder(
|
final MapConstantBuilder builder = new MapConstantBuilder(
|
||||||
node, convertType(keyType), convertType(valueType), this);
|
node, convertType(keyType), convertType(valueType), this);
|
||||||
|
@ -3127,8 +3074,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(positional != null);
|
|
||||||
|
|
||||||
final Map<String, Constant>? named =
|
final Map<String, Constant>? named =
|
||||||
_evaluateNamedArguments(node.arguments.named);
|
_evaluateNamedArguments(node.arguments.named);
|
||||||
|
@ -3138,8 +3083,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(named != null);
|
|
||||||
|
|
||||||
bool isSymbol = klass == coreTypes.internalSymbolClass;
|
bool isSymbol = klass == coreTypes.internalSymbolClass;
|
||||||
if (isSymbol && shouldBeUnevaluated) {
|
if (isSymbol && shouldBeUnevaluated) {
|
||||||
|
@ -3174,8 +3117,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(types != null);
|
|
||||||
|
|
||||||
final List<DartType> typeArguments = convertTypes(types);
|
final List<DartType> typeArguments = convertTypes(types);
|
||||||
|
|
||||||
|
@ -3307,8 +3248,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
'unary-'
|
'unary-'
|
||||||
};
|
};
|
||||||
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (name == null) return false;
|
|
||||||
if (name == '') return true;
|
if (name == '') return true;
|
||||||
|
|
||||||
final List<String> parts = name.split('.');
|
final List<String> parts = name.split('.');
|
||||||
|
@ -3463,8 +3402,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(types != null);
|
|
||||||
|
|
||||||
List<Constant>? positionalArguments =
|
List<Constant>? positionalArguments =
|
||||||
_evaluatePositionalArguments(init.arguments.positional);
|
_evaluatePositionalArguments(init.arguments.positional);
|
||||||
|
@ -3474,8 +3411,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(positionalArguments != null);
|
|
||||||
Map<String, Constant>? namedArguments =
|
Map<String, Constant>? namedArguments =
|
||||||
_evaluateNamedArguments(init.arguments.named);
|
_evaluateNamedArguments(init.arguments.named);
|
||||||
if (namedArguments == null) {
|
if (namedArguments == null) {
|
||||||
|
@ -3484,8 +3419,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(namedArguments != null);
|
|
||||||
error = handleConstructorInvocation(
|
error = handleConstructorInvocation(
|
||||||
init.target, types, positionalArguments, namedArguments, caller);
|
init.target, types, positionalArguments, namedArguments, caller);
|
||||||
if (error != null) return error;
|
if (error != null) return error;
|
||||||
|
@ -3504,8 +3437,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(positionalArguments != null);
|
|
||||||
|
|
||||||
Map<String, Constant>? namedArguments =
|
Map<String, Constant>? namedArguments =
|
||||||
_evaluateNamedArguments(init.arguments.named);
|
_evaluateNamedArguments(init.arguments.named);
|
||||||
|
@ -3515,8 +3446,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(namedArguments != null);
|
|
||||||
|
|
||||||
error = handleConstructorInvocation(init.target, typeArguments,
|
error = handleConstructorInvocation(init.target, typeArguments,
|
||||||
positionalArguments, namedArguments, caller);
|
positionalArguments, namedArguments, caller);
|
||||||
|
@ -3544,8 +3473,7 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
instanceBuilder!.unusedArguments.add(_wrap(constant));
|
instanceBuilder!.unusedArguments.add(_wrap(constant));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: unnecessary_null_comparison
|
if (enableConstFunctions) {
|
||||||
if (enableConstFunctions && constructor.function != null) {
|
|
||||||
AbortConstant? error = executeConstructorBody(constructor);
|
AbortConstant? error = executeConstructorBody(constructor);
|
||||||
if (error != null) return error;
|
if (error != null) return error;
|
||||||
}
|
}
|
||||||
|
@ -3643,8 +3571,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(positionalArguments != null);
|
|
||||||
|
|
||||||
if (shouldBeUnevaluated) {
|
if (shouldBeUnevaluated) {
|
||||||
return unevaluated(
|
return unevaluated(
|
||||||
|
@ -3688,8 +3614,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(positionalArguments != null);
|
|
||||||
|
|
||||||
if (shouldBeUnevaluated) {
|
if (shouldBeUnevaluated) {
|
||||||
return unevaluated(
|
return unevaluated(
|
||||||
|
@ -3733,8 +3657,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
}
|
}
|
||||||
|
|
||||||
final Constant receiver = env.lookupVariable(node.variable)!;
|
final Constant receiver = env.lookupVariable(node.variable)!;
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(receiver != null);
|
|
||||||
if (receiver is AbortConstant) return receiver;
|
if (receiver is AbortConstant) return receiver;
|
||||||
|
|
||||||
return _evaluateFunctionInvocation(node, receiver, node.arguments);
|
return _evaluateFunctionInvocation(node, receiver, node.arguments);
|
||||||
|
@ -3751,8 +3673,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(positional != null);
|
|
||||||
|
|
||||||
// Evaluate type arguments of the function invoked.
|
// Evaluate type arguments of the function invoked.
|
||||||
List<DartType>? types = _evaluateTypeArguments(node, arguments);
|
List<DartType>? types = _evaluateTypeArguments(node, arguments);
|
||||||
|
@ -3762,8 +3682,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(types != null);
|
|
||||||
|
|
||||||
// Evaluate named arguments of the function invoked.
|
// Evaluate named arguments of the function invoked.
|
||||||
final Map<String, Constant>? named =
|
final Map<String, Constant>? named =
|
||||||
|
@ -3774,8 +3692,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(named != null);
|
|
||||||
|
|
||||||
if (receiver is FunctionValue) {
|
if (receiver is FunctionValue) {
|
||||||
return _handleFunctionInvocation(
|
return _handleFunctionInvocation(
|
||||||
|
@ -4048,8 +3964,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(typeArguments != null);
|
|
||||||
|
|
||||||
// Evaluate named arguments of the method invoked.
|
// Evaluate named arguments of the method invoked.
|
||||||
final Map<String, Constant>? namedArguments =
|
final Map<String, Constant>? namedArguments =
|
||||||
|
@ -4060,8 +3974,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(namedArguments != null);
|
|
||||||
|
|
||||||
if (receiver is FunctionValue && name == Name.callName) {
|
if (receiver is FunctionValue && name == Name.callName) {
|
||||||
return _handleFunctionInvocation(receiver.function, typeArguments,
|
return _handleFunctionInvocation(receiver.function, typeArguments,
|
||||||
|
@ -4616,8 +4528,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(types != null);
|
|
||||||
|
|
||||||
final List<DartType> typeArguments = convertTypes(types);
|
final List<DartType> typeArguments = convertTypes(types);
|
||||||
|
|
||||||
|
@ -4629,8 +4539,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(positional != null);
|
|
||||||
|
|
||||||
final Map<String, Constant>? named =
|
final Map<String, Constant>? named =
|
||||||
_evaluateNamedArguments(arguments.named);
|
_evaluateNamedArguments(arguments.named);
|
||||||
|
@ -4640,8 +4548,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(named != null);
|
|
||||||
|
|
||||||
if (shouldBeUnevaluated) {
|
if (shouldBeUnevaluated) {
|
||||||
return unevaluated(
|
return unevaluated(
|
||||||
|
@ -4815,8 +4721,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(type != null);
|
|
||||||
return ensureIsSubtype(constant, type, node);
|
return ensureIsSubtype(constant, type, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4839,12 +4743,8 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(type != null);
|
|
||||||
|
|
||||||
bool performIs(Constant constant, {required bool strongMode}) {
|
bool performIs(Constant constant, {required bool strongMode}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(strongMode != null);
|
|
||||||
if (strongMode) {
|
if (strongMode) {
|
||||||
return isSubtype(constant, type, SubtypeCheckMode.withNullabilities);
|
return isSubtype(constant, type, SubtypeCheckMode.withNullabilities);
|
||||||
} else {
|
} else {
|
||||||
|
@ -4970,8 +4870,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(types != null);
|
|
||||||
|
|
||||||
return canonicalize(
|
return canonicalize(
|
||||||
new InstantiationConstant(constant, convertTypes(types)));
|
new InstantiationConstant(constant, convertTypes(types)));
|
||||||
|
@ -5248,8 +5146,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
assert(_gotError == null);
|
assert(_gotError == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(type != null);
|
|
||||||
result[i] = type;
|
result[i] = type;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -223,8 +223,6 @@ abstract class Generator {
|
||||||
|
|
||||||
Expression_Generator buildEqualsOperation(Token token, Expression right,
|
Expression_Generator buildEqualsOperation(Token token, Expression right,
|
||||||
{required bool isNot}) {
|
{required bool isNot}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNot != null);
|
|
||||||
return _forest.createEquals(offsetForToken(token), buildSimpleRead(), right,
|
return _forest.createEquals(offsetForToken(token), buildSimpleRead(), right,
|
||||||
isNot: isNot);
|
isNot: isNot);
|
||||||
}
|
}
|
||||||
|
@ -401,8 +399,6 @@ class VariableUseGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -525,8 +521,6 @@ class PropertyAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -687,8 +681,6 @@ class ThisPropertyAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -794,8 +786,6 @@ class NullAwarePropertyAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -919,8 +909,6 @@ class SuperPropertyAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -946,9 +934,7 @@ class IndexedAccessGenerator extends Generator {
|
||||||
IndexedAccessGenerator(
|
IndexedAccessGenerator(
|
||||||
ExpressionGeneratorHelper helper, Token token, this.receiver, this.index,
|
ExpressionGeneratorHelper helper, Token token, this.receiver, this.index,
|
||||||
{required this.isNullAware})
|
{required this.isNullAware})
|
||||||
// ignore: unnecessary_null_comparison
|
: super(helper, token);
|
||||||
: assert(isNullAware != null),
|
|
||||||
super(helper, token);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get _plainNameForRead => "[]";
|
String get _plainNameForRead => "[]";
|
||||||
|
@ -1072,8 +1058,6 @@ class IndexedAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -1091,8 +1075,6 @@ class IndexedAccessGenerator extends Generator {
|
||||||
static Generator make(ExpressionGeneratorHelper helper, Token token,
|
static Generator make(ExpressionGeneratorHelper helper, Token token,
|
||||||
Expression receiver, Expression index,
|
Expression receiver, Expression index,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
if (helper.forest.isThisExpression(receiver)) {
|
if (helper.forest.isThisExpression(receiver)) {
|
||||||
return new ThisIndexedAccessGenerator(helper, token, index,
|
return new ThisIndexedAccessGenerator(helper, token, index,
|
||||||
thisOffset: receiver.fileOffset, isNullAware: isNullAware);
|
thisOffset: receiver.fileOffset, isNullAware: isNullAware);
|
||||||
|
@ -1195,8 +1177,6 @@ class ThisIndexedAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -1321,8 +1301,6 @@ class SuperIndexedAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -1401,9 +1379,7 @@ class StaticAccessGenerator extends Generator {
|
||||||
StaticAccessGenerator(ExpressionGeneratorHelper helper, Token token,
|
StaticAccessGenerator(ExpressionGeneratorHelper helper, Token token,
|
||||||
this.targetName, this.parentBuilder, this.readTarget, this.writeTarget,
|
this.targetName, this.parentBuilder, this.readTarget, this.writeTarget,
|
||||||
{this.typeOffset, this.isNullAware = false})
|
{this.typeOffset, this.isNullAware = false})
|
||||||
// ignore: unnecessary_null_comparison
|
: assert(readTarget != null || writeTarget != null),
|
||||||
: assert(targetName != null),
|
|
||||||
assert(readTarget != null || writeTarget != null),
|
|
||||||
assert(parentBuilder is DeclarationBuilder ||
|
assert(parentBuilder is DeclarationBuilder ||
|
||||||
parentBuilder is LibraryBuilder),
|
parentBuilder is LibraryBuilder),
|
||||||
super(helper, token);
|
super(helper, token);
|
||||||
|
@ -1563,8 +1539,6 @@ class StaticAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -1647,12 +1621,8 @@ class ExtensionInstanceAccessGenerator extends Generator {
|
||||||
this.writeTarget,
|
this.writeTarget,
|
||||||
this.extensionThis,
|
this.extensionThis,
|
||||||
this.extensionTypeParameters)
|
this.extensionTypeParameters)
|
||||||
// ignore: unnecessary_null_comparison
|
: assert(
|
||||||
: assert(targetName != null),
|
|
||||||
assert(
|
|
||||||
readTarget != null || invokeTarget != null || writeTarget != null),
|
readTarget != null || invokeTarget != null || writeTarget != null),
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(extensionThis != null),
|
|
||||||
super(helper, token);
|
super(helper, token);
|
||||||
|
|
||||||
factory ExtensionInstanceAccessGenerator.fromBuilder(
|
factory ExtensionInstanceAccessGenerator.fromBuilder(
|
||||||
|
@ -1850,8 +1820,6 @@ class ExtensionInstanceAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -1948,14 +1916,8 @@ class ExplicitExtensionInstanceAccessGenerator extends Generator {
|
||||||
this.explicitTypeArguments,
|
this.explicitTypeArguments,
|
||||||
this.extensionTypeParameterCount,
|
this.extensionTypeParameterCount,
|
||||||
{required this.isNullAware})
|
{required this.isNullAware})
|
||||||
// ignore: unnecessary_null_comparison
|
: assert(
|
||||||
: assert(targetName != null),
|
|
||||||
assert(
|
|
||||||
readTarget != null || invokeTarget != null || writeTarget != null),
|
readTarget != null || invokeTarget != null || writeTarget != null),
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null),
|
|
||||||
super(helper, token);
|
super(helper, token);
|
||||||
|
|
||||||
factory ExplicitExtensionInstanceAccessGenerator.fromBuilder(
|
factory ExplicitExtensionInstanceAccessGenerator.fromBuilder(
|
||||||
|
@ -2276,8 +2238,6 @@ class ExplicitExtensionInstanceAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -2339,10 +2299,6 @@ class ExplicitExtensionIndexedAccessGenerator extends Generator {
|
||||||
this.extensionTypeParameterCount,
|
this.extensionTypeParameterCount,
|
||||||
{required this.isNullAware})
|
{required this.isNullAware})
|
||||||
: assert(readTarget != null || writeTarget != null),
|
: assert(readTarget != null || writeTarget != null),
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null),
|
|
||||||
super(helper, token);
|
super(helper, token);
|
||||||
|
|
||||||
factory ExplicitExtensionIndexedAccessGenerator.fromBuilder(
|
factory ExplicitExtensionIndexedAccessGenerator.fromBuilder(
|
||||||
|
@ -2357,8 +2313,6 @@ class ExplicitExtensionIndexedAccessGenerator extends Generator {
|
||||||
List<DartType>? explicitTypeArguments,
|
List<DartType>? explicitTypeArguments,
|
||||||
int extensionTypeParameterCount,
|
int extensionTypeParameterCount,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
Procedure? readTarget;
|
Procedure? readTarget;
|
||||||
if (getterBuilder != null) {
|
if (getterBuilder != null) {
|
||||||
if (getterBuilder is AccessErrorBuilder) {
|
if (getterBuilder is AccessErrorBuilder) {
|
||||||
|
@ -2561,8 +2515,6 @@ class ExplicitExtensionIndexedAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -2747,8 +2699,6 @@ class ExplicitExtensionAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
Builder? getter = extensionBuilder.lookupLocalMemberByName(indexGetName);
|
Builder? getter = extensionBuilder.lookupLocalMemberByName(indexGetName);
|
||||||
Builder? setter = extensionBuilder.lookupLocalMemberByName(indexSetName);
|
Builder? setter = extensionBuilder.lookupLocalMemberByName(indexSetName);
|
||||||
if (getter == null && setter == null) {
|
if (getter == null && setter == null) {
|
||||||
|
@ -2852,8 +2802,6 @@ class LoadLibraryGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -3018,8 +2966,6 @@ class DeferredAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -3547,15 +3493,11 @@ abstract class AbstractReadOnlyAccessGenerator extends Generator {
|
||||||
Expression _makeInvalidWrite(Expression value) {
|
Expression _makeInvalidWrite(Expression value) {
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case ReadOnlyAccessKind.ConstVariable:
|
case ReadOnlyAccessKind.ConstVariable:
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(targetName != null);
|
|
||||||
return _helper.buildProblem(
|
return _helper.buildProblem(
|
||||||
templateCannotAssignToConstVariable.withArguments(targetName),
|
templateCannotAssignToConstVariable.withArguments(targetName),
|
||||||
fileOffset,
|
fileOffset,
|
||||||
lengthForToken(token));
|
lengthForToken(token));
|
||||||
case ReadOnlyAccessKind.FinalVariable:
|
case ReadOnlyAccessKind.FinalVariable:
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(targetName != null);
|
|
||||||
return _helper.buildProblem(
|
return _helper.buildProblem(
|
||||||
templateCannotAssignToFinalVariable.withArguments(targetName),
|
templateCannotAssignToFinalVariable.withArguments(targetName),
|
||||||
fileOffset,
|
fileOffset,
|
||||||
|
@ -3622,8 +3564,6 @@ abstract class AbstractReadOnlyAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
// TODO(johnniwinther): The read-only quality of the variable should be
|
// TODO(johnniwinther): The read-only quality of the variable should be
|
||||||
// passed on to the generator.
|
// passed on to the generator.
|
||||||
return new IndexedAccessGenerator(_helper, token, _createRead(), index,
|
return new IndexedAccessGenerator(_helper, token, _createRead(), index,
|
||||||
|
@ -3757,8 +3697,6 @@ abstract class ErroneousExpressionGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -3846,8 +3784,6 @@ class UnresolvedNameGenerator extends ErroneousExpressionGenerator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -3918,8 +3854,6 @@ abstract class ContextAwareGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -4155,8 +4089,6 @@ class PrefixUseGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -4249,8 +4181,6 @@ class UnexpectedQualifiedUseGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -4379,8 +4309,6 @@ class ParserErrorGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||||
isNullAware: isNullAware);
|
isNullAware: isNullAware);
|
||||||
}
|
}
|
||||||
|
@ -4572,8 +4500,6 @@ class ThisAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Expression_Generator buildEqualsOperation(Token token, Expression right,
|
Expression_Generator buildEqualsOperation(Token token, Expression right,
|
||||||
{required bool isNot}) {
|
{required bool isNot}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNot != null);
|
|
||||||
if (isSuper) {
|
if (isSuper) {
|
||||||
int offset = offsetForToken(token);
|
int offset = offsetForToken(token);
|
||||||
Expression result = _helper.buildSuperInvocation(equalsName,
|
Expression result = _helper.buildSuperInvocation(equalsName,
|
||||||
|
@ -4669,8 +4595,6 @@ class ThisAccessGenerator extends Generator {
|
||||||
@override
|
@override
|
||||||
Generator buildIndexedAccess(Expression index, Token token,
|
Generator buildIndexedAccess(Expression index, Token token,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
if (isSuper) {
|
if (isSuper) {
|
||||||
return new SuperIndexedAccessGenerator(
|
return new SuperIndexedAccessGenerator(
|
||||||
_helper,
|
_helper,
|
||||||
|
@ -4909,10 +4833,7 @@ class InvocationSelector extends Selector {
|
||||||
InvocationSelector(ExpressionGeneratorHelper helper, Token token, this.name,
|
InvocationSelector(ExpressionGeneratorHelper helper, Token token, this.name,
|
||||||
this.typeArguments, this.arguments,
|
this.typeArguments, this.arguments,
|
||||||
{this.isPotentiallyConstant = false, this.isTypeArgumentsInForest = true})
|
{this.isPotentiallyConstant = false, this.isTypeArgumentsInForest = true})
|
||||||
: super(helper, token) {
|
: super(helper, token);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(arguments != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get _debugName => 'InvocationSelector';
|
String get _debugName => 'InvocationSelector';
|
||||||
|
|
|
@ -32,8 +32,6 @@ class Forest {
|
||||||
List<NamedExpression>? named,
|
List<NamedExpression>? named,
|
||||||
bool hasExplicitTypeArguments = true,
|
bool hasExplicitTypeArguments = true,
|
||||||
List<Object?>? argumentsOriginalOrder}) {
|
List<Object?>? argumentsOriginalOrder}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
if (!hasExplicitTypeArguments) {
|
if (!hasExplicitTypeArguments) {
|
||||||
ArgumentsImpl arguments = new ArgumentsImpl(positional,
|
ArgumentsImpl arguments = new ArgumentsImpl(positional,
|
||||||
types: <DartType>[],
|
types: <DartType>[],
|
||||||
|
@ -61,8 +59,6 @@ class Forest {
|
||||||
List<Expression> positionalArguments = const <Expression>[],
|
List<Expression> positionalArguments = const <Expression>[],
|
||||||
List<NamedExpression> namedArguments = const <NamedExpression>[],
|
List<NamedExpression> namedArguments = const <NamedExpression>[],
|
||||||
List<Object?>? argumentsOriginalOrder}) {
|
List<Object?>? argumentsOriginalOrder}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new ArgumentsImpl.forExtensionMethod(
|
return new ArgumentsImpl.forExtensionMethod(
|
||||||
extensionTypeParameterCount, typeParameterCount, receiver,
|
extensionTypeParameterCount, typeParameterCount, receiver,
|
||||||
extensionTypeArguments: extensionTypeArguments,
|
extensionTypeArguments: extensionTypeArguments,
|
||||||
|
@ -75,8 +71,6 @@ class Forest {
|
||||||
}
|
}
|
||||||
|
|
||||||
ArgumentsImpl createArgumentsEmpty(int fileOffset) {
|
ArgumentsImpl createArgumentsEmpty(int fileOffset) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return createArguments(fileOffset, <Expression>[]);
|
return createArguments(fileOffset, <Expression>[]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,30 +94,22 @@ class Forest {
|
||||||
/// Return a representation of a boolean literal at the given [fileOffset].
|
/// Return a representation of a boolean literal at the given [fileOffset].
|
||||||
/// The literal has the given [value].
|
/// The literal has the given [value].
|
||||||
BoolLiteral createBoolLiteral(int fileOffset, bool value) {
|
BoolLiteral createBoolLiteral(int fileOffset, bool value) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new BoolLiteral(value)..fileOffset = fileOffset;
|
return new BoolLiteral(value)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a representation of a double literal at the given [fileOffset]. The
|
/// Return a representation of a double literal at the given [fileOffset]. The
|
||||||
/// literal has the given [value].
|
/// literal has the given [value].
|
||||||
DoubleLiteral createDoubleLiteral(int fileOffset, double value) {
|
DoubleLiteral createDoubleLiteral(int fileOffset, double value) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new DoubleLiteral(value)..fileOffset = fileOffset;
|
return new DoubleLiteral(value)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a representation of an integer literal at the given [fileOffset].
|
/// Return a representation of an integer literal at the given [fileOffset].
|
||||||
/// The literal has the given [value].
|
/// The literal has the given [value].
|
||||||
IntLiteral createIntLiteral(int fileOffset, int value, [String? literal]) {
|
IntLiteral createIntLiteral(int fileOffset, int value, [String? literal]) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new IntJudgment(value, literal)..fileOffset = fileOffset;
|
return new IntJudgment(value, literal)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntLiteral createIntLiteralLarge(int fileOffset, String literal) {
|
IntLiteral createIntLiteralLarge(int fileOffset, String literal) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new ShadowLargeIntLiteral(literal, fileOffset);
|
return new ShadowLargeIntLiteral(literal, fileOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,10 +123,6 @@ class Forest {
|
||||||
ListLiteral createListLiteral(
|
ListLiteral createListLiteral(
|
||||||
int fileOffset, DartType typeArgument, List<Expression> expressions,
|
int fileOffset, DartType typeArgument, List<Expression> expressions,
|
||||||
{required bool isConst}) {
|
{required bool isConst}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isConst != null);
|
|
||||||
return new ListLiteral(expressions,
|
return new ListLiteral(expressions,
|
||||||
typeArgument: typeArgument, isConst: isConst)
|
typeArgument: typeArgument, isConst: isConst)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
|
@ -156,10 +138,6 @@ class Forest {
|
||||||
SetLiteral createSetLiteral(
|
SetLiteral createSetLiteral(
|
||||||
int fileOffset, DartType typeArgument, List<Expression> expressions,
|
int fileOffset, DartType typeArgument, List<Expression> expressions,
|
||||||
{required bool isConst}) {
|
{required bool isConst}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isConst != null);
|
|
||||||
return new SetLiteral(expressions,
|
return new SetLiteral(expressions,
|
||||||
typeArgument: typeArgument, isConst: isConst)
|
typeArgument: typeArgument, isConst: isConst)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
|
@ -177,10 +155,6 @@ class Forest {
|
||||||
MapLiteral createMapLiteral(int fileOffset, DartType keyType,
|
MapLiteral createMapLiteral(int fileOffset, DartType keyType,
|
||||||
DartType valueType, List<MapLiteralEntry> entries,
|
DartType valueType, List<MapLiteralEntry> entries,
|
||||||
{required bool isConst}) {
|
{required bool isConst}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isConst != null);
|
|
||||||
return new MapLiteral(entries,
|
return new MapLiteral(entries,
|
||||||
keyType: keyType, valueType: valueType, isConst: isConst)
|
keyType: keyType, valueType: valueType, isConst: isConst)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
|
@ -188,8 +162,6 @@ class Forest {
|
||||||
|
|
||||||
/// Return a representation of a null literal at the given [fileOffset].
|
/// Return a representation of a null literal at the given [fileOffset].
|
||||||
NullLiteral createNullLiteral(int fileOffset) {
|
NullLiteral createNullLiteral(int fileOffset) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new NullLiteral()..fileOffset = fileOffset;
|
return new NullLiteral()..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,22 +169,16 @@ class Forest {
|
||||||
/// [fileOffset]. The literal has the given [value]. This does not include
|
/// [fileOffset]. The literal has the given [value]. This does not include
|
||||||
/// either adjacent strings or interpolated strings.
|
/// either adjacent strings or interpolated strings.
|
||||||
StringLiteral createStringLiteral(int fileOffset, String value) {
|
StringLiteral createStringLiteral(int fileOffset, String value) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new StringLiteral(value)..fileOffset = fileOffset;
|
return new StringLiteral(value)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a representation of a symbol literal defined by [value] at the
|
/// Return a representation of a symbol literal defined by [value] at the
|
||||||
/// given [fileOffset].
|
/// given [fileOffset].
|
||||||
SymbolLiteral createSymbolLiteral(int fileOffset, String value) {
|
SymbolLiteral createSymbolLiteral(int fileOffset, String value) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new SymbolLiteral(value)..fileOffset = fileOffset;
|
return new SymbolLiteral(value)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeLiteral createTypeLiteral(int fileOffset, DartType type) {
|
TypeLiteral createTypeLiteral(int fileOffset, DartType type) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new TypeLiteral(type)..fileOffset = fileOffset;
|
return new TypeLiteral(type)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,32 +188,22 @@ class Forest {
|
||||||
/// to compute the value.
|
/// to compute the value.
|
||||||
MapLiteralEntry createMapEntry(
|
MapLiteralEntry createMapEntry(
|
||||||
int fileOffset, Expression key, Expression value) {
|
int fileOffset, Expression key, Expression value) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new MapLiteralEntry(key, value)..fileOffset = fileOffset;
|
return new MapLiteralEntry(key, value)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadLibrary createLoadLibrary(
|
LoadLibrary createLoadLibrary(
|
||||||
int fileOffset, LibraryDependency dependency, Arguments? arguments) {
|
int fileOffset, LibraryDependency dependency, Arguments? arguments) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new LoadLibraryImpl(dependency, arguments)..fileOffset = fileOffset;
|
return new LoadLibraryImpl(dependency, arguments)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression checkLibraryIsLoaded(
|
Expression checkLibraryIsLoaded(
|
||||||
int fileOffset, LibraryDependency dependency) {
|
int fileOffset, LibraryDependency dependency) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new CheckLibraryIsLoaded(dependency)..fileOffset = fileOffset;
|
return new CheckLibraryIsLoaded(dependency)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression createAsExpression(
|
Expression createAsExpression(
|
||||||
int fileOffset, Expression expression, DartType type,
|
int fileOffset, Expression expression, DartType type,
|
||||||
{required bool forNonNullableByDefault, bool forDynamic = false}) {
|
{required bool forNonNullableByDefault, bool forDynamic = false}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forNonNullableByDefault != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new AsExpression(expression, type)
|
return new AsExpression(expression, type)
|
||||||
..fileOffset = fileOffset
|
..fileOffset = fileOffset
|
||||||
..isForNonNullableByDefault = forNonNullableByDefault
|
..isForNonNullableByDefault = forNonNullableByDefault
|
||||||
|
@ -256,10 +212,6 @@ class Forest {
|
||||||
|
|
||||||
Expression createSpreadElement(int fileOffset, Expression expression,
|
Expression createSpreadElement(int fileOffset, Expression expression,
|
||||||
{required bool isNullAware}) {
|
{required bool isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null);
|
|
||||||
return new SpreadElement(expression, isNullAware: isNullAware)
|
return new SpreadElement(expression, isNullAware: isNullAware)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
@ -267,8 +219,6 @@ class Forest {
|
||||||
Expression createIfElement(
|
Expression createIfElement(
|
||||||
int fileOffset, Expression condition, Expression then,
|
int fileOffset, Expression condition, Expression then,
|
||||||
[Expression? otherwise]) {
|
[Expression? otherwise]) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new IfElement(condition, then, otherwise)..fileOffset = fileOffset;
|
return new IfElement(condition, then, otherwise)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,8 +228,6 @@ class Forest {
|
||||||
required PatternGuard patternGuard,
|
required PatternGuard patternGuard,
|
||||||
required Expression then,
|
required Expression then,
|
||||||
Expression? otherwise}) {
|
Expression? otherwise}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new IfCaseElement(
|
return new IfCaseElement(
|
||||||
prelude: prelude,
|
prelude: prelude,
|
||||||
expression: expression,
|
expression: expression,
|
||||||
|
@ -292,8 +240,6 @@ class Forest {
|
||||||
MapLiteralEntry createIfMapEntry(
|
MapLiteralEntry createIfMapEntry(
|
||||||
int fileOffset, Expression condition, MapLiteralEntry then,
|
int fileOffset, Expression condition, MapLiteralEntry then,
|
||||||
[MapLiteralEntry? otherwise]) {
|
[MapLiteralEntry? otherwise]) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new IfMapEntry(condition, then, otherwise)..fileOffset = fileOffset;
|
return new IfMapEntry(condition, then, otherwise)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,8 +249,6 @@ class Forest {
|
||||||
required PatternGuard patternGuard,
|
required PatternGuard patternGuard,
|
||||||
required MapLiteralEntry then,
|
required MapLiteralEntry then,
|
||||||
MapLiteralEntry? otherwise}) {
|
MapLiteralEntry? otherwise}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new IfCaseMapEntry(
|
return new IfCaseMapEntry(
|
||||||
prelude: prelude,
|
prelude: prelude,
|
||||||
expression: expression,
|
expression: expression,
|
||||||
|
@ -320,8 +264,6 @@ class Forest {
|
||||||
Expression? condition,
|
Expression? condition,
|
||||||
List<Expression> updates,
|
List<Expression> updates,
|
||||||
Expression body) {
|
Expression body) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new ForElement(variables, condition, updates, body)
|
return new ForElement(variables, condition, updates, body)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
@ -333,8 +275,6 @@ class Forest {
|
||||||
required Expression? condition,
|
required Expression? condition,
|
||||||
required List<Expression> updates,
|
required List<Expression> updates,
|
||||||
required Expression body}) {
|
required Expression body}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new PatternForElement(
|
return new PatternForElement(
|
||||||
patternVariableDeclaration: patternVariableDeclaration,
|
patternVariableDeclaration: patternVariableDeclaration,
|
||||||
intermediateVariables: intermediateVariables,
|
intermediateVariables: intermediateVariables,
|
||||||
|
@ -351,8 +291,6 @@ class Forest {
|
||||||
Expression? condition,
|
Expression? condition,
|
||||||
List<Expression> updates,
|
List<Expression> updates,
|
||||||
MapLiteralEntry body) {
|
MapLiteralEntry body) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new ForMapEntry(variables, condition, updates, body)
|
return new ForMapEntry(variables, condition, updates, body)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
@ -364,8 +302,6 @@ class Forest {
|
||||||
required Expression? condition,
|
required Expression? condition,
|
||||||
required List<Expression> updates,
|
required List<Expression> updates,
|
||||||
required MapLiteralEntry body}) {
|
required MapLiteralEntry body}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new PatternForMapEntry(
|
return new PatternForMapEntry(
|
||||||
patternVariableDeclaration: patternVariableDeclaration,
|
patternVariableDeclaration: patternVariableDeclaration,
|
||||||
intermediateVariables: intermediateVariables,
|
intermediateVariables: intermediateVariables,
|
||||||
|
@ -385,8 +321,6 @@ class Forest {
|
||||||
Expression body,
|
Expression body,
|
||||||
Expression? problem,
|
Expression? problem,
|
||||||
{bool isAsync = false}) {
|
{bool isAsync = false}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new ForInElement(variable, iterable, synthesizedAssignment,
|
return new ForInElement(variable, iterable, synthesizedAssignment,
|
||||||
expressionEffects, body, problem,
|
expressionEffects, body, problem,
|
||||||
isAsync: isAsync)
|
isAsync: isAsync)
|
||||||
|
@ -402,8 +336,6 @@ class Forest {
|
||||||
MapLiteralEntry body,
|
MapLiteralEntry body,
|
||||||
Expression? problem,
|
Expression? problem,
|
||||||
{bool isAsync = false}) {
|
{bool isAsync = false}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new ForInMapEntry(variable, iterable, synthesizedAssignment,
|
return new ForInMapEntry(variable, iterable, synthesizedAssignment,
|
||||||
expressionEffects, body, problem,
|
expressionEffects, body, problem,
|
||||||
isAsync: isAsync)
|
isAsync: isAsync)
|
||||||
|
@ -414,16 +346,12 @@ class Forest {
|
||||||
/// initializer list.
|
/// initializer list.
|
||||||
AssertInitializer createAssertInitializer(
|
AssertInitializer createAssertInitializer(
|
||||||
int fileOffset, AssertStatement assertStatement) {
|
int fileOffset, AssertStatement assertStatement) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new AssertInitializer(assertStatement)..fileOffset = fileOffset;
|
return new AssertInitializer(assertStatement)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a representation of an assert that appears as a statement.
|
/// Return a representation of an assert that appears as a statement.
|
||||||
AssertStatement createAssertStatement(int fileOffset, Expression condition,
|
AssertStatement createAssertStatement(int fileOffset, Expression condition,
|
||||||
Expression? message, int conditionStartOffset, int conditionEndOffset) {
|
Expression? message, int conditionStartOffset, int conditionEndOffset) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new AssertStatement(condition,
|
return new AssertStatement(condition,
|
||||||
conditionStartOffset: conditionStartOffset,
|
conditionStartOffset: conditionStartOffset,
|
||||||
conditionEndOffset: conditionEndOffset,
|
conditionEndOffset: conditionEndOffset,
|
||||||
|
@ -432,8 +360,6 @@ class Forest {
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression createAwaitExpression(int fileOffset, Expression operand) {
|
Expression createAwaitExpression(int fileOffset, Expression operand) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new AwaitExpression(operand)..fileOffset = fileOffset;
|
return new AwaitExpression(operand)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,8 +367,6 @@ class Forest {
|
||||||
/// [fileOffset].
|
/// [fileOffset].
|
||||||
Block createBlock(
|
Block createBlock(
|
||||||
int fileOffset, int fileEndOffset, List<Statement> statements) {
|
int fileOffset, int fileEndOffset, List<Statement> statements) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
List<Statement>? copy;
|
List<Statement>? copy;
|
||||||
for (int i = 0; i < statements.length; i++) {
|
for (int i = 0; i < statements.length; i++) {
|
||||||
Statement statement = statements[i];
|
Statement statement = statements[i];
|
||||||
|
@ -460,8 +384,6 @@ class Forest {
|
||||||
|
|
||||||
/// Return a representation of a break statement.
|
/// Return a representation of a break statement.
|
||||||
Statement createBreakStatement(int fileOffset, Object? label) {
|
Statement createBreakStatement(int fileOffset, Object? label) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
// TODO(johnniwinther): Use [label]?
|
// TODO(johnniwinther): Use [label]?
|
||||||
return new BreakStatementImpl(isContinue: false)
|
return new BreakStatementImpl(isContinue: false)
|
||||||
..fileOffset = fileOffset
|
..fileOffset = fileOffset
|
||||||
|
@ -476,8 +398,6 @@ class Forest {
|
||||||
VariableDeclaration? stackTraceParameter,
|
VariableDeclaration? stackTraceParameter,
|
||||||
DartType stackTraceType,
|
DartType stackTraceType,
|
||||||
Statement body) {
|
Statement body) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new Catch(exceptionParameter, body,
|
return new Catch(exceptionParameter, body,
|
||||||
guard: exceptionType, stackTrace: stackTraceParameter)
|
guard: exceptionType, stackTrace: stackTraceParameter)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
|
@ -499,8 +419,6 @@ class Forest {
|
||||||
|
|
||||||
/// Return a representation of a continue statement.
|
/// Return a representation of a continue statement.
|
||||||
Statement createContinueStatement(int fileOffset, Object? label) {
|
Statement createContinueStatement(int fileOffset, Object? label) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
// TODO(johnniwinther): Use [label]?
|
// TODO(johnniwinther): Use [label]?
|
||||||
return new BreakStatementImpl(isContinue: true)..fileOffset = fileOffset;
|
return new BreakStatementImpl(isContinue: true)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
@ -508,23 +426,17 @@ class Forest {
|
||||||
/// Return a representation of a do statement.
|
/// Return a representation of a do statement.
|
||||||
Statement createDoStatement(
|
Statement createDoStatement(
|
||||||
int fileOffset, Statement body, Expression condition) {
|
int fileOffset, Statement body, Expression condition) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new DoStatement(body, condition)..fileOffset = fileOffset;
|
return new DoStatement(body, condition)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a representation of an expression statement at the given
|
/// Return a representation of an expression statement at the given
|
||||||
/// [fileOffset] containing the [expression].
|
/// [fileOffset] containing the [expression].
|
||||||
Statement createExpressionStatement(int fileOffset, Expression expression) {
|
Statement createExpressionStatement(int fileOffset, Expression expression) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new ExpressionStatement(expression)..fileOffset = fileOffset;
|
return new ExpressionStatement(expression)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a representation of an empty statement at the given [fileOffset].
|
/// Return a representation of an empty statement at the given [fileOffset].
|
||||||
Statement createEmptyStatement(int fileOffset) {
|
Statement createEmptyStatement(int fileOffset) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new EmptyStatement()..fileOffset = fileOffset;
|
return new EmptyStatement()..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,8 +447,6 @@ class Forest {
|
||||||
Expression? condition,
|
Expression? condition,
|
||||||
List<Expression> updaters,
|
List<Expression> updaters,
|
||||||
Statement body) {
|
Statement body) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new ForStatement(variables ?? [], condition, updaters, body)
|
return new ForStatement(variables ?? [], condition, updaters, body)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
@ -544,8 +454,6 @@ class Forest {
|
||||||
/// Return a representation of an `if` statement.
|
/// Return a representation of an `if` statement.
|
||||||
Statement createIfStatement(int fileOffset, Expression condition,
|
Statement createIfStatement(int fileOffset, Expression condition,
|
||||||
Statement thenStatement, Statement? elseStatement) {
|
Statement thenStatement, Statement? elseStatement) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new IfStatement(condition, thenStatement, elseStatement)
|
return new IfStatement(condition, thenStatement, elseStatement)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
@ -553,8 +461,6 @@ class Forest {
|
||||||
/// Return a representation of a `switch` statement.
|
/// Return a representation of a `switch` statement.
|
||||||
Statement createSwitchStatement(
|
Statement createSwitchStatement(
|
||||||
int fileOffset, Expression expression, List<SwitchCase> cases) {
|
int fileOffset, Expression expression, List<SwitchCase> cases) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new SwitchStatement(expression, cases)..fileOffset = fileOffset;
|
return new SwitchStatement(expression, cases)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,10 +471,6 @@ class Forest {
|
||||||
Expression createIsExpression(
|
Expression createIsExpression(
|
||||||
int fileOffset, Expression operand, DartType type,
|
int fileOffset, Expression operand, DartType type,
|
||||||
{required bool forNonNullableByDefault, int? notFileOffset}) {
|
{required bool forNonNullableByDefault, int? notFileOffset}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forNonNullableByDefault != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
Expression result = new IsExpression(operand, type)
|
Expression result = new IsExpression(operand, type)
|
||||||
..fileOffset = fileOffset
|
..fileOffset = fileOffset
|
||||||
..isForNonNullableByDefault = forNonNullableByDefault;
|
..isForNonNullableByDefault = forNonNullableByDefault;
|
||||||
|
@ -583,8 +485,6 @@ class Forest {
|
||||||
/// (either `&&` or `||`).
|
/// (either `&&` or `||`).
|
||||||
Expression createLogicalExpression(int fileOffset, Expression leftOperand,
|
Expression createLogicalExpression(int fileOffset, Expression leftOperand,
|
||||||
String operatorString, Expression rightOperand) {
|
String operatorString, Expression rightOperand) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
LogicalExpressionOperator operator;
|
LogicalExpressionOperator operator;
|
||||||
if (operatorString == '&&') {
|
if (operatorString == '&&') {
|
||||||
operator = LogicalExpressionOperator.AND;
|
operator = LogicalExpressionOperator.AND;
|
||||||
|
@ -600,8 +500,6 @@ class Forest {
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression createNot(int fileOffset, Expression operand) {
|
Expression createNot(int fileOffset, Expression operand) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new Not(operand)..fileOffset = fileOffset;
|
return new Not(operand)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,10 +507,6 @@ class Forest {
|
||||||
/// rethrow at [rethrowFileOffset] and the statement at [statementFileOffset].
|
/// rethrow at [rethrowFileOffset] and the statement at [statementFileOffset].
|
||||||
Statement createRethrowStatement(
|
Statement createRethrowStatement(
|
||||||
int rethrowFileOffset, int statementFileOffset) {
|
int rethrowFileOffset, int statementFileOffset) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(rethrowFileOffset != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(statementFileOffset != null);
|
|
||||||
return new ExpressionStatement(
|
return new ExpressionStatement(
|
||||||
new Rethrow()..fileOffset = rethrowFileOffset)
|
new Rethrow()..fileOffset = rethrowFileOffset)
|
||||||
..fileOffset = statementFileOffset;
|
..fileOffset = statementFileOffset;
|
||||||
|
@ -621,16 +515,12 @@ class Forest {
|
||||||
/// Return a representation of a return statement.
|
/// Return a representation of a return statement.
|
||||||
Statement createReturnStatement(int fileOffset, Expression? expression,
|
Statement createReturnStatement(int fileOffset, Expression? expression,
|
||||||
{bool isArrow = true}) {
|
{bool isArrow = true}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new ReturnStatementImpl(isArrow, expression)
|
return new ReturnStatementImpl(isArrow, expression)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression createStringConcatenation(
|
Expression createStringConcatenation(
|
||||||
int fileOffset, List<Expression> expressions) {
|
int fileOffset, List<Expression> expressions) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
return new StringConcatenation(expressions)..fileOffset = fileOffset;
|
return new StringConcatenation(expressions)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
@ -643,15 +533,11 @@ class Forest {
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression createThisExpression(int fileOffset) {
|
Expression createThisExpression(int fileOffset) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new ThisExpression()..fileOffset = fileOffset;
|
return new ThisExpression()..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a representation of a throw expression at the given [fileOffset].
|
/// Return a representation of a throw expression at the given [fileOffset].
|
||||||
Expression createThrow(int fileOffset, Expression expression) {
|
Expression createThrow(int fileOffset, Expression expression) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new Throw(expression)..fileOffset = fileOffset;
|
return new Throw(expression)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -659,8 +545,6 @@ class Forest {
|
||||||
|
|
||||||
Statement createTryStatement(int fileOffset, Statement tryBlock,
|
Statement createTryStatement(int fileOffset, Statement tryBlock,
|
||||||
List<Catch>? catchBlocks, Statement? finallyBlock) {
|
List<Catch>? catchBlocks, Statement? finallyBlock) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new TryStatement(tryBlock, catchBlocks ?? <Catch>[], finallyBlock)
|
return new TryStatement(tryBlock, catchBlocks ?? <Catch>[], finallyBlock)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
@ -692,8 +576,6 @@ class Forest {
|
||||||
/// consisting of the given [condition] and [body].
|
/// consisting of the given [condition] and [body].
|
||||||
Statement createWhileStatement(
|
Statement createWhileStatement(
|
||||||
int fileOffset, Expression condition, Statement body) {
|
int fileOffset, Expression condition, Statement body) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new WhileStatement(condition, body)..fileOffset = fileOffset;
|
return new WhileStatement(condition, body)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,10 +584,6 @@ class Forest {
|
||||||
/// statement is a yield* statement.
|
/// statement is a yield* statement.
|
||||||
Statement createYieldStatement(int fileOffset, Expression expression,
|
Statement createYieldStatement(int fileOffset, Expression expression,
|
||||||
{required bool isYieldStar}) {
|
{required bool isYieldStar}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isYieldStar != null);
|
|
||||||
return new YieldStatement(expression, isYieldStar: isYieldStar)
|
return new YieldStatement(expression, isYieldStar: isYieldStar)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
@ -741,8 +619,6 @@ class Forest {
|
||||||
bool isCovariantByDeclaration = false,
|
bool isCovariantByDeclaration = false,
|
||||||
bool isLocalFunction = false,
|
bool isLocalFunction = false,
|
||||||
bool isSynthesized = false}) {
|
bool isSynthesized = false}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new VariableDeclarationImpl(name,
|
return new VariableDeclarationImpl(name,
|
||||||
type: type,
|
type: type,
|
||||||
initializer: initializer,
|
initializer: initializer,
|
||||||
|
@ -778,8 +654,6 @@ class Forest {
|
||||||
DartType returnType = const DynamicType(),
|
DartType returnType = const DynamicType(),
|
||||||
AsyncMarker asyncMarker = AsyncMarker.Sync,
|
AsyncMarker asyncMarker = AsyncMarker.Sync,
|
||||||
AsyncMarker? dartAsyncMarker}) {
|
AsyncMarker? dartAsyncMarker}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new FunctionNode(body,
|
return new FunctionNode(body,
|
||||||
typeParameters: typeParameters,
|
typeParameters: typeParameters,
|
||||||
positionalParameters: positionalParameters,
|
positionalParameters: positionalParameters,
|
||||||
|
@ -807,66 +681,48 @@ class Forest {
|
||||||
|
|
||||||
FunctionExpression createFunctionExpression(
|
FunctionExpression createFunctionExpression(
|
||||||
int fileOffset, FunctionNode function) {
|
int fileOffset, FunctionNode function) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new FunctionExpression(function)..fileOffset = fileOffset;
|
return new FunctionExpression(function)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression createExpressionInvocation(
|
Expression createExpressionInvocation(
|
||||||
int fileOffset, Expression expression, Arguments arguments) {
|
int fileOffset, Expression expression, Arguments arguments) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new ExpressionInvocation(expression, arguments)
|
return new ExpressionInvocation(expression, arguments)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression createMethodInvocation(
|
Expression createMethodInvocation(
|
||||||
int fileOffset, Expression expression, Name name, Arguments arguments) {
|
int fileOffset, Expression expression, Name name, Arguments arguments) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new MethodInvocation(expression, name, arguments)
|
return new MethodInvocation(expression, name, arguments)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
NamedExpression createNamedExpression(
|
NamedExpression createNamedExpression(
|
||||||
int fileOffset, String name, Expression expression) {
|
int fileOffset, String name, Expression expression) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new NamedExpression(name, expression)..fileOffset = fileOffset;
|
return new NamedExpression(name, expression)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticInvocation createStaticInvocation(
|
StaticInvocation createStaticInvocation(
|
||||||
int fileOffset, Procedure procedure, Arguments arguments) {
|
int fileOffset, Procedure procedure, Arguments arguments) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new StaticInvocation(procedure, arguments)..fileOffset = fileOffset;
|
return new StaticInvocation(procedure, arguments)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
SuperMethodInvocation createSuperMethodInvocation(
|
SuperMethodInvocation createSuperMethodInvocation(
|
||||||
int fileOffset, Name name, Procedure procedure, Arguments arguments) {
|
int fileOffset, Name name, Procedure procedure, Arguments arguments) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new SuperMethodInvocation(name, arguments, procedure)
|
return new SuperMethodInvocation(name, arguments, procedure)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
NullCheck createNullCheck(int fileOffset, Expression expression) {
|
NullCheck createNullCheck(int fileOffset, Expression expression) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new NullCheck(expression)..fileOffset = fileOffset;
|
return new NullCheck(expression)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression createPropertyGet(int fileOffset, Expression receiver, Name name) {
|
Expression createPropertyGet(int fileOffset, Expression receiver, Name name) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new PropertyGet(receiver, name)..fileOffset = fileOffset;
|
return new PropertyGet(receiver, name)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
Expression createPropertySet(
|
Expression createPropertySet(
|
||||||
int fileOffset, Expression receiver, Name name, Expression value,
|
int fileOffset, Expression receiver, Name name, Expression value,
|
||||||
{required bool forEffect, bool readOnlyReceiver = false}) {
|
{required bool forEffect, bool readOnlyReceiver = false}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new PropertySet(receiver, name, value,
|
return new PropertySet(receiver, name, value,
|
||||||
forEffect: forEffect, readOnlyReceiver: readOnlyReceiver)
|
forEffect: forEffect, readOnlyReceiver: readOnlyReceiver)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
|
@ -874,25 +730,17 @@ class Forest {
|
||||||
|
|
||||||
IndexGet createIndexGet(
|
IndexGet createIndexGet(
|
||||||
int fileOffset, Expression receiver, Expression index) {
|
int fileOffset, Expression receiver, Expression index) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new IndexGet(receiver, index)..fileOffset = fileOffset;
|
return new IndexGet(receiver, index)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
IndexSet createIndexSet(
|
IndexSet createIndexSet(
|
||||||
int fileOffset, Expression receiver, Expression index, Expression value,
|
int fileOffset, Expression receiver, Expression index, Expression value,
|
||||||
{required bool forEffect}) {
|
{required bool forEffect}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null);
|
|
||||||
return new IndexSet(receiver, index, value, forEffect: forEffect)
|
return new IndexSet(receiver, index, value, forEffect: forEffect)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
VariableGet createVariableGet(int fileOffset, VariableDeclaration variable) {
|
VariableGet createVariableGet(int fileOffset, VariableDeclaration variable) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new VariableGetImpl(variable, forNullGuardedAccess: false)
|
return new VariableGetImpl(variable, forNullGuardedAccess: false)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
@ -900,47 +748,33 @@ class Forest {
|
||||||
EqualsExpression createEquals(
|
EqualsExpression createEquals(
|
||||||
int fileOffset, Expression left, Expression right,
|
int fileOffset, Expression left, Expression right,
|
||||||
{required bool isNot}) {
|
{required bool isNot}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNot != null);
|
|
||||||
return new EqualsExpression(left, right, isNot: isNot)
|
return new EqualsExpression(left, right, isNot: isNot)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
BinaryExpression createBinary(
|
BinaryExpression createBinary(
|
||||||
int fileOffset, Expression left, Name binaryName, Expression right) {
|
int fileOffset, Expression left, Name binaryName, Expression right) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new BinaryExpression(left, binaryName, right)
|
return new BinaryExpression(left, binaryName, right)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnaryExpression createUnary(
|
UnaryExpression createUnary(
|
||||||
int fileOffset, Name unaryName, Expression expression) {
|
int fileOffset, Name unaryName, Expression expression) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new UnaryExpression(unaryName, expression)..fileOffset = fileOffset;
|
return new UnaryExpression(unaryName, expression)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParenthesizedExpression createParenthesized(
|
ParenthesizedExpression createParenthesized(
|
||||||
int fileOffset, Expression expression) {
|
int fileOffset, Expression expression) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new ParenthesizedExpression(expression)..fileOffset = fileOffset;
|
return new ParenthesizedExpression(expression)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstructorTearOff createConstructorTearOff(int fileOffset, Member target) {
|
ConstructorTearOff createConstructorTearOff(int fileOffset, Member target) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(target is Constructor || (target is Procedure && target.isFactory),
|
assert(target is Constructor || (target is Procedure && target.isFactory),
|
||||||
"Unexpected constructor tear off target: $target");
|
"Unexpected constructor tear off target: $target");
|
||||||
return new ConstructorTearOff(target)..fileOffset = fileOffset;
|
return new ConstructorTearOff(target)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticTearOff createStaticTearOff(int fileOffset, Procedure procedure) {
|
StaticTearOff createStaticTearOff(int fileOffset, Procedure procedure) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(procedure.kind == ProcedureKind.Method,
|
assert(procedure.kind == ProcedureKind.Method,
|
||||||
"Unexpected static tear off target: $procedure");
|
"Unexpected static tear off target: $procedure");
|
||||||
assert(!procedure.isRedirectingFactory,
|
assert(!procedure.isRedirectingFactory,
|
||||||
|
@ -949,24 +783,18 @@ class Forest {
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticGet createStaticGet(int fileOffset, Member target) {
|
StaticGet createStaticGet(int fileOffset, Member target) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(target is Field || (target is Procedure && target.isGetter));
|
assert(target is Field || (target is Procedure && target.isGetter));
|
||||||
return new StaticGet(target)..fileOffset = fileOffset;
|
return new StaticGet(target)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
RedirectingFactoryTearOff createRedirectingFactoryTearOff(
|
RedirectingFactoryTearOff createRedirectingFactoryTearOff(
|
||||||
int fileOffset, Procedure procedure) {
|
int fileOffset, Procedure procedure) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(procedure.isRedirectingFactory);
|
assert(procedure.isRedirectingFactory);
|
||||||
return new RedirectingFactoryTearOff(procedure)..fileOffset = fileOffset;
|
return new RedirectingFactoryTearOff(procedure)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
Instantiation createInstantiation(
|
Instantiation createInstantiation(
|
||||||
int fileOffset, Expression expression, List<DartType> typeArguments) {
|
int fileOffset, Expression expression, List<DartType> typeArguments) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new Instantiation(expression, typeArguments)
|
return new Instantiation(expression, typeArguments)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
@ -976,8 +804,6 @@ class Forest {
|
||||||
List<TypeParameter> typeParameters,
|
List<TypeParameter> typeParameters,
|
||||||
Expression expression,
|
Expression expression,
|
||||||
List<DartType> typeArguments) {
|
List<DartType> typeArguments) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
return new TypedefTearOff(typeParameters, expression, typeArguments)
|
return new TypedefTearOff(typeParameters, expression, typeArguments)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,8 +244,6 @@ class ForwardingNode {
|
||||||
void _createForwardingImplIfNeeded(FunctionNode function, Name name,
|
void _createForwardingImplIfNeeded(FunctionNode function, Name name,
|
||||||
Class enclosingClass, Member? superTarget,
|
Class enclosingClass, Member? superTarget,
|
||||||
{required bool isForwardingStub}) {
|
{required bool isForwardingStub}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isForwardingStub != null);
|
|
||||||
if (function.body != null) {
|
if (function.body != null) {
|
||||||
// There is already an implementation; nothing further needs to be done.
|
// There is already an implementation; nothing further needs to be done.
|
||||||
return;
|
return;
|
||||||
|
@ -268,9 +266,6 @@ class ForwardingNode {
|
||||||
bool isForwardingSemiStub = isForwardingStub && !procedure.isSynthetic;
|
bool isForwardingSemiStub = isForwardingStub && !procedure.isSynthetic;
|
||||||
bool needsSignatureType = false;
|
bool needsSignatureType = false;
|
||||||
Expression superCall;
|
Expression superCall;
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(superTarget != null,
|
|
||||||
"No super target found for '${name}' in ${enclosingClass}.");
|
|
||||||
assert(
|
assert(
|
||||||
!superTarget.isAbstract,
|
!superTarget.isAbstract,
|
||||||
"Abstract super target $superTarget found for '${name}' in "
|
"Abstract super target $superTarget found for '${name}' in "
|
||||||
|
|
|
@ -152,11 +152,7 @@ abstract class SynthesizedMember extends ClassMember {
|
||||||
final bool isProperty;
|
final bool isProperty;
|
||||||
|
|
||||||
SynthesizedMember(this.classBuilder, this.name,
|
SynthesizedMember(this.classBuilder, this.name,
|
||||||
{required this.forSetter, required this.isProperty})
|
{required this.forSetter, required this.isProperty});
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(forSetter != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isProperty != null);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<ClassMember> get declarations => throw new UnimplementedError();
|
List<ClassMember> get declarations => throw new UnimplementedError();
|
||||||
|
@ -508,11 +504,7 @@ class InheritedClassMemberImplementsInterface extends SynthesizedMember {
|
||||||
required this.implementedInterfaceMember,
|
required this.implementedInterfaceMember,
|
||||||
required bool isProperty,
|
required bool isProperty,
|
||||||
required bool forSetter})
|
required bool forSetter})
|
||||||
// ignore: unnecessary_null_comparison
|
: super(classBuilder, name, isProperty: isProperty, forSetter: forSetter);
|
||||||
: assert(inheritedClassMember != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(implementedInterfaceMember != null),
|
|
||||||
super(classBuilder, name, isProperty: isProperty, forSetter: forSetter);
|
|
||||||
|
|
||||||
void _ensureMemberAndCovariance(ClassMembersBuilder membersBuilder) {
|
void _ensureMemberAndCovariance(ClassMembersBuilder membersBuilder) {
|
||||||
if (_member == null) {
|
if (_member == null) {
|
||||||
|
|
|
@ -150,8 +150,6 @@ class ClassHierarchyBuilder
|
||||||
|
|
||||||
for (int i = 0; i < nodes2.length; i++) {
|
for (int i = 0; i < nodes2.length; i++) {
|
||||||
ClassHierarchyNode node = nodes2[i];
|
ClassHierarchyNode node = nodes2[i];
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (node == null) continue;
|
|
||||||
if (node.classBuilder.cls.isAnonymousMixin) {
|
if (node.classBuilder.cls.isAnonymousMixin) {
|
||||||
// Never find unnamed mixin application in least upper bound.
|
// Never find unnamed mixin application in least upper bound.
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -43,8 +43,6 @@ class ClassHierarchyNodeBuilder {
|
||||||
if (supernode == null) {
|
if (supernode == null) {
|
||||||
supernode = hierarchy.getNodeFromClassBuilder(objectClass);
|
supernode = hierarchy.getNodeFromClassBuilder(objectClass);
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(supernode != null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Supertype> superclasses;
|
List<Supertype> superclasses;
|
||||||
|
@ -157,11 +155,8 @@ class ClassHierarchyNodeBuilder {
|
||||||
for (Supertype superclass in superclasses) {
|
for (Supertype superclass in superclasses) {
|
||||||
recordSupertype(superclass);
|
recordSupertype(superclass);
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
for (Supertype superinterface in interfacesList) {
|
||||||
if (interfacesList != null) {
|
recordSupertype(superinterface);
|
||||||
for (Supertype superinterface in interfacesList) {
|
|
||||||
recordSupertype(superinterface);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ClassHierarchyNode(classBuilder, supernode, mixedInNode,
|
return new ClassHierarchyNode(classBuilder, supernode, mixedInNode,
|
||||||
|
@ -224,14 +219,10 @@ class ClassHierarchyNodeBuilder {
|
||||||
|
|
||||||
void addInterface(Map<Class, Supertype> interfaces,
|
void addInterface(Map<Class, Supertype> interfaces,
|
||||||
List<Supertype> superclasses, Supertype type) {
|
List<Supertype> superclasses, Supertype type) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (type == null) return null;
|
|
||||||
if (!classBuilder.libraryBuilder.isNonNullableByDefault) {
|
if (!classBuilder.libraryBuilder.isNonNullableByDefault) {
|
||||||
type = legacyErasureSupertype(type);
|
type = legacyErasureSupertype(type);
|
||||||
}
|
}
|
||||||
ClassHierarchyNode node = hierarchy.getNodeFromClass(type.classNode);
|
ClassHierarchyNode node = hierarchy.getNodeFromClass(type.classNode);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (node == null) return null;
|
|
||||||
int depth = node.depth;
|
int depth = node.depth;
|
||||||
int myDepth = superclasses.length;
|
int myDepth = superclasses.length;
|
||||||
Supertype? superclass = depth < myDepth ? superclasses[depth] : null;
|
Supertype? superclass = depth < myDepth ? superclasses[depth] : null;
|
||||||
|
|
|
@ -252,8 +252,6 @@ class ClassMembersNodeBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
void inferFrom(List<ClassMember> members, {required bool forSetter}) {
|
void inferFrom(List<ClassMember> members, {required bool forSetter}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forSetter != null);
|
|
||||||
CombinedClassMemberSignature combinedMemberSignature =
|
CombinedClassMemberSignature combinedMemberSignature =
|
||||||
new CombinedClassMemberSignature(
|
new CombinedClassMemberSignature(
|
||||||
membersBuilder, classBuilder, members,
|
membersBuilder, classBuilder, members,
|
||||||
|
@ -317,8 +315,6 @@ class ClassMembersNodeBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
void inferFrom(List<ClassMember> members, {required bool forSetter}) {
|
void inferFrom(List<ClassMember> members, {required bool forSetter}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forSetter != null);
|
|
||||||
CombinedClassMemberSignature combinedMemberSignature =
|
CombinedClassMemberSignature combinedMemberSignature =
|
||||||
new CombinedClassMemberSignature(
|
new CombinedClassMemberSignature(
|
||||||
membersBuilder, classBuilder, members,
|
membersBuilder, classBuilder, members,
|
||||||
|
@ -418,8 +414,6 @@ class ClassMembersNodeBuilder {
|
||||||
|
|
||||||
DartType? inferFrom(List<ClassMember> members,
|
DartType? inferFrom(List<ClassMember> members,
|
||||||
{required bool forSetter}) {
|
{required bool forSetter}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forSetter != null);
|
|
||||||
CombinedClassMemberSignature combinedMemberSignature =
|
CombinedClassMemberSignature combinedMemberSignature =
|
||||||
new CombinedClassMemberSignature(
|
new CombinedClassMemberSignature(
|
||||||
membersBuilder, classBuilder, members,
|
membersBuilder, classBuilder, members,
|
||||||
|
@ -917,8 +911,7 @@ class ClassMembersNodeBuilder {
|
||||||
"Only inherited members can implement by inheritance: "
|
"Only inherited members can implement by inheritance: "
|
||||||
"${inheritedMember}");
|
"${inheritedMember}");
|
||||||
inheritedImplementsMap[inheritedMember] = overrides;
|
inheritedImplementsMap[inheritedMember] = overrides;
|
||||||
// ignore: unnecessary_null_comparison
|
if (dataForTesting != null) {
|
||||||
if (dataForTesting != null && aliasForTesting != null) {
|
|
||||||
dataForTesting.aliasMap[aliasForTesting] = inheritedMember;
|
dataForTesting.aliasMap[aliasForTesting] = inheritedMember;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,11 +253,7 @@ class ForInStatementWithSynthesizedVariable extends InternalStatement {
|
||||||
|
|
||||||
ForInStatementWithSynthesizedVariable(this.variable, this.iterable,
|
ForInStatementWithSynthesizedVariable(this.variable, this.iterable,
|
||||||
this.syntheticAssignment, this.expressionEffects, this.body,
|
this.syntheticAssignment, this.expressionEffects, this.body,
|
||||||
{required this.isAsync, required this.hasProblem})
|
{required this.isAsync, required this.hasProblem}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(isAsync != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(hasProblem != null) {
|
|
||||||
variable?.parent = this;
|
variable?.parent = this;
|
||||||
iterable.parent = this;
|
iterable.parent = this;
|
||||||
syntheticAssignment?.parent = this;
|
syntheticAssignment?.parent = this;
|
||||||
|
@ -286,11 +282,7 @@ class TryStatement extends InternalStatement {
|
||||||
List<Catch> catchBlocks;
|
List<Catch> catchBlocks;
|
||||||
Statement? finallyBlock;
|
Statement? finallyBlock;
|
||||||
|
|
||||||
TryStatement(this.tryBlock, this.catchBlocks, this.finallyBlock)
|
TryStatement(this.tryBlock, this.catchBlocks, this.finallyBlock) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(tryBlock != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(catchBlocks != null) {
|
|
||||||
tryBlock.parent = this;
|
tryBlock.parent = this;
|
||||||
setParents(catchBlocks, this);
|
setParents(catchBlocks, this);
|
||||||
finallyBlock?.parent = this;
|
finallyBlock?.parent = this;
|
||||||
|
@ -328,9 +320,7 @@ class SwitchCaseImpl extends SwitchCase {
|
||||||
SwitchCaseImpl(this.caseOffsets, List<Expression> expressions,
|
SwitchCaseImpl(this.caseOffsets, List<Expression> expressions,
|
||||||
List<int> expressionOffsets, Statement body,
|
List<int> expressionOffsets, Statement body,
|
||||||
{bool isDefault = false, required this.hasLabel})
|
{bool isDefault = false, required this.hasLabel})
|
||||||
// ignore: unnecessary_null_comparison
|
: super(expressions, expressionOffsets, body, isDefault: isDefault);
|
||||||
: assert(hasLabel != null),
|
|
||||||
super(expressions, expressionOffsets, body, isDefault: isDefault);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
@ -342,10 +332,7 @@ class BreakStatementImpl extends BreakStatement {
|
||||||
Statement? targetStatement;
|
Statement? targetStatement;
|
||||||
final bool isContinue;
|
final bool isContinue;
|
||||||
|
|
||||||
BreakStatementImpl({required this.isContinue})
|
BreakStatementImpl({required this.isContinue}) : super(dummyLabeledStatement);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(isContinue != null),
|
|
||||||
super(dummyLabeledStatement);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
@ -599,11 +586,7 @@ class Cascade extends InternalExpression {
|
||||||
/// variable. Caller is responsible for ensuring that [variable]'s
|
/// variable. Caller is responsible for ensuring that [variable]'s
|
||||||
/// initializer is the expression preceding the first `..` of the cascade
|
/// initializer is the expression preceding the first `..` of the cascade
|
||||||
/// expression.
|
/// expression.
|
||||||
Cascade(this.variable, {required this.isNullAware})
|
Cascade(this.variable, {required this.isNullAware}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(variable != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNullAware != null) {
|
|
||||||
variable.parent = this;
|
variable.parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,11 +634,7 @@ class DeferredCheck extends InternalExpression {
|
||||||
VariableDeclaration variable;
|
VariableDeclaration variable;
|
||||||
Expression expression;
|
Expression expression;
|
||||||
|
|
||||||
DeferredCheck(this.variable, this.expression)
|
DeferredCheck(this.variable, this.expression) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(variable != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(expression != null) {
|
|
||||||
variable.parent = this;
|
variable.parent = this;
|
||||||
expression.parent = this;
|
expression.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -856,11 +835,7 @@ class IfNullExpression extends InternalExpression {
|
||||||
Expression left;
|
Expression left;
|
||||||
Expression right;
|
Expression right;
|
||||||
|
|
||||||
IfNullExpression(this.left, this.right)
|
IfNullExpression(this.left, this.right) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(left != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(right != null) {
|
|
||||||
left.parent = this;
|
left.parent = this;
|
||||||
right.parent = this;
|
right.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -995,9 +970,7 @@ class ShadowInvalidFieldInitializer extends LocalInitializer
|
||||||
|
|
||||||
ShadowInvalidFieldInitializer(
|
ShadowInvalidFieldInitializer(
|
||||||
this.field, this.value, VariableDeclaration variable)
|
this.field, this.value, VariableDeclaration variable)
|
||||||
// ignore: unnecessary_null_comparison
|
: super(variable) {
|
||||||
: assert(value != null),
|
|
||||||
super(variable) {
|
|
||||||
value.parent = this;
|
value.parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1016,11 +989,7 @@ class ExpressionInvocation extends InternalExpression {
|
||||||
Expression expression;
|
Expression expression;
|
||||||
Arguments arguments;
|
Arguments arguments;
|
||||||
|
|
||||||
ExpressionInvocation(this.expression, this.arguments)
|
ExpressionInvocation(this.expression, this.arguments) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(expression != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(arguments != null) {
|
|
||||||
expression.parent = this;
|
expression.parent = this;
|
||||||
arguments.parent = this;
|
arguments.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -1056,11 +1025,7 @@ class NullAwareMethodInvocation extends InternalExpression {
|
||||||
/// The expression that invokes the method on [variable].
|
/// The expression that invokes the method on [variable].
|
||||||
Expression invocation;
|
Expression invocation;
|
||||||
|
|
||||||
NullAwareMethodInvocation(this.variable, this.invocation)
|
NullAwareMethodInvocation(this.variable, this.invocation) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(variable != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(invocation != null) {
|
|
||||||
variable.parent = this;
|
variable.parent = this;
|
||||||
invocation.parent = this;
|
invocation.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -1121,11 +1086,7 @@ class NullAwarePropertyGet extends InternalExpression {
|
||||||
/// The expression that reads the property from [variable].
|
/// The expression that reads the property from [variable].
|
||||||
Expression read;
|
Expression read;
|
||||||
|
|
||||||
NullAwarePropertyGet(this.variable, this.read)
|
NullAwarePropertyGet(this.variable, this.read) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(variable != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(read != null) {
|
|
||||||
variable.parent = this;
|
variable.parent = this;
|
||||||
read.parent = this;
|
read.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -1174,11 +1135,7 @@ class NullAwarePropertySet extends InternalExpression {
|
||||||
/// The expression that writes the value to the property in [variable].
|
/// The expression that writes the value to the property in [variable].
|
||||||
Expression write;
|
Expression write;
|
||||||
|
|
||||||
NullAwarePropertySet(this.variable, this.write)
|
NullAwarePropertySet(this.variable, this.write) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(variable != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(write != null) {
|
|
||||||
variable.parent = this;
|
variable.parent = this;
|
||||||
write.parent = this;
|
write.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -1390,9 +1347,7 @@ class VariableGetImpl extends VariableGet {
|
||||||
|
|
||||||
VariableGetImpl(VariableDeclaration variable,
|
VariableGetImpl(VariableDeclaration variable,
|
||||||
{required this.forNullGuardedAccess})
|
{required this.forNullGuardedAccess})
|
||||||
// ignore: unnecessary_null_comparison
|
: super(variable);
|
||||||
: assert(forNullGuardedAccess != null),
|
|
||||||
super(variable);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
|
@ -1481,17 +1436,7 @@ class IfNullPropertySet extends InternalExpression {
|
||||||
IfNullPropertySet(this.receiver, this.propertyName, this.rhs,
|
IfNullPropertySet(this.receiver, this.propertyName, this.rhs,
|
||||||
{required this.forEffect,
|
{required this.forEffect,
|
||||||
required this.readOffset,
|
required this.readOffset,
|
||||||
required this.writeOffset})
|
required this.writeOffset}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(rhs != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(readOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(writeOffset != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
rhs.parent = this;
|
rhs.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -1538,13 +1483,7 @@ class IfNullSet extends InternalExpression {
|
||||||
/// If `true`, the expression is only need for effect and not for its value.
|
/// If `true`, the expression is only need for effect and not for its value.
|
||||||
final bool forEffect;
|
final bool forEffect;
|
||||||
|
|
||||||
IfNullSet(this.read, this.write, {required this.forEffect})
|
IfNullSet(this.read, this.write, {required this.forEffect}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(read != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(write != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null) {
|
|
||||||
read.parent = this;
|
read.parent = this;
|
||||||
write.parent = this;
|
write.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -1641,19 +1580,7 @@ class CompoundExtensionSet extends InternalExpression {
|
||||||
{required this.forEffect,
|
{required this.forEffect,
|
||||||
required this.readOffset,
|
required this.readOffset,
|
||||||
required this.binaryOffset,
|
required this.binaryOffset,
|
||||||
required this.writeOffset})
|
required this.writeOffset}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(rhs != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(readOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(binaryOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(writeOffset != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
rhs.parent = this;
|
rhs.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -1711,19 +1638,7 @@ class CompoundPropertySet extends InternalExpression {
|
||||||
{required this.forEffect,
|
{required this.forEffect,
|
||||||
required this.readOffset,
|
required this.readOffset,
|
||||||
required this.binaryOffset,
|
required this.binaryOffset,
|
||||||
required this.writeOffset})
|
required this.writeOffset}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(rhs != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(readOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(binaryOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(writeOffset != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
rhs.parent = this;
|
rhs.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -1772,11 +1687,7 @@ class PropertyPostIncDec extends InternalExpression {
|
||||||
/// property on [variable].
|
/// property on [variable].
|
||||||
VariableDeclarationImpl write;
|
VariableDeclarationImpl write;
|
||||||
|
|
||||||
PropertyPostIncDec(this.variable, this.read, this.write)
|
PropertyPostIncDec(this.variable, this.read, this.write) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(read != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(write != null) {
|
|
||||||
variable?.parent = this;
|
variable?.parent = this;
|
||||||
read.parent = this;
|
read.parent = this;
|
||||||
write.parent = this;
|
write.parent = this;
|
||||||
|
@ -1813,11 +1724,7 @@ class LocalPostIncDec extends InternalExpression {
|
||||||
/// local variable.
|
/// local variable.
|
||||||
VariableDeclarationImpl write;
|
VariableDeclarationImpl write;
|
||||||
|
|
||||||
LocalPostIncDec(this.read, this.write)
|
LocalPostIncDec(this.read, this.write) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(read != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(write != null) {
|
|
||||||
read.parent = this;
|
read.parent = this;
|
||||||
write.parent = this;
|
write.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -1849,11 +1756,7 @@ class StaticPostIncDec extends InternalExpression {
|
||||||
/// static member.
|
/// static member.
|
||||||
VariableDeclarationImpl write;
|
VariableDeclarationImpl write;
|
||||||
|
|
||||||
StaticPostIncDec(this.read, this.write)
|
StaticPostIncDec(this.read, this.write) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(read != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(write != null) {
|
|
||||||
read.parent = this;
|
read.parent = this;
|
||||||
write.parent = this;
|
write.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -1885,11 +1788,7 @@ class SuperPostIncDec extends InternalExpression {
|
||||||
/// static member.
|
/// static member.
|
||||||
VariableDeclarationImpl write;
|
VariableDeclarationImpl write;
|
||||||
|
|
||||||
SuperPostIncDec(this.read, this.write)
|
SuperPostIncDec(this.read, this.write) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(read != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(write != null) {
|
|
||||||
read.parent = this;
|
read.parent = this;
|
||||||
write.parent = this;
|
write.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -1914,11 +1813,7 @@ class IndexGet extends InternalExpression {
|
||||||
/// The index expression of the operation.
|
/// The index expression of the operation.
|
||||||
Expression index;
|
Expression index;
|
||||||
|
|
||||||
IndexGet(this.receiver, this.index)
|
IndexGet(this.receiver, this.index) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(index != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
index.parent = this;
|
index.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -1968,15 +1863,7 @@ class IndexSet extends InternalExpression {
|
||||||
|
|
||||||
final bool forEffect;
|
final bool forEffect;
|
||||||
|
|
||||||
IndexSet(this.receiver, this.index, this.value, {required this.forEffect})
|
IndexSet(this.receiver, this.index, this.value, {required this.forEffect}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(index != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(value != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
index.parent = this;
|
index.parent = this;
|
||||||
value.parent = this;
|
value.parent = this;
|
||||||
|
@ -2026,11 +1913,7 @@ class SuperIndexSet extends InternalExpression {
|
||||||
/// The value expression of the operation.
|
/// The value expression of the operation.
|
||||||
Expression value;
|
Expression value;
|
||||||
|
|
||||||
SuperIndexSet(this.setter, this.index, this.value)
|
SuperIndexSet(this.setter, this.index, this.value) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(index != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(value != null) {
|
|
||||||
index.parent = this;
|
index.parent = this;
|
||||||
value.parent = this;
|
value.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -2088,13 +1971,7 @@ class ExtensionIndexSet extends InternalExpression {
|
||||||
ExtensionIndexSet(this.extension, this.explicitTypeArguments, this.receiver,
|
ExtensionIndexSet(this.extension, this.explicitTypeArguments, this.receiver,
|
||||||
this.setter, this.index, this.value)
|
this.setter, this.index, this.value)
|
||||||
: assert(explicitTypeArguments == null ||
|
: assert(explicitTypeArguments == null ||
|
||||||
explicitTypeArguments.length == extension.typeParameters.length),
|
explicitTypeArguments.length == extension.typeParameters.length) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(index != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(value != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
index.parent = this;
|
index.parent = this;
|
||||||
value.parent = this;
|
value.parent = this;
|
||||||
|
@ -2175,21 +2052,7 @@ class IfNullIndexSet extends InternalExpression {
|
||||||
{required this.readOffset,
|
{required this.readOffset,
|
||||||
required this.testOffset,
|
required this.testOffset,
|
||||||
required this.writeOffset,
|
required this.writeOffset,
|
||||||
required this.forEffect})
|
required this.forEffect}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(index != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(value != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(readOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(testOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(writeOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
index.parent = this;
|
index.parent = this;
|
||||||
value.parent = this;
|
value.parent = this;
|
||||||
|
@ -2255,19 +2118,7 @@ class IfNullSuperIndexSet extends InternalExpression {
|
||||||
{required this.readOffset,
|
{required this.readOffset,
|
||||||
required this.testOffset,
|
required this.testOffset,
|
||||||
required this.writeOffset,
|
required this.writeOffset,
|
||||||
required this.forEffect})
|
required this.forEffect}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(index != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(value != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(readOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(testOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(writeOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null) {
|
|
||||||
index.parent = this;
|
index.parent = this;
|
||||||
value.parent = this;
|
value.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -2342,21 +2193,7 @@ class IfNullExtensionIndexSet extends InternalExpression {
|
||||||
required this.writeOffset,
|
required this.writeOffset,
|
||||||
required this.forEffect})
|
required this.forEffect})
|
||||||
: assert(explicitTypeArguments == null ||
|
: assert(explicitTypeArguments == null ||
|
||||||
explicitTypeArguments.length == extension.typeParameters.length),
|
explicitTypeArguments.length == extension.typeParameters.length) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(index != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(value != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(readOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(testOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(writeOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
index.parent = this;
|
index.parent = this;
|
||||||
value.parent = this;
|
value.parent = this;
|
||||||
|
@ -2421,23 +2258,7 @@ class CompoundIndexSet extends InternalExpression {
|
||||||
required this.binaryOffset,
|
required this.binaryOffset,
|
||||||
required this.writeOffset,
|
required this.writeOffset,
|
||||||
required this.forEffect,
|
required this.forEffect,
|
||||||
required this.forPostIncDec})
|
required this.forPostIncDec}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(index != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(rhs != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(readOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(binaryOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(writeOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forPostIncDec != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
index.parent = this;
|
index.parent = this;
|
||||||
rhs.parent = this;
|
rhs.parent = this;
|
||||||
|
@ -2546,21 +2367,7 @@ class NullAwareCompoundSet extends InternalExpression {
|
||||||
required this.binaryOffset,
|
required this.binaryOffset,
|
||||||
required this.writeOffset,
|
required this.writeOffset,
|
||||||
required this.forEffect,
|
required this.forEffect,
|
||||||
required this.forPostIncDec})
|
required this.forPostIncDec}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(rhs != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(readOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(binaryOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(writeOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forPostIncDec != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
rhs.parent = this;
|
rhs.parent = this;
|
||||||
fileOffset = binaryOffset;
|
fileOffset = binaryOffset;
|
||||||
|
@ -2648,19 +2455,7 @@ class NullAwareIfNullSet extends InternalExpression {
|
||||||
{required this.readOffset,
|
{required this.readOffset,
|
||||||
required this.writeOffset,
|
required this.writeOffset,
|
||||||
required this.testOffset,
|
required this.testOffset,
|
||||||
required this.forEffect})
|
required this.forEffect}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(value != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(readOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(writeOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(testOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
value.parent = this;
|
value.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -2736,21 +2531,7 @@ class CompoundSuperIndexSet extends InternalExpression {
|
||||||
required this.binaryOffset,
|
required this.binaryOffset,
|
||||||
required this.writeOffset,
|
required this.writeOffset,
|
||||||
required this.forEffect,
|
required this.forEffect,
|
||||||
required this.forPostIncDec})
|
required this.forPostIncDec}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(index != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(rhs != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(readOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(binaryOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(writeOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forPostIncDec != null) {
|
|
||||||
index.parent = this;
|
index.parent = this;
|
||||||
rhs.parent = this;
|
rhs.parent = this;
|
||||||
fileOffset = binaryOffset;
|
fileOffset = binaryOffset;
|
||||||
|
@ -2839,23 +2620,7 @@ class CompoundExtensionIndexSet extends InternalExpression {
|
||||||
required this.forEffect,
|
required this.forEffect,
|
||||||
required this.forPostIncDec})
|
required this.forPostIncDec})
|
||||||
: assert(explicitTypeArguments == null ||
|
: assert(explicitTypeArguments == null ||
|
||||||
explicitTypeArguments.length == extension.typeParameters.length),
|
explicitTypeArguments.length == extension.typeParameters.length) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(index != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(rhs != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(readOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(binaryOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(writeOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forPostIncDec != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
index.parent = this;
|
index.parent = this;
|
||||||
rhs.parent = this;
|
rhs.parent = this;
|
||||||
|
@ -2914,16 +2679,9 @@ class ExtensionSet extends InternalExpression {
|
||||||
final bool forEffect;
|
final bool forEffect;
|
||||||
|
|
||||||
ExtensionSet(this.extension, this.explicitTypeArguments, this.receiver,
|
ExtensionSet(this.extension, this.explicitTypeArguments, this.receiver,
|
||||||
this.target, this.value,
|
this.target, this.value, {required this.forEffect})
|
||||||
{required this.forEffect})
|
|
||||||
: assert(explicitTypeArguments == null ||
|
: assert(explicitTypeArguments == null ||
|
||||||
explicitTypeArguments.length == extension.typeParameters.length),
|
explicitTypeArguments.length == extension.typeParameters.length) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(value != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
value.parent = this;
|
value.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -2953,11 +2711,7 @@ class NullAwareExtension extends InternalExpression {
|
||||||
VariableDeclarationImpl variable;
|
VariableDeclarationImpl variable;
|
||||||
Expression expression;
|
Expression expression;
|
||||||
|
|
||||||
NullAwareExtension(this.variable, this.expression)
|
NullAwareExtension(this.variable, this.expression) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(variable != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(expression != null) {
|
|
||||||
variable.parent = this;
|
variable.parent = this;
|
||||||
expression.parent = this;
|
expression.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -2993,9 +2747,7 @@ class ExtensionTearOff extends InternalExpression {
|
||||||
/// The arguments provided to the top-level method.
|
/// The arguments provided to the top-level method.
|
||||||
Arguments arguments;
|
Arguments arguments;
|
||||||
|
|
||||||
ExtensionTearOff(this.target, this.arguments)
|
ExtensionTearOff(this.target, this.arguments) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(arguments != null) {
|
|
||||||
arguments.parent = this;
|
arguments.parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3017,13 +2769,7 @@ class EqualsExpression extends InternalExpression {
|
||||||
Expression right;
|
Expression right;
|
||||||
bool isNot;
|
bool isNot;
|
||||||
|
|
||||||
EqualsExpression(this.left, this.right, {required this.isNot})
|
EqualsExpression(this.left, this.right, {required this.isNot}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(left != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(right != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNot != null) {
|
|
||||||
left.parent = this;
|
left.parent = this;
|
||||||
right.parent = this;
|
right.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -3057,11 +2803,7 @@ class BinaryExpression extends InternalExpression {
|
||||||
Name binaryName;
|
Name binaryName;
|
||||||
Expression right;
|
Expression right;
|
||||||
|
|
||||||
BinaryExpression(this.left, this.binaryName, this.right)
|
BinaryExpression(this.left, this.binaryName, this.right) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(left != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(right != null) {
|
|
||||||
left.parent = this;
|
left.parent = this;
|
||||||
right.parent = this;
|
right.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -3093,9 +2835,7 @@ class UnaryExpression extends InternalExpression {
|
||||||
Name unaryName;
|
Name unaryName;
|
||||||
Expression expression;
|
Expression expression;
|
||||||
|
|
||||||
UnaryExpression(this.unaryName, this.expression)
|
UnaryExpression(this.unaryName, this.expression) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(expression != null) {
|
|
||||||
expression.parent = this;
|
expression.parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3128,9 +2868,7 @@ class UnaryExpression extends InternalExpression {
|
||||||
class ParenthesizedExpression extends InternalExpression {
|
class ParenthesizedExpression extends InternalExpression {
|
||||||
Expression expression;
|
Expression expression;
|
||||||
|
|
||||||
ParenthesizedExpression(this.expression)
|
ParenthesizedExpression(this.expression) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(expression != null) {
|
|
||||||
expression.parent = this;
|
expression.parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3198,11 +2936,7 @@ class MethodInvocation extends InternalExpression {
|
||||||
|
|
||||||
Arguments arguments;
|
Arguments arguments;
|
||||||
|
|
||||||
MethodInvocation(this.receiver, this.name, this.arguments)
|
MethodInvocation(this.receiver, this.name, this.arguments) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(arguments != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
arguments.parent = this;
|
arguments.parent = this;
|
||||||
}
|
}
|
||||||
|
@ -3240,9 +2974,7 @@ class PropertyGet extends InternalExpression {
|
||||||
|
|
||||||
Name name;
|
Name name;
|
||||||
|
|
||||||
PropertyGet(this.receiver, this.name)
|
PropertyGet(this.receiver, this.name) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(receiver != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3286,15 +3018,7 @@ class PropertySet extends InternalExpression {
|
||||||
final bool readOnlyReceiver;
|
final bool readOnlyReceiver;
|
||||||
|
|
||||||
PropertySet(this.receiver, this.name, this.value,
|
PropertySet(this.receiver, this.name, this.value,
|
||||||
{required this.forEffect, required this.readOnlyReceiver})
|
{required this.forEffect, required this.readOnlyReceiver}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(receiver != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(value != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(readOnlyReceiver != null) {
|
|
||||||
receiver.parent = this;
|
receiver.parent = this;
|
||||||
value.parent = this;
|
value.parent = this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,14 +259,11 @@ class KernelTarget extends TargetImplementation {
|
||||||
|
|
||||||
void _parseCurrentSdkVersion() {
|
void _parseCurrentSdkVersion() {
|
||||||
bool good = false;
|
bool good = false;
|
||||||
// ignore: unnecessary_null_comparison
|
List<String> dotSeparatedParts = currentSdkVersionString.split(".");
|
||||||
if (currentSdkVersionString != null) {
|
if (dotSeparatedParts.length >= 2) {
|
||||||
List<String> dotSeparatedParts = currentSdkVersionString.split(".");
|
_currentSdkVersion = new Version(int.tryParse(dotSeparatedParts[0])!,
|
||||||
if (dotSeparatedParts.length >= 2) {
|
int.tryParse(dotSeparatedParts[1])!);
|
||||||
_currentSdkVersion = new Version(int.tryParse(dotSeparatedParts[0])!,
|
good = true;
|
||||||
int.tryParse(dotSeparatedParts[1])!);
|
|
||||||
good = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!good) {
|
if (!good) {
|
||||||
throw new StateError(
|
throw new StateError(
|
||||||
|
@ -1552,8 +1549,7 @@ class KernelTarget extends TargetImplementation {
|
||||||
constants.ConstantCoverage coverage = constantEvaluationData.coverage;
|
constants.ConstantCoverage coverage = constantEvaluationData.coverage;
|
||||||
coverage.constructorCoverage.forEach((Uri fileUri, Set<Reference> value) {
|
coverage.constructorCoverage.forEach((Uri fileUri, Set<Reference> value) {
|
||||||
Source? source = uriToSource[fileUri];
|
Source? source = uriToSource[fileUri];
|
||||||
// ignore: unnecessary_null_comparison
|
if (source != null) {
|
||||||
if (source != null && fileUri != null) {
|
|
||||||
source.constantCoverageConstructors ??= new Set<Reference>();
|
source.constantCoverageConstructors ??= new Set<Reference>();
|
||||||
source.constantCoverageConstructors!.addAll(value);
|
source.constantCoverageConstructors!.addAll(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,6 @@ Statement createGetterWithInitializer(CoreTypes coreTypes, int fileOffset,
|
||||||
required Expression createIsSetRead(),
|
required Expression createIsSetRead(),
|
||||||
required Expression createIsSetWrite(Expression value),
|
required Expression createIsSetWrite(Expression value),
|
||||||
required IsSetEncoding isSetEncoding}) {
|
required IsSetEncoding isSetEncoding}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isSetEncoding != null);
|
|
||||||
switch (isSetEncoding) {
|
switch (isSetEncoding) {
|
||||||
case IsSetEncoding.useIsSetField:
|
case IsSetEncoding.useIsSetField:
|
||||||
// Generate:
|
// Generate:
|
||||||
|
@ -120,8 +118,6 @@ Statement createGetterWithInitializerWithRecheck(CoreTypes coreTypes,
|
||||||
required Expression createIsSetWrite(Expression value),
|
required Expression createIsSetWrite(Expression value),
|
||||||
required IsSetEncoding isSetEncoding,
|
required IsSetEncoding isSetEncoding,
|
||||||
required bool forField}) {
|
required bool forField}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forField != null);
|
|
||||||
Constructor constructor = forField
|
Constructor constructor = forField
|
||||||
? coreTypes.lateInitializationFieldAssignedDuringInitializationConstructor
|
? coreTypes.lateInitializationFieldAssignedDuringInitializationConstructor
|
||||||
: coreTypes
|
: coreTypes
|
||||||
|
@ -271,10 +267,6 @@ Statement createGetterBodyWithoutInitializer(
|
||||||
required Expression createIsSetRead(),
|
required Expression createIsSetRead(),
|
||||||
required IsSetEncoding isSetEncoding,
|
required IsSetEncoding isSetEncoding,
|
||||||
required bool forField}) {
|
required bool forField}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forField != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isSetEncoding != null);
|
|
||||||
Expression exception = new Throw(
|
Expression exception = new Throw(
|
||||||
new ConstructorInvocation(
|
new ConstructorInvocation(
|
||||||
forField
|
forField
|
||||||
|
@ -356,8 +348,6 @@ Statement createSetterBody(CoreTypes coreTypes, int fileOffset, String name,
|
||||||
required Expression createVariableWrite(Expression value),
|
required Expression createVariableWrite(Expression value),
|
||||||
required Expression createIsSetWrite(Expression value),
|
required Expression createIsSetWrite(Expression value),
|
||||||
required IsSetEncoding isSetEncoding}) {
|
required IsSetEncoding isSetEncoding}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isSetEncoding != null);
|
|
||||||
Statement createReturn(Expression value) {
|
Statement createReturn(Expression value) {
|
||||||
if (shouldReturnValue) {
|
if (shouldReturnValue) {
|
||||||
return new ReturnStatement(value)..fileOffset = fileOffset;
|
return new ReturnStatement(value)..fileOffset = fileOffset;
|
||||||
|
@ -406,10 +396,6 @@ Statement createSetterBodyFinal(CoreTypes coreTypes, int fileOffset,
|
||||||
required Expression createIsSetWrite(Expression value),
|
required Expression createIsSetWrite(Expression value),
|
||||||
required IsSetEncoding isSetEncoding,
|
required IsSetEncoding isSetEncoding,
|
||||||
required bool forField}) {
|
required bool forField}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forField != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isSetEncoding != null);
|
|
||||||
Expression exception = new Throw(
|
Expression exception = new Throw(
|
||||||
new ConstructorInvocation(
|
new ConstructorInvocation(
|
||||||
forField
|
forField
|
||||||
|
|
|
@ -155,8 +155,6 @@ class Covariance {
|
||||||
/// aspect of [member]. Otherwise, the covariance for the getter/method aspect
|
/// aspect of [member]. Otherwise, the covariance for the getter/method aspect
|
||||||
/// of [member] is computed.
|
/// of [member] is computed.
|
||||||
factory Covariance.fromMember(Member member, {required bool forSetter}) {
|
factory Covariance.fromMember(Member member, {required bool forSetter}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forSetter != null);
|
|
||||||
if (member is Procedure) {
|
if (member is Procedure) {
|
||||||
if (member.kind == ProcedureKind.Getter) {
|
if (member.kind == ProcedureKind.Getter) {
|
||||||
return const Covariance.empty();
|
return const Covariance.empty();
|
||||||
|
|
|
@ -168,13 +168,6 @@ int computeTypeVariableBuilderVariance(TypeVariableBuilder variable,
|
||||||
/// type parameter occurrence or on the type argument replacing it.
|
/// type parameter occurrence or on the type argument replacing it.
|
||||||
NullabilityBuilder combineNullabilityBuildersForSubstitution(
|
NullabilityBuilder combineNullabilityBuildersForSubstitution(
|
||||||
NullabilityBuilder a, NullabilityBuilder b) {
|
NullabilityBuilder a, NullabilityBuilder b) {
|
||||||
assert(
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
a != null && b != null,
|
|
||||||
"Both arguments to combineNullabilityBuildersForSubstitution "
|
|
||||||
"should be identical to either 'const NullabilityBuilder.nullable()' or "
|
|
||||||
"'const NullabilityBuilder.omitted()'.");
|
|
||||||
|
|
||||||
if (identical(a, const NullabilityBuilder.inherent()) &&
|
if (identical(a, const NullabilityBuilder.inherent()) &&
|
||||||
identical(b, const NullabilityBuilder.inherent())) {
|
identical(b, const NullabilityBuilder.inherent())) {
|
||||||
return const NullabilityBuilder.inherent();
|
return const NullabilityBuilder.inherent();
|
||||||
|
@ -219,14 +212,6 @@ TypeBuilder substituteRange(
|
||||||
List<TypeBuilder>? arguments;
|
List<TypeBuilder>? arguments;
|
||||||
TypeDeclarationBuilder? declaration = type.declaration;
|
TypeDeclarationBuilder? declaration = type.declaration;
|
||||||
if (declaration == null) {
|
if (declaration == null) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(unboundTypes != null,
|
|
||||||
"Can not handle unbound named type builders without `unboundTypes`.");
|
|
||||||
assert(
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
unboundTypeVariables != null,
|
|
||||||
"Can not handle unbound named type builders without "
|
|
||||||
"`unboundTypeVariables`.");
|
|
||||||
assert(
|
assert(
|
||||||
identical(upperSubstitution, lowerSubstitution),
|
identical(upperSubstitution, lowerSubstitution),
|
||||||
"Can only handle unbound named type builders identical "
|
"Can only handle unbound named type builders identical "
|
||||||
|
@ -445,11 +430,6 @@ List<TypeBuilder> calculateBounds(List<TypeVariableBuilder> variables,
|
||||||
TypeBuilder dynamicType, TypeBuilder bottomType,
|
TypeBuilder dynamicType, TypeBuilder bottomType,
|
||||||
{required List<TypeBuilder> unboundTypes,
|
{required List<TypeBuilder> unboundTypes,
|
||||||
required List<TypeVariableBuilder> unboundTypeVariables}) {
|
required List<TypeVariableBuilder> unboundTypeVariables}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(unboundTypes != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(unboundTypeVariables != null);
|
|
||||||
|
|
||||||
List<TypeBuilder> bounds = new List<TypeBuilder>.generate(
|
List<TypeBuilder> bounds = new List<TypeBuilder>.generate(
|
||||||
variables.length, (int i) => variables[i].bound ?? dynamicType,
|
variables.length, (int i) => variables[i].bound ?? dynamicType,
|
||||||
growable: false);
|
growable: false);
|
||||||
|
@ -1084,8 +1064,6 @@ void breakCycles(List<List<RawTypeCycleElement>> cycles) {
|
||||||
/// Finds generic function type sub-terms in [type].
|
/// Finds generic function type sub-terms in [type].
|
||||||
void findUnaliasedGenericFunctionTypes(TypeBuilder? type,
|
void findUnaliasedGenericFunctionTypes(TypeBuilder? type,
|
||||||
{required List<FunctionTypeBuilder> result}) {
|
{required List<FunctionTypeBuilder> result}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(result != null);
|
|
||||||
if (type is FunctionTypeBuilder) {
|
if (type is FunctionTypeBuilder) {
|
||||||
if (type.typeVariables != null && type.typeVariables!.length > 0) {
|
if (type.typeVariables != null && type.typeVariables!.length > 0) {
|
||||||
result.add(type);
|
result.add(type);
|
||||||
|
@ -1114,8 +1092,6 @@ void findUnaliasedGenericFunctionTypes(TypeBuilder? type,
|
||||||
/// Finds generic function type sub-terms in [type] including the aliased ones.
|
/// Finds generic function type sub-terms in [type] including the aliased ones.
|
||||||
void findGenericFunctionTypes(TypeBuilder? type,
|
void findGenericFunctionTypes(TypeBuilder? type,
|
||||||
{required List<TypeBuilder> result}) {
|
{required List<TypeBuilder> result}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(result != null);
|
|
||||||
if (type is FunctionTypeBuilder) {
|
if (type is FunctionTypeBuilder) {
|
||||||
if (type.typeVariables != null && type.typeVariables!.length > 0) {
|
if (type.typeVariables != null && type.typeVariables!.length > 0) {
|
||||||
result.add(type);
|
result.add(type);
|
||||||
|
|
|
@ -31,9 +31,6 @@ class TypeLabeler implements DartTypeVisitor<void>, ConstantVisitor<void> {
|
||||||
/// pretty-printed, the returned list can be converted to its string
|
/// pretty-printed, the returned list can be converted to its string
|
||||||
/// representation (with labels on duplicated names) by the `join()` method.
|
/// representation (with labels on duplicated names) by the `join()` method.
|
||||||
List<Object> labelType(DartType type) {
|
List<Object> labelType(DartType type) {
|
||||||
// TODO(askesc): Remove null check when we are completely null clean here.
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (type == null) return ["null-type"];
|
|
||||||
result = [];
|
result = [];
|
||||||
type.accept(this);
|
type.accept(this);
|
||||||
return result;
|
return result;
|
||||||
|
@ -44,9 +41,6 @@ class TypeLabeler implements DartTypeVisitor<void>, ConstantVisitor<void> {
|
||||||
/// pretty-printed, the returned list can be converted to its string
|
/// pretty-printed, the returned list can be converted to its string
|
||||||
/// representation (with labels on duplicated names) by the `join()` method.
|
/// representation (with labels on duplicated names) by the `join()` method.
|
||||||
List<Object> labelConstant(Constant constant) {
|
List<Object> labelConstant(Constant constant) {
|
||||||
// TODO(askesc): Remove null check when we are completely null clean here.
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (constant == null) return ["null-constant"];
|
|
||||||
result = [];
|
result = [];
|
||||||
constant.accept(this);
|
constant.accept(this);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -32,8 +32,7 @@ class LibraryGraph implements Graph<Uri> {
|
||||||
Uri uri2 = dependency.targetLibrary.fileUri;
|
Uri uri2 = dependency.targetLibrary.fileUri;
|
||||||
if (libraries.containsKey(uri1)) {
|
if (libraries.containsKey(uri1)) {
|
||||||
yield uri1;
|
yield uri1;
|
||||||
// ignore: unnecessary_null_comparison
|
} else {
|
||||||
} else if (uri2 != null) {
|
|
||||||
if (libraries.containsKey(uri2)) {
|
if (libraries.containsKey(uri2)) {
|
||||||
yield uri2;
|
yield uri2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,10 +149,7 @@ class MutableScope {
|
||||||
final ScopeKind kind;
|
final ScopeKind kind;
|
||||||
|
|
||||||
MutableScope(this.kind, this._local, this._setters, this._extensions,
|
MutableScope(this.kind, this._local, this._setters, this._extensions,
|
||||||
this._parent, this.classNameOrDebugName) {
|
this._parent, this.classNameOrDebugName);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(classNameOrDebugName != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
Scope? get parent => _parent;
|
Scope? get parent => _parent;
|
||||||
|
|
||||||
|
|
|
@ -827,10 +827,6 @@ class DietListener extends StackListenerImpl {
|
||||||
builder.computeTypeParameterScope(memberScope);
|
builder.computeTypeParameterScope(memberScope);
|
||||||
final Scope formalParameterScope =
|
final Scope formalParameterScope =
|
||||||
builder.computeFormalParameterScope(typeParameterScope);
|
builder.computeFormalParameterScope(typeParameterScope);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(typeParameterScope != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(formalParameterScope != null);
|
|
||||||
return createListener(
|
return createListener(
|
||||||
builder.bodyBuilderContext, builder, typeParameterScope,
|
builder.bodyBuilderContext, builder, typeParameterScope,
|
||||||
thisVariable: builder.thisVariable,
|
thisVariable: builder.thisVariable,
|
||||||
|
|
|
@ -22,11 +22,7 @@ class NameScheme {
|
||||||
required this.containerName,
|
required this.containerName,
|
||||||
required this.containerType,
|
required this.containerType,
|
||||||
required this.libraryName})
|
required this.libraryName})
|
||||||
// ignore: unnecessary_null_comparison
|
: assert((containerName == null) ==
|
||||||
: assert(isInstanceMember != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(libraryName != null),
|
|
||||||
assert((containerName == null) ==
|
|
||||||
(containerType == ContainerType.Library));
|
(containerType == ContainerType.Library));
|
||||||
|
|
||||||
bool get isStatic => !isInstanceMember;
|
bool get isStatic => !isInstanceMember;
|
||||||
|
|
|
@ -536,13 +536,10 @@ class SourceClassBuilder extends ClassBuilderImpl
|
||||||
for (int i = 0; i < variables.length; i++) {
|
for (int i = 0; i < variables.length; i++) {
|
||||||
DartType argument =
|
DartType argument =
|
||||||
i < arguments.length ? arguments[i] : const DynamicType();
|
i < arguments.length ? arguments[i] : const DynamicType();
|
||||||
// ignore: unnecessary_null_comparison
|
// TODO(ahe): Investigate if requiring the caller to use
|
||||||
if (substitutionMap != null) {
|
// `substituteDeep` from `package:kernel/type_algebra.dart` instead
|
||||||
// TODO(ahe): Investigate if requiring the caller to use
|
// of `substitute` is faster. If so, we can simply this code.
|
||||||
// `substituteDeep` from `package:kernel/type_algebra.dart` instead
|
argument = substitute(argument, substitutionMap);
|
||||||
// of `substitute` is faster. If so, we can simply this code.
|
|
||||||
argument = substitute(argument, substitutionMap);
|
|
||||||
}
|
|
||||||
directSubstitutionMap[variables[i]] = argument;
|
directSubstitutionMap[variables[i]] = argument;
|
||||||
}
|
}
|
||||||
substitutionMap = directSubstitutionMap;
|
substitutionMap = directSubstitutionMap;
|
||||||
|
@ -1040,50 +1037,39 @@ class SourceClassBuilder extends ClassBuilderImpl
|
||||||
procedure.function.namedParameters;
|
procedure.function.namedParameters;
|
||||||
DartType returnType = procedure.function.returnType;
|
DartType returnType = procedure.function.returnType;
|
||||||
|
|
||||||
// ignore: unnecessary_null_comparison
|
for (TypeParameter functionParameter in functionTypeParameters) {
|
||||||
if (functionTypeParameters != null) {
|
|
||||||
for (TypeParameter functionParameter in functionTypeParameters) {
|
|
||||||
for (TypeParameter typeParameter in typeParameters) {
|
|
||||||
int typeVariance = Variance.combine(Variance.invariant,
|
|
||||||
computeVariance(typeParameter, functionParameter.bound));
|
|
||||||
reportVariancePositionIfInvalid(typeVariance, typeParameter, fileUri,
|
|
||||||
functionParameter.fileOffset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (positionalParameters != null) {
|
|
||||||
for (VariableDeclaration formal in positionalParameters) {
|
|
||||||
if (!formal.isCovariantByDeclaration) {
|
|
||||||
for (TypeParameter typeParameter in typeParameters) {
|
|
||||||
int formalVariance = Variance.combine(Variance.contravariant,
|
|
||||||
computeVariance(typeParameter, formal.type));
|
|
||||||
reportVariancePositionIfInvalid(
|
|
||||||
formalVariance, typeParameter, fileUri, formal.fileOffset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (namedParameters != null) {
|
|
||||||
for (VariableDeclaration named in namedParameters) {
|
|
||||||
for (TypeParameter typeParameter in typeParameters) {
|
|
||||||
int namedVariance = Variance.combine(Variance.contravariant,
|
|
||||||
computeVariance(typeParameter, named.type));
|
|
||||||
reportVariancePositionIfInvalid(
|
|
||||||
namedVariance, typeParameter, fileUri, named.fileOffset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (returnType != null) {
|
|
||||||
for (TypeParameter typeParameter in typeParameters) {
|
for (TypeParameter typeParameter in typeParameters) {
|
||||||
int returnTypeVariance = computeVariance(typeParameter, returnType);
|
int typeVariance = Variance.combine(Variance.invariant,
|
||||||
reportVariancePositionIfInvalid(returnTypeVariance, typeParameter,
|
computeVariance(typeParameter, functionParameter.bound));
|
||||||
fileUri, procedure.function.fileOffset,
|
reportVariancePositionIfInvalid(
|
||||||
isReturnType: true);
|
typeVariance, typeParameter, fileUri, functionParameter.fileOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (VariableDeclaration formal in positionalParameters) {
|
||||||
|
if (!formal.isCovariantByDeclaration) {
|
||||||
|
for (TypeParameter typeParameter in typeParameters) {
|
||||||
|
int formalVariance = Variance.combine(Variance.contravariant,
|
||||||
|
computeVariance(typeParameter, formal.type));
|
||||||
|
reportVariancePositionIfInvalid(
|
||||||
|
formalVariance, typeParameter, fileUri, formal.fileOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (VariableDeclaration named in namedParameters) {
|
||||||
|
for (TypeParameter typeParameter in typeParameters) {
|
||||||
|
int namedVariance = Variance.combine(
|
||||||
|
Variance.contravariant, computeVariance(typeParameter, named.type));
|
||||||
|
reportVariancePositionIfInvalid(
|
||||||
|
namedVariance, typeParameter, fileUri, named.fileOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (TypeParameter typeParameter in typeParameters) {
|
||||||
|
int returnTypeVariance = computeVariance(typeParameter, returnType);
|
||||||
|
reportVariancePositionIfInvalid(returnTypeVariance, typeParameter,
|
||||||
|
fileUri, procedure.function.fileOffset,
|
||||||
|
isReturnType: true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void reportVariancePositionIfInvalid(
|
void reportVariancePositionIfInvalid(
|
||||||
|
@ -1406,75 +1392,72 @@ class SourceClassBuilder extends ClassBuilderImpl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: unnecessary_null_comparison
|
Builder? targetBuilder = redirectionTarget.target;
|
||||||
if (redirectionTarget != null) {
|
if (declaration.next == null) {
|
||||||
Builder? targetBuilder = redirectionTarget.target;
|
// Only the first one (that is, the last on in the linked list)
|
||||||
if (declaration.next == null) {
|
// is actually in the kernel tree. This call creates a StaticGet
|
||||||
// Only the first one (that is, the last on in the linked list)
|
// to [declaration.target] in a field `_redirecting#` which is
|
||||||
// is actually in the kernel tree. This call creates a StaticGet
|
// only legal to do to things in the kernel tree.
|
||||||
// to [declaration.target] in a field `_redirecting#` which is
|
Reference? fieldReference;
|
||||||
// only legal to do to things in the kernel tree.
|
Reference? getterReference;
|
||||||
Reference? fieldReference;
|
if (referencesFromIndexed != null) {
|
||||||
Reference? getterReference;
|
Name name =
|
||||||
if (referencesFromIndexed != null) {
|
new Name(redirectingName, referencesFromIndexed!.library);
|
||||||
Name name =
|
fieldReference =
|
||||||
new Name(redirectingName, referencesFromIndexed!.library);
|
referencesFromIndexed!.lookupFieldReference(name);
|
||||||
fieldReference =
|
getterReference =
|
||||||
referencesFromIndexed!.lookupFieldReference(name);
|
referencesFromIndexed!.lookupGetterReference(name);
|
||||||
getterReference =
|
|
||||||
referencesFromIndexed!.lookupGetterReference(name);
|
|
||||||
}
|
|
||||||
_addRedirectingConstructor(
|
|
||||||
declaration, library, fieldReference, getterReference);
|
|
||||||
}
|
|
||||||
Member? targetNode;
|
|
||||||
if (targetBuilder is FunctionBuilder) {
|
|
||||||
targetNode = targetBuilder.member;
|
|
||||||
} else if (targetBuilder is DillMemberBuilder) {
|
|
||||||
targetNode = targetBuilder.member;
|
|
||||||
} else if (targetBuilder is AmbiguousBuilder) {
|
|
||||||
addProblemForRedirectingFactory(
|
|
||||||
declaration,
|
|
||||||
templateDuplicatedDeclarationUse
|
|
||||||
.withArguments(redirectionTarget.fullNameForErrors),
|
|
||||||
redirectionTarget.charOffset,
|
|
||||||
noLength);
|
|
||||||
} else {
|
|
||||||
addProblemForRedirectingFactory(
|
|
||||||
declaration,
|
|
||||||
templateRedirectionTargetNotFound
|
|
||||||
.withArguments(redirectionTarget.fullNameForErrors),
|
|
||||||
redirectionTarget.charOffset,
|
|
||||||
noLength);
|
|
||||||
}
|
|
||||||
if (targetNode != null &&
|
|
||||||
targetNode is Constructor &&
|
|
||||||
targetNode.enclosingClass.isAbstract) {
|
|
||||||
addProblemForRedirectingFactory(
|
|
||||||
declaration,
|
|
||||||
templateAbstractRedirectedClassInstantiation
|
|
||||||
.withArguments(redirectionTarget.fullNameForErrors),
|
|
||||||
redirectionTarget.charOffset,
|
|
||||||
noLength);
|
|
||||||
targetNode = null;
|
|
||||||
}
|
|
||||||
if (targetNode != null &&
|
|
||||||
targetNode is Constructor &&
|
|
||||||
targetNode.enclosingClass.isEnum) {
|
|
||||||
addProblemForRedirectingFactory(
|
|
||||||
declaration,
|
|
||||||
messageEnumFactoryRedirectsToConstructor,
|
|
||||||
redirectionTarget.charOffset,
|
|
||||||
noLength);
|
|
||||||
targetNode = null;
|
|
||||||
}
|
|
||||||
if (targetNode != null) {
|
|
||||||
List<DartType> typeArguments = declaration.typeArguments ??
|
|
||||||
new List<DartType>.filled(
|
|
||||||
targetNode.enclosingClass!.typeParameters.length,
|
|
||||||
const UnknownType());
|
|
||||||
declaration.setRedirectingFactoryBody(targetNode, typeArguments);
|
|
||||||
}
|
}
|
||||||
|
_addRedirectingConstructor(
|
||||||
|
declaration, library, fieldReference, getterReference);
|
||||||
|
}
|
||||||
|
Member? targetNode;
|
||||||
|
if (targetBuilder is FunctionBuilder) {
|
||||||
|
targetNode = targetBuilder.member;
|
||||||
|
} else if (targetBuilder is DillMemberBuilder) {
|
||||||
|
targetNode = targetBuilder.member;
|
||||||
|
} else if (targetBuilder is AmbiguousBuilder) {
|
||||||
|
addProblemForRedirectingFactory(
|
||||||
|
declaration,
|
||||||
|
templateDuplicatedDeclarationUse
|
||||||
|
.withArguments(redirectionTarget.fullNameForErrors),
|
||||||
|
redirectionTarget.charOffset,
|
||||||
|
noLength);
|
||||||
|
} else {
|
||||||
|
addProblemForRedirectingFactory(
|
||||||
|
declaration,
|
||||||
|
templateRedirectionTargetNotFound
|
||||||
|
.withArguments(redirectionTarget.fullNameForErrors),
|
||||||
|
redirectionTarget.charOffset,
|
||||||
|
noLength);
|
||||||
|
}
|
||||||
|
if (targetNode != null &&
|
||||||
|
targetNode is Constructor &&
|
||||||
|
targetNode.enclosingClass.isAbstract) {
|
||||||
|
addProblemForRedirectingFactory(
|
||||||
|
declaration,
|
||||||
|
templateAbstractRedirectedClassInstantiation
|
||||||
|
.withArguments(redirectionTarget.fullNameForErrors),
|
||||||
|
redirectionTarget.charOffset,
|
||||||
|
noLength);
|
||||||
|
targetNode = null;
|
||||||
|
}
|
||||||
|
if (targetNode != null &&
|
||||||
|
targetNode is Constructor &&
|
||||||
|
targetNode.enclosingClass.isEnum) {
|
||||||
|
addProblemForRedirectingFactory(
|
||||||
|
declaration,
|
||||||
|
messageEnumFactoryRedirectsToConstructor,
|
||||||
|
redirectionTarget.charOffset,
|
||||||
|
noLength);
|
||||||
|
targetNode = null;
|
||||||
|
}
|
||||||
|
if (targetNode != null) {
|
||||||
|
List<DartType> typeArguments = declaration.typeArguments ??
|
||||||
|
new List<DartType>.filled(
|
||||||
|
targetNode.enclosingClass!.typeParameters.length,
|
||||||
|
const UnknownType());
|
||||||
|
declaration.setRedirectingFactoryBody(targetNode, typeArguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1508,10 +1491,6 @@ class SourceClassBuilder extends ClassBuilderImpl
|
||||||
callback(Member interfaceMember, bool isSetter),
|
callback(Member interfaceMember, bool isSetter),
|
||||||
{required bool isInterfaceCheck,
|
{required bool isInterfaceCheck,
|
||||||
required bool declaredNeedsLegacyErasure}) {
|
required bool declaredNeedsLegacyErasure}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isInterfaceCheck != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(declaredNeedsLegacyErasure != null);
|
|
||||||
if (declaredMember == interfaceMember) {
|
if (declaredMember == interfaceMember) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,8 +157,6 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl
|
||||||
kind = ExtensionMemberKind.TearOff;
|
kind = ExtensionMemberKind.TearOff;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(kind != null);
|
|
||||||
extension.members.add(new ExtensionMemberDescriptor(
|
extension.members.add(new ExtensionMemberDescriptor(
|
||||||
name: new Name(name, libraryBuilder.library),
|
name: new Name(name, libraryBuilder.library),
|
||||||
member: memberReference,
|
member: memberReference,
|
||||||
|
|
|
@ -623,14 +623,6 @@ class RegularFieldEncoding implements FieldEncoding {
|
||||||
required Reference? getterReference,
|
required Reference? getterReference,
|
||||||
required Reference? setterReference,
|
required Reference? setterReference,
|
||||||
required bool isEnumElement}) {
|
required bool isEnumElement}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isFinal != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isConst != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isLate != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(hasInitializer != null);
|
|
||||||
bool isImmutable =
|
bool isImmutable =
|
||||||
isLate ? (isFinal && hasInitializer) : (isFinal || isConst);
|
isLate ? (isFinal && hasInitializer) : (isFinal || isConst);
|
||||||
_field = isImmutable
|
_field = isImmutable
|
||||||
|
@ -759,9 +751,7 @@ class SourceFieldMember extends BuilderClassMember {
|
||||||
@override
|
@override
|
||||||
final bool forSetter;
|
final bool forSetter;
|
||||||
|
|
||||||
SourceFieldMember(this.memberBuilder, {required this.forSetter})
|
SourceFieldMember(this.memberBuilder, {required this.forSetter});
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(forSetter != null);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void inferType(ClassMembersBuilder membersBuilder) {
|
void inferType(ClassMembersBuilder membersBuilder) {
|
||||||
|
@ -1011,8 +1001,6 @@ abstract class AbstractLateFieldEncoding implements FieldEncoding {
|
||||||
|
|
||||||
Procedure? _createSetter(Uri fileUri, int charOffset, Reference? reference,
|
Procedure? _createSetter(Uri fileUri, int charOffset, Reference? reference,
|
||||||
{required bool isCovariantByDeclaration}) {
|
{required bool isCovariantByDeclaration}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isCovariantByDeclaration != null);
|
|
||||||
VariableDeclaration parameter = new VariableDeclaration("${name}#param")
|
VariableDeclaration parameter = new VariableDeclaration("${name}#param")
|
||||||
..isCovariantByDeclaration = isCovariantByDeclaration
|
..isCovariantByDeclaration = isCovariantByDeclaration
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
|
@ -1433,9 +1421,7 @@ class _SynthesizedFieldClassMember implements ClassMember {
|
||||||
final bool isInternalImplementation;
|
final bool isInternalImplementation;
|
||||||
|
|
||||||
_SynthesizedFieldClassMember(this.fieldBuilder, this._member, this._kind,
|
_SynthesizedFieldClassMember(this.fieldBuilder, this._member, this._kind,
|
||||||
{this.forSetter = false, required this.isInternalImplementation})
|
{this.forSetter = false, required this.isInternalImplementation});
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(isInternalImplementation != null);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Member getMember(ClassMembersBuilder membersBuilder) {
|
Member getMember(ClassMembersBuilder membersBuilder) {
|
||||||
|
@ -1519,10 +1505,7 @@ class _SynthesizedFieldClassMember implements ClassMember {
|
||||||
String get fullName {
|
String get fullName {
|
||||||
String suffix = isSetter ? "=" : "";
|
String suffix = isSetter ? "=" : "";
|
||||||
String className = classBuilder.fullNameForErrors;
|
String className = classBuilder.fullNameForErrors;
|
||||||
// ignore: unnecessary_null_comparison
|
return "${className}.${fullNameForErrors}$suffix";
|
||||||
return className == null
|
|
||||||
? "${fullNameForErrors}$suffix"
|
|
||||||
: "${className}.${fullNameForErrors}$suffix";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -1591,17 +1574,7 @@ class AbstractOrExternalFieldEncoding implements FieldEncoding {
|
||||||
required bool isFinal,
|
required bool isFinal,
|
||||||
required bool isCovariantByDeclaration,
|
required bool isCovariantByDeclaration,
|
||||||
required bool isNonNullableByDefault})
|
required bool isNonNullableByDefault})
|
||||||
// ignore: unnecessary_null_comparison
|
: _isExtensionInstanceMember = isExternal &&
|
||||||
: assert(isAbstract != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isExternal != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isFinal != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isCovariantByDeclaration != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNonNullableByDefault != null),
|
|
||||||
_isExtensionInstanceMember = isExternal &&
|
|
||||||
nameScheme.isExtensionMember &&
|
nameScheme.isExtensionMember &&
|
||||||
nameScheme.isInstanceMember,
|
nameScheme.isInstanceMember,
|
||||||
_isInlineClassInstanceMember = isExternal &&
|
_isInlineClassInstanceMember = isExternal &&
|
||||||
|
|
|
@ -195,8 +195,6 @@ class SourceInlineClassBuilder extends InlineClassBuilderImpl
|
||||||
kind = InlineClassMemberKind.TearOff;
|
kind = InlineClassMemberKind.TearOff;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(kind != null);
|
|
||||||
inlineClass.members.add(new InlineClassMemberDescriptor(
|
inlineClass.members.add(new InlineClassMemberDescriptor(
|
||||||
name: new Name(name, libraryBuilder.library),
|
name: new Name(name, libraryBuilder.library),
|
||||||
member: memberReference,
|
member: memberReference,
|
||||||
|
|
|
@ -1024,11 +1024,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||||
SourceLibraryBuilder sourceLibraryBuilder, Scope scope,
|
SourceLibraryBuilder sourceLibraryBuilder, Scope scope,
|
||||||
{required bool checkForInstanceVsStaticConflict,
|
{required bool checkForInstanceVsStaticConflict,
|
||||||
required bool checkForMethodVsSetterConflict}) {
|
required bool checkForMethodVsSetterConflict}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(checkForInstanceVsStaticConflict != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(checkForMethodVsSetterConflict != null);
|
|
||||||
|
|
||||||
scope.forEachLocalSetter((String name, MemberBuilder setter) {
|
scope.forEachLocalSetter((String name, MemberBuilder setter) {
|
||||||
Builder? getable = scope.lookupLocalMember(name, setter: false);
|
Builder? getable = scope.lookupLocalMember(name, setter: false);
|
||||||
if (getable == null) {
|
if (getable == null) {
|
||||||
|
@ -2907,10 +2902,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||||
AsyncMarker asyncModifier,
|
AsyncMarker asyncModifier,
|
||||||
{required bool isInstanceMember,
|
{required bool isInstanceMember,
|
||||||
required bool isExtensionMember}) {
|
required bool isExtensionMember}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isInstanceMember != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isExtensionMember != null);
|
|
||||||
assert(!isExtensionMember ||
|
assert(!isExtensionMember ||
|
||||||
currentTypeParameterScopeBuilder.kind ==
|
currentTypeParameterScopeBuilder.kind ==
|
||||||
TypeParameterScopeKind.extensionDeclaration);
|
TypeParameterScopeKind.extensionDeclaration);
|
||||||
|
@ -4337,8 +4328,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||||
String enclosingName = issue.enclosingType == null
|
String enclosingName = issue.enclosingType == null
|
||||||
? targetName!
|
? targetName!
|
||||||
: getGenericTypeName(issue.enclosingType!);
|
: getGenericTypeName(issue.enclosingType!);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(enclosingName != null);
|
|
||||||
if (issueInferred) {
|
if (issueInferred) {
|
||||||
message = templateIncorrectTypeArgumentInferred.withArguments(
|
message = templateIncorrectTypeArgumentInferred.withArguments(
|
||||||
argument,
|
argument,
|
||||||
|
@ -4577,7 +4566,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||||
// TODO(cstefantsova): Find a better way than relying on [interfaceTarget].
|
// TODO(cstefantsova): Find a better way than relying on [interfaceTarget].
|
||||||
Member? method =
|
Member? method =
|
||||||
membersHierarchy.getDispatchTarget(klass, name) ?? interfaceTarget;
|
membersHierarchy.getDispatchTarget(klass, name) ?? interfaceTarget;
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (method == null || method is! Procedure) {
|
if (method == null || method is! Procedure) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4669,8 +4657,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
||||||
Uri fileUri,
|
Uri fileUri,
|
||||||
int offset,
|
int offset,
|
||||||
{required bool inferred}) {
|
{required bool inferred}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(inferred != null);
|
|
||||||
if (typeArguments.isEmpty) return;
|
if (typeArguments.isEmpty) return;
|
||||||
|
|
||||||
List<TypeParameter> functionTypeParameters = functionType.typeParameters;
|
List<TypeParameter> functionTypeParameters = functionType.typeParameters;
|
||||||
|
@ -5276,10 +5262,7 @@ class TypeParameterScopeBuilder {
|
||||||
this.extensions,
|
this.extensions,
|
||||||
this._name,
|
this._name,
|
||||||
this._charOffset,
|
this._charOffset,
|
||||||
this.parent) {
|
this.parent);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(_name != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
TypeParameterScopeBuilder.library()
|
TypeParameterScopeBuilder.library()
|
||||||
: this(
|
: this(
|
||||||
|
@ -5687,9 +5670,6 @@ List<TypeVariableBuilder> _sortTypeVariablesTopologically(
|
||||||
|
|
||||||
void _sortTypeVariablesTopologicallyFromRoot(TypeBuilder root,
|
void _sortTypeVariablesTopologicallyFromRoot(TypeBuilder root,
|
||||||
Set<TypeVariableBuilder> unhandled, List<TypeVariableBuilder> result) {
|
Set<TypeVariableBuilder> unhandled, List<TypeVariableBuilder> result) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(root != null);
|
|
||||||
|
|
||||||
List<TypeVariableBuilder>? typeVariables;
|
List<TypeVariableBuilder>? typeVariables;
|
||||||
List<TypeBuilder>? internalDependents;
|
List<TypeBuilder>? internalDependents;
|
||||||
|
|
||||||
|
|
|
@ -412,10 +412,7 @@ class SourceLoader extends Loader {
|
||||||
Message? packageLanguageVersionProblem;
|
Message? packageLanguageVersionProblem;
|
||||||
if (packageForLanguageVersion != null) {
|
if (packageForLanguageVersion != null) {
|
||||||
Uri importUri = origin?.importUri ?? uri;
|
Uri importUri = origin?.importUri ?? uri;
|
||||||
if (!importUri.isScheme('dart') &&
|
if (!importUri.isScheme('dart') && !importUri.isScheme('package')) {
|
||||||
!importUri.isScheme('package') &&
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
packageForLanguageVersion.name != null) {
|
|
||||||
packageUri =
|
packageUri =
|
||||||
new Uri(scheme: 'package', path: packageForLanguageVersion.name);
|
new Uri(scheme: 'package', path: packageForLanguageVersion.name);
|
||||||
}
|
}
|
||||||
|
@ -1205,8 +1202,6 @@ severity: $severity
|
||||||
|
|
||||||
Future<Null> buildOutline(SourceLibraryBuilder library) async {
|
Future<Null> buildOutline(SourceLibraryBuilder library) async {
|
||||||
Token tokens = await tokenize(library);
|
Token tokens = await tokenize(library);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (tokens == null) return;
|
|
||||||
OutlineBuilder listener = new OutlineBuilder(library);
|
OutlineBuilder listener = new OutlineBuilder(library);
|
||||||
new ClassMemberParser(listener,
|
new ClassMemberParser(listener,
|
||||||
allowPatterns: library.libraryFeatures.patterns.isEnabled)
|
allowPatterns: library.libraryFeatures.patterns.isEnabled)
|
||||||
|
@ -1229,10 +1224,6 @@ severity: $severity
|
||||||
// second time, and the first time was in [buildOutline] above. So this
|
// second time, and the first time was in [buildOutline] above. So this
|
||||||
// time we suppress lexical errors.
|
// time we suppress lexical errors.
|
||||||
Token tokens = await tokenize(library, suppressLexicalErrors: true);
|
Token tokens = await tokenize(library, suppressLexicalErrors: true);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (tokens == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target.benchmarker != null) {
|
if (target.benchmarker != null) {
|
||||||
// When benchmarking we do extra parsing on it's own to get a timing of
|
// When benchmarking we do extra parsing on it's own to get a timing of
|
||||||
|
@ -1271,11 +1262,8 @@ severity: $severity
|
||||||
}
|
}
|
||||||
Token tokens = await tokenize(part as SourceLibraryBuilder,
|
Token tokens = await tokenize(part as SourceLibraryBuilder,
|
||||||
suppressLexicalErrors: true);
|
suppressLexicalErrors: true);
|
||||||
// ignore: unnecessary_null_comparison
|
listener.uri = part.fileUri;
|
||||||
if (tokens != null) {
|
parser.parseUnit(tokens);
|
||||||
listener.uri = part.fileUri;
|
|
||||||
parser.parseUnit(tokens);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,28 +107,16 @@ class SourceTypeAliasBuilder extends TypeAliasBuilderImpl {
|
||||||
// detect cycles by detecting recursive calls to this method using an
|
// detect cycles by detecting recursive calls to this method using an
|
||||||
// instance of InvalidType that isn't identical to `const InvalidType()`.
|
// instance of InvalidType that isn't identical to `const InvalidType()`.
|
||||||
thisType = pendingTypeAliasMarker;
|
thisType = pendingTypeAliasMarker;
|
||||||
DartType builtType = const InvalidType();
|
DartType builtType = type.build(libraryBuilder, TypeUse.typedefAlias);
|
||||||
TypeBuilder type = this.type;
|
if (typeVariables != null) {
|
||||||
// ignore: unnecessary_null_comparison
|
for (TypeVariableBuilder tv in typeVariables!) {
|
||||||
if (type != null) {
|
// Follow bound in order to find all cycles
|
||||||
builtType = type.build(libraryBuilder, TypeUse.typedefAlias);
|
tv.bound?.build(libraryBuilder, TypeUse.typeParameterBound);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (builtType != null) {
|
|
||||||
if (typeVariables != null) {
|
|
||||||
for (TypeVariableBuilder tv in typeVariables!) {
|
|
||||||
// Follow bound in order to find all cycles
|
|
||||||
tv.bound?.build(libraryBuilder, TypeUse.typeParameterBound);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (identical(thisType, cyclicTypeAliasMarker)) {
|
|
||||||
builtType = const InvalidType();
|
|
||||||
} else {
|
|
||||||
builtType = builtType;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
builtType = const InvalidType();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (identical(thisType, cyclicTypeAliasMarker)) {
|
||||||
|
builtType = const InvalidType();
|
||||||
|
}
|
||||||
return thisType = typedef.type ??= builtType;
|
return thisType = typedef.type ??= builtType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,8 +89,6 @@ abstract class StackListenerImpl extends StackListener {
|
||||||
|
|
||||||
void reportMissingNonNullableSupport(Token token) {
|
void reportMissingNonNullableSupport(Token token) {
|
||||||
assert(!libraryBuilder.isNonNullableByDefault);
|
assert(!libraryBuilder.isNonNullableByDefault);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(token != null);
|
|
||||||
if (libraryFeatures.nonNullable.isSupported) {
|
if (libraryFeatures.nonNullable.isSupported) {
|
||||||
if (libraryBuilder.languageVersion.isExplicit) {
|
if (libraryBuilder.languageVersion.isExplicit) {
|
||||||
addProblem(
|
addProblem(
|
||||||
|
|
|
@ -44,8 +44,6 @@ abstract class ClosureContext {
|
||||||
|
|
||||||
factory ClosureContext(InferenceVisitorBase inferrer, AsyncMarker asyncMarker,
|
factory ClosureContext(InferenceVisitorBase inferrer, AsyncMarker asyncMarker,
|
||||||
DartType returnContext, bool needToInferReturnType) {
|
DartType returnContext, bool needToInferReturnType) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(returnContext != null);
|
|
||||||
DartType declaredReturnType =
|
DartType declaredReturnType =
|
||||||
inferrer.computeGreatestClosure(returnContext);
|
inferrer.computeGreatestClosure(returnContext);
|
||||||
bool isAsync = asyncMarker == AsyncMarker.Async ||
|
bool isAsync = asyncMarker == AsyncMarker.Async ||
|
||||||
|
@ -326,8 +324,6 @@ class _SyncClosureContext implements ClosureContext {
|
||||||
DartType inferReturnType(InferenceVisitorBase inferrer,
|
DartType inferReturnType(InferenceVisitorBase inferrer,
|
||||||
{required bool hasImplicitReturn}) {
|
{required bool hasImplicitReturn}) {
|
||||||
assert(_needToInferReturnType);
|
assert(_needToInferReturnType);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(hasImplicitReturn != null);
|
|
||||||
DartType? actualReturnedType;
|
DartType? actualReturnedType;
|
||||||
DartType inferredReturnType;
|
DartType inferredReturnType;
|
||||||
if (inferrer.isNonNullableByDefault) {
|
if (inferrer.isNonNullableByDefault) {
|
||||||
|
@ -737,8 +733,6 @@ class _AsyncClosureContext implements ClosureContext {
|
||||||
DartType inferReturnType(InferenceVisitorBase inferrer,
|
DartType inferReturnType(InferenceVisitorBase inferrer,
|
||||||
{required bool hasImplicitReturn}) {
|
{required bool hasImplicitReturn}) {
|
||||||
assert(_needToInferReturnType);
|
assert(_needToInferReturnType);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(hasImplicitReturn != null);
|
|
||||||
DartType? inferredType;
|
DartType? inferredType;
|
||||||
|
|
||||||
if (inferrer.isNonNullableByDefault) {
|
if (inferrer.isNonNullableByDefault) {
|
||||||
|
@ -973,8 +967,6 @@ class _SyncStarClosureContext implements ClosureContext {
|
||||||
DartType inferReturnType(InferenceVisitorBase inferrer,
|
DartType inferReturnType(InferenceVisitorBase inferrer,
|
||||||
{required bool hasImplicitReturn}) {
|
{required bool hasImplicitReturn}) {
|
||||||
assert(_needToInferReturnType);
|
assert(_needToInferReturnType);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(hasImplicitReturn != null);
|
|
||||||
DartType? inferredElementType;
|
DartType? inferredElementType;
|
||||||
if (_yieldElementTypes!.isNotEmpty) {
|
if (_yieldElementTypes!.isNotEmpty) {
|
||||||
// Use the types seen from the explicit return statements.
|
// Use the types seen from the explicit return statements.
|
||||||
|
@ -1109,8 +1101,6 @@ class _AsyncStarClosureContext implements ClosureContext {
|
||||||
DartType inferReturnType(InferenceVisitorBase inferrer,
|
DartType inferReturnType(InferenceVisitorBase inferrer,
|
||||||
{required bool hasImplicitReturn}) {
|
{required bool hasImplicitReturn}) {
|
||||||
assert(_needToInferReturnType);
|
assert(_needToInferReturnType);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(hasImplicitReturn != null);
|
|
||||||
DartType? inferredElementType;
|
DartType? inferredElementType;
|
||||||
if (_yieldElementTypes!.isNotEmpty) {
|
if (_yieldElementTypes!.isNotEmpty) {
|
||||||
// Use the types seen from the explicit return statements.
|
// Use the types seen from the explicit return statements.
|
||||||
|
|
|
@ -222,9 +222,7 @@ class WrapInProblemInferenceResult implements InvocationInferenceResult {
|
||||||
|
|
||||||
WrapInProblemInferenceResult(this.inferredType, this.functionType,
|
WrapInProblemInferenceResult(this.inferredType, this.functionType,
|
||||||
this.message, this.fileOffset, this.length, this.helper,
|
this.message, this.fileOffset, this.length, this.helper,
|
||||||
{required this.isInapplicable, required this.hoistedArguments})
|
{required this.isInapplicable, required this.hoistedArguments});
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(isInapplicable != null);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Expression applyResult(Expression expression) {
|
Expression applyResult(Expression expression) {
|
||||||
|
@ -345,9 +343,7 @@ class ExpressionInferenceResult {
|
||||||
|
|
||||||
ExpressionInferenceResult(this.inferredType, this.expression,
|
ExpressionInferenceResult(this.inferredType, this.expression,
|
||||||
{this.postCoercionType = null})
|
{this.postCoercionType = null})
|
||||||
// ignore: unnecessary_null_comparison
|
: assert(isKnown(inferredType));
|
||||||
: assert(expression != null),
|
|
||||||
assert(isKnown(inferredType));
|
|
||||||
|
|
||||||
/// The guards used for null-aware access if the expression is part of a
|
/// The guards used for null-aware access if the expression is part of a
|
||||||
/// null-shorting.
|
/// null-shorting.
|
||||||
|
@ -377,13 +373,7 @@ class NullAwareGuard {
|
||||||
final InferenceVisitorBase _inferrer;
|
final InferenceVisitorBase _inferrer;
|
||||||
|
|
||||||
NullAwareGuard(
|
NullAwareGuard(
|
||||||
this._nullAwareVariable, this._nullAwareFileOffset, this._inferrer)
|
this._nullAwareVariable, this._nullAwareFileOffset, this._inferrer) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(_nullAwareVariable != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(_nullAwareFileOffset != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(_inferrer != null) {
|
|
||||||
// Ensure the initializer of [_nullAwareVariable] is promoted to
|
// Ensure the initializer of [_nullAwareVariable] is promoted to
|
||||||
// non-nullable.
|
// non-nullable.
|
||||||
_inferrer.flowAnalysis.nullAwareAccess_rightBegin(
|
_inferrer.flowAnalysis.nullAwareAccess_rightBegin(
|
||||||
|
@ -447,9 +437,7 @@ class NullAwareExpressionInferenceResult implements ExpressionInferenceResult {
|
||||||
|
|
||||||
NullAwareExpressionInferenceResult(this.inferredType,
|
NullAwareExpressionInferenceResult(this.inferredType,
|
||||||
this.nullAwareActionType, this.nullAwareGuards, this.nullAwareAction)
|
this.nullAwareActionType, this.nullAwareGuards, this.nullAwareAction)
|
||||||
: assert(nullAwareGuards.isNotEmpty),
|
: assert(nullAwareGuards.isNotEmpty);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(nullAwareAction != null);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Expression get expression {
|
Expression get expression {
|
||||||
|
|
|
@ -246,11 +246,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
{bool isVoidAllowed = false, bool forEffect = false}) {
|
{bool isVoidAllowed = false, bool forEffect = false}) {
|
||||||
registerIfUnreachableForTesting(expression);
|
registerIfUnreachableForTesting(expression);
|
||||||
|
|
||||||
// `null` should never be used as the type context. An instance of
|
|
||||||
// `UnknownType` should be used instead.
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(typeContext != null);
|
|
||||||
|
|
||||||
ExpressionInferenceResult result;
|
ExpressionInferenceResult result;
|
||||||
if (expression is ExpressionJudgment) {
|
if (expression is ExpressionJudgment) {
|
||||||
result = expression.acceptInference(this, typeContext);
|
result = expression.acceptInference(this, typeContext);
|
||||||
|
@ -260,9 +255,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
result = expression.accept1(this, typeContext);
|
result = expression.accept1(this, typeContext);
|
||||||
}
|
}
|
||||||
DartType inferredType = result.inferredType;
|
DartType inferredType = result.inferredType;
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(inferredType != null,
|
|
||||||
"No type inferred for $expression (${expression.runtimeType}).");
|
|
||||||
if (inferredType is VoidType && !isVoidAllowed) {
|
if (inferredType is VoidType && !isVoidAllowed) {
|
||||||
if (expression.parent is! ArgumentsImpl) {
|
if (expression.parent is! ArgumentsImpl) {
|
||||||
helper.addProblem(
|
helper.addProblem(
|
||||||
|
@ -943,15 +935,11 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
|
|
||||||
BlockExpression _createBlockExpression(
|
BlockExpression _createBlockExpression(
|
||||||
int fileOffset, Block body, Expression value) {
|
int fileOffset, Block body, Expression value) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
return new BlockExpression(body, value)..fileOffset = fileOffset;
|
return new BlockExpression(body, value)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpressionStatement _createExpressionStatement(Expression expression) {
|
ExpressionStatement _createExpressionStatement(Expression expression) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(expression != null);
|
|
||||||
assert(expression.fileOffset != TreeNode.noOffset);
|
assert(expression.fileOffset != TreeNode.noOffset);
|
||||||
return new ExpressionStatement(expression)
|
return new ExpressionStatement(expression)
|
||||||
..fileOffset = expression.fileOffset;
|
..fileOffset = expression.fileOffset;
|
||||||
|
@ -1019,21 +1007,16 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
|
|
||||||
ExpressionInferenceResult visitExtensionTearOff(
|
ExpressionInferenceResult visitExtensionTearOff(
|
||||||
ExtensionTearOff node, DartType typeContext) {
|
ExtensionTearOff node, DartType typeContext) {
|
||||||
// ignore: unnecessary_null_comparison
|
FunctionType calleeType =
|
||||||
FunctionType calleeType = node.target != null
|
node.target.function.computeFunctionType(libraryBuilder.nonNullable);
|
||||||
? node.target.function.computeFunctionType(libraryBuilder.nonNullable)
|
|
||||||
: new FunctionType([], const DynamicType(), libraryBuilder.nonNullable);
|
|
||||||
TypeArgumentsInfo typeArgumentsInfo = getTypeArgumentsInfo(node.arguments);
|
TypeArgumentsInfo typeArgumentsInfo = getTypeArgumentsInfo(node.arguments);
|
||||||
InvocationInferenceResult result = inferInvocation(this, typeContext,
|
InvocationInferenceResult result = inferInvocation(this, typeContext,
|
||||||
node.fileOffset, calleeType, node.arguments as ArgumentsImpl,
|
node.fileOffset, calleeType, node.arguments as ArgumentsImpl,
|
||||||
staticTarget: node.target);
|
staticTarget: node.target);
|
||||||
StaticInvocation replacement =
|
StaticInvocation replacement =
|
||||||
new StaticInvocation(node.target, node.arguments);
|
new StaticInvocation(node.target, node.arguments);
|
||||||
// ignore: unnecessary_null_comparison
|
libraryBuilder.checkBoundsInStaticInvocation(
|
||||||
if (node.target != null) {
|
replacement, typeSchemaEnvironment, helper.uri, typeArgumentsInfo);
|
||||||
libraryBuilder.checkBoundsInStaticInvocation(
|
|
||||||
replacement, typeSchemaEnvironment, helper.uri, typeArgumentsInfo);
|
|
||||||
}
|
|
||||||
return instantiateTearOff(
|
return instantiateTearOff(
|
||||||
result.inferredType, typeContext, result.applyResult(replacement));
|
result.inferredType, typeContext, result.applyResult(replacement));
|
||||||
}
|
}
|
||||||
|
@ -1550,9 +1533,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
Statement? expressionEffects,
|
Statement? expressionEffects,
|
||||||
{bool isAsync = false,
|
{bool isAsync = false,
|
||||||
required bool hasProblem}) {
|
required bool hasProblem}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(hasProblem != null);
|
|
||||||
|
|
||||||
ForInVariable forInVariable =
|
ForInVariable forInVariable =
|
||||||
computeForInVariable(syntheticAssignment, hasProblem);
|
computeForInVariable(syntheticAssignment, hasProblem);
|
||||||
DartType elementType = forInVariable.computeElementType(this);
|
DartType elementType = forInVariable.computeElementType(this);
|
||||||
|
@ -3545,8 +3525,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
}
|
}
|
||||||
|
|
||||||
VariableDeclaration _createVariable(Expression expression, DartType type) {
|
VariableDeclaration _createVariable(Expression expression, DartType type) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(expression != null);
|
|
||||||
assert(expression.fileOffset != TreeNode.noOffset);
|
assert(expression.fileOffset != TreeNode.noOffset);
|
||||||
return new VariableDeclaration.forValue(expression, type: type)
|
return new VariableDeclaration.forValue(expression, type: type)
|
||||||
..fileOffset = expression.fileOffset;
|
..fileOffset = expression.fileOffset;
|
||||||
|
@ -3559,15 +3537,11 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
}
|
}
|
||||||
|
|
||||||
VariableGet _createVariableGet(VariableDeclaration variable) {
|
VariableGet _createVariableGet(VariableDeclaration variable) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(variable != null);
|
|
||||||
assert(variable.fileOffset != TreeNode.noOffset);
|
assert(variable.fileOffset != TreeNode.noOffset);
|
||||||
return new VariableGet(variable)..fileOffset = variable.fileOffset;
|
return new VariableGet(variable)..fileOffset = variable.fileOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
VariableGet _createNullCheckedVariableGet(VariableDeclaration variable) {
|
VariableGet _createNullCheckedVariableGet(VariableDeclaration variable) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(variable != null);
|
|
||||||
assert(variable.fileOffset != TreeNode.noOffset);
|
assert(variable.fileOffset != TreeNode.noOffset);
|
||||||
DartType promotedType =
|
DartType promotedType =
|
||||||
variable.type.withDeclaredNullability(libraryBuilder.nonNullable);
|
variable.type.withDeclaredNullability(libraryBuilder.nonNullable);
|
||||||
|
@ -3581,8 +3555,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
MapLiteral _createMapLiteral(int fileOffset, DartType keyType,
|
MapLiteral _createMapLiteral(int fileOffset, DartType keyType,
|
||||||
DartType valueType, List<MapLiteralEntry> entries,
|
DartType valueType, List<MapLiteralEntry> entries,
|
||||||
{bool isConst = false}) {
|
{bool isConst = false}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
return new MapLiteral(entries,
|
return new MapLiteral(entries,
|
||||||
keyType: keyType, valueType: valueType, isConst: isConst)
|
keyType: keyType, valueType: valueType, isConst: isConst)
|
||||||
|
@ -3592,8 +3564,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
ListLiteral _createListLiteral(
|
ListLiteral _createListLiteral(
|
||||||
int fileOffset, DartType elementType, List<Expression> elements,
|
int fileOffset, DartType elementType, List<Expression> elements,
|
||||||
{bool isConst = false}) {
|
{bool isConst = false}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
return new ListLiteral(elements,
|
return new ListLiteral(elements,
|
||||||
typeArgument: elementType, isConst: isConst)
|
typeArgument: elementType, isConst: isConst)
|
||||||
|
@ -3603,8 +3573,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
SetLiteral _createSetLiteral(
|
SetLiteral _createSetLiteral(
|
||||||
int fileOffset, DartType elementType, List<Expression> elements,
|
int fileOffset, DartType elementType, List<Expression> elements,
|
||||||
{bool isConst = false}) {
|
{bool isConst = false}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
return new SetLiteral(elements, typeArgument: elementType, isConst: isConst)
|
return new SetLiteral(elements, typeArgument: elementType, isConst: isConst)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
|
@ -3613,10 +3581,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
Expression _createAdd(
|
Expression _createAdd(
|
||||||
Expression receiver, InterfaceType receiverType, Expression argument,
|
Expression receiver, InterfaceType receiverType, Expression argument,
|
||||||
{required bool isSet}) {
|
{required bool isSet}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(receiver != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(argument != null);
|
|
||||||
assert(argument.fileOffset != TreeNode.noOffset,
|
assert(argument.fileOffset != TreeNode.noOffset,
|
||||||
"No fileOffset on ${argument}.");
|
"No fileOffset on ${argument}.");
|
||||||
DartType functionType = Substitution.fromInterfaceType(receiverType)
|
DartType functionType = Substitution.fromInterfaceType(receiverType)
|
||||||
|
@ -3635,10 +3599,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
|
|
||||||
Expression _createAddAll(Expression receiver, InterfaceType receiverType,
|
Expression _createAddAll(Expression receiver, InterfaceType receiverType,
|
||||||
Expression argument, bool isSet) {
|
Expression argument, bool isSet) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(receiver != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(argument != null);
|
|
||||||
assert(argument.fileOffset != TreeNode.noOffset,
|
assert(argument.fileOffset != TreeNode.noOffset,
|
||||||
"No fileOffset on ${argument}.");
|
"No fileOffset on ${argument}.");
|
||||||
DartType functionType = Substitution.fromInterfaceType(receiverType)
|
DartType functionType = Substitution.fromInterfaceType(receiverType)
|
||||||
|
@ -3658,10 +3618,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
|
|
||||||
Expression _createMapAddAll(
|
Expression _createMapAddAll(
|
||||||
Expression receiver, InterfaceType receiverType, Expression argument) {
|
Expression receiver, InterfaceType receiverType, Expression argument) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(receiver != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(argument != null);
|
|
||||||
assert(argument.fileOffset != TreeNode.noOffset,
|
assert(argument.fileOffset != TreeNode.noOffset,
|
||||||
"No fileOffset on ${argument}.");
|
"No fileOffset on ${argument}.");
|
||||||
DartType functionType = Substitution.fromInterfaceType(receiverType)
|
DartType functionType = Substitution.fromInterfaceType(receiverType)
|
||||||
|
@ -3679,8 +3635,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
|
|
||||||
Expression _createEqualsNull(Expression expression,
|
Expression _createEqualsNull(Expression expression,
|
||||||
{bool notEquals = false}) {
|
{bool notEquals = false}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(expression != null);
|
|
||||||
assert(expression.fileOffset != TreeNode.noOffset);
|
assert(expression.fileOffset != TreeNode.noOffset);
|
||||||
Expression check = new EqualsNull(expression)
|
Expression check = new EqualsNull(expression)
|
||||||
..fileOffset = expression.fileOffset;
|
..fileOffset = expression.fileOffset;
|
||||||
|
@ -3692,8 +3646,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
|
|
||||||
Expression _createIndexSet(int fileOffset, Expression receiver,
|
Expression _createIndexSet(int fileOffset, Expression receiver,
|
||||||
InterfaceType receiverType, Expression key, Expression value) {
|
InterfaceType receiverType, Expression key, Expression value) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
DartType functionType = Substitution.fromInterfaceType(receiverType)
|
DartType functionType = Substitution.fromInterfaceType(receiverType)
|
||||||
.substituteType(engine.mapPutFunctionType);
|
.substituteType(engine.mapPutFunctionType);
|
||||||
|
@ -3710,8 +3662,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
|
|
||||||
AsExpression _createImplicitAs(
|
AsExpression _createImplicitAs(
|
||||||
int fileOffset, Expression expression, DartType type) {
|
int fileOffset, Expression expression, DartType type) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
return new AsExpression(expression, type)
|
return new AsExpression(expression, type)
|
||||||
..isTypeError = true
|
..isTypeError = true
|
||||||
|
@ -3721,8 +3671,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
|
|
||||||
IfStatement _createIf(int fileOffset, Expression condition, Statement then,
|
IfStatement _createIf(int fileOffset, Expression condition, Statement then,
|
||||||
[Statement? otherwise]) {
|
[Statement? otherwise]) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
return new IfStatement(condition, then, otherwise)..fileOffset = fileOffset;
|
return new IfStatement(condition, then, otherwise)..fileOffset = fileOffset;
|
||||||
}
|
}
|
||||||
|
@ -3730,8 +3678,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
IfCaseStatement _createIfCase(int fileOffset, Expression condition,
|
IfCaseStatement _createIfCase(int fileOffset, Expression condition,
|
||||||
DartType matchedValueType, PatternGuard patternGuard, Statement then,
|
DartType matchedValueType, PatternGuard patternGuard, Statement then,
|
||||||
[Statement? otherwise]) {
|
[Statement? otherwise]) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
return new IfCaseStatement(condition, patternGuard, then, otherwise)
|
return new IfCaseStatement(condition, patternGuard, then, otherwise)
|
||||||
..matchedValueType = matchedValueType
|
..matchedValueType = matchedValueType
|
||||||
|
@ -3740,8 +3686,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
|
|
||||||
Expression _createGetKey(
|
Expression _createGetKey(
|
||||||
int fileOffset, Expression receiver, InterfaceType entryType) {
|
int fileOffset, Expression receiver, InterfaceType entryType) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
DartType resultType = Substitution.fromInterfaceType(entryType)
|
DartType resultType = Substitution.fromInterfaceType(entryType)
|
||||||
.substituteType(engine.mapEntryKey.type);
|
.substituteType(engine.mapEntryKey.type);
|
||||||
|
@ -3753,8 +3697,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
|
|
||||||
Expression _createGetValue(
|
Expression _createGetValue(
|
||||||
int fileOffset, Expression receiver, InterfaceType entryType) {
|
int fileOffset, Expression receiver, InterfaceType entryType) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
DartType resultType = Substitution.fromInterfaceType(entryType)
|
DartType resultType = Substitution.fromInterfaceType(entryType)
|
||||||
.substituteType(engine.mapEntryValue.type);
|
.substituteType(engine.mapEntryValue.type);
|
||||||
|
@ -3766,8 +3708,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
|
|
||||||
Expression _createGetEntries(
|
Expression _createGetEntries(
|
||||||
int fileOffset, Expression receiver, InterfaceType mapType) {
|
int fileOffset, Expression receiver, InterfaceType mapType) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
DartType resultType = Substitution.fromInterfaceType(mapType)
|
DartType resultType = Substitution.fromInterfaceType(mapType)
|
||||||
.substituteType(engine.mapEntries.getterType);
|
.substituteType(engine.mapEntries.getterType);
|
||||||
|
@ -3783,8 +3723,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
Expression? condition,
|
Expression? condition,
|
||||||
List<Expression> updates,
|
List<Expression> updates,
|
||||||
Statement body) {
|
Statement body) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
return new ForStatement(variables, condition, updates, body)
|
return new ForStatement(variables, condition, updates, body)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
|
@ -3793,8 +3731,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
ForInStatement _createForInStatement(int fileOffset,
|
ForInStatement _createForInStatement(int fileOffset,
|
||||||
VariableDeclaration variable, Expression iterable, Statement body,
|
VariableDeclaration variable, Expression iterable, Statement body,
|
||||||
{bool isAsync = false}) {
|
{bool isAsync = false}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
return new ForInStatement(variable, iterable, body, isAsync: isAsync)
|
return new ForInStatement(variable, iterable, body, isAsync: isAsync)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
|
@ -3819,8 +3755,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
Expression then,
|
Expression then,
|
||||||
Expression otherwise,
|
Expression otherwise,
|
||||||
DartType type) {
|
DartType type) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fileOffset != null);
|
|
||||||
assert(fileOffset != TreeNode.noOffset);
|
assert(fileOffset != TreeNode.noOffset);
|
||||||
return new ConditionalExpression(condition, then, otherwise, type)
|
return new ConditionalExpression(condition, then, otherwise, type)
|
||||||
..fileOffset = fileOffset;
|
..fileOffset = fileOffset;
|
||||||
|
@ -6023,8 +5957,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
ExpressionInferenceResult _computeEqualsExpression(
|
ExpressionInferenceResult _computeEqualsExpression(
|
||||||
int fileOffset, Expression left, DartType leftType, Expression right,
|
int fileOffset, Expression left, DartType leftType, Expression right,
|
||||||
{required bool isNot}) {
|
{required bool isNot}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNot != null);
|
|
||||||
ExpressionInfo<DartType>? equalityInfo =
|
ExpressionInfo<DartType>? equalityInfo =
|
||||||
flowAnalysis.equalityOperand_end(left, leftType);
|
flowAnalysis.equalityOperand_end(left, leftType);
|
||||||
|
|
||||||
|
@ -6693,8 +6625,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
{required bool isThisReceiver,
|
{required bool isThisReceiver,
|
||||||
ObjectAccessTarget? readTarget,
|
ObjectAccessTarget? readTarget,
|
||||||
Expression? propertyGetNode}) {
|
Expression? propertyGetNode}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isThisReceiver != null);
|
|
||||||
Map<DartType, NonPromotionReason> Function() whyNotPromoted =
|
Map<DartType, NonPromotionReason> Function() whyNotPromoted =
|
||||||
flowAnalysis.whyNotPromoted(receiver);
|
flowAnalysis.whyNotPromoted(receiver);
|
||||||
|
|
||||||
|
@ -6747,8 +6677,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
Expression value,
|
Expression value,
|
||||||
{required DartType valueType,
|
{required DartType valueType,
|
||||||
required bool forEffect}) {
|
required bool forEffect}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null);
|
|
||||||
Expression write;
|
Expression write;
|
||||||
DartType writeType = valueType;
|
DartType writeType = valueType;
|
||||||
switch (writeTarget.kind) {
|
switch (writeTarget.kind) {
|
||||||
|
@ -8103,19 +8031,14 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
@override
|
@override
|
||||||
ExpressionInferenceResult visitStaticInvocation(
|
ExpressionInferenceResult visitStaticInvocation(
|
||||||
StaticInvocation node, DartType typeContext) {
|
StaticInvocation node, DartType typeContext) {
|
||||||
// ignore: unnecessary_null_comparison
|
FunctionType calleeType =
|
||||||
FunctionType calleeType = node.target != null
|
node.target.function.computeFunctionType(libraryBuilder.nonNullable);
|
||||||
? node.target.function.computeFunctionType(libraryBuilder.nonNullable)
|
|
||||||
: new FunctionType([], const DynamicType(), libraryBuilder.nonNullable);
|
|
||||||
TypeArgumentsInfo typeArgumentsInfo = getTypeArgumentsInfo(node.arguments);
|
TypeArgumentsInfo typeArgumentsInfo = getTypeArgumentsInfo(node.arguments);
|
||||||
InvocationInferenceResult result = inferInvocation(this, typeContext,
|
InvocationInferenceResult result = inferInvocation(this, typeContext,
|
||||||
node.fileOffset, calleeType, node.arguments as ArgumentsImpl,
|
node.fileOffset, calleeType, node.arguments as ArgumentsImpl,
|
||||||
staticTarget: node.target);
|
staticTarget: node.target);
|
||||||
// ignore: unnecessary_null_comparison
|
libraryBuilder.checkBoundsInStaticInvocation(
|
||||||
if (node.target != null) {
|
node, typeSchemaEnvironment, helper.uri, typeArgumentsInfo);
|
||||||
libraryBuilder.checkBoundsInStaticInvocation(
|
|
||||||
node, typeSchemaEnvironment, helper.uri, typeArgumentsInfo);
|
|
||||||
}
|
|
||||||
return new ExpressionInferenceResult(
|
return new ExpressionInferenceResult(
|
||||||
result.inferredType, result.applyResult(node));
|
result.inferredType, result.applyResult(node));
|
||||||
}
|
}
|
||||||
|
@ -9138,18 +9061,15 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
||||||
receiver.literal.length);
|
receiver.literal.length);
|
||||||
return new ExpressionInferenceResult(const DynamicType(), error);
|
return new ExpressionInferenceResult(const DynamicType(), error);
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
Expression? error = checkWebIntLiteralsErrorIfUnexact(
|
||||||
if (intValue != null) {
|
intValue, receiver.literal, receiver.fileOffset);
|
||||||
Expression? error = checkWebIntLiteralsErrorIfUnexact(
|
if (error != null) {
|
||||||
intValue, receiver.literal, receiver.fileOffset);
|
return new ExpressionInferenceResult(const DynamicType(), error);
|
||||||
if (error != null) {
|
|
||||||
return new ExpressionInferenceResult(const DynamicType(), error);
|
|
||||||
}
|
|
||||||
expressionResult = new ExpressionInferenceResult(
|
|
||||||
coreTypes.intRawType(libraryBuilder.nonNullable),
|
|
||||||
new IntLiteral(-intValue)
|
|
||||||
..fileOffset = node.expression.fileOffset);
|
|
||||||
}
|
}
|
||||||
|
expressionResult = new ExpressionInferenceResult(
|
||||||
|
coreTypes.intRawType(libraryBuilder.nonNullable),
|
||||||
|
new IntLiteral(-intValue)
|
||||||
|
..fileOffset = node.expression.fileOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,23 +237,13 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
|
|
||||||
Expression createReachabilityError(
|
Expression createReachabilityError(
|
||||||
int fileOffset, Message errorMessage, Message warningMessage) {
|
int fileOffset, Message errorMessage, Message warningMessage) {
|
||||||
if (libraryBuilder.loader.target.context.options.warnOnReachabilityCheck &&
|
if (libraryBuilder.loader.target.context.options.warnOnReachabilityCheck) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
warningMessage != null) {
|
|
||||||
helper.addProblem(warningMessage, fileOffset, noLength);
|
helper.addProblem(warningMessage, fileOffset, noLength);
|
||||||
}
|
}
|
||||||
Arguments arguments;
|
Arguments arguments = new Arguments([
|
||||||
// ignore: unnecessary_null_comparison
|
new StringLiteral(errorMessage.problemMessage)..fileOffset = fileOffset
|
||||||
if (errorMessage != null) {
|
])
|
||||||
arguments = new Arguments([
|
..fileOffset = fileOffset;
|
||||||
new StringLiteral(errorMessage.problemMessage)..fileOffset = fileOffset
|
|
||||||
])
|
|
||||||
..fileOffset = fileOffset;
|
|
||||||
} else {
|
|
||||||
arguments = new Arguments([])..fileOffset = fileOffset;
|
|
||||||
}
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(coreTypes.reachabilityErrorConstructor != null);
|
|
||||||
return new Throw(
|
return new Throw(
|
||||||
new ConstructorInvocation(
|
new ConstructorInvocation(
|
||||||
coreTypes.reachabilityErrorConstructor, arguments)
|
coreTypes.reachabilityErrorConstructor, arguments)
|
||||||
|
@ -461,9 +451,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
DartType? runtimeCheckedType,
|
DartType? runtimeCheckedType,
|
||||||
bool isVoidAllowed = false,
|
bool isVoidAllowed = false,
|
||||||
bool coerceExpression = true}) {
|
bool coerceExpression = true}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(contextType != null);
|
|
||||||
|
|
||||||
fileOffset ??= inferenceResult.expression.fileOffset;
|
fileOffset ??= inferenceResult.expression.fileOffset;
|
||||||
contextType = computeGreatestClosure(contextType);
|
contextType = computeGreatestClosure(contextType);
|
||||||
|
|
||||||
|
@ -554,9 +541,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
Template<Message Function(DartType, DartType, DartType, DartType, bool)>?
|
Template<Message Function(DartType, DartType, DartType, DartType, bool)>?
|
||||||
nullabilityPartErrorTemplate,
|
nullabilityPartErrorTemplate,
|
||||||
Map<DartType, NonPromotionReason> Function()? whyNotPromoted}) {
|
Map<DartType, NonPromotionReason> Function()? whyNotPromoted}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(contextType != null);
|
|
||||||
|
|
||||||
// [errorTemplate], [nullabilityErrorTemplate], and
|
// [errorTemplate], [nullabilityErrorTemplate], and
|
||||||
// [nullabilityPartErrorTemplate] should be provided together.
|
// [nullabilityPartErrorTemplate] should be provided together.
|
||||||
assert((errorTemplate == null) == (nullabilityErrorTemplate == null) &&
|
assert((errorTemplate == null) == (nullabilityErrorTemplate == null) &&
|
||||||
|
@ -723,9 +707,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
Template<Message Function(DartType, DartType, DartType, DartType, bool)>?
|
Template<Message Function(DartType, DartType, DartType, DartType, bool)>?
|
||||||
nullabilityPartErrorTemplate,
|
nullabilityPartErrorTemplate,
|
||||||
Map<DartType, NonPromotionReason> Function()? whyNotPromoted}) {
|
Map<DartType, NonPromotionReason> Function()? whyNotPromoted}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(contextType != null);
|
|
||||||
|
|
||||||
if (coerceExpression) {
|
if (coerceExpression) {
|
||||||
ExpressionInferenceResult? coercionResult = coerceExpressionForAssignment(
|
ExpressionInferenceResult? coercionResult = coerceExpressionForAssignment(
|
||||||
contextType, inferenceResult,
|
contextType, inferenceResult,
|
||||||
|
@ -757,8 +738,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
|
|
||||||
Expression _wrapTearoffErrorExpression(Expression expression,
|
Expression _wrapTearoffErrorExpression(Expression expression,
|
||||||
DartType contextType, Template<Message Function(String)> template) {
|
DartType contextType, Template<Message Function(String)> template) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(template != null);
|
|
||||||
Expression errorNode = new AsExpression(
|
Expression errorNode = new AsExpression(
|
||||||
expression,
|
expression,
|
||||||
// TODO(ahe): The outline phase doesn't correctly remove invalid
|
// TODO(ahe): The outline phase doesn't correctly remove invalid
|
||||||
|
@ -842,13 +821,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
required bool isVoidAllowed,
|
required bool isVoidAllowed,
|
||||||
required bool isExpressionTypePrecise,
|
required bool isExpressionTypePrecise,
|
||||||
required bool coerceExpression}) {
|
required bool coerceExpression}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNonNullableByDefault != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isVoidAllowed != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isExpressionTypePrecise != null);
|
|
||||||
|
|
||||||
// If an interface type is being assigned to a function type, see if we
|
// If an interface type is being assigned to a function type, see if we
|
||||||
// should tear off `.call`.
|
// should tear off `.call`.
|
||||||
// TODO(paulberry): use resolveTypeParameter. See findInterfaceMember.
|
// TODO(paulberry): use resolveTypeParameter. See findInterfaceMember.
|
||||||
|
@ -1315,8 +1287,7 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
{required CallSiteAccessKind callSiteAccessKind,
|
{required CallSiteAccessKind callSiteAccessKind,
|
||||||
bool instrumented = true,
|
bool instrumented = true,
|
||||||
bool includeExtensionMethods = false}) {
|
bool includeExtensionMethods = false}) {
|
||||||
// ignore: unnecessary_null_comparison
|
assert(isKnown(receiverType));
|
||||||
assert(receiverType != null && isKnown(receiverType));
|
|
||||||
|
|
||||||
bool isSetter = callSiteAccessKind == CallSiteAccessKind.setterInvocation;
|
bool isSetter = callSiteAccessKind == CallSiteAccessKind.setterInvocation;
|
||||||
|
|
||||||
|
@ -1415,10 +1386,8 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
Name name,
|
Name name,
|
||||||
int fileOffset,
|
int fileOffset,
|
||||||
Template<Message Function(String, DartType, bool)> errorTemplate) {
|
Template<Message Function(String, DartType, bool)> errorTemplate) {
|
||||||
// ignore: unnecessary_null_comparison
|
assert(isKnown(receiverType));
|
||||||
assert(receiverType != null && isKnown(receiverType));
|
if (target.isMissing) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (target.isMissing && errorTemplate != null) {
|
|
||||||
int length = name.text.length;
|
int length = name.text.length;
|
||||||
if (identical(name.text, callName.text) ||
|
if (identical(name.text, callName.text) ||
|
||||||
identical(name.text, unaryMinusName.text)) {
|
identical(name.text, unaryMinusName.text)) {
|
||||||
|
@ -1806,8 +1775,7 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
|
|
||||||
TypeConstraintGatherer? gatherer;
|
TypeConstraintGatherer? gatherer;
|
||||||
if (inferenceNeeded) {
|
if (inferenceNeeded) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (isConst) {
|
||||||
if (isConst && typeContext != null) {
|
|
||||||
typeContext = new TypeVariableEliminator(
|
typeContext = new TypeVariableEliminator(
|
||||||
bottomType,
|
bottomType,
|
||||||
isNonNullableByDefault
|
isNonNullableByDefault
|
||||||
|
@ -2450,8 +2418,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
DartType typeContext,
|
DartType typeContext,
|
||||||
List<VariableDeclaration>? hoistedExpressions,
|
List<VariableDeclaration>? hoistedExpressions,
|
||||||
{required bool isImplicitCall}) {
|
{required bool isImplicitCall}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isImplicitCall != null);
|
|
||||||
InvocationInferenceResult result = inferInvocation(
|
InvocationInferenceResult result = inferInvocation(
|
||||||
visitor, typeContext, fileOffset, unknownFunction, arguments,
|
visitor, typeContext, fileOffset, unknownFunction, arguments,
|
||||||
hoistedExpressions: hoistedExpressions,
|
hoistedExpressions: hoistedExpressions,
|
||||||
|
@ -2476,8 +2442,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
DartType typeContext,
|
DartType typeContext,
|
||||||
List<VariableDeclaration>? hoistedExpressions,
|
List<VariableDeclaration>? hoistedExpressions,
|
||||||
{required bool isImplicitCall}) {
|
{required bool isImplicitCall}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isImplicitCall != null);
|
|
||||||
InvocationInferenceResult result = inferInvocation(
|
InvocationInferenceResult result = inferInvocation(
|
||||||
visitor, typeContext, fileOffset, unknownFunction, arguments,
|
visitor, typeContext, fileOffset, unknownFunction, arguments,
|
||||||
hoistedExpressions: hoistedExpressions,
|
hoistedExpressions: hoistedExpressions,
|
||||||
|
@ -2508,10 +2472,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
required bool isImplicitCall,
|
required bool isImplicitCall,
|
||||||
Name? implicitInvocationPropertyName}) {
|
Name? implicitInvocationPropertyName}) {
|
||||||
assert(target.isMissing || target.isAmbiguous);
|
assert(target.isMissing || target.isAmbiguous);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isExpressionInvocation != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isImplicitCall != null);
|
|
||||||
Expression error = createMissingMethodInvocation(
|
Expression error = createMissingMethodInvocation(
|
||||||
fileOffset, receiverType, name,
|
fileOffset, receiverType, name,
|
||||||
receiver: receiver,
|
receiver: receiver,
|
||||||
|
@ -2544,8 +2504,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
DartType typeContext,
|
DartType typeContext,
|
||||||
List<VariableDeclaration>? hoistedExpressions,
|
List<VariableDeclaration>? hoistedExpressions,
|
||||||
{required bool isImplicitCall}) {
|
{required bool isImplicitCall}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isImplicitCall != null);
|
|
||||||
assert(target.isExtensionMember ||
|
assert(target.isExtensionMember ||
|
||||||
target.isNullableExtensionMember ||
|
target.isNullableExtensionMember ||
|
||||||
target.isInlineClassMember ||
|
target.isInlineClassMember ||
|
||||||
|
@ -2659,8 +2617,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
DartType typeContext,
|
DartType typeContext,
|
||||||
List<VariableDeclaration>? hoistedExpressions,
|
List<VariableDeclaration>? hoistedExpressions,
|
||||||
{required bool isImplicitCall}) {
|
{required bool isImplicitCall}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isImplicitCall != null);
|
|
||||||
assert(target.isCallFunction || target.isNullableCallFunction);
|
assert(target.isCallFunction || target.isNullableCallFunction);
|
||||||
FunctionType declaredFunctionType = target.getFunctionType(this);
|
FunctionType declaredFunctionType = target.getFunctionType(this);
|
||||||
InvocationInferenceResult result = inferInvocation(
|
InvocationInferenceResult result = inferInvocation(
|
||||||
|
@ -2765,12 +2721,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
{required bool isImplicitCall,
|
{required bool isImplicitCall,
|
||||||
required bool isSpecialCasedBinaryOperator,
|
required bool isSpecialCasedBinaryOperator,
|
||||||
required bool isSpecialCasedTernaryOperator}) {
|
required bool isSpecialCasedTernaryOperator}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isImplicitCall != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isSpecialCasedBinaryOperator != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isSpecialCasedTernaryOperator != null);
|
|
||||||
assert(target.isInstanceMember ||
|
assert(target.isInstanceMember ||
|
||||||
target.isObjectMember ||
|
target.isObjectMember ||
|
||||||
target.isNullableInstanceMember);
|
target.isNullableInstanceMember);
|
||||||
|
@ -2932,8 +2882,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
DartType typeContext,
|
DartType typeContext,
|
||||||
List<VariableDeclaration>? hoistedExpressions,
|
List<VariableDeclaration>? hoistedExpressions,
|
||||||
{required bool isExpressionInvocation}) {
|
{required bool isExpressionInvocation}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isExpressionInvocation != null);
|
|
||||||
assert(target.isInstanceMember ||
|
assert(target.isInstanceMember ||
|
||||||
target.isObjectMember ||
|
target.isObjectMember ||
|
||||||
target.isNullableInstanceMember);
|
target.isNullableInstanceMember);
|
||||||
|
@ -3134,8 +3082,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
DartType typeContext,
|
DartType typeContext,
|
||||||
List<VariableDeclaration>? hoistedExpressions,
|
List<VariableDeclaration>? hoistedExpressions,
|
||||||
{required bool isExpressionInvocation}) {
|
{required bool isExpressionInvocation}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isExpressionInvocation != null);
|
|
||||||
assert(target.isInstanceMember ||
|
assert(target.isInstanceMember ||
|
||||||
target.isObjectMember ||
|
target.isObjectMember ||
|
||||||
target.isNullableInstanceMember);
|
target.isNullableInstanceMember);
|
||||||
|
@ -3310,11 +3256,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
Name? implicitInvocationPropertyName,
|
Name? implicitInvocationPropertyName,
|
||||||
List<VariableDeclaration>? hoistedExpressions,
|
List<VariableDeclaration>? hoistedExpressions,
|
||||||
ObjectAccessTarget? target}) {
|
ObjectAccessTarget? target}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isExpressionInvocation != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isImplicitCall != null);
|
|
||||||
|
|
||||||
target ??= findInterfaceMember(receiverType, name, fileOffset,
|
target ??= findInterfaceMember(receiverType, name, fileOffset,
|
||||||
instrumented: true,
|
instrumented: true,
|
||||||
includeExtensionMethods: true,
|
includeExtensionMethods: true,
|
||||||
|
@ -3593,8 +3534,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
void checkBoundsInInstantiation(
|
void checkBoundsInInstantiation(
|
||||||
FunctionType functionType, List<DartType> arguments, int fileOffset,
|
FunctionType functionType, List<DartType> arguments, int fileOffset,
|
||||||
{required bool inferred}) {
|
{required bool inferred}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(inferred != null);
|
|
||||||
// If [arguments] were inferred, check them.
|
// If [arguments] were inferred, check them.
|
||||||
|
|
||||||
libraryBuilder.checkBoundsInInstantiation(
|
libraryBuilder.checkBoundsInInstantiation(
|
||||||
|
@ -3805,8 +3744,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
MethodContravarianceCheckKind preCheckInvocationContravariance(
|
MethodContravarianceCheckKind preCheckInvocationContravariance(
|
||||||
DartType receiverType, ObjectAccessTarget target,
|
DartType receiverType, ObjectAccessTarget target,
|
||||||
{required bool isThisReceiver}) {
|
{required bool isThisReceiver}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isThisReceiver != null);
|
|
||||||
if (target.isInstanceMember || target.isObjectMember) {
|
if (target.isInstanceMember || target.isObjectMember) {
|
||||||
Member interfaceMember = target.member!;
|
Member interfaceMember = target.member!;
|
||||||
if (interfaceMember is Field ||
|
if (interfaceMember is Field ||
|
||||||
|
@ -3888,10 +3825,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
}
|
}
|
||||||
// TODO(paulberry): If [type] is a subtype of `Future`, should we just
|
// TODO(paulberry): If [type] is a subtype of `Future`, should we just
|
||||||
// return it unmodified?
|
// return it unmodified?
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (type == null) {
|
|
||||||
return coreTypes.futureRawType(libraryBuilder.nullable);
|
|
||||||
}
|
|
||||||
return new FutureOrType(type, libraryBuilder.nonNullable);
|
return new FutureOrType(type, libraryBuilder.nonNullable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4117,8 +4050,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
required bool isExpressionInvocation,
|
required bool isExpressionInvocation,
|
||||||
Name? implicitInvocationPropertyName,
|
Name? implicitInvocationPropertyName,
|
||||||
List<ExtensionAccessCandidate>? extensionAccessCandidates}) {
|
List<ExtensionAccessCandidate>? extensionAccessCandidates}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isExpressionInvocation != null);
|
|
||||||
assert((receiver == null) == (arguments == null),
|
assert((receiver == null) == (arguments == null),
|
||||||
"Receiver and arguments must be supplied together.");
|
"Receiver and arguments must be supplied together.");
|
||||||
if (implicitInvocationPropertyName != null) {
|
if (implicitInvocationPropertyName != null) {
|
||||||
|
@ -4369,8 +4300,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
DartType receiverType, Name propertyName, Expression value,
|
DartType receiverType, Name propertyName, Expression value,
|
||||||
{required bool forEffect,
|
{required bool forEffect,
|
||||||
List<ExtensionAccessCandidate>? extensionAccessCandidates}) {
|
List<ExtensionAccessCandidate>? extensionAccessCandidates}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null);
|
|
||||||
Template<Message Function(String, DartType, bool)> templateMissing;
|
Template<Message Function(String, DartType, bool)> templateMissing;
|
||||||
if (receiverType is ExtensionType) {
|
if (receiverType is ExtensionType) {
|
||||||
templateMissing = templateUndefinedExtensionSetter;
|
templateMissing = templateUndefinedExtensionSetter;
|
||||||
|
@ -4413,8 +4342,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
||||||
DartType receiverType, Expression index, Expression value,
|
DartType receiverType, Expression index, Expression value,
|
||||||
{required bool forEffect,
|
{required bool forEffect,
|
||||||
List<ExtensionAccessCandidate>? extensionAccessCandidates}) {
|
List<ExtensionAccessCandidate>? extensionAccessCandidates}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forEffect != null);
|
|
||||||
Template<Message Function(String, DartType, bool)> templateMissing;
|
Template<Message Function(String, DartType, bool)> templateMissing;
|
||||||
if (receiverType is ExtensionType) {
|
if (receiverType is ExtensionType) {
|
||||||
templateMissing = templateUndefinedExtensionOperator;
|
templateMissing = templateUndefinedExtensionOperator;
|
||||||
|
|
|
@ -102,10 +102,6 @@ abstract class ObjectAccessTarget {
|
||||||
factory ObjectAccessTarget.interfaceMember(
|
factory ObjectAccessTarget.interfaceMember(
|
||||||
DartType receiverType, Member member,
|
DartType receiverType, Member member,
|
||||||
{required bool isPotentiallyNullable}) {
|
{required bool isPotentiallyNullable}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(member != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isPotentiallyNullable != null);
|
|
||||||
return isPotentiallyNullable
|
return isPotentiallyNullable
|
||||||
? new InstanceAccessTarget.nullable(receiverType, member)
|
? new InstanceAccessTarget.nullable(receiverType, member)
|
||||||
: new InstanceAccessTarget.nonNullable(receiverType, member);
|
: new InstanceAccessTarget.nonNullable(receiverType, member);
|
||||||
|
@ -980,9 +976,7 @@ class ExtensionAccessCandidate {
|
||||||
|
|
||||||
ExtensionAccessCandidate(this.memberBuilder, this.onType,
|
ExtensionAccessCandidate(this.memberBuilder, this.onType,
|
||||||
this.onTypeInstantiateToBounds, this.target,
|
this.onTypeInstantiateToBounds, this.target,
|
||||||
{required this.isPlatform})
|
{required this.isPlatform});
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(isPlatform != null);
|
|
||||||
|
|
||||||
bool? isMoreSpecificThan(TypeSchemaEnvironment typeSchemaEnvironment,
|
bool? isMoreSpecificThan(TypeSchemaEnvironment typeSchemaEnvironment,
|
||||||
ExtensionAccessCandidate other) {
|
ExtensionAccessCandidate other) {
|
||||||
|
|
|
@ -151,8 +151,6 @@ abstract class TypeConstraintGatherer {
|
||||||
/// type schema.
|
/// type schema.
|
||||||
bool _tryNullabilityAwareSubtypeMatch(DartType subtype, DartType supertype,
|
bool _tryNullabilityAwareSubtypeMatch(DartType subtype, DartType supertype,
|
||||||
{required bool constrainSupertype}) {
|
{required bool constrainSupertype}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(constrainSupertype != null);
|
|
||||||
int baseConstraintCount = _protoConstraints.length;
|
int baseConstraintCount = _protoConstraints.length;
|
||||||
bool isMatch = _isNullabilityAwareSubtypeMatch(subtype, supertype,
|
bool isMatch = _isNullabilityAwareSubtypeMatch(subtype, supertype,
|
||||||
constrainSupertype: constrainSupertype);
|
constrainSupertype: constrainSupertype);
|
||||||
|
@ -327,13 +325,6 @@ abstract class TypeConstraintGatherer {
|
||||||
/// [UnknownType], that is, to be a type schema.
|
/// [UnknownType], that is, to be a type schema.
|
||||||
bool _isNullabilityAwareSubtypeMatch(DartType p, DartType q,
|
bool _isNullabilityAwareSubtypeMatch(DartType p, DartType q,
|
||||||
{required bool constrainSupertype}) {
|
{required bool constrainSupertype}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(p != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(q != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(constrainSupertype != null);
|
|
||||||
|
|
||||||
// If the type parameters being constrained occur in the supertype (that is,
|
// If the type parameters being constrained occur in the supertype (that is,
|
||||||
// [q]), the subtype (that is, [p]) is not allowed to contain them. To
|
// [q]), the subtype (that is, [p]) is not allowed to contain them. To
|
||||||
// check that, the assert below uses the equivalence of the following: X ->
|
// check that, the assert below uses the equivalence of the following: X ->
|
||||||
|
@ -1066,18 +1057,15 @@ abstract class TypeConstraintGatherer {
|
||||||
Member? callMember = getInterfaceMember(subtype.classNode, callName);
|
Member? callMember = getInterfaceMember(subtype.classNode, callName);
|
||||||
if (callMember is Procedure && !callMember.isGetter) {
|
if (callMember is Procedure && !callMember.isGetter) {
|
||||||
DartType callType = callMember.getterType;
|
DartType callType = callMember.getterType;
|
||||||
// ignore: unnecessary_null_comparison
|
callType =
|
||||||
if (callType != null) {
|
Substitution.fromInterfaceType(subtype).substituteType(callType);
|
||||||
callType =
|
// TODO(kmillikin): The subtype check will fail if the type of a
|
||||||
Substitution.fromInterfaceType(subtype).substituteType(callType);
|
// generic call method is a subtype of a non-generic function type.
|
||||||
// TODO(kmillikin): The subtype check will fail if the type of a
|
// For example, if `T call<T>(T arg)` is a subtype of `S->S` for some
|
||||||
// generic call method is a subtype of a non-generic function type.
|
// S. However, explicitly tearing off that call method will work and
|
||||||
// For example, if `T call<T>(T arg)` is a subtype of `S->S` for some
|
// insert an explicit instantiation, so the implicit tear off should
|
||||||
// S. However, explicitly tearing off that call method will work and
|
// work as well. Figure out how to support this case.
|
||||||
// insert an explicit instantiation, so the implicit tear off should
|
return _isNullabilityObliviousSubtypeMatch(callType, supertype);
|
||||||
// work as well. Figure out how to support this case.
|
|
||||||
return _isNullabilityObliviousSubtypeMatch(callType, supertype);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -104,11 +104,7 @@ class _DemotionNullabilityNormalization extends ReplacementVisitor {
|
||||||
|
|
||||||
const _DemotionNullabilityNormalization(
|
const _DemotionNullabilityNormalization(
|
||||||
{required this.demoteTypeVariables,
|
{required this.demoteTypeVariables,
|
||||||
required this.forNonNullableByDefault})
|
required this.forNonNullableByDefault});
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(demoteTypeVariables != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(forNonNullableByDefault != null);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Nullability? visitNullability(DartType node) {
|
Nullability? visitNullability(DartType node) {
|
||||||
|
|
|
@ -142,9 +142,7 @@ class TypeInferrerImpl implements TypeInferrer {
|
||||||
this.dataForTesting,
|
this.dataForTesting,
|
||||||
FunctionType unknownFunctionNonNullable,
|
FunctionType unknownFunctionNonNullable,
|
||||||
FunctionType unknownFunctionLegacy)
|
FunctionType unknownFunctionLegacy)
|
||||||
// ignore: unnecessary_null_comparison
|
: unknownFunction = libraryBuilder.isNonNullableByDefault
|
||||||
: assert(libraryBuilder != null),
|
|
||||||
unknownFunction = libraryBuilder.isNonNullableByDefault
|
|
||||||
? unknownFunctionNonNullable
|
? unknownFunctionNonNullable
|
||||||
: unknownFunctionLegacy,
|
: unknownFunctionLegacy,
|
||||||
instrumentation = isTopLevel ? null : engine.instrumentation,
|
instrumentation = isTopLevel ? null : engine.instrumentation,
|
||||||
|
@ -193,8 +191,6 @@ class TypeInferrerImpl implements TypeInferrer {
|
||||||
@override
|
@override
|
||||||
InferredFunctionBody inferFunctionBody(InferenceHelper helper, int fileOffset,
|
InferredFunctionBody inferFunctionBody(InferenceHelper helper, int fileOffset,
|
||||||
DartType returnType, AsyncMarker asyncMarker, Statement body) {
|
DartType returnType, AsyncMarker asyncMarker, Statement body) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(body != null);
|
|
||||||
InferenceVisitorBase visitor = _createInferenceVisitor(helper);
|
InferenceVisitorBase visitor = _createInferenceVisitor(helper);
|
||||||
ClosureContext closureContext =
|
ClosureContext closureContext =
|
||||||
new ClosureContext(visitor, asyncMarker, returnType, false);
|
new ClosureContext(visitor, asyncMarker, returnType, false);
|
||||||
|
@ -292,8 +288,6 @@ class TypeInferrerImpl implements TypeInferrer {
|
||||||
Expression initializer,
|
Expression initializer,
|
||||||
DartType declaredType,
|
DartType declaredType,
|
||||||
bool hasDeclaredInitializer) {
|
bool hasDeclaredInitializer) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(declaredType != null);
|
|
||||||
InferenceVisitorBase visitor = _createInferenceVisitor(helper);
|
InferenceVisitorBase visitor = _createInferenceVisitor(helper);
|
||||||
ExpressionInferenceResult result =
|
ExpressionInferenceResult result =
|
||||||
visitor.inferExpression(initializer, declaredType);
|
visitor.inferExpression(initializer, declaredType);
|
||||||
|
|
|
@ -370,8 +370,6 @@ class TypeSchemaEnvironment extends HierarchyBasedTypeEnvironment
|
||||||
bool isSpecialCasesBinaryForReceiverType(
|
bool isSpecialCasesBinaryForReceiverType(
|
||||||
Procedure member, DartType receiverType,
|
Procedure member, DartType receiverType,
|
||||||
{required bool isNonNullableByDefault}) {
|
{required bool isNonNullableByDefault}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNonNullableByDefault != null);
|
|
||||||
if (!isNonNullableByDefault) {
|
if (!isNonNullableByDefault) {
|
||||||
// TODO(paulberry): this matches what is defined in the spec. It would be
|
// TODO(paulberry): this matches what is defined in the spec. It would be
|
||||||
// nice if we could change kernel to match the spec and not have to
|
// nice if we could change kernel to match the spec and not have to
|
||||||
|
|
|
@ -40,8 +40,6 @@ class UriTranslator {
|
||||||
|
|
||||||
/// For a package uri, get the corresponding [Package].
|
/// For a package uri, get the corresponding [Package].
|
||||||
Package? getPackage(Uri uri) {
|
Package? getPackage(Uri uri) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (packages == null) return null;
|
|
||||||
if (!uri.isScheme("package")) return null;
|
if (!uri.isScheme("package")) return null;
|
||||||
int firstSlash = uri.path.indexOf('/');
|
int firstSlash = uri.path.indexOf('/');
|
||||||
if (firstSlash == -1) return null;
|
if (firstSlash == -1) return null;
|
||||||
|
|
|
@ -55,11 +55,6 @@ CompilationUnitEnd getAST(List<int> rawBytes,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
Token firstToken = scanner.tokenize();
|
Token firstToken = scanner.tokenize();
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (firstToken == null) {
|
|
||||||
throw "firstToken is null";
|
|
||||||
}
|
|
||||||
|
|
||||||
ParserASTListener listener = new ParserASTListener();
|
ParserASTListener listener = new ParserASTListener();
|
||||||
Parser parser;
|
Parser parser;
|
||||||
if (includeBody) {
|
if (includeBody) {
|
||||||
|
|
|
@ -450,12 +450,6 @@ String? textualOutline(
|
||||||
..originalPosition = originalPosition.value++);
|
..originalPosition = originalPosition.value++);
|
||||||
});
|
});
|
||||||
Token firstToken = scanner.tokenize();
|
Token firstToken = scanner.tokenize();
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (firstToken == null) {
|
|
||||||
if (throwOnUnexpected) throw "firstToken is null";
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
TextualOutlineListener listener = new TextualOutlineListener();
|
TextualOutlineListener listener = new TextualOutlineListener();
|
||||||
ClassMemberParser classMemberParser = new ClassMemberParser(listener);
|
ClassMemberParser classMemberParser = new ClassMemberParser(listener);
|
||||||
classMemberParser.parseUnit(firstToken);
|
classMemberParser.parseUnit(firstToken);
|
||||||
|
@ -866,8 +860,7 @@ class TextualOutlineListener extends Listener {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void endImport(Token importKeyword, Token? augmentToken, Token? semicolon) {
|
void endImport(Token importKeyword, Token? augmentToken, Token? semicolon) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (semicolon != null) {
|
||||||
if (importKeyword != null && semicolon != null) {
|
|
||||||
importExportsStartToChunk[importKeyword] = new _ImportChunk(
|
importExportsStartToChunk[importKeyword] = new _ImportChunk(
|
||||||
importKeyword, semicolon, firstShowOrHide, _combinators);
|
importKeyword, semicolon, firstShowOrHide, _combinators);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,6 @@ abstract class DataExtractor<T> extends Visitor<void>
|
||||||
|
|
||||||
void computeForMember(Member member) {
|
void computeForMember(Member member) {
|
||||||
MemberId id = computeMemberId(member);
|
MemberId id = computeMemberId(member);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (id == null) return;
|
|
||||||
T? value = computeMemberValue(id, member);
|
T? value = computeMemberValue(id, member);
|
||||||
registerValue(member.fileUri, member.fileOffset, id, value, member);
|
registerValue(member.fileUri, member.fileOffset, id, value, member);
|
||||||
}
|
}
|
||||||
|
|
|
@ -413,8 +413,7 @@ Future<TestResult<T>> runTestForConfig<T>(MarkerOptions markerOptions,
|
||||||
|
|
||||||
errorMap.forEach((Uri uri, Map<int, List<FormattedMessage>> map) {
|
errorMap.forEach((Uri uri, Map<int, List<FormattedMessage>> map) {
|
||||||
map.forEach((int offset, List<FormattedMessage> list) {
|
map.forEach((int offset, List<FormattedMessage> list) {
|
||||||
// ignore: unnecessary_null_comparison
|
if (offset < 0) {
|
||||||
if (offset == null || offset < 0) {
|
|
||||||
// Position errors without offset in the begin of the file.
|
// Position errors without offset in the begin of the file.
|
||||||
offset = 0;
|
offset = 0;
|
||||||
}
|
}
|
||||||
|
@ -578,8 +577,7 @@ void printMessageInLocation(
|
||||||
if (source == null) {
|
if (source == null) {
|
||||||
print('$uri@$offset: $message');
|
print('$uri@$offset: $message');
|
||||||
} else {
|
} else {
|
||||||
// ignore: unnecessary_null_comparison
|
if (offset >= 1) {
|
||||||
if (offset != null && offset >= 1) {
|
|
||||||
Location location = source.getLocation(uri, offset);
|
Location location = source.getLocation(uri, offset);
|
||||||
print('$location: $message');
|
print('$location: $message');
|
||||||
if (!succinct) {
|
if (!succinct) {
|
||||||
|
|
|
@ -80,11 +80,7 @@ class WidgetCache {
|
||||||
List<int> oldSource =
|
List<int> oldSource =
|
||||||
lastGoodComponent.uriToSource[library.fileUri]!.source;
|
lastGoodComponent.uriToSource[library.fileUri]!.source;
|
||||||
List<int> newSource = partialComponent.uriToSource[library.fileUri]!.source;
|
List<int> newSource = partialComponent.uriToSource[library.fileUri]!.source;
|
||||||
// Library was added and does not exist in the old component.
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (oldSource == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
int newStartIndex = 0;
|
int newStartIndex = 0;
|
||||||
int newEndIndex = newSource.length - 1;
|
int newEndIndex = newSource.length - 1;
|
||||||
int oldStartIndex = 0;
|
int oldStartIndex = 0;
|
||||||
|
|
|
@ -1106,12 +1106,6 @@ worlds:
|
||||||
_isUriNnbd(uri) ? _scannerConfiguration : _scannerConfigurationNonNNBD,
|
_isUriNnbd(uri) ? _scannerConfiguration : _scannerConfigurationNonNNBD,
|
||||||
lineStarts);
|
lineStarts);
|
||||||
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (firstToken == null) {
|
|
||||||
print("Got null token from scanner for $uri");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int compileTry = 0;
|
int compileTry = 0;
|
||||||
Token? token = firstToken;
|
Token? token = firstToken;
|
||||||
while (token is ErrorToken) {
|
while (token is ErrorToken) {
|
||||||
|
@ -1897,8 +1891,6 @@ worlds:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (foundLine == null) throw "Unexpected crash without stacktrace: $e";
|
|
||||||
if (_expectedCrashLine == null) {
|
if (_expectedCrashLine == null) {
|
||||||
print("Got '$foundLine'");
|
print("Got '$foundLine'");
|
||||||
_expectedCrashLine = foundLine;
|
_expectedCrashLine = foundLine;
|
||||||
|
@ -2016,11 +2008,6 @@ worlds:
|
||||||
nnbd ? _scannerConfiguration : _scannerConfigurationNonNNBD,
|
nnbd ? _scannerConfiguration : _scannerConfigurationNonNNBD,
|
||||||
lineStarts);
|
lineStarts);
|
||||||
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (firstToken == null) {
|
|
||||||
throw "Got null token from scanner";
|
|
||||||
}
|
|
||||||
|
|
||||||
ParserTestListener parserTestListener = new ParserTestListener(false);
|
ParserTestListener parserTestListener = new ParserTestListener(false);
|
||||||
Parser parser = new Parser(parserTestListener,
|
Parser parser = new Parser(parserTestListener,
|
||||||
useImplicitCreationExpression: useImplicitCreationExpressionInCfe);
|
useImplicitCreationExpression: useImplicitCreationExpressionInCfe);
|
||||||
|
@ -2034,11 +2021,6 @@ worlds:
|
||||||
Token firstToken = parser_suite.scanRawBytes(rawBytes,
|
Token firstToken = parser_suite.scanRawBytes(rawBytes,
|
||||||
nnbd ? _scannerConfiguration : _scannerConfigurationNonNNBD, null);
|
nnbd ? _scannerConfiguration : _scannerConfigurationNonNNBD, null);
|
||||||
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (firstToken == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ParserErrorListener parserErrorListener = new ParserErrorListener();
|
ParserErrorListener parserErrorListener = new ParserErrorListener();
|
||||||
Parser parser = new Parser(parserErrorListener,
|
Parser parser = new Parser(parserErrorListener,
|
||||||
useImplicitCreationExpression: useImplicitCreationExpressionInCfe);
|
useImplicitCreationExpression: useImplicitCreationExpressionInCfe);
|
||||||
|
|
|
@ -278,16 +278,10 @@ class FolderOptions {
|
||||||
// can be null
|
// can be null
|
||||||
this.overwriteCurrentSdkVersion,
|
this.overwriteCurrentSdkVersion,
|
||||||
this.showOffsets = false})
|
this.showOffsets = false})
|
||||||
// ignore: unnecessary_null_comparison
|
: assert(
|
||||||
: assert(nnbdAgnosticMode != null),
|
|
||||||
assert(
|
|
||||||
// no this doesn't make any sense but left to underline
|
// no this doesn't make any sense but left to underline
|
||||||
// that this is allowed to be null!
|
// that this is allowed to be null!
|
||||||
defines != null || defines == null),
|
defines != null || defines == null);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(noVerify != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(target != null);
|
|
||||||
|
|
||||||
Map<ExperimentalFlag, bool> computeExplicitExperimentalFlags(
|
Map<ExperimentalFlag, bool> computeExplicitExperimentalFlags(
|
||||||
Map<ExperimentalFlag, bool> forcedExperimentalFlags) {
|
Map<ExperimentalFlag, bool> forcedExperimentalFlags) {
|
||||||
|
@ -315,9 +309,7 @@ class TestOptions {
|
||||||
{required this.nnbdMode,
|
{required this.nnbdMode,
|
||||||
required this.allowedExperimentalFlags,
|
required this.allowedExperimentalFlags,
|
||||||
required this.experimentEnabledVersion,
|
required this.experimentEnabledVersion,
|
||||||
required this.experimentReleasedVersion})
|
required this.experimentReleasedVersion});
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(linkDependencies != null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FastaContext extends ChainContext with MatchContext {
|
class FastaContext extends ChainContext with MatchContext {
|
||||||
|
@ -2335,10 +2327,7 @@ class Outline extends Step<TestDescription, ComponentResult, FastaContext> {
|
||||||
backendTarget.performModularTransformations = true;
|
backendTarget.performModularTransformations = true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// ignore: unnecessary_null_comparison
|
sourceTarget.runBuildTransformations();
|
||||||
if (sourceTarget.loader.coreTypes != null) {
|
|
||||||
sourceTarget.runBuildTransformations();
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
if (backendTarget is TestTarget) {
|
if (backendTarget is TestTarget) {
|
||||||
backendTarget.performModularTransformations = false;
|
backendTarget.performModularTransformations = false;
|
||||||
|
@ -2463,10 +2452,7 @@ class Transform extends Step<ComponentResult, ComponentResult, FastaContext> {
|
||||||
backendTarget.performModularTransformations = true;
|
backendTarget.performModularTransformations = true;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// ignore: unnecessary_null_comparison
|
sourceTarget.runBuildTransformations();
|
||||||
if (sourceTarget.loader.coreTypes != null) {
|
|
||||||
sourceTarget.runBuildTransformations();
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
if (backendTarget is TestTarget) {
|
if (backendTarget is TestTarget) {
|
||||||
backendTarget.performModularTransformations = false;
|
backendTarget.performModularTransformations = false;
|
||||||
|
|
|
@ -1475,8 +1475,7 @@ class NewWorldTest {
|
||||||
for (Uri uri in component!.uriToSource.keys) {
|
for (Uri uri in component!.uriToSource.keys) {
|
||||||
// null is always there, so allow it implicitly.
|
// null is always there, so allow it implicitly.
|
||||||
// Dart scheme uris too.
|
// Dart scheme uris too.
|
||||||
// ignore: unnecessary_null_comparison
|
if (uri.isScheme("org-dartlang-sdk")) continue;
|
||||||
if (uri == null || uri.isScheme("org-dartlang-sdk")) continue;
|
|
||||||
if (!allowed.contains(uri)) {
|
if (!allowed.contains(uri)) {
|
||||||
return new Result<TestData>(
|
return new Result<TestData>(
|
||||||
data,
|
data,
|
||||||
|
|
|
@ -78,8 +78,6 @@ Future<void> throwOnInsufficientUriToSource(Component component,
|
||||||
if (fileSystem != null) {
|
if (fileSystem != null) {
|
||||||
uris = uriFinder.seenUris.toSet();
|
uris = uriFinder.seenUris.toSet();
|
||||||
for (Uri uri in uris) {
|
for (Uri uri in uris) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (uri == null) continue;
|
|
||||||
if (!uri.isScheme("org-dartlang-test")) continue;
|
if (!uri.isScheme("org-dartlang-test")) continue;
|
||||||
// The file system doesn't have the sources for any modules.
|
// The file system doesn't have the sources for any modules.
|
||||||
// For now assume that that is always what's going on.
|
// For now assume that that is always what's going on.
|
||||||
|
|
|
@ -197,11 +197,6 @@ class ListenerStep extends Step<TestDescription, TestDescription, Context> {
|
||||||
List<int> lineStarts = <int>[];
|
List<int> lineStarts = <int>[];
|
||||||
Token firstToken = scanUri(uri, shortName, lineStarts: lineStarts);
|
Token firstToken = scanUri(uri, shortName, lineStarts: lineStarts);
|
||||||
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (firstToken == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
File f = new File.fromUri(uri);
|
File f = new File.fromUri(uri);
|
||||||
List<int> rawBytes = f.readAsBytesSync();
|
List<int> rawBytes = f.readAsBytesSync();
|
||||||
Source source = new Source(lineStarts, rawBytes, uri, uri);
|
Source source = new Source(lineStarts, rawBytes, uri, uri);
|
||||||
|
@ -261,11 +256,6 @@ class IntertwinedStep extends Step<TestDescription, TestDescription, Context> {
|
||||||
Token firstToken =
|
Token firstToken =
|
||||||
scanUri(description.uri, description.shortName, lineStarts: lineStarts);
|
scanUri(description.uri, description.shortName, lineStarts: lineStarts);
|
||||||
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (firstToken == null) {
|
|
||||||
return Future.value(crash(description, StackTrace.current));
|
|
||||||
}
|
|
||||||
|
|
||||||
File f = new File.fromUri(description.uri);
|
File f = new File.fromUri(description.uri);
|
||||||
List<int> rawBytes = f.readAsBytesSync();
|
List<int> rawBytes = f.readAsBytesSync();
|
||||||
Source source =
|
Source source =
|
||||||
|
@ -301,11 +291,6 @@ class TokenStep extends Step<TestDescription, TestDescription, Context> {
|
||||||
Token firstToken =
|
Token firstToken =
|
||||||
scanUri(description.uri, description.shortName, lineStarts: lineStarts);
|
scanUri(description.uri, description.shortName, lineStarts: lineStarts);
|
||||||
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (firstToken == null) {
|
|
||||||
return Future.value(crash(description, StackTrace.current));
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuffer beforeParser = tokenStreamToString(firstToken, lineStarts);
|
StringBuffer beforeParser = tokenStreamToString(firstToken, lineStarts);
|
||||||
StringBuffer beforeParserWithTypes =
|
StringBuffer beforeParserWithTypes =
|
||||||
tokenStreamToString(firstToken, lineStarts, addTypes: true);
|
tokenStreamToString(firstToken, lineStarts, addTypes: true);
|
||||||
|
|
|
@ -210,9 +210,7 @@ class MatchExpectation
|
||||||
/// be serialized, deserialized, and the textual representation of that is
|
/// be serialized, deserialized, and the textual representation of that is
|
||||||
/// compared. It is still the original component that is returned though.
|
/// compared. It is still the original component that is returned though.
|
||||||
const MatchExpectation(this.suffix,
|
const MatchExpectation(this.suffix,
|
||||||
{this.serializeFirst = false, required this.isLastMatchStep})
|
{this.serializeFirst = false, required this.isLastMatchStep});
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(isLastMatchStep != null);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get name => "match expectations";
|
String get name => "match expectations";
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
library fasta.tool.entry_points;
|
library fasta.tool.entry_points;
|
||||||
|
|
||||||
import 'dart:convert' show JsonEncoder, LineSplitter, jsonDecode, utf8;
|
import 'dart:convert' show JsonEncoder, LineSplitter, jsonDecode, utf8;
|
||||||
import 'dart:io' show File, Platform, exitCode, stderr, stdin, stdout;
|
import 'dart:io' show File, Platform, stderr, stdin, stdout;
|
||||||
import 'dart:typed_data' show Uint8List;
|
import 'dart:typed_data' show Uint8List;
|
||||||
|
|
||||||
import 'package:_fe_analyzer_shared/src/util/relativize.dart'
|
import 'package:_fe_analyzer_shared/src/util/relativize.dart'
|
||||||
|
@ -508,13 +508,6 @@ Future<void> compilePlatformInternal(CompilerContext c, Uri fullOutput,
|
||||||
|
|
||||||
CompilerResult result =
|
CompilerResult result =
|
||||||
await generateKernelInternal(buildSummary: true, buildComponent: true);
|
await generateKernelInternal(buildSummary: true, buildComponent: true);
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (result == null) {
|
|
||||||
exitCode = 1;
|
|
||||||
// Note: an error should have been reported by now.
|
|
||||||
print('The platform .dill files were not created.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
new File.fromUri(outlineOutput).writeAsBytesSync(result.summary!);
|
new File.fromUri(outlineOutput).writeAsBytesSync(result.summary!);
|
||||||
c.options.ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}");
|
c.options.ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}");
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,6 @@ Template compileTemplate(String name, int? index, String? problemMessage,
|
||||||
// `|` (verbatim) as they always contain a trailing newline that we don't
|
// `|` (verbatim) as they always contain a trailing newline that we don't
|
||||||
// want.
|
// want.
|
||||||
problemMessage = problemMessage.trimRight();
|
problemMessage = problemMessage.trimRight();
|
||||||
const String ignoreNotNull = "// ignore: unnecessary_null_comparison";
|
|
||||||
var parameters = new Set<String>();
|
var parameters = new Set<String>();
|
||||||
var conversions = new Set<String>();
|
var conversions = new Set<String>();
|
||||||
var conversions2 = new Set<String>();
|
var conversions2 = new Set<String>();
|
||||||
|
@ -261,8 +260,7 @@ Template compileTemplate(String name, int? index, String? problemMessage,
|
||||||
|
|
||||||
case "nameOKEmpty":
|
case "nameOKEmpty":
|
||||||
parameters.add("String nameOKEmpty");
|
parameters.add("String nameOKEmpty");
|
||||||
conversions.add("$ignoreNotNull\n"
|
conversions.add("if (nameOKEmpty.isEmpty) "
|
||||||
"if (nameOKEmpty == null || nameOKEmpty.isEmpty) "
|
|
||||||
"nameOKEmpty = '(unnamed)';");
|
"nameOKEmpty = '(unnamed)';");
|
||||||
arguments.add("'nameOKEmpty': nameOKEmpty");
|
arguments.add("'nameOKEmpty': nameOKEmpty");
|
||||||
break;
|
break;
|
||||||
|
@ -306,8 +304,7 @@ Template compileTemplate(String name, int? index, String? problemMessage,
|
||||||
|
|
||||||
case "stringOKEmpty":
|
case "stringOKEmpty":
|
||||||
parameters.add("String stringOKEmpty");
|
parameters.add("String stringOKEmpty");
|
||||||
conversions.add("$ignoreNotNull\n"
|
conversions.add("if (stringOKEmpty.isEmpty) "
|
||||||
"if (stringOKEmpty == null || stringOKEmpty.isEmpty) "
|
|
||||||
"stringOKEmpty = '(empty)';");
|
"stringOKEmpty = '(empty)';");
|
||||||
arguments.add("'$name': stringOKEmpty");
|
arguments.add("'$name': stringOKEmpty");
|
||||||
break;
|
break;
|
||||||
|
@ -344,15 +341,11 @@ Template compileTemplate(String name, int? index, String? problemMessage,
|
||||||
|
|
||||||
case "count":
|
case "count":
|
||||||
parameters.add("int count");
|
parameters.add("int count");
|
||||||
conversions.add(
|
|
||||||
"$ignoreNotNull\n" "if (count == null) throw 'No count provided';");
|
|
||||||
arguments.add("'$name': count");
|
arguments.add("'$name': count");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "count2":
|
case "count2":
|
||||||
parameters.add("int count2");
|
parameters.add("int count2");
|
||||||
conversions.add("$ignoreNotNull\n"
|
|
||||||
"if (count2 == null) throw 'No count provided';");
|
|
||||||
arguments.add("'$name': count2");
|
arguments.add("'$name': count2");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -367,24 +360,18 @@ Template compileTemplate(String name, int? index, String? problemMessage,
|
||||||
|
|
||||||
case "num1":
|
case "num1":
|
||||||
parameters.add("num _num1");
|
parameters.add("num _num1");
|
||||||
conversions.add("$ignoreNotNull\n"
|
|
||||||
"if (_num1 == null) throw 'No number provided';");
|
|
||||||
conversions.add("String num1 = ${format('_num1')};");
|
conversions.add("String num1 = ${format('_num1')};");
|
||||||
arguments.add("'$name': _num1");
|
arguments.add("'$name': _num1");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "num2":
|
case "num2":
|
||||||
parameters.add("num _num2");
|
parameters.add("num _num2");
|
||||||
conversions.add("$ignoreNotNull\n"
|
|
||||||
"if (_num2 == null) throw 'No number provided';");
|
|
||||||
conversions.add("String num2 = ${format('_num2')};");
|
conversions.add("String num2 = ${format('_num2')};");
|
||||||
arguments.add("'$name': _num2");
|
arguments.add("'$name': _num2");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "num3":
|
case "num3":
|
||||||
parameters.add("num _num3");
|
parameters.add("num _num3");
|
||||||
conversions.add("$ignoreNotNull\n"
|
|
||||||
"if (_num3 == null) throw 'No number provided';");
|
|
||||||
conversions.add("String num3 = ${format('_num3')};");
|
conversions.add("String num3 = ${format('_num3')};");
|
||||||
arguments.add("'$name': _num3");
|
arguments.add("'$name': _num3");
|
||||||
break;
|
break;
|
||||||
|
@ -428,10 +415,7 @@ Template compileTemplate(String name, int? index, String? problemMessage,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameters.isEmpty && conversions.isEmpty && arguments.isEmpty) {
|
if (parameters.isEmpty && conversions.isEmpty && arguments.isEmpty) {
|
||||||
// ignore: unnecessary_null_comparison
|
codeArguments.add('problemMessage: r"""$problemMessage"""');
|
||||||
if (problemMessage != null) {
|
|
||||||
codeArguments.add('problemMessage: r"""$problemMessage"""');
|
|
||||||
}
|
|
||||||
if (correctionMessage != null) {
|
if (correctionMessage != null) {
|
||||||
codeArguments.add('correctionMessage: r"""$correctionMessage"""');
|
codeArguments.add('correctionMessage: r"""$correctionMessage"""');
|
||||||
}
|
}
|
||||||
|
@ -447,10 +431,7 @@ const MessageCode message$name =
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> templateArguments = <String>[];
|
List<String> templateArguments = <String>[];
|
||||||
// ignore: unnecessary_null_comparison
|
templateArguments.add('problemMessageTemplate: r"""$problemMessage"""');
|
||||||
if (problemMessage != null) {
|
|
||||||
templateArguments.add('problemMessageTemplate: r"""$problemMessage"""');
|
|
||||||
}
|
|
||||||
if (correctionMessage != null) {
|
if (correctionMessage != null) {
|
||||||
templateArguments
|
templateArguments
|
||||||
.add('correctionMessageTemplate: r"""$correctionMessage"""');
|
.add('correctionMessageTemplate: r"""$correctionMessage"""');
|
||||||
|
|
|
@ -155,8 +155,6 @@ Map<Uri, List<int>> scanReachableFiles(Uri entryUri) {
|
||||||
void collectSources(Uri start, Map<Uri, List<int>> files) {
|
void collectSources(Uri start, Map<Uri, List<int>> files) {
|
||||||
void helper(Uri uri) {
|
void helper(Uri uri) {
|
||||||
uri = uriResolver.translate(uri) ?? uri;
|
uri = uriResolver.translate(uri) ?? uri;
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (uri == null) return;
|
|
||||||
if (files.containsKey(uri)) return;
|
if (files.containsKey(uri)) return;
|
||||||
var contents = readBytesFromFileSync(uri);
|
var contents = readBytesFromFileSync(uri);
|
||||||
files[uri] = contents;
|
files[uri] = contents;
|
||||||
|
|
|
@ -188,10 +188,6 @@ void processField(
|
||||||
|
|
||||||
Token beginToken = classFields.beginToken;
|
Token beginToken = classFields.beginToken;
|
||||||
Token endToken = classFields.endToken;
|
Token endToken = classFields.endToken;
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(beginToken != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(endToken != null);
|
|
||||||
|
|
||||||
String frozenCheckCode =
|
String frozenCheckCode =
|
||||||
"""if (frozen) throw "Trying to modify frozen node!";""";
|
"""if (frozen) throw "Trying to modify frozen node!";""";
|
||||||
|
|
|
@ -736,8 +736,6 @@ class FrontendCompiler implements CompilerInterface {
|
||||||
Future<void> writeJavaScriptBundle(KernelCompilationResults results,
|
Future<void> writeJavaScriptBundle(KernelCompilationResults results,
|
||||||
String filename, String fileSystemScheme, String moduleFormat,
|
String filename, String fileSystemScheme, String moduleFormat,
|
||||||
{required bool fullComponent}) async {
|
{required bool fullComponent}) async {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(fullComponent != null);
|
|
||||||
var packageConfig = await loadPackageConfigUri(
|
var packageConfig = await loadPackageConfigUri(
|
||||||
_compilerOptions.packagesFileUri ??
|
_compilerOptions.packagesFileUri ??
|
||||||
File('.dart_tool/package_config.json').absolute.uri);
|
File('.dart_tool/package_config.json').absolute.uri);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -120,6 +120,11 @@ abstract class StringInterner {
|
||||||
String internString(String string);
|
String internString(String string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Helper used to trigger the read of a late variable in asserts.
|
||||||
|
bool _lateIsInitialized(dynamic value) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
class BinaryBuilder {
|
class BinaryBuilder {
|
||||||
final List<VariableDeclaration> variableStack = <VariableDeclaration>[];
|
final List<VariableDeclaration> variableStack = <VariableDeclaration>[];
|
||||||
final List<LabeledStatement> labelStack = <LabeledStatement>[];
|
final List<LabeledStatement> labelStack = <LabeledStatement>[];
|
||||||
|
@ -945,8 +950,7 @@ class BinaryBuilder {
|
||||||
/// if [readCoverage] is true, references are read and that the link table
|
/// if [readCoverage] is true, references are read and that the link table
|
||||||
/// thus has to be read first.
|
/// thus has to be read first.
|
||||||
Map<Uri, Source> readUriToSource({required bool readCoverage}) {
|
Map<Uri, Source> readUriToSource({required bool readCoverage}) {
|
||||||
// ignore: unnecessary_null_comparison
|
assert(!readCoverage || (readCoverage && _lateIsInitialized(_linkTable)));
|
||||||
assert(!readCoverage || (readCoverage && _linkTable != null));
|
|
||||||
|
|
||||||
int length = readUint32();
|
int length = readUint32();
|
||||||
|
|
||||||
|
@ -1508,8 +1512,10 @@ class BinaryBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
typeParameterStack.length = 0;
|
typeParameterStack.length = 0;
|
||||||
// ignore: unnecessary_null_comparison
|
assert(() {
|
||||||
assert(debugPath.removeLast() != null);
|
debugPath.removeLast();
|
||||||
|
return true;
|
||||||
|
}());
|
||||||
node.name = name;
|
node.name = name;
|
||||||
node.fileUri = fileUri;
|
node.fileUri = fileUri;
|
||||||
node.annotations = annotations;
|
node.annotations = annotations;
|
||||||
|
|
|
@ -955,15 +955,10 @@ class BinaryPrinter implements Visitor<void>, BinarySink {
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeNonNullReference(Reference reference) {
|
void writeNonNullReference(Reference reference) {
|
||||||
// ignore: unnecessary_null_comparison
|
assert(reference.isConsistent, reference.getInconsistency());
|
||||||
if (reference == null) {
|
CanonicalName name = _ensureCanonicalName(reference);
|
||||||
throw new ArgumentError('Got null reference');
|
checkCanonicalName(name);
|
||||||
} else {
|
writeUInt30(name.index + 1);
|
||||||
assert(reference.isConsistent, reference.getInconsistency());
|
|
||||||
CanonicalName name = _ensureCanonicalName(reference);
|
|
||||||
checkCanonicalName(name);
|
|
||||||
writeUInt30(name.index + 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the canonical name for [reference].
|
/// Returns the canonical name for [reference].
|
||||||
|
@ -1046,14 +1041,8 @@ class BinaryPrinter implements Visitor<void>, BinarySink {
|
||||||
|
|
||||||
void writeNonNullCanonicalNameReference(Reference reference) {
|
void writeNonNullCanonicalNameReference(Reference reference) {
|
||||||
CanonicalName name = _ensureCanonicalName(reference);
|
CanonicalName name = _ensureCanonicalName(reference);
|
||||||
// ignore: unnecessary_null_comparison
|
checkCanonicalName(name);
|
||||||
if (name == null) {
|
writeUInt30(name.index + 1);
|
||||||
throw new ArgumentError(
|
|
||||||
'Expected a canonical name to be valid but was `null`.');
|
|
||||||
} else {
|
|
||||||
checkCanonicalName(name);
|
|
||||||
writeUInt30(name.index + 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeOffset(int offset) {
|
void writeOffset(int offset) {
|
||||||
|
@ -1068,11 +1057,6 @@ class BinaryPrinter implements Visitor<void>, BinarySink {
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeClassReference(Class class_) {
|
void writeClassReference(Class class_) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (class_ == null) {
|
|
||||||
throw new ArgumentError(
|
|
||||||
'Expected a class reference to be valid but was `null`.');
|
|
||||||
}
|
|
||||||
writeNonNullCanonicalNameReference(class_.reference);
|
writeNonNullCanonicalNameReference(class_.reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,10 +94,6 @@ class CanonicalName {
|
||||||
int index = -1;
|
int index = -1;
|
||||||
|
|
||||||
CanonicalName._(CanonicalName parent, this.name) : _parent = parent {
|
CanonicalName._(CanonicalName parent, this.name) : _parent = parent {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(name != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(parent != null);
|
|
||||||
_nonRootTop = parent.isRoot ? this : parent._nonRootTop;
|
_nonRootTop = parent.isRoot ? this : parent._nonRootTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,10 +211,6 @@ class CanonicalName {
|
||||||
}
|
}
|
||||||
|
|
||||||
void bindTo(Reference target) {
|
void bindTo(Reference target) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (target == null) {
|
|
||||||
throw '$this cannot be bound to null';
|
|
||||||
}
|
|
||||||
if (_reference == target) return;
|
if (_reference == target) return;
|
||||||
if (_reference != null) {
|
if (_reference != null) {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
|
@ -1754,9 +1754,6 @@ class _ClassInfo {
|
||||||
} else {
|
} else {
|
||||||
canonical = type;
|
canonical = type;
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(canonical != null,
|
|
||||||
"No canonical instantiation computed for $cls in $classNode.");
|
|
||||||
genericSuperType![cls] = canonical;
|
genericSuperType![cls] = canonical;
|
||||||
genericSuperTypes![cls] = <Supertype>[type];
|
genericSuperTypes![cls] = <Supertype>[type];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -615,10 +615,7 @@ class CloneVisitorNotMembers implements TreeVisitor<TreeNode> {
|
||||||
TypeParameter visitTypeParameter(TypeParameter node) {
|
TypeParameter visitTypeParameter(TypeParameter node) {
|
||||||
TypeParameter newNode = typeParams[node]!;
|
TypeParameter newNode = typeParams[node]!;
|
||||||
newNode.bound = visitType(node.bound);
|
newNode.bound = visitType(node.bound);
|
||||||
// ignore: unnecessary_null_comparison
|
newNode.defaultType = visitType(node.defaultType);
|
||||||
if (node.defaultType != null) {
|
|
||||||
newNode.defaultType = visitType(node.defaultType);
|
|
||||||
}
|
|
||||||
return newNode
|
return newNode
|
||||||
..annotations = cloneAnnotations && !node.annotations.isEmpty
|
..annotations = cloneAnnotations && !node.annotations.isEmpty
|
||||||
? node.annotations.map(clone).toList()
|
? node.annotations.map(clone).toList()
|
||||||
|
@ -1209,8 +1206,6 @@ class MixinApplicationCloner extends CloneVisitorWithMembers {
|
||||||
cloneAnnotations: cloneAnnotations);
|
cloneAnnotations: cloneAnnotations);
|
||||||
|
|
||||||
Member? _findSuperMember(Name name, {required bool isSetter}) {
|
Member? _findSuperMember(Name name, {required bool isSetter}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isSetter != null);
|
|
||||||
Map<Name, Member> cache;
|
Map<Name, Member> cache;
|
||||||
if (isSetter) {
|
if (isSetter) {
|
||||||
cache = _setterMap ??= {};
|
cache = _setterMap ??= {};
|
||||||
|
|
|
@ -80,11 +80,7 @@ class _ImportTableBuilder extends RecursiveVisitor {
|
||||||
if (target == referenceLibrary) return; // Self-reference is special.
|
if (target == referenceLibrary) return; // Self-reference is special.
|
||||||
if (target == null) return;
|
if (target == null) return;
|
||||||
Uri referenceUri = referenceLibrary.importUri;
|
Uri referenceUri = referenceLibrary.importUri;
|
||||||
Uri? targetUri = target.importUri;
|
Uri targetUri = target.importUri;
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (targetUri == null) {
|
|
||||||
throw '$referenceUri cannot refer to library without an import URI';
|
|
||||||
}
|
|
||||||
// To support using custom-uris in unit tests, we don't check directly
|
// To support using custom-uris in unit tests, we don't check directly
|
||||||
// whether the scheme is 'file:', but instead we check that is not 'dart:'
|
// whether the scheme is 'file:', but instead we check that is not 'dart:'
|
||||||
// or 'package:'.
|
// or 'package:'.
|
||||||
|
|
|
@ -210,9 +210,6 @@ List<DartType> calculateBounds(
|
||||||
List<DartType> calculateBoundsInternal(
|
List<DartType> calculateBoundsInternal(
|
||||||
List<TypeParameter> typeParameters, Class objectClass,
|
List<TypeParameter> typeParameters, Class objectClass,
|
||||||
{required bool isNonNullableByDefault}) {
|
{required bool isNonNullableByDefault}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNonNullableByDefault != null);
|
|
||||||
|
|
||||||
List<DartType> bounds =
|
List<DartType> bounds =
|
||||||
new List<DartType>.filled(typeParameters.length, dummyDartType);
|
new List<DartType>.filled(typeParameters.length, dummyDartType);
|
||||||
for (int i = 0; i < typeParameters.length; i++) {
|
for (int i = 0; i < typeParameters.length; i++) {
|
||||||
|
@ -342,11 +339,6 @@ List<TypeArgumentIssue> findTypeArgumentIssues(DartType type,
|
||||||
{required bool allowSuperBounded,
|
{required bool allowSuperBounded,
|
||||||
required bool isNonNullableByDefault,
|
required bool isNonNullableByDefault,
|
||||||
required bool areGenericArgumentsAllowed}) {
|
required bool areGenericArgumentsAllowed}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNonNullableByDefault != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(areGenericArgumentsAllowed != null);
|
|
||||||
|
|
||||||
List<TypeParameter> variables = const <TypeParameter>[];
|
List<TypeParameter> variables = const <TypeParameter>[];
|
||||||
List<DartType> arguments = const <DartType>[];
|
List<DartType> arguments = const <DartType>[];
|
||||||
List<TypeArgumentIssue> typedefRhsResult = const <TypeArgumentIssue>[];
|
List<TypeArgumentIssue> typedefRhsResult = const <TypeArgumentIssue>[];
|
||||||
|
@ -498,11 +490,6 @@ List<TypeArgumentIssue> findTypeArgumentIssuesForInvocation(
|
||||||
DartType bottomType,
|
DartType bottomType,
|
||||||
{required bool isNonNullableByDefault,
|
{required bool isNonNullableByDefault,
|
||||||
required bool areGenericArgumentsAllowed}) {
|
required bool areGenericArgumentsAllowed}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNonNullableByDefault != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(areGenericArgumentsAllowed != null);
|
|
||||||
|
|
||||||
assert(arguments.length == parameters.length);
|
assert(arguments.length == parameters.length);
|
||||||
assert(bottomType == const NeverType.nonNullable() || bottomType is NullType);
|
assert(bottomType == const NeverType.nonNullable() || bottomType is NullType);
|
||||||
|
|
||||||
|
@ -550,9 +537,6 @@ String getGenericTypeName(DartType type) {
|
||||||
DartType? convertSuperBoundedToRegularBounded(
|
DartType? convertSuperBoundedToRegularBounded(
|
||||||
TypeEnvironment typeEnvironment, DartType type,
|
TypeEnvironment typeEnvironment, DartType type,
|
||||||
{int variance = Variance.covariant, required bool isNonNullableByDefault}) {
|
{int variance = Variance.covariant, required bool isNonNullableByDefault}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNonNullableByDefault != null);
|
|
||||||
|
|
||||||
return type.accept1(
|
return type.accept1(
|
||||||
new _SuperBoundedTypeInverter(typeEnvironment,
|
new _SuperBoundedTypeInverter(typeEnvironment,
|
||||||
isNonNullableByDefault: isNonNullableByDefault),
|
isNonNullableByDefault: isNonNullableByDefault),
|
||||||
|
@ -565,11 +549,7 @@ class _SuperBoundedTypeInverter extends ReplacementVisitor {
|
||||||
bool isOutermost = true;
|
bool isOutermost = true;
|
||||||
|
|
||||||
_SuperBoundedTypeInverter(this.typeEnvironment,
|
_SuperBoundedTypeInverter(this.typeEnvironment,
|
||||||
{required this.isNonNullableByDefault})
|
{required this.isNonNullableByDefault});
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
: assert(typeEnvironment != null),
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNonNullableByDefault != null);
|
|
||||||
|
|
||||||
bool flipTop(int variance) {
|
bool flipTop(int variance) {
|
||||||
return isNonNullableByDefault
|
return isNonNullableByDefault
|
||||||
|
|
|
@ -53,9 +53,6 @@ class _ConstCanonicalTypeVisitor extends ReplacementVisitor {
|
||||||
/// https://github.com/dart-lang/language/blob/master/accepted/future-releases/nnbd/feature-specification.md#constant-instances
|
/// https://github.com/dart-lang/language/blob/master/accepted/future-releases/nnbd/feature-specification.md#constant-instances
|
||||||
DartType? computeConstCanonicalType(DartType type, CoreTypes coreTypes,
|
DartType? computeConstCanonicalType(DartType type, CoreTypes coreTypes,
|
||||||
{required bool isNonNullableByDefault}) {
|
{required bool isNonNullableByDefault}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNonNullableByDefault != null);
|
|
||||||
|
|
||||||
return type.accept1(
|
return type.accept1(
|
||||||
new _ConstCanonicalTypeVisitor(coreTypes,
|
new _ConstCanonicalTypeVisitor(coreTypes,
|
||||||
isNonNullableByDefault: isNonNullableByDefault),
|
isNonNullableByDefault: isNonNullableByDefault),
|
||||||
|
|
|
@ -402,12 +402,6 @@ abstract class Target {
|
||||||
{required bool hasInitializer,
|
{required bool hasInitializer,
|
||||||
required bool isFinal,
|
required bool isFinal,
|
||||||
required bool isStatic}) {
|
required bool isStatic}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(hasInitializer != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isFinal != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isStatic != null);
|
|
||||||
int mask = LateLowering.getFieldLowering(
|
int mask = LateLowering.getFieldLowering(
|
||||||
hasInitializer: hasInitializer, isFinal: isFinal, isStatic: isStatic);
|
hasInitializer: hasInitializer, isFinal: isFinal, isStatic: isStatic);
|
||||||
return enabledLateLowerings & mask != 0;
|
return enabledLateLowerings & mask != 0;
|
||||||
|
@ -461,12 +455,6 @@ abstract class Target {
|
||||||
{required bool hasInitializer,
|
{required bool hasInitializer,
|
||||||
required bool isFinal,
|
required bool isFinal,
|
||||||
required bool isPotentiallyNullable}) {
|
required bool isPotentiallyNullable}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(hasInitializer != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isFinal != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isPotentiallyNullable != null);
|
|
||||||
int mask = LateLowering.getLocalLowering(
|
int mask = LateLowering.getLocalLowering(
|
||||||
hasInitializer: hasInitializer,
|
hasInitializer: hasInitializer,
|
||||||
isFinal: isFinal,
|
isFinal: isFinal,
|
||||||
|
@ -656,12 +644,6 @@ class LateLowering {
|
||||||
{required bool hasInitializer,
|
{required bool hasInitializer,
|
||||||
required bool isFinal,
|
required bool isFinal,
|
||||||
required bool isPotentiallyNullable}) {
|
required bool isPotentiallyNullable}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(hasInitializer != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isFinal != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isPotentiallyNullable != null);
|
|
||||||
if (hasInitializer) {
|
if (hasInitializer) {
|
||||||
if (isFinal) {
|
if (isFinal) {
|
||||||
if (isPotentiallyNullable) {
|
if (isPotentiallyNullable) {
|
||||||
|
@ -697,12 +679,6 @@ class LateLowering {
|
||||||
{required bool hasInitializer,
|
{required bool hasInitializer,
|
||||||
required bool isFinal,
|
required bool isFinal,
|
||||||
required bool isStatic}) {
|
required bool isStatic}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(hasInitializer != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isFinal != null);
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isStatic != null);
|
|
||||||
if (hasInitializer) {
|
if (hasInitializer) {
|
||||||
if (isFinal) {
|
if (isFinal) {
|
||||||
if (isStatic) {
|
if (isStatic) {
|
||||||
|
|
|
@ -79,8 +79,6 @@ class Env {
|
||||||
final bool isNonNullableByDefault;
|
final bool isNonNullableByDefault;
|
||||||
|
|
||||||
Env(String source, {required this.isNonNullableByDefault}) {
|
Env(String source, {required this.isNonNullableByDefault}) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
assert(isNonNullableByDefault != null);
|
|
||||||
Uri libraryUri = Uri.parse('memory:main.dart');
|
Uri libraryUri = Uri.parse('memory:main.dart');
|
||||||
Uri coreUri = Uri.parse("dart:core");
|
Uri coreUri = Uri.parse("dart:core");
|
||||||
TypeParserEnvironment coreEnvironment =
|
TypeParserEnvironment coreEnvironment =
|
||||||
|
@ -211,8 +209,7 @@ class TypeParserEnvironment {
|
||||||
}
|
}
|
||||||
|
|
||||||
ParameterEnvironment extendToParameterEnvironment(String typeParameters) {
|
ParameterEnvironment extendToParameterEnvironment(String typeParameters) {
|
||||||
// ignore: unnecessary_null_comparison
|
assert(typeParameters.isNotEmpty);
|
||||||
assert(typeParameters != null && typeParameters.isNotEmpty);
|
|
||||||
return const _KernelFromParsedType().computeTypeParameterEnvironment(
|
return const _KernelFromParsedType().computeTypeParameterEnvironment(
|
||||||
parseTypeVariables("<${typeParameters}>"), this);
|
parseTypeVariables("<${typeParameters}>"), this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,6 @@ String componentToString(Component node) {
|
||||||
class NameSystem {
|
class NameSystem {
|
||||||
final Namer<VariableDeclaration> variables =
|
final Namer<VariableDeclaration> variables =
|
||||||
new NormalNamer<VariableDeclaration>('#t');
|
new NormalNamer<VariableDeclaration>('#t');
|
||||||
final Namer<Member> members = new NormalNamer<Member>('#m');
|
|
||||||
final Namer<Class> classes = new NormalNamer<Class>('#class');
|
final Namer<Class> classes = new NormalNamer<Class>('#class');
|
||||||
final Namer<Extension> extensions = new NormalNamer<Extension>('#extension');
|
final Namer<Extension> extensions = new NormalNamer<Extension>('#extension');
|
||||||
final Namer<Library> libraries = new NormalNamer<Library>('#lib');
|
final Namer<Library> libraries = new NormalNamer<Library>('#lib');
|
||||||
|
@ -203,7 +202,6 @@ class NameSystem {
|
||||||
new Disambiguator<Reference, CanonicalName>();
|
new Disambiguator<Reference, CanonicalName>();
|
||||||
|
|
||||||
String nameVariable(VariableDeclaration node) => variables.getName(node);
|
String nameVariable(VariableDeclaration node) => variables.getName(node);
|
||||||
String nameMember(Member node) => members.getName(node);
|
|
||||||
String nameClass(Class node) => classes.getName(node);
|
String nameClass(Class node) => classes.getName(node);
|
||||||
String nameExtension(Extension node) => extensions.getName(node);
|
String nameExtension(Extension node) => extensions.getName(node);
|
||||||
String nameLibrary(Library node) => libraries.getName(node);
|
String nameLibrary(Library node) => libraries.getName(node);
|
||||||
|
@ -224,17 +222,13 @@ class NameSystem {
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
return abbreviateName(name);
|
return abbreviateName(name);
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
String path = node.importUri.hasEmptyPath
|
||||||
if (node.importUri != null) {
|
? '${node.importUri}'
|
||||||
String path = node.importUri.hasEmptyPath
|
: node.importUri.pathSegments.last;
|
||||||
? '${node.importUri}'
|
if (path.endsWith('.dart')) {
|
||||||
: node.importUri.pathSegments.last;
|
path = path.substring(0, path.length - '.dart'.length);
|
||||||
if (path.endsWith('.dart')) {
|
|
||||||
path = path.substring(0, path.length - '.dart'.length);
|
|
||||||
}
|
|
||||||
return abbreviateName(path);
|
|
||||||
}
|
}
|
||||||
return 'L';
|
return abbreviateName(path);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,8 +321,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getLibraryReference(Library node) {
|
String getLibraryReference(Library node) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (node == null) return '<No Library>';
|
|
||||||
if (importTable != null && importTable?.getImportIndex(node) != -1) {
|
if (importTable != null && importTable?.getImportIndex(node) != -1) {
|
||||||
return syntheticNames.nameLibraryPrefix(node);
|
return syntheticNames.nameLibraryPrefix(node);
|
||||||
}
|
}
|
||||||
|
@ -348,32 +340,24 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getClassReference(Class node) {
|
String getClassReference(Class node) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (node == null) return '<No Class>';
|
|
||||||
String name = getClassName(node);
|
String name = getClassName(node);
|
||||||
String library = getLibraryReference(node.enclosingLibrary);
|
String library = getLibraryReference(node.enclosingLibrary);
|
||||||
return '$library::$name';
|
return '$library::$name';
|
||||||
}
|
}
|
||||||
|
|
||||||
String getExtensionReference(Extension node) {
|
String getExtensionReference(Extension node) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (node == null) return '<No Extension>';
|
|
||||||
String name = getExtensionName(node);
|
String name = getExtensionName(node);
|
||||||
String library = getLibraryReference(node.enclosingLibrary);
|
String library = getLibraryReference(node.enclosingLibrary);
|
||||||
return '$library::$name';
|
return '$library::$name';
|
||||||
}
|
}
|
||||||
|
|
||||||
String getInlineClassReference(InlineClass node) {
|
String getInlineClassReference(InlineClass node) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (node == null) return '<No InlineClass>';
|
|
||||||
String name = getInlineClassName(node);
|
String name = getInlineClassName(node);
|
||||||
String library = getLibraryReference(node.enclosingLibrary);
|
String library = getLibraryReference(node.enclosingLibrary);
|
||||||
return '$library::$name';
|
return '$library::$name';
|
||||||
}
|
}
|
||||||
|
|
||||||
String getTypedefReference(Typedef node) {
|
String getTypedefReference(Typedef node) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (node == null) return '<No Typedef>';
|
|
||||||
String library = getLibraryReference(node.enclosingLibrary);
|
String library = getLibraryReference(node.enclosingLibrary);
|
||||||
return '$library::${node.name}';
|
return '$library::${node.name}';
|
||||||
}
|
}
|
||||||
|
@ -383,14 +367,10 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
|
|
||||||
Name getMemberName(Member node) {
|
Name getMemberName(Member node) {
|
||||||
if (node.name.text == '') return emptyName;
|
if (node.name.text == '') return emptyName;
|
||||||
// ignore: unnecessary_null_comparison
|
return node.name;
|
||||||
if (node.name != null) return node.name;
|
|
||||||
return new Name(syntheticNames.nameMember(node));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String getMemberReference(Member node) {
|
String getMemberReference(Member node) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (node == null) return '<No Member>';
|
|
||||||
String name = getMemberName(node).text;
|
String name = getMemberName(node).text;
|
||||||
Class? enclosingClass = node.enclosingClass;
|
Class? enclosingClass = node.enclosingClass;
|
||||||
if (enclosingClass != null) {
|
if (enclosingClass != null) {
|
||||||
|
@ -407,8 +387,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getVariableReference(VariableDeclaration node) {
|
String getVariableReference(VariableDeclaration node) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (node == null) return '<No VariableDeclaration>';
|
|
||||||
return getVariableName(node);
|
return getVariableName(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,8 +395,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getTypeParameterReference(TypeParameter node) {
|
String getTypeParameterReference(TypeParameter node) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (node == null) return '<No TypeParameter>';
|
|
||||||
String name = getTypeParameterName(node);
|
String name = getTypeParameterName(node);
|
||||||
TreeNode? parent = node.parent;
|
TreeNode? parent = node.parent;
|
||||||
if (parent is FunctionNode && parent.parent is Member) {
|
if (parent is FunctionNode && parent.parent is Member) {
|
||||||
|
@ -587,11 +563,8 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
writeWord(name);
|
writeWord(name);
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
writeSpaced('from');
|
||||||
if (library.importUri != null) {
|
writeWord('"${library.importUri}"');
|
||||||
writeSpaced('from');
|
|
||||||
writeWord('"${library.importUri}"');
|
|
||||||
}
|
|
||||||
String prefix = syntheticNames.nameLibraryPrefix(library);
|
String prefix = syntheticNames.nameLibraryPrefix(library);
|
||||||
writeSpaced('as');
|
writeSpaced('as');
|
||||||
writeWord(prefix);
|
writeWord(prefix);
|
||||||
|
@ -716,33 +689,16 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeType(DartType type) {
|
void writeType(DartType type) {
|
||||||
// ignore: unnecessary_null_comparison
|
type.accept(this);
|
||||||
if (type == null) {
|
|
||||||
write('<No DartType>');
|
|
||||||
} else {
|
|
||||||
type.accept(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeOptionalType(DartType type) {
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (type != null) {
|
|
||||||
type.accept(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitSupertype(Supertype type) {
|
void visitSupertype(Supertype type) {
|
||||||
// ignore: unnecessary_null_comparison
|
writeClassReferenceFromReference(type.className);
|
||||||
if (type == null) {
|
if (type.typeArguments.isNotEmpty) {
|
||||||
write('<No Supertype>');
|
writeSymbol('<');
|
||||||
} else {
|
writeList(type.typeArguments, writeType);
|
||||||
writeClassReferenceFromReference(type.className);
|
writeSymbol('>');
|
||||||
if (type.typeArguments.isNotEmpty) {
|
|
||||||
writeSymbol('<');
|
|
||||||
writeList(type.typeArguments, writeType);
|
|
||||||
writeSymbol('>');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -919,8 +875,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeReturnType(DartType type, String? annotation) {
|
void writeReturnType(DartType type, String? annotation) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (type == null) return;
|
|
||||||
writeSpaced('→');
|
writeSpaced('→');
|
||||||
writeAnnotatedType(type, annotation);
|
writeAnnotatedType(type, annotation);
|
||||||
}
|
}
|
||||||
|
@ -976,8 +930,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getClassReferenceFromReference(Reference reference) {
|
String getClassReferenceFromReference(Reference reference) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (reference == null) return '<No Class>';
|
|
||||||
if (reference.node != null) return getClassReference(reference.asClass);
|
if (reference.node != null) return getClassReference(reference.asClass);
|
||||||
if (reference.canonicalName != null) {
|
if (reference.canonicalName != null) {
|
||||||
return getCanonicalNameString(reference.canonicalName!);
|
return getCanonicalNameString(reference.canonicalName!);
|
||||||
|
@ -990,8 +942,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getExtensionReferenceFromReference(Reference reference) {
|
String getExtensionReferenceFromReference(Reference reference) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (reference == null) return '<No Extension>';
|
|
||||||
if (reference.node != null) {
|
if (reference.node != null) {
|
||||||
return getExtensionReference(reference.asExtension);
|
return getExtensionReference(reference.asExtension);
|
||||||
}
|
}
|
||||||
|
@ -1006,8 +956,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
String getInlineClassReferenceFromReference(Reference reference) {
|
String getInlineClassReferenceFromReference(Reference reference) {
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (reference == null) return '<No Extension>';
|
|
||||||
if (reference.node != null) {
|
if (reference.node != null) {
|
||||||
return getInlineClassReference(reference.asInlineClass);
|
return getInlineClassReference(reference.asInlineClass);
|
||||||
}
|
}
|
||||||
|
@ -1932,12 +1880,9 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
writeWord('const');
|
writeWord('const');
|
||||||
writeSpace();
|
writeSpace();
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
writeSymbol('<');
|
||||||
if (node.typeArgument != null) {
|
writeType(node.typeArgument);
|
||||||
writeSymbol('<');
|
writeSymbol('>');
|
||||||
writeType(node.typeArgument);
|
|
||||||
writeSymbol('>');
|
|
||||||
}
|
|
||||||
writeSymbol('[');
|
writeSymbol('[');
|
||||||
writeList(node.expressions, writeNode);
|
writeList(node.expressions, writeNode);
|
||||||
writeSymbol(']');
|
writeSymbol(']');
|
||||||
|
@ -1949,12 +1894,9 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
writeWord('const');
|
writeWord('const');
|
||||||
writeSpace();
|
writeSpace();
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
writeSymbol('<');
|
||||||
if (node.typeArgument != null) {
|
writeType(node.typeArgument);
|
||||||
writeSymbol('<');
|
writeSymbol('>');
|
||||||
writeType(node.typeArgument);
|
|
||||||
writeSymbol('>');
|
|
||||||
}
|
|
||||||
writeSymbol('{');
|
writeSymbol('{');
|
||||||
writeList(node.expressions, writeNode);
|
writeList(node.expressions, writeNode);
|
||||||
writeSymbol('}');
|
writeSymbol('}');
|
||||||
|
@ -1966,12 +1908,9 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
writeWord('const');
|
writeWord('const');
|
||||||
writeSpace();
|
writeSpace();
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
writeSymbol('<');
|
||||||
if (node.keyType != null) {
|
writeList([node.keyType, node.valueType], writeType);
|
||||||
writeSymbol('<');
|
writeSymbol('>');
|
||||||
writeList([node.keyType, node.valueType], writeType);
|
|
||||||
writeSymbol('>');
|
|
||||||
}
|
|
||||||
writeSymbol('{');
|
writeSymbol('{');
|
||||||
writeList(node.entries, writeNode);
|
writeList(node.entries, writeNode);
|
||||||
writeSymbol('}');
|
writeSymbol('}');
|
||||||
|
@ -2172,12 +2111,9 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeStaticType(DartType type) {
|
void writeStaticType(DartType type) {
|
||||||
// ignore: unnecessary_null_comparison
|
writeSymbol('{');
|
||||||
if (type != null) {
|
writeType(type);
|
||||||
writeSymbol('{');
|
writeSymbol('}');
|
||||||
writeType(type);
|
|
||||||
writeSymbol('}');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -2533,12 +2469,9 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
@override
|
@override
|
||||||
void visitCatch(Catch node) {
|
void visitCatch(Catch node) {
|
||||||
writeIndentation();
|
writeIndentation();
|
||||||
// ignore: unnecessary_null_comparison
|
writeWord('on');
|
||||||
if (node.guard != null) {
|
writeType(node.guard);
|
||||||
writeWord('on');
|
writeSpace();
|
||||||
writeType(node.guard);
|
|
||||||
writeSpace();
|
|
||||||
}
|
|
||||||
writeWord('catch');
|
writeWord('catch');
|
||||||
writeSymbol('(');
|
writeSymbol('(');
|
||||||
VariableDeclaration? exception = node.exception;
|
VariableDeclaration? exception = node.exception;
|
||||||
|
@ -2590,13 +2523,7 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
writeAnnotationList(node.variable.annotations);
|
writeAnnotationList(node.variable.annotations);
|
||||||
writeIndentation();
|
writeIndentation();
|
||||||
writeWord('function');
|
writeWord('function');
|
||||||
// ignore: unnecessary_null_comparison
|
writeFunction(node.function, name: getVariableName(node.variable));
|
||||||
if (node.function != null) {
|
|
||||||
writeFunction(node.function, name: getVariableName(node.variable));
|
|
||||||
} else {
|
|
||||||
writeWord(getVariableName(node.variable));
|
|
||||||
endLine('...;');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeVariableDeclaration(VariableDeclaration node,
|
void writeVariableDeclaration(VariableDeclaration node,
|
||||||
|
@ -2624,14 +2551,7 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
||||||
!node.hasDeclaredInitializer) {
|
!node.hasDeclaredInitializer) {
|
||||||
writeModifier(node.hasDeclaredInitializer, 'has-no-declared-initializer');
|
writeModifier(node.hasDeclaredInitializer, 'has-no-declared-initializer');
|
||||||
}
|
}
|
||||||
// ignore: unnecessary_null_comparison
|
writeAnnotatedType(node.type, annotator?.annotateVariable(this, node));
|
||||||
if (node.type != null) {
|
|
||||||
writeAnnotatedType(node.type, annotator?.annotateVariable(this, node));
|
|
||||||
}
|
|
||||||
// ignore: unnecessary_null_comparison
|
|
||||||
if (useVarKeyword && !node.isFinal && !node.isConst && node.type == null) {
|
|
||||||
writeWord('var');
|
|
||||||
}
|
|
||||||
writeWord(getVariableName(node));
|
writeWord(getVariableName(node));
|
||||||
Expression? initializer = node.initializer;
|
Expression? initializer = node.initializer;
|
||||||
if (initializer != null) {
|
if (initializer != null) {
|
||||||
|
|
|
@ -368,8 +368,7 @@ class WidgetCreatorTracker {
|
||||||
bool foundLocationClass = false;
|
bool foundLocationClass = false;
|
||||||
for (Library library in libraries) {
|
for (Library library in libraries) {
|
||||||
final Uri importUri = library.importUri;
|
final Uri importUri = library.importUri;
|
||||||
// ignore: unnecessary_null_comparison
|
if (importUri.isScheme('package')) {
|
||||||
if (importUri != null && importUri.isScheme('package')) {
|
|
||||||
if (importUri.path == 'flutter/src/widgets/framework.dart') {
|
if (importUri.path == 'flutter/src/widgets/framework.dart') {
|
||||||
for (Class class_ in library.classes) {
|
for (Class class_ in library.classes) {
|
||||||
if (class_.name == 'Widget') {
|
if (class_.name == 'Widget') {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue