mirror of
https://github.com/dart-lang/sdk
synced 2024-07-19 20:17:27 +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 this.uniqueName,
|
||||
}) : _correctionMessage = correctionMessage,
|
||||
_problemMessage = problemMessage,
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(hasPublishedDocs != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isUnresolvedIdentifier != null);
|
||||
_problemMessage = problemMessage;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
Message _withArgumentsConstEvalDeferredLibrary(String nameOKEmpty) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (nameOKEmpty == null || nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
||||
if (nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
||||
return new Message(codeConstEvalDeferredLibrary,
|
||||
problemMessage:
|
||||
"""'${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.
|
||||
Message _withArgumentsConstEvalFailedAssertionWithMessage(
|
||||
String stringOKEmpty) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||
if (stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||
return new Message(codeConstEvalFailedAssertionWithMessage,
|
||||
problemMessage:
|
||||
"""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.
|
||||
Message _withArgumentsConstEvalGetterNotFound(String nameOKEmpty) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (nameOKEmpty == null || nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
||||
if (nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
||||
return new Message(codeConstEvalGetterNotFound,
|
||||
problemMessage: """Variable get not found: '${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.
|
||||
Message _withArgumentsConstEvalInvalidStaticInvocation(String nameOKEmpty) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (nameOKEmpty == null || nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
||||
if (nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
||||
return new Message(codeConstEvalInvalidStaticInvocation,
|
||||
problemMessage:
|
||||
"""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.
|
||||
Message _withArgumentsConstEvalNonConstantVariableGet(String nameOKEmpty) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (nameOKEmpty == null || nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
||||
if (nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
|
||||
return new Message(codeConstEvalNonConstantVariableGet,
|
||||
problemMessage:
|
||||
"""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.
|
||||
Message _withArgumentsConstEvalUnhandledCoreException(String stringOKEmpty) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||
if (stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||
return new Message(codeConstEvalUnhandledCoreException,
|
||||
problemMessage: """Unhandled core exception: ${stringOKEmpty}""",
|
||||
arguments: {'stringOKEmpty': stringOKEmpty});
|
||||
|
@ -2464,18 +2458,8 @@ const Code<
|
|||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsDillOutlineSummary(
|
||||
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);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (_num2 == null) throw 'No number provided';
|
||||
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);
|
||||
return new Message(codeDillOutlineSummary,
|
||||
problemMessage:
|
||||
|
@ -4070,8 +4054,6 @@ Message _withArgumentsExplicitExtensionTypeArgumentMismatch(
|
|||
String name, int count) {
|
||||
if (name.isEmpty) throw 'No name provided';
|
||||
name = demangleMixinApplicationName(name);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (count == null) throw 'No count provided';
|
||||
return new Message(codeExplicitExtensionTypeArgumentMismatch,
|
||||
problemMessage:
|
||||
"""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.
|
||||
Message _withArgumentsFfiNativeUnexpectedNumberOfParameters(
|
||||
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,
|
||||
problemMessage:
|
||||
"""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.
|
||||
Message _withArgumentsFfiNativeUnexpectedNumberOfParametersWithReceiver(
|
||||
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,
|
||||
problemMessage:
|
||||
"""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) {
|
||||
if (name.isEmpty) throw 'No name provided';
|
||||
name = demangleMixinApplicationName(name);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (count == null) throw 'No count provided';
|
||||
return new Message(codeImplementsRepeated,
|
||||
problemMessage: """'${name}' can only be implemented once.""",
|
||||
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.
|
||||
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,
|
||||
problemMessage:
|
||||
"""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.
|
||||
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,
|
||||
problemMessage:
|
||||
"""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.
|
||||
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,
|
||||
problemMessage:
|
||||
"""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.
|
||||
Message _withArgumentsSourceBodySummary(
|
||||
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);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (_num2 == null) throw 'No number provided';
|
||||
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);
|
||||
return new Message(codeSourceBodySummary,
|
||||
problemMessage:
|
||||
|
@ -11904,18 +11854,8 @@ const Code<
|
|||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsSourceOutlineSummary(
|
||||
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);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (_num2 == null) throw 'No number provided';
|
||||
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);
|
||||
return new Message(codeSourceOutlineSummary,
|
||||
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.
|
||||
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,
|
||||
problemMessage:
|
||||
"""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.
|
||||
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,
|
||||
problemMessage:
|
||||
"""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.
|
||||
Message _withArgumentsTypeArgumentMismatch(int count) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (count == null) throw 'No count provided';
|
||||
return new Message(codeTypeArgumentMismatch,
|
||||
problemMessage: """Expected ${count} type arguments.""",
|
||||
arguments: {'count': count});
|
||||
|
|
|
@ -1897,8 +1897,6 @@ class Parser {
|
|||
/// ```
|
||||
Token parseFormalParameter(
|
||||
Token token, FormalParameterKind parameterKind, MemberKind memberKind) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(parameterKind != null);
|
||||
token = parseMetadataStar(token);
|
||||
|
||||
Token? skippedNonRequiredRequired;
|
||||
|
@ -3159,14 +3157,10 @@ class Parser {
|
|||
/// identifier in the given [context], create a synthetic identifier, report
|
||||
/// an error, and return the synthetic identifier.
|
||||
Token ensureIdentifier(Token token, IdentifierContext context) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(context != null);
|
||||
_tryRewriteNewToIdentifier(token, context);
|
||||
Token identifier = token.next!;
|
||||
if (identifier.kind != IDENTIFIER_TOKEN) {
|
||||
identifier = context.ensureIdentifier(token, this);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(identifier != null);
|
||||
assert(identifier.isKeywordOrIdentifier);
|
||||
}
|
||||
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.
|
||||
Token ensureIdentifierPotentiallyRecovered(
|
||||
Token token, IdentifierContext context, bool isRecovered) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(context != null);
|
||||
Token identifier = token.next!;
|
||||
if (identifier.kind != IDENTIFIER_TOKEN) {
|
||||
identifier = context.ensureIdentifierPotentiallyRecovered(
|
||||
token, this, isRecovered);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(identifier != null);
|
||||
assert(identifier.isKeywordOrIdentifier);
|
||||
}
|
||||
listener.handleIdentifier(identifier, context);
|
||||
|
|
|
@ -521,10 +521,7 @@ class ComplexTypeInfo implements TypeInfo {
|
|||
|
||||
ComplexTypeInfo(Token beforeStart, this.typeArguments)
|
||||
: this.start = beforeStart.next!,
|
||||
recovered = typeArguments.recovered {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(typeArguments != null);
|
||||
}
|
||||
recovered = typeArguments.recovered;
|
||||
|
||||
ComplexTypeInfo._nonNullable(
|
||||
this.start,
|
||||
|
@ -1226,10 +1223,6 @@ class ComplexTypeParamOrArgInfo extends TypeParamOrArgInfo {
|
|||
ComplexTypeParamOrArgInfo(
|
||||
Token token, this.inDeclaration, this.allowsVariance)
|
||||
: assert(optional('<', token.next!)),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(inDeclaration != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(allowsVariance != null),
|
||||
start = token.next!;
|
||||
|
||||
/// Parse the tokens and return the receiver or [noTypeParamOrArg] if there
|
||||
|
|
|
@ -85,8 +85,6 @@ ScannerResult scanString(String source,
|
|||
{ScannerConfiguration? configuration,
|
||||
bool includeComments = false,
|
||||
LanguageVersionChanged? languageVersionChanged}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(source != null, 'source must not be null');
|
||||
StringScanner scanner = new StringScanner(source,
|
||||
configuration: configuration,
|
||||
includeComments: includeComments,
|
||||
|
|
|
@ -37,9 +37,7 @@ class Annotation {
|
|||
|
||||
Annotation(this.index, this.lineNo, this.columnNo, this.offset, this.prefix,
|
||||
this.text, this.suffix)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(offset != null),
|
||||
assert(offset >= 0);
|
||||
: assert(offset >= 0);
|
||||
|
||||
@override
|
||||
String toString() =>
|
||||
|
|
|
@ -305,11 +305,7 @@ class NodeId implements Id {
|
|||
@override
|
||||
final IdKind kind;
|
||||
|
||||
const NodeId(this.value, this.kind)
|
||||
:
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(value != null),
|
||||
assert(value >= 0);
|
||||
const NodeId(this.value, this.kind) : assert(value >= 0);
|
||||
|
||||
@override
|
||||
bool get isGlobal => false;
|
||||
|
|
|
@ -43,12 +43,6 @@ Map<Uri, List<Annotation>> computeAnnotationsPerUri<T>(
|
|||
actualData
|
||||
.forEach((String marker, Map<Uri, Map<Id, ActualData<T>>> dataPerUri) {
|
||||
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);
|
||||
dataMap.forEach((Id id, ActualData<T> data) {
|
||||
Map<Id, Map<String, ActualData<T>>> actualDataPerId =
|
||||
|
@ -88,9 +82,6 @@ List<Annotation> _computeAnnotations<T>(
|
|||
bool sortMarkers = true,
|
||||
Annotation? Function(Annotation? expected, Annotation? actual)? createDiff,
|
||||
bool forceUpdate = false}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(annotatedCode != null);
|
||||
|
||||
Annotation createAnnotationFromData(
|
||||
ActualData<T> actualData, Annotation? annotation) {
|
||||
String getIndentationFromOffset(int offset) {
|
||||
|
|
|
@ -225,8 +225,6 @@ void computeExpectedMap(Uri sourceUri, String filename, AnnotatedCode code,
|
|||
|
||||
split.forEach((String marker, AnnotatedCode code) {
|
||||
MemberAnnotations<IdValue> fileAnnotations = maps[marker]!;
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileAnnotations != null, "No annotations for $marker in $maps");
|
||||
Map<Id, IdValue> expectedValues = fileAnnotations[sourceUri]!;
|
||||
for (Annotation annotation in code.annotations) {
|
||||
String text = annotation.text;
|
||||
|
@ -940,13 +938,9 @@ Future<void> runTests<T>(Directory dataDir,
|
|||
actualData[marker] = {};
|
||||
|
||||
void addActualData(Uri uri, Map<Id, ActualData<T>> actualData) {
|
||||
assert(
|
||||
// ignore: unnecessary_null_comparison
|
||||
uri != null && testData.code.containsKey(uri) ||
|
||||
actualData.isEmpty,
|
||||
assert(testData.code.containsKey(uri) || actualData.isEmpty,
|
||||
"Unexpected data ${actualData} for $uri");
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (uri == null || actualData.isEmpty) {
|
||||
if (actualData.isEmpty) {
|
||||
// TODO(johnniwinther): Avoid collecting data without
|
||||
// invalid uris.
|
||||
return;
|
||||
|
@ -969,8 +963,6 @@ Future<void> runTests<T>(Directory dataDir,
|
|||
dataInterpreter!,
|
||||
forceUpdate: forceUpdate);
|
||||
annotations.forEach((Uri uri, List<Annotation> annotations) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(uri != null, "Annotations without uri: $annotations");
|
||||
AnnotatedCode? code = testData.code[uri];
|
||||
assert(code != null,
|
||||
"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
|
||||
/// colors.
|
||||
void set enableColors(bool value) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(value != null);
|
||||
_enableColors = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -551,9 +551,7 @@ void testGeneral<T>(DataInterpreter<T> dataInterpreter, String text,
|
|||
code.annotatedCode, code.sourceCode, annotations[mainUri]!);
|
||||
String actualResult = generated.toText();
|
||||
if (expectedResult != actualResult) {
|
||||
print("Unexpected result for '$text'"
|
||||
// ignore: unnecessary_null_comparison
|
||||
"${actualData != null ? ' with actualData=$actualData' : ''}");
|
||||
print("Unexpected result for '$text' with actualData=$actualData");
|
||||
print('---expected-------------------------------------------------------');
|
||||
print(expectedResult);
|
||||
print('---actual---------------------------------------------------------');
|
||||
|
|
|
@ -177,8 +177,6 @@ Statement forEachWithNonVariable(Expression iterable, List<Statement> body) {
|
|||
/// }
|
||||
Statement forEachWithVariableDecl(
|
||||
Var variable, Expression iterable, List<Statement> body) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(variable != null);
|
||||
return new ForEach._(variable, iterable, block(body), true,
|
||||
location: computeLocation());
|
||||
}
|
||||
|
@ -193,8 +191,6 @@ Statement forEachWithVariableDecl(
|
|||
/// }
|
||||
Statement forEachWithVariableSet(
|
||||
Var variable, Expression iterable, List<Statement> body) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(variable != null);
|
||||
var location = computeLocation();
|
||||
return new ForEach._(
|
||||
variable, iterable, Block._(body, location: location), false,
|
||||
|
|
|
@ -792,8 +792,7 @@ class JsInteropChecks extends RecursiveVisitor {
|
|||
|
||||
/// Reports an error if [functionNode] has named parameters.
|
||||
void _checkNoNamedParameters(FunctionNode functionNode) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (functionNode != null && functionNode.namedParameters.isNotEmpty) {
|
||||
if (functionNode.namedParameters.isNotEmpty) {
|
||||
final firstNamedParam = functionNode.namedParameters[0];
|
||||
_reporter.report(
|
||||
messageJsInteropNamedParameters,
|
||||
|
|
|
@ -158,8 +158,6 @@ Version getExperimentEnabledVersionInLibrary(ExperimentalFlag flag,
|
|||
}
|
||||
version ??= flag.experimentEnabledVersion;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(version != null, "No version for enabling $flag in $canonicalUri.");
|
||||
return version;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,14 +40,11 @@ Future<VersionAndPackageUri> languageVersionForUri(
|
|||
bool good = false;
|
||||
late final int currentSdkVersionMajor;
|
||||
late final int currentSdkVersionMinor;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (currentSdkVersion != null) {
|
||||
List<String> dotSeparatedParts = currentSdkVersion.split(".");
|
||||
if (dotSeparatedParts.length >= 2) {
|
||||
currentSdkVersionMajor = int.parse(dotSeparatedParts[0]);
|
||||
currentSdkVersionMinor = int.parse(dotSeparatedParts[1]);
|
||||
good = true;
|
||||
}
|
||||
List<String> dotSeparatedParts = currentSdkVersion.split(".");
|
||||
if (dotSeparatedParts.length >= 2) {
|
||||
currentSdkVersionMajor = int.parse(dotSeparatedParts[0]);
|
||||
currentSdkVersionMinor = int.parse(dotSeparatedParts[1]);
|
||||
good = true;
|
||||
}
|
||||
if (!good) {
|
||||
throw new StateError("Unparsable sdk version given: $currentSdkVersion");
|
||||
|
@ -67,9 +64,7 @@ Future<VersionAndPackageUri> languageVersionForUri(
|
|||
Uri packageUri = uri;
|
||||
if (!packageUri.isScheme('dart') &&
|
||||
!packageUri.isScheme('package') &&
|
||||
package != null &&
|
||||
// ignore: unnecessary_null_comparison
|
||||
package.name != null) {
|
||||
package != null) {
|
||||
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`.
|
||||
bool isLateLoweredField(Field node) {
|
||||
return node.isInternalImplementation &&
|
||||
// ignore: unnecessary_null_comparison
|
||||
node.name != null &&
|
||||
node.name.text.startsWith(lateFieldPrefix) &&
|
||||
!node.name.text.endsWith(lateIsSetSuffix);
|
||||
}
|
||||
|
@ -87,8 +85,6 @@ Name extractFieldNameFromLateLoweredField(Field node) {
|
|||
/// The default value of this field is `false`.
|
||||
bool isLateLoweredIsSetField(Field node) {
|
||||
return node.isInternalImplementation &&
|
||||
// ignore: unnecessary_null_comparison
|
||||
node.name != null &&
|
||||
node.name.text.startsWith(lateFieldPrefix) &&
|
||||
node.name.text.endsWith(lateIsSetSuffix);
|
||||
}
|
||||
|
|
|
@ -88,9 +88,7 @@ class DdcResult {
|
|||
final Set<Library>? neededDillLibraries;
|
||||
|
||||
DdcResult(this.component, this.sdkSummary, this.additionalDills,
|
||||
this.classHierarchy, this.neededDillLibraries)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(classHierarchy != null);
|
||||
this.classHierarchy, this.neededDillLibraries);
|
||||
|
||||
Set<Library> computeLibrariesFromDill() {
|
||||
Set<Library> librariesFromDill = new Set<Library>();
|
||||
|
@ -123,8 +121,6 @@ InitializedCompilerState initializeCompiler(
|
|||
Map<ExperimentalFlag, bool>? explicitExperimentalFlags,
|
||||
Map<String, String>? environmentDefines,
|
||||
required NnbdMode nnbdMode}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(nnbdMode != null, "No NnbdMode provided.");
|
||||
additionalDills.sort((a, b) => a.toString().compareTo(b.toString()));
|
||||
|
||||
if (oldState != null &&
|
||||
|
|
|
@ -439,8 +439,7 @@ class ProcessedOptions {
|
|||
Future<List<Component>> loadAdditionalDills(CanonicalName? nameRoot) async {
|
||||
if (_additionalDillComponents == null) {
|
||||
List<Uri> uris = _raw.additionalDills;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (uris == null || uris.isEmpty) return const <Component>[];
|
||||
if (uris.isEmpty) return const <Component>[];
|
||||
// TODO(sigmund): throttle # of concurrent operations.
|
||||
List<List<int>?> allBytes = await Future.wait(
|
||||
uris.map((uri) => _readAsBytes(fileSystem.entityForUri(uri))));
|
||||
|
|
|
@ -125,14 +125,11 @@ Uri translateSdk(Uri uri) {
|
|||
if (sdkRoot == null) {
|
||||
sdkRoot = (options.sdkSummary ?? computePlatformBinariesLocation())
|
||||
.resolve("../../");
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (sdkRoot != null) {
|
||||
if (!isExistingFile(sdkRoot.resolve("lib/libraries.json"))) {
|
||||
if (isExistingFile(sdkRoot.resolve("sdk/lib/libraries.json"))) {
|
||||
sdkRoot = sdkRoot.resolve("sdk/");
|
||||
} else {
|
||||
sdkRoot = null;
|
||||
}
|
||||
if (!isExistingFile(sdkRoot.resolve("lib/libraries.json"))) {
|
||||
if (isExistingFile(sdkRoot.resolve("sdk/lib/libraries.json"))) {
|
||||
sdkRoot = sdkRoot.resolve("sdk/");
|
||||
} else {
|
||||
sdkRoot = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,8 +193,6 @@ class FormalParameterBuilder extends ModifierBuilderImpl
|
|||
}
|
||||
|
||||
FormalParameterBuilder forFormalParameterInitializerScope() {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(variable != null);
|
||||
if (isInitializingFormal) {
|
||||
return new FormalParameterBuilder(
|
||||
metadata,
|
||||
|
|
|
@ -188,10 +188,7 @@ abstract class BuilderClassMember implements ClassMember {
|
|||
String get fullName {
|
||||
String suffix = isSetter ? "=" : "";
|
||||
String className = classBuilder.fullNameForErrors;
|
||||
// ignore: unnecessary_null_comparison
|
||||
return className == null
|
||||
? "${fullNameForErrors}$suffix"
|
||||
: "${className}.${fullNameForErrors}$suffix";
|
||||
return "${className}.${fullNameForErrors}$suffix";
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -382,9 +382,7 @@ abstract class NamedTypeBuilder extends TypeBuilder {
|
|||
if (declaration!.isTypeVariable) {
|
||||
message =
|
||||
templateSupertypeIsTypeVariable.withArguments(fullNameForErrors);
|
||||
} else
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (type != null && type.nullability == Nullability.nullable) {
|
||||
} else if (type.nullability == Nullability.nullable) {
|
||||
message = templateSupertypeIsNullableAliased.withArguments(
|
||||
fullNameForErrors, type, library.isNonNullableByDefault);
|
||||
} else {
|
||||
|
|
|
@ -55,9 +55,6 @@ class NullabilityBuilder {
|
|||
}
|
||||
|
||||
Nullability build(LibraryBuilder libraryBuilder) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(libraryBuilder != null);
|
||||
|
||||
switch (_syntacticNullability) {
|
||||
case SyntacticNullability.legacy:
|
||||
return Nullability.legacy;
|
||||
|
|
|
@ -76,9 +76,7 @@ abstract class TypeDeclarationBuilderImpl extends ModifierBuilderImpl
|
|||
|
||||
TypeDeclarationBuilderImpl(
|
||||
this.metadata, this.modifiers, this.name, Builder? parent, int charOffset)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(modifiers != null),
|
||||
super(parent, charOffset);
|
||||
: super(parent, charOffset);
|
||||
|
||||
@override
|
||||
TypeDeclarationBuilder get origin => this;
|
||||
|
|
|
@ -98,20 +98,17 @@ Future<T> reportCrash<T>(error, StackTrace trace,
|
|||
new Crash(uri, charOffset, error, trace).._hasBeenReported = true,
|
||||
trace);
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (request != null) {
|
||||
await note("\nSending crash report data");
|
||||
request.persistentConnection = false;
|
||||
request.bufferOutput = false;
|
||||
String? host = request.connectionInfo?.remoteAddress.host;
|
||||
int? port = request.connectionInfo?.remotePort;
|
||||
await note(" to $host:$port");
|
||||
await request
|
||||
..headers.contentType = ContentType.json
|
||||
..write(json);
|
||||
await request.close();
|
||||
await note(".");
|
||||
}
|
||||
await note("\nSending crash report data");
|
||||
request.persistentConnection = false;
|
||||
request.bufferOutput = false;
|
||||
String? host = request.connectionInfo?.remoteAddress.host;
|
||||
int? port = request.connectionInfo?.remotePort;
|
||||
await note(" to $host:$port");
|
||||
await request
|
||||
..headers.contentType = ContentType.json
|
||||
..write(json);
|
||||
await request.close();
|
||||
await note(".");
|
||||
} catch (e, s) {
|
||||
await note("\n${safeToString(e)}\n$s\n");
|
||||
await note("\n\n\nFE::ERROR::$json\n\n\n");
|
||||
|
|
|
@ -234,8 +234,7 @@ int computeModifiers(Class cls) {
|
|||
if (cls.isAbstract) {
|
||||
modifiers |= abstractMask;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (cls.isMixinApplication && cls.name != null) {
|
||||
if (cls.isMixinApplication) {
|
||||
modifiers |= namedMixinApplicationMask;
|
||||
}
|
||||
return modifiers;
|
||||
|
|
|
@ -340,8 +340,6 @@ class DillLibraryBuilder extends LibraryBuilderImpl {
|
|||
String name;
|
||||
if (sourceBuildersMap?.containsKey(reference) == true) {
|
||||
declaration = sourceBuildersMap![reference]!;
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(declaration != null);
|
||||
if (declaration is ModifierBuilder) {
|
||||
name = declaration.name!;
|
||||
} else {
|
||||
|
@ -395,14 +393,6 @@ class DillLibraryBuilder extends LibraryBuilderImpl {
|
|||
library.exportScope.lookupLocalMember(name, 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(
|
||||
|
|
|
@ -32,7 +32,7 @@ import '../messages.dart'
|
|||
messagePlatformPrivateLibraryAccess,
|
||||
templateInternalProblemContextSeverity;
|
||||
|
||||
import '../problems.dart' show internalProblem, unhandled;
|
||||
import '../problems.dart' show internalProblem;
|
||||
|
||||
import '../source/source_loader.dart' show SourceLoader;
|
||||
|
||||
|
@ -118,7 +118,6 @@ class DillLoader extends Loader {
|
|||
DillLibraryBuilder? libraryBuilder = _builders[uri];
|
||||
if (libraryBuilder == null) {
|
||||
libraryBuilder = _knownLibraryBuilders.remove(uri);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(libraryBuilder != null, "No library found for $uri.");
|
||||
_builders[uri] = libraryBuilder!;
|
||||
assert(libraryBuilder.loader == this);
|
||||
|
@ -311,10 +310,6 @@ severity: $severity
|
|||
}
|
||||
|
||||
void buildOutline(DillLibraryBuilder builder) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (builder.library == null) {
|
||||
unhandled("null", "builder.library", 0, builder.fileUri);
|
||||
}
|
||||
builder.markAsReadyToBuild();
|
||||
}
|
||||
|
||||
|
|
|
@ -262,9 +262,7 @@ class DillClassMember extends BuilderClassMember {
|
|||
@override
|
||||
final bool forSetter;
|
||||
|
||||
DillClassMember(this.memberBuilder, {required this.forSetter})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(forSetter != null);
|
||||
DillClassMember(this.memberBuilder, {required this.forSetter});
|
||||
|
||||
@override
|
||||
bool get isSourceDeclaration => false;
|
||||
|
|
|
@ -45,13 +45,7 @@ class DillTarget extends TargetImplementation {
|
|||
final Benchmarker? benchmarker;
|
||||
|
||||
DillTarget(this.ticker, this.uriTranslator, this.backendTarget,
|
||||
{this.benchmarker})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(ticker != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(uriTranslator != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(backendTarget != null) {
|
||||
{this.benchmarker}) {
|
||||
loader = new DillLoader(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -589,8 +589,7 @@ Message _withArgumentsConstEvalInvalidBinaryOperandType(
|
|||
DartType _type,
|
||||
DartType _type2,
|
||||
bool isNonNullableByDefault) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||
if (stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> constantParts = labeler.labelConstant(_constant);
|
||||
List<Object> typeParts = labeler.labelType(_type);
|
||||
|
@ -673,8 +672,7 @@ const Code<
|
|||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsConstEvalInvalidMethodInvocation(
|
||||
String stringOKEmpty, Constant _constant, bool isNonNullableByDefault) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||
if (stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> constantParts = labeler.labelConstant(_constant);
|
||||
String constant = constantParts.join();
|
||||
|
@ -711,8 +709,7 @@ const Code<
|
|||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsConstEvalInvalidPropertyGet(
|
||||
String stringOKEmpty, Constant _constant, bool isNonNullableByDefault) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||
if (stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> constantParts = labeler.labelConstant(_constant);
|
||||
String constant = constantParts.join();
|
||||
|
@ -749,8 +746,7 @@ const Code<
|
|||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsConstEvalInvalidRecordIndexGet(
|
||||
String stringOKEmpty, Constant _constant, bool isNonNullableByDefault) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||
if (stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> constantParts = labeler.labelConstant(_constant);
|
||||
String constant = constantParts.join();
|
||||
|
@ -787,8 +783,7 @@ const Code<
|
|||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsConstEvalInvalidRecordNameGet(
|
||||
String stringOKEmpty, Constant _constant, bool isNonNullableByDefault) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||
if (stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
|
||||
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||
List<Object> constantParts = labeler.labelConstant(_constant);
|
||||
String constant = constantParts.join();
|
||||
|
@ -2039,10 +2034,6 @@ const Code<
|
|||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||
Message _withArgumentsIndexOutOfBoundInRecordIndexGet(
|
||||
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);
|
||||
List<Object> typeParts = labeler.labelType(_type);
|
||||
String type = typeParts.join();
|
||||
|
|
|
@ -1465,11 +1465,9 @@ class IncrementalCompiler implements IncrementalKernelGenerator {
|
|||
}
|
||||
|
||||
if (childReplacementMap == null) return;
|
||||
Builder replacement = childReplacementMap[declaration.name]!;
|
||||
Builder? replacement = childReplacementMap[declaration.name];
|
||||
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(
|
||||
parent as LibraryBuilder, replacement as TypeDeclarationBuilder);
|
||||
}
|
||||
|
@ -2366,18 +2364,7 @@ class ReusageResult {
|
|||
this.directlyInvalidated,
|
||||
this.invalidatedBecauseOfPackageUpdate,
|
||||
this.reusedLibraries,
|
||||
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);
|
||||
this.partUriToParent);
|
||||
}
|
||||
|
||||
class ExperimentalInvalidation {
|
||||
|
@ -2386,13 +2373,7 @@ class ExperimentalInvalidation {
|
|||
final Set<Uri> missingSources;
|
||||
|
||||
ExperimentalInvalidation(
|
||||
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);
|
||||
this.rebuildBodies, this.originalNotReusedLibraries, this.missingSources);
|
||||
}
|
||||
|
||||
class IncrementalKernelTarget extends KernelTarget
|
||||
|
@ -2637,8 +2618,7 @@ class _InitializationFromUri extends _InitializationFromSdkSummary {
|
|||
context.options.fileSystem.entityForUri(initializeFromDillUri);
|
||||
if (await entity.exists()) {
|
||||
List<int> initializationBytes = await entity.readAsBytes();
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (initializationBytes != null && initializationBytes.isNotEmpty) {
|
||||
if (initializationBytes.isNotEmpty) {
|
||||
dillLoadedData.ticker.logMs("Read $initializeFromDillUri");
|
||||
data.initializationBytes = initializationBytes;
|
||||
|
||||
|
|
|
@ -424,8 +424,6 @@ class BodyBuilder extends StackListenerImpl
|
|||
}
|
||||
}
|
||||
scope = pop() as Scope;
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(scope != null);
|
||||
}
|
||||
|
||||
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
|
||||
// the outermost parent to check if the node is a dead code.
|
||||
if (invocation.parent == null) continue;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (typeInferrer != null) {
|
||||
if (!invocation.hasBeenInferred) {
|
||||
if (allowFurtherDelays) {
|
||||
delayedRedirectingFactoryInvocations.add(invocation);
|
||||
}
|
||||
continue;
|
||||
if (!invocation.hasBeenInferred) {
|
||||
if (allowFurtherDelays) {
|
||||
delayedRedirectingFactoryInvocations.add(invocation);
|
||||
}
|
||||
} else {
|
||||
TreeNode? parent = invocation.parent;
|
||||
while (parent is! Component && parent != null) {
|
||||
parent = parent.parent;
|
||||
}
|
||||
if (parent == null) continue;
|
||||
continue;
|
||||
}
|
||||
Expression? replacement = _resolveRedirectingFactoryTarget(
|
||||
invocation.target,
|
||||
|
@ -6400,8 +6389,7 @@ class BodyBuilder extends StackListenerImpl
|
|||
}
|
||||
|
||||
List<DartType> typeArgumentsToCheck = const <DartType>[];
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (typeArgumentBuilders != null && typeArgumentBuilders.isNotEmpty) {
|
||||
if (typeArgumentBuilders.isNotEmpty) {
|
||||
typeArgumentsToCheck = new List.filled(
|
||||
typeArgumentBuilders.length, const DynamicType(),
|
||||
growable: false);
|
||||
|
@ -8925,8 +8913,6 @@ class BodyBuilder extends StackListenerImpl
|
|||
@override
|
||||
TypeBuilder validateTypeVariableUse(TypeBuilder typeBuilder,
|
||||
{required bool allowPotentiallyConstantType}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(allowPotentiallyConstantType != null);
|
||||
_validateTypeVariableUseInternal(typeBuilder,
|
||||
allowPotentiallyConstantType: allowPotentiallyConstantType);
|
||||
return typeBuilder;
|
||||
|
@ -8934,8 +8920,6 @@ class BodyBuilder extends StackListenerImpl
|
|||
|
||||
void _validateTypeVariableUseInternal(TypeBuilder? builder,
|
||||
{required bool allowPotentiallyConstantType}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(allowPotentiallyConstantType != null);
|
||||
if (builder is NamedTypeBuilder) {
|
||||
if (builder.declaration!.isTypeVariable) {
|
||||
TypeVariableBuilder typeParameterBuilder =
|
||||
|
|
|
@ -67,11 +67,7 @@ class SpreadElement extends Expression with ControlFlowElement {
|
|||
/// during the desugaring.
|
||||
DartType? elementType;
|
||||
|
||||
SpreadElement(this.expression, {required this.isNullAware})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(expression != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null) {
|
||||
SpreadElement(this.expression, {required this.isNullAware}) {
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
|
@ -82,20 +78,14 @@ class SpreadElement extends Expression with ControlFlowElement {
|
|||
|
||||
@override
|
||||
void transformChildren(Transformer v) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (expression != null) {
|
||||
expression = v.transform(expression);
|
||||
expression.parent = this;
|
||||
}
|
||||
expression = v.transform(expression);
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
@override
|
||||
void transformOrRemoveChildren(RemovingTransformer v) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (expression != null) {
|
||||
expression = v.transform(expression);
|
||||
expression.parent = this;
|
||||
}
|
||||
expression = v.transform(expression);
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -126,11 +116,7 @@ class IfElement extends Expression with ControlFlowElement {
|
|||
Expression then;
|
||||
Expression? otherwise;
|
||||
|
||||
IfElement(this.condition, this.then, this.otherwise)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(condition != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(then != null) {
|
||||
IfElement(this.condition, this.then, this.otherwise) {
|
||||
condition.parent = this;
|
||||
then.parent = this;
|
||||
otherwise?.parent = this;
|
||||
|
@ -145,16 +131,10 @@ class IfElement extends Expression with ControlFlowElement {
|
|||
|
||||
@override
|
||||
void transformChildren(Transformer v) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (condition != null) {
|
||||
condition = v.transform(condition);
|
||||
condition.parent = this;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (then != null) {
|
||||
then = v.transform(then);
|
||||
then.parent = this;
|
||||
}
|
||||
condition = v.transform(condition);
|
||||
condition.parent = this;
|
||||
then = v.transform(then);
|
||||
then.parent = this;
|
||||
if (otherwise != null) {
|
||||
otherwise = v.transform(otherwise!);
|
||||
otherwise?.parent = this;
|
||||
|
@ -163,16 +143,10 @@ class IfElement extends Expression with ControlFlowElement {
|
|||
|
||||
@override
|
||||
void transformOrRemoveChildren(RemovingTransformer v) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (condition != null) {
|
||||
condition = v.transform(condition);
|
||||
condition.parent = this;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (then != null) {
|
||||
then = v.transform(then);
|
||||
then.parent = this;
|
||||
}
|
||||
condition = v.transform(condition);
|
||||
condition.parent = this;
|
||||
then = v.transform(then);
|
||||
then.parent = this;
|
||||
if (otherwise != null) {
|
||||
otherwise = v.transformOrRemoveExpression(otherwise!);
|
||||
otherwise?.parent = this;
|
||||
|
@ -229,9 +203,7 @@ class ForElement extends Expression with ControlFlowElement {
|
|||
final List<Expression> updates; // May be empty, but not null.
|
||||
Expression body;
|
||||
|
||||
ForElement(this.variables, this.condition, this.updates, this.body)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(body != null) {
|
||||
ForElement(this.variables, this.condition, this.updates, this.body) {
|
||||
setParents(variables, this);
|
||||
condition?.parent = this;
|
||||
setParents(updates, this);
|
||||
|
@ -254,11 +226,8 @@ class ForElement extends Expression with ControlFlowElement {
|
|||
condition?.parent = this;
|
||||
}
|
||||
v.transformList(updates, this);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (body != null) {
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
}
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -269,11 +238,8 @@ class ForElement extends Expression with ControlFlowElement {
|
|||
condition?.parent = this;
|
||||
}
|
||||
v.transformExpressionList(updates, this);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (body != null) {
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
}
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -331,13 +297,7 @@ class ForInElement extends Expression with ControlFlowElement {
|
|||
|
||||
ForInElement(this.variable, this.iterable, this.syntheticAssignment,
|
||||
this.expressionEffects, this.body, this.problem,
|
||||
{this.isAsync = false})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(variable != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(iterable != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(body != null) {
|
||||
{this.isAsync = false}) {
|
||||
variable.parent = this;
|
||||
iterable.parent = this;
|
||||
syntheticAssignment?.parent = this;
|
||||
|
@ -363,16 +323,10 @@ class ForInElement extends Expression with ControlFlowElement {
|
|||
|
||||
@override
|
||||
void transformChildren(Transformer v) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (variable != null) {
|
||||
variable = v.transform(variable);
|
||||
variable.parent = this;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (iterable != null) {
|
||||
iterable = v.transform(iterable);
|
||||
iterable.parent = this;
|
||||
}
|
||||
variable = v.transform(variable);
|
||||
variable.parent = this;
|
||||
iterable = v.transform(iterable);
|
||||
iterable.parent = this;
|
||||
if (syntheticAssignment != null) {
|
||||
syntheticAssignment = v.transform(syntheticAssignment!);
|
||||
syntheticAssignment?.parent = this;
|
||||
|
@ -381,11 +335,8 @@ class ForInElement extends Expression with ControlFlowElement {
|
|||
expressionEffects = v.transform(expressionEffects!);
|
||||
expressionEffects?.parent = this;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (body != null) {
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
}
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
if (problem != null) {
|
||||
problem = v.transform(problem!);
|
||||
problem?.parent = this;
|
||||
|
@ -394,16 +345,10 @@ class ForInElement extends Expression with ControlFlowElement {
|
|||
|
||||
@override
|
||||
void transformOrRemoveChildren(RemovingTransformer v) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (variable != null) {
|
||||
variable = v.transform(variable);
|
||||
variable.parent = this;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (iterable != null) {
|
||||
iterable = v.transform(iterable);
|
||||
iterable.parent = this;
|
||||
}
|
||||
variable = v.transform(variable);
|
||||
variable.parent = this;
|
||||
iterable = v.transform(iterable);
|
||||
iterable.parent = this;
|
||||
if (syntheticAssignment != null) {
|
||||
syntheticAssignment = v.transformOrRemoveExpression(syntheticAssignment!);
|
||||
syntheticAssignment?.parent = this;
|
||||
|
@ -412,11 +357,8 @@ class ForInElement extends Expression with ControlFlowElement {
|
|||
expressionEffects = v.transformOrRemoveStatement(expressionEffects!);
|
||||
expressionEffects?.parent = this;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (body != null) {
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
}
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
if (problem != null) {
|
||||
problem = v.transformOrRemoveExpression(problem!);
|
||||
problem?.parent = this;
|
||||
|
@ -493,11 +435,7 @@ class SpreadMapEntry extends TreeNode with ControlFlowMapEntry {
|
|||
/// during the desugaring.
|
||||
DartType? entryType;
|
||||
|
||||
SpreadMapEntry(this.expression, {required this.isNullAware})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(expression != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null) {
|
||||
SpreadMapEntry(this.expression, {required this.isNullAware}) {
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
|
@ -508,20 +446,14 @@ class SpreadMapEntry extends TreeNode with ControlFlowMapEntry {
|
|||
|
||||
@override
|
||||
void transformChildren(Transformer v) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (expression != null) {
|
||||
expression = v.transform(expression);
|
||||
expression.parent = this;
|
||||
}
|
||||
expression = v.transform(expression);
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
@override
|
||||
void transformOrRemoveChildren(RemovingTransformer v) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (expression != null) {
|
||||
expression = v.transform(expression);
|
||||
expression.parent = this;
|
||||
}
|
||||
expression = v.transform(expression);
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -542,11 +474,7 @@ class IfMapEntry extends TreeNode with ControlFlowMapEntry {
|
|||
MapLiteralEntry then;
|
||||
MapLiteralEntry? otherwise;
|
||||
|
||||
IfMapEntry(this.condition, this.then, this.otherwise)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(condition != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(then != null) {
|
||||
IfMapEntry(this.condition, this.then, this.otherwise) {
|
||||
condition.parent = this;
|
||||
then.parent = this;
|
||||
otherwise?.parent = this;
|
||||
|
@ -561,16 +489,10 @@ class IfMapEntry extends TreeNode with ControlFlowMapEntry {
|
|||
|
||||
@override
|
||||
void transformChildren(Transformer v) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (condition != null) {
|
||||
condition = v.transform(condition);
|
||||
condition.parent = this;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (then != null) {
|
||||
then = v.transform(then);
|
||||
then.parent = this;
|
||||
}
|
||||
condition = v.transform(condition);
|
||||
condition.parent = this;
|
||||
then = v.transform(then);
|
||||
then.parent = this;
|
||||
if (otherwise != null) {
|
||||
otherwise = v.transform(otherwise!);
|
||||
otherwise?.parent = this;
|
||||
|
@ -579,16 +501,10 @@ class IfMapEntry extends TreeNode with ControlFlowMapEntry {
|
|||
|
||||
@override
|
||||
void transformOrRemoveChildren(RemovingTransformer v) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (condition != null) {
|
||||
condition = v.transform(condition);
|
||||
condition.parent = this;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (then != null) {
|
||||
then = v.transform(then);
|
||||
then.parent = this;
|
||||
}
|
||||
condition = v.transform(condition);
|
||||
condition.parent = this;
|
||||
then = v.transform(then);
|
||||
then.parent = this;
|
||||
if (otherwise != null) {
|
||||
otherwise = v.transformOrRemove(otherwise!, dummyMapLiteralEntry);
|
||||
otherwise?.parent = this;
|
||||
|
@ -620,9 +536,7 @@ class ForMapEntry extends TreeNode with ControlFlowMapEntry {
|
|||
final List<Expression> updates; // May be empty, but not null.
|
||||
MapLiteralEntry body;
|
||||
|
||||
ForMapEntry(this.variables, this.condition, this.updates, this.body)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(body != null) {
|
||||
ForMapEntry(this.variables, this.condition, this.updates, this.body) {
|
||||
setParents(variables, this);
|
||||
condition?.parent = this;
|
||||
setParents(updates, this);
|
||||
|
@ -645,11 +559,8 @@ class ForMapEntry extends TreeNode with ControlFlowMapEntry {
|
|||
condition?.parent = this;
|
||||
}
|
||||
v.transformList(updates, this);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (body != null) {
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
}
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -660,11 +571,8 @@ class ForMapEntry extends TreeNode with ControlFlowMapEntry {
|
|||
condition?.parent = this;
|
||||
}
|
||||
v.transformExpressionList(updates, this);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (body != null) {
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
}
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -705,13 +613,7 @@ class ForInMapEntry extends TreeNode with ControlFlowMapEntry {
|
|||
|
||||
ForInMapEntry(this.variable, this.iterable, this.syntheticAssignment,
|
||||
this.expressionEffects, this.body, this.problem,
|
||||
{required this.isAsync})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(iterable != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(body != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isAsync != null) {
|
||||
{required this.isAsync}) {
|
||||
variable.parent = this;
|
||||
iterable.parent = this;
|
||||
syntheticAssignment?.parent = this;
|
||||
|
@ -737,16 +639,10 @@ class ForInMapEntry extends TreeNode with ControlFlowMapEntry {
|
|||
|
||||
@override
|
||||
void transformChildren(Transformer v) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (variable != null) {
|
||||
variable = v.transform(variable);
|
||||
variable.parent = this;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (iterable != null) {
|
||||
iterable = v.transform(iterable);
|
||||
iterable.parent = this;
|
||||
}
|
||||
variable = v.transform(variable);
|
||||
variable.parent = this;
|
||||
iterable = v.transform(iterable);
|
||||
iterable.parent = this;
|
||||
if (syntheticAssignment != null) {
|
||||
syntheticAssignment = v.transform(syntheticAssignment!);
|
||||
syntheticAssignment?.parent = this;
|
||||
|
@ -755,11 +651,8 @@ class ForInMapEntry extends TreeNode with ControlFlowMapEntry {
|
|||
expressionEffects = v.transform(expressionEffects!);
|
||||
expressionEffects?.parent = this;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (body != null) {
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
}
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
if (problem != null) {
|
||||
problem = v.transform(problem!);
|
||||
problem?.parent = this;
|
||||
|
@ -768,16 +661,10 @@ class ForInMapEntry extends TreeNode with ControlFlowMapEntry {
|
|||
|
||||
@override
|
||||
void transformOrRemoveChildren(RemovingTransformer v) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (variable != null) {
|
||||
variable = v.transform(variable);
|
||||
variable.parent = this;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (iterable != null) {
|
||||
iterable = v.transform(iterable);
|
||||
iterable.parent = this;
|
||||
}
|
||||
variable = v.transform(variable);
|
||||
variable.parent = this;
|
||||
iterable = v.transform(iterable);
|
||||
iterable.parent = this;
|
||||
if (syntheticAssignment != null) {
|
||||
syntheticAssignment = v.transformOrRemoveExpression(syntheticAssignment!);
|
||||
syntheticAssignment?.parent = this;
|
||||
|
@ -786,11 +673,8 @@ class ForInMapEntry extends TreeNode with ControlFlowMapEntry {
|
|||
expressionEffects = v.transformOrRemoveStatement(expressionEffects!);
|
||||
expressionEffects?.parent = this;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (body != null) {
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
}
|
||||
body = v.transform(body);
|
||||
body.parent = this;
|
||||
if (problem != null) {
|
||||
problem = v.transformOrRemoveExpression(problem!);
|
||||
problem?.parent = this;
|
||||
|
|
|
@ -104,9 +104,7 @@ abstract class CombinedMemberSignatureBase<T> {
|
|||
/// Creates a [CombinedClassMemberSignature] whose canonical member is already
|
||||
/// defined.
|
||||
CombinedMemberSignatureBase.internal(
|
||||
this.classBuilder, this._canonicalMemberIndex, this.forSetter)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(forSetter != null);
|
||||
this.classBuilder, this._canonicalMemberIndex, this.forSetter);
|
||||
|
||||
/// Creates a [CombinedClassMemberSignature] for [members] inherited into
|
||||
/// [classBuilder].
|
||||
|
@ -115,8 +113,6 @@ abstract class CombinedMemberSignatureBase<T> {
|
|||
/// compute the most specific member type. Otherwise covariance of the getter
|
||||
/// types or function types is used.
|
||||
CombinedMemberSignatureBase(this.classBuilder, {required this.forSetter}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(forSetter != null);
|
||||
int? bestSoFarIndex;
|
||||
if (members.length == 1) {
|
||||
bestSoFarIndex = 0;
|
||||
|
@ -292,9 +288,6 @@ abstract class CombinedMemberSignatureBase<T> {
|
|||
DartType? candidateType = _memberTypes![index];
|
||||
if (candidateType == null) {
|
||||
Member target = _getMember(index);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(target != null,
|
||||
"No member computed for index ${index} in ${members}");
|
||||
candidateType = _computeMemberType(thisType, target);
|
||||
if (!classBuilder.libraryBuilder.isNonNullableByDefault) {
|
||||
DartType? legacyErasure;
|
||||
|
@ -526,8 +519,6 @@ abstract class CombinedMemberSignatureBase<T> {
|
|||
/// [type].
|
||||
Procedure _createGetterMemberSignature(Member member, DartType type,
|
||||
{required bool copyLocation}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(copyLocation != null);
|
||||
Class enclosingClass = classBuilder.cls;
|
||||
Reference? reference =
|
||||
classBuilder.referencesFromIndexed?.lookupGetterReference(member.name);
|
||||
|
@ -570,12 +561,6 @@ abstract class CombinedMemberSignatureBase<T> {
|
|||
required bool isCovariantByClass,
|
||||
VariableDeclaration? parameter,
|
||||
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;
|
||||
Reference? reference =
|
||||
classBuilder.referencesFromIndexed?.lookupSetterReference(member.name);
|
||||
|
@ -620,8 +605,6 @@ abstract class CombinedMemberSignatureBase<T> {
|
|||
Procedure _createMethodSignature(
|
||||
Procedure procedure, FunctionType functionType,
|
||||
{required bool copyLocation}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(copyLocation != null);
|
||||
Class enclosingClass = classBuilder.cls;
|
||||
Reference? reference = classBuilder.referencesFromIndexed
|
||||
?.lookupGetterReference(procedure.name);
|
||||
|
@ -778,21 +761,13 @@ class CombinedClassMemberSignature
|
|||
@override
|
||||
Member _getMember(int index) {
|
||||
ClassMember candidate = members[index];
|
||||
Member target = candidate.getMember(membersBuilder);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(target != null,
|
||||
"No member computed for ${candidate} (${candidate.runtimeType})");
|
||||
return target;
|
||||
return candidate.getMember(membersBuilder);
|
||||
}
|
||||
|
||||
@override
|
||||
Covariance _getMemberCovariance(int index) {
|
||||
ClassMember candidate = members[index];
|
||||
Covariance covariance = candidate.getCovariance(membersBuilder);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(covariance != null,
|
||||
"No covariance computed for ${candidate} (${candidate.runtimeType})");
|
||||
return covariance;
|
||||
return candidate.getCovariance(membersBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,18 +64,6 @@ Component transformComponent(
|
|||
CoreTypes? coreTypes,
|
||||
ClassHierarchy? hierarchy,
|
||||
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);
|
||||
hierarchy ??= new ClassHierarchy(component, coreTypes);
|
||||
|
||||
|
@ -106,16 +94,6 @@ ConstantEvaluationData transformLibraries(
|
|||
required bool errorOnUnevaluatedConstant,
|
||||
required bool enableConstructorTearOff,
|
||||
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(
|
||||
target,
|
||||
environmentDefines,
|
||||
|
@ -151,16 +129,6 @@ void transformProcedure(
|
|||
required bool enableConstFunctions,
|
||||
required bool enableConstructorTearOff,
|
||||
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(
|
||||
target,
|
||||
environmentDefines,
|
||||
|
@ -657,10 +625,7 @@ class ConstantsTransformer extends RemovingTransformer {
|
|||
TreeNode visitFunctionDeclaration(
|
||||
FunctionDeclaration node, TreeNode? removalSentinel) {
|
||||
if (enableConstFunctions) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node.function != null) {
|
||||
node.function = transform(node.function)..parent = node;
|
||||
}
|
||||
node.function = transform(node.function)..parent = node;
|
||||
constantEvaluator.env.addVariableValue(
|
||||
node.variable, new FunctionValue(node.function, null));
|
||||
} else {
|
||||
|
@ -1609,27 +1574,23 @@ class ConstantsTransformer extends RemovingTransformer {
|
|||
TreeNode visitSwitchStatement(
|
||||
SwitchStatement node, TreeNode? removalSentinel) {
|
||||
TreeNode result = super.visitSwitchStatement(node, removalSentinel);
|
||||
Library library = currentLibrary;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (library != null) {
|
||||
for (SwitchCase switchCase in node.cases) {
|
||||
for (Expression caseExpression in switchCase.expressions) {
|
||||
if (caseExpression is ConstantExpression) {
|
||||
if (!constantEvaluator.hasPrimitiveEqual(caseExpression.constant,
|
||||
staticTypeContext: staticTypeContext)) {
|
||||
constantEvaluator.errorReporter.report(
|
||||
constantEvaluator.createLocatedMessage(
|
||||
caseExpression,
|
||||
templateConstEvalCaseImplementsEqual.withArguments(
|
||||
caseExpression.constant,
|
||||
staticTypeContext.nonNullable ==
|
||||
Nullability.nonNullable)),
|
||||
null);
|
||||
}
|
||||
} else {
|
||||
// If caseExpression is not ConstantExpression, an error is
|
||||
// reported elsewhere.
|
||||
for (SwitchCase switchCase in node.cases) {
|
||||
for (Expression caseExpression in switchCase.expressions) {
|
||||
if (caseExpression is ConstantExpression) {
|
||||
if (!constantEvaluator.hasPrimitiveEqual(caseExpression.constant,
|
||||
staticTypeContext: staticTypeContext)) {
|
||||
constantEvaluator.errorReporter.report(
|
||||
constantEvaluator.createLocatedMessage(
|
||||
caseExpression,
|
||||
templateConstEvalCaseImplementsEqual.withArguments(
|
||||
caseExpression.constant,
|
||||
staticTypeContext.nonNullable ==
|
||||
Nullability.nonNullable)),
|
||||
null);
|
||||
}
|
||||
} else {
|
||||
// If caseExpression is not ConstantExpression, an error is
|
||||
// reported elsewhere.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2871,8 +2832,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(type != null);
|
||||
return canonicalize(new TypeLiteralConstant(type));
|
||||
}
|
||||
|
||||
|
@ -2912,8 +2871,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(type != null);
|
||||
|
||||
final ListConstantBuilder builder = new ListConstantBuilder(
|
||||
node, convertType(type), this,
|
||||
|
@ -2949,8 +2906,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(positional != null);
|
||||
|
||||
Map<String, Constant>? named = _evaluateNamedArguments(node.named);
|
||||
if (named == null) {
|
||||
|
@ -2959,8 +2914,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(named != null);
|
||||
|
||||
if (shouldBeUnevaluated) {
|
||||
return unevaluated(
|
||||
|
@ -3003,8 +2956,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(type != null);
|
||||
|
||||
final SetConstantBuilder builder =
|
||||
new SetConstantBuilder(node, convertType(type), this);
|
||||
|
@ -3050,8 +3001,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(keyType != null);
|
||||
|
||||
DartType? valueType = _evaluateDartType(node, node.valueType);
|
||||
if (valueType == null) {
|
||||
|
@ -3060,8 +3009,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(valueType != null);
|
||||
|
||||
final MapConstantBuilder builder = new MapConstantBuilder(
|
||||
node, convertType(keyType), convertType(valueType), this);
|
||||
|
@ -3127,8 +3074,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(positional != null);
|
||||
|
||||
final Map<String, Constant>? named =
|
||||
_evaluateNamedArguments(node.arguments.named);
|
||||
|
@ -3138,8 +3083,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(named != null);
|
||||
|
||||
bool isSymbol = klass == coreTypes.internalSymbolClass;
|
||||
if (isSymbol && shouldBeUnevaluated) {
|
||||
|
@ -3174,8 +3117,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(types != null);
|
||||
|
||||
final List<DartType> typeArguments = convertTypes(types);
|
||||
|
||||
|
@ -3307,8 +3248,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
'unary-'
|
||||
};
|
||||
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (name == null) return false;
|
||||
if (name == '') return true;
|
||||
|
||||
final List<String> parts = name.split('.');
|
||||
|
@ -3463,8 +3402,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(types != null);
|
||||
|
||||
List<Constant>? positionalArguments =
|
||||
_evaluatePositionalArguments(init.arguments.positional);
|
||||
|
@ -3474,8 +3411,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(positionalArguments != null);
|
||||
Map<String, Constant>? namedArguments =
|
||||
_evaluateNamedArguments(init.arguments.named);
|
||||
if (namedArguments == null) {
|
||||
|
@ -3484,8 +3419,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(namedArguments != null);
|
||||
error = handleConstructorInvocation(
|
||||
init.target, types, positionalArguments, namedArguments, caller);
|
||||
if (error != null) return error;
|
||||
|
@ -3504,8 +3437,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(positionalArguments != null);
|
||||
|
||||
Map<String, Constant>? namedArguments =
|
||||
_evaluateNamedArguments(init.arguments.named);
|
||||
|
@ -3515,8 +3446,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(namedArguments != null);
|
||||
|
||||
error = handleConstructorInvocation(init.target, typeArguments,
|
||||
positionalArguments, namedArguments, caller);
|
||||
|
@ -3544,8 +3473,7 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
instanceBuilder!.unusedArguments.add(_wrap(constant));
|
||||
}
|
||||
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (enableConstFunctions && constructor.function != null) {
|
||||
if (enableConstFunctions) {
|
||||
AbortConstant? error = executeConstructorBody(constructor);
|
||||
if (error != null) return error;
|
||||
}
|
||||
|
@ -3643,8 +3571,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(positionalArguments != null);
|
||||
|
||||
if (shouldBeUnevaluated) {
|
||||
return unevaluated(
|
||||
|
@ -3688,8 +3614,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(positionalArguments != null);
|
||||
|
||||
if (shouldBeUnevaluated) {
|
||||
return unevaluated(
|
||||
|
@ -3733,8 +3657,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
}
|
||||
|
||||
final Constant receiver = env.lookupVariable(node.variable)!;
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(receiver != null);
|
||||
if (receiver is AbortConstant) return receiver;
|
||||
|
||||
return _evaluateFunctionInvocation(node, receiver, node.arguments);
|
||||
|
@ -3751,8 +3673,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(positional != null);
|
||||
|
||||
// Evaluate type arguments of the function invoked.
|
||||
List<DartType>? types = _evaluateTypeArguments(node, arguments);
|
||||
|
@ -3762,8 +3682,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(types != null);
|
||||
|
||||
// Evaluate named arguments of the function invoked.
|
||||
final Map<String, Constant>? named =
|
||||
|
@ -3774,8 +3692,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(named != null);
|
||||
|
||||
if (receiver is FunctionValue) {
|
||||
return _handleFunctionInvocation(
|
||||
|
@ -4048,8 +3964,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(typeArguments != null);
|
||||
|
||||
// Evaluate named arguments of the method invoked.
|
||||
final Map<String, Constant>? namedArguments =
|
||||
|
@ -4060,8 +3974,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(namedArguments != null);
|
||||
|
||||
if (receiver is FunctionValue && name == Name.callName) {
|
||||
return _handleFunctionInvocation(receiver.function, typeArguments,
|
||||
|
@ -4616,8 +4528,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(types != null);
|
||||
|
||||
final List<DartType> typeArguments = convertTypes(types);
|
||||
|
||||
|
@ -4629,8 +4539,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(positional != null);
|
||||
|
||||
final Map<String, Constant>? named =
|
||||
_evaluateNamedArguments(arguments.named);
|
||||
|
@ -4640,8 +4548,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(named != null);
|
||||
|
||||
if (shouldBeUnevaluated) {
|
||||
return unevaluated(
|
||||
|
@ -4815,8 +4721,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(type != null);
|
||||
return ensureIsSubtype(constant, type, node);
|
||||
}
|
||||
|
||||
|
@ -4839,12 +4743,8 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(type != null);
|
||||
|
||||
bool performIs(Constant constant, {required bool strongMode}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(strongMode != null);
|
||||
if (strongMode) {
|
||||
return isSubtype(constant, type, SubtypeCheckMode.withNullabilities);
|
||||
} else {
|
||||
|
@ -4970,8 +4870,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return error;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(types != null);
|
||||
|
||||
return canonicalize(
|
||||
new InstantiationConstant(constant, convertTypes(types)));
|
||||
|
@ -5248,8 +5146,6 @@ class ConstantEvaluator implements ExpressionVisitor<Constant> {
|
|||
return null;
|
||||
}
|
||||
assert(_gotError == null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(type != null);
|
||||
result[i] = type;
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -223,8 +223,6 @@ abstract class Generator {
|
|||
|
||||
Expression_Generator buildEqualsOperation(Token token, Expression right,
|
||||
{required bool isNot}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNot != null);
|
||||
return _forest.createEquals(offsetForToken(token), buildSimpleRead(), right,
|
||||
isNot: isNot);
|
||||
}
|
||||
|
@ -401,8 +399,6 @@ class VariableUseGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -525,8 +521,6 @@ class PropertyAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -687,8 +681,6 @@ class ThisPropertyAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -794,8 +786,6 @@ class NullAwarePropertyAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -919,8 +909,6 @@ class SuperPropertyAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -946,9 +934,7 @@ class IndexedAccessGenerator extends Generator {
|
|||
IndexedAccessGenerator(
|
||||
ExpressionGeneratorHelper helper, Token token, this.receiver, this.index,
|
||||
{required this.isNullAware})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(isNullAware != null),
|
||||
super(helper, token);
|
||||
: super(helper, token);
|
||||
|
||||
@override
|
||||
String get _plainNameForRead => "[]";
|
||||
|
@ -1072,8 +1058,6 @@ class IndexedAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -1091,8 +1075,6 @@ class IndexedAccessGenerator extends Generator {
|
|||
static Generator make(ExpressionGeneratorHelper helper, Token token,
|
||||
Expression receiver, Expression index,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
if (helper.forest.isThisExpression(receiver)) {
|
||||
return new ThisIndexedAccessGenerator(helper, token, index,
|
||||
thisOffset: receiver.fileOffset, isNullAware: isNullAware);
|
||||
|
@ -1195,8 +1177,6 @@ class ThisIndexedAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -1321,8 +1301,6 @@ class SuperIndexedAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -1401,9 +1379,7 @@ class StaticAccessGenerator extends Generator {
|
|||
StaticAccessGenerator(ExpressionGeneratorHelper helper, Token token,
|
||||
this.targetName, this.parentBuilder, this.readTarget, this.writeTarget,
|
||||
{this.typeOffset, this.isNullAware = false})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(targetName != null),
|
||||
assert(readTarget != null || writeTarget != null),
|
||||
: assert(readTarget != null || writeTarget != null),
|
||||
assert(parentBuilder is DeclarationBuilder ||
|
||||
parentBuilder is LibraryBuilder),
|
||||
super(helper, token);
|
||||
|
@ -1563,8 +1539,6 @@ class StaticAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -1647,12 +1621,8 @@ class ExtensionInstanceAccessGenerator extends Generator {
|
|||
this.writeTarget,
|
||||
this.extensionThis,
|
||||
this.extensionTypeParameters)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(targetName != null),
|
||||
assert(
|
||||
: assert(
|
||||
readTarget != null || invokeTarget != null || writeTarget != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(extensionThis != null),
|
||||
super(helper, token);
|
||||
|
||||
factory ExtensionInstanceAccessGenerator.fromBuilder(
|
||||
|
@ -1850,8 +1820,6 @@ class ExtensionInstanceAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -1948,14 +1916,8 @@ class ExplicitExtensionInstanceAccessGenerator extends Generator {
|
|||
this.explicitTypeArguments,
|
||||
this.extensionTypeParameterCount,
|
||||
{required this.isNullAware})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(targetName != null),
|
||||
assert(
|
||||
: assert(
|
||||
readTarget != null || invokeTarget != null || writeTarget != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(receiver != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null),
|
||||
super(helper, token);
|
||||
|
||||
factory ExplicitExtensionInstanceAccessGenerator.fromBuilder(
|
||||
|
@ -2276,8 +2238,6 @@ class ExplicitExtensionInstanceAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -2339,10 +2299,6 @@ class ExplicitExtensionIndexedAccessGenerator extends Generator {
|
|||
this.extensionTypeParameterCount,
|
||||
{required this.isNullAware})
|
||||
: assert(readTarget != null || writeTarget != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(receiver != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null),
|
||||
super(helper, token);
|
||||
|
||||
factory ExplicitExtensionIndexedAccessGenerator.fromBuilder(
|
||||
|
@ -2357,8 +2313,6 @@ class ExplicitExtensionIndexedAccessGenerator extends Generator {
|
|||
List<DartType>? explicitTypeArguments,
|
||||
int extensionTypeParameterCount,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
Procedure? readTarget;
|
||||
if (getterBuilder != null) {
|
||||
if (getterBuilder is AccessErrorBuilder) {
|
||||
|
@ -2561,8 +2515,6 @@ class ExplicitExtensionIndexedAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -2747,8 +2699,6 @@ class ExplicitExtensionAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
Builder? getter = extensionBuilder.lookupLocalMemberByName(indexGetName);
|
||||
Builder? setter = extensionBuilder.lookupLocalMemberByName(indexSetName);
|
||||
if (getter == null && setter == null) {
|
||||
|
@ -2852,8 +2802,6 @@ class LoadLibraryGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -3018,8 +2966,6 @@ class DeferredAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -3547,15 +3493,11 @@ abstract class AbstractReadOnlyAccessGenerator extends Generator {
|
|||
Expression _makeInvalidWrite(Expression value) {
|
||||
switch (kind) {
|
||||
case ReadOnlyAccessKind.ConstVariable:
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(targetName != null);
|
||||
return _helper.buildProblem(
|
||||
templateCannotAssignToConstVariable.withArguments(targetName),
|
||||
fileOffset,
|
||||
lengthForToken(token));
|
||||
case ReadOnlyAccessKind.FinalVariable:
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(targetName != null);
|
||||
return _helper.buildProblem(
|
||||
templateCannotAssignToFinalVariable.withArguments(targetName),
|
||||
fileOffset,
|
||||
|
@ -3622,8 +3564,6 @@ abstract class AbstractReadOnlyAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
// TODO(johnniwinther): The read-only quality of the variable should be
|
||||
// passed on to the generator.
|
||||
return new IndexedAccessGenerator(_helper, token, _createRead(), index,
|
||||
|
@ -3757,8 +3697,6 @@ abstract class ErroneousExpressionGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -3846,8 +3784,6 @@ class UnresolvedNameGenerator extends ErroneousExpressionGenerator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -3918,8 +3854,6 @@ abstract class ContextAwareGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -4155,8 +4089,6 @@ class PrefixUseGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -4249,8 +4181,6 @@ class UnexpectedQualifiedUseGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -4379,8 +4309,6 @@ class ParserErrorGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new IndexedAccessGenerator(_helper, token, buildSimpleRead(), index,
|
||||
isNullAware: isNullAware);
|
||||
}
|
||||
|
@ -4572,8 +4500,6 @@ class ThisAccessGenerator extends Generator {
|
|||
@override
|
||||
Expression_Generator buildEqualsOperation(Token token, Expression right,
|
||||
{required bool isNot}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNot != null);
|
||||
if (isSuper) {
|
||||
int offset = offsetForToken(token);
|
||||
Expression result = _helper.buildSuperInvocation(equalsName,
|
||||
|
@ -4669,8 +4595,6 @@ class ThisAccessGenerator extends Generator {
|
|||
@override
|
||||
Generator buildIndexedAccess(Expression index, Token token,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
if (isSuper) {
|
||||
return new SuperIndexedAccessGenerator(
|
||||
_helper,
|
||||
|
@ -4909,10 +4833,7 @@ class InvocationSelector extends Selector {
|
|||
InvocationSelector(ExpressionGeneratorHelper helper, Token token, this.name,
|
||||
this.typeArguments, this.arguments,
|
||||
{this.isPotentiallyConstant = false, this.isTypeArgumentsInForest = true})
|
||||
: super(helper, token) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(arguments != null);
|
||||
}
|
||||
: super(helper, token);
|
||||
|
||||
@override
|
||||
String get _debugName => 'InvocationSelector';
|
||||
|
|
|
@ -32,8 +32,6 @@ class Forest {
|
|||
List<NamedExpression>? named,
|
||||
bool hasExplicitTypeArguments = true,
|
||||
List<Object?>? argumentsOriginalOrder}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
if (!hasExplicitTypeArguments) {
|
||||
ArgumentsImpl arguments = new ArgumentsImpl(positional,
|
||||
types: <DartType>[],
|
||||
|
@ -61,8 +59,6 @@ class Forest {
|
|||
List<Expression> positionalArguments = const <Expression>[],
|
||||
List<NamedExpression> namedArguments = const <NamedExpression>[],
|
||||
List<Object?>? argumentsOriginalOrder}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new ArgumentsImpl.forExtensionMethod(
|
||||
extensionTypeParameterCount, typeParameterCount, receiver,
|
||||
extensionTypeArguments: extensionTypeArguments,
|
||||
|
@ -75,8 +71,6 @@ class Forest {
|
|||
}
|
||||
|
||||
ArgumentsImpl createArgumentsEmpty(int fileOffset) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return createArguments(fileOffset, <Expression>[]);
|
||||
}
|
||||
|
||||
|
@ -100,30 +94,22 @@ class Forest {
|
|||
/// Return a representation of a boolean literal at the given [fileOffset].
|
||||
/// The literal has the given [value].
|
||||
BoolLiteral createBoolLiteral(int fileOffset, bool value) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new BoolLiteral(value)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
/// Return a representation of a double literal at the given [fileOffset]. The
|
||||
/// literal has the given [value].
|
||||
DoubleLiteral createDoubleLiteral(int fileOffset, double value) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new DoubleLiteral(value)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
/// Return a representation of an integer literal at the given [fileOffset].
|
||||
/// The literal has the given [value].
|
||||
IntLiteral createIntLiteral(int fileOffset, int value, [String? literal]) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new IntJudgment(value, literal)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
IntLiteral createIntLiteralLarge(int fileOffset, String literal) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new ShadowLargeIntLiteral(literal, fileOffset);
|
||||
}
|
||||
|
||||
|
@ -137,10 +123,6 @@ class Forest {
|
|||
ListLiteral createListLiteral(
|
||||
int fileOffset, DartType typeArgument, List<Expression> expressions,
|
||||
{required bool isConst}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isConst != null);
|
||||
return new ListLiteral(expressions,
|
||||
typeArgument: typeArgument, isConst: isConst)
|
||||
..fileOffset = fileOffset;
|
||||
|
@ -156,10 +138,6 @@ class Forest {
|
|||
SetLiteral createSetLiteral(
|
||||
int fileOffset, DartType typeArgument, List<Expression> expressions,
|
||||
{required bool isConst}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isConst != null);
|
||||
return new SetLiteral(expressions,
|
||||
typeArgument: typeArgument, isConst: isConst)
|
||||
..fileOffset = fileOffset;
|
||||
|
@ -177,10 +155,6 @@ class Forest {
|
|||
MapLiteral createMapLiteral(int fileOffset, DartType keyType,
|
||||
DartType valueType, List<MapLiteralEntry> entries,
|
||||
{required bool isConst}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isConst != null);
|
||||
return new MapLiteral(entries,
|
||||
keyType: keyType, valueType: valueType, isConst: isConst)
|
||||
..fileOffset = fileOffset;
|
||||
|
@ -188,8 +162,6 @@ class Forest {
|
|||
|
||||
/// Return a representation of a null literal at the given [fileOffset].
|
||||
NullLiteral createNullLiteral(int fileOffset) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new NullLiteral()..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
|
@ -197,22 +169,16 @@ class Forest {
|
|||
/// [fileOffset]. The literal has the given [value]. This does not include
|
||||
/// either adjacent strings or interpolated strings.
|
||||
StringLiteral createStringLiteral(int fileOffset, String value) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new StringLiteral(value)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
/// Return a representation of a symbol literal defined by [value] at the
|
||||
/// given [fileOffset].
|
||||
SymbolLiteral createSymbolLiteral(int fileOffset, String value) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new SymbolLiteral(value)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
TypeLiteral createTypeLiteral(int fileOffset, DartType type) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new TypeLiteral(type)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
|
@ -222,32 +188,22 @@ class Forest {
|
|||
/// to compute the value.
|
||||
MapLiteralEntry createMapEntry(
|
||||
int fileOffset, Expression key, Expression value) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new MapLiteralEntry(key, value)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
LoadLibrary createLoadLibrary(
|
||||
int fileOffset, LibraryDependency dependency, Arguments? arguments) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new LoadLibraryImpl(dependency, arguments)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
Expression checkLibraryIsLoaded(
|
||||
int fileOffset, LibraryDependency dependency) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new CheckLibraryIsLoaded(dependency)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
Expression createAsExpression(
|
||||
int fileOffset, Expression expression, DartType type,
|
||||
{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)
|
||||
..fileOffset = fileOffset
|
||||
..isForNonNullableByDefault = forNonNullableByDefault
|
||||
|
@ -256,10 +212,6 @@ class Forest {
|
|||
|
||||
Expression createSpreadElement(int fileOffset, Expression expression,
|
||||
{required bool isNullAware}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null);
|
||||
return new SpreadElement(expression, isNullAware: isNullAware)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
@ -267,8 +219,6 @@ class Forest {
|
|||
Expression createIfElement(
|
||||
int fileOffset, Expression condition, Expression then,
|
||||
[Expression? otherwise]) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new IfElement(condition, then, otherwise)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
|
@ -278,8 +228,6 @@ class Forest {
|
|||
required PatternGuard patternGuard,
|
||||
required Expression then,
|
||||
Expression? otherwise}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new IfCaseElement(
|
||||
prelude: prelude,
|
||||
expression: expression,
|
||||
|
@ -292,8 +240,6 @@ class Forest {
|
|||
MapLiteralEntry createIfMapEntry(
|
||||
int fileOffset, Expression condition, MapLiteralEntry then,
|
||||
[MapLiteralEntry? otherwise]) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new IfMapEntry(condition, then, otherwise)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
|
@ -303,8 +249,6 @@ class Forest {
|
|||
required PatternGuard patternGuard,
|
||||
required MapLiteralEntry then,
|
||||
MapLiteralEntry? otherwise}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new IfCaseMapEntry(
|
||||
prelude: prelude,
|
||||
expression: expression,
|
||||
|
@ -320,8 +264,6 @@ class Forest {
|
|||
Expression? condition,
|
||||
List<Expression> updates,
|
||||
Expression body) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new ForElement(variables, condition, updates, body)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
@ -333,8 +275,6 @@ class Forest {
|
|||
required Expression? condition,
|
||||
required List<Expression> updates,
|
||||
required Expression body}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new PatternForElement(
|
||||
patternVariableDeclaration: patternVariableDeclaration,
|
||||
intermediateVariables: intermediateVariables,
|
||||
|
@ -351,8 +291,6 @@ class Forest {
|
|||
Expression? condition,
|
||||
List<Expression> updates,
|
||||
MapLiteralEntry body) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new ForMapEntry(variables, condition, updates, body)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
@ -364,8 +302,6 @@ class Forest {
|
|||
required Expression? condition,
|
||||
required List<Expression> updates,
|
||||
required MapLiteralEntry body}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new PatternForMapEntry(
|
||||
patternVariableDeclaration: patternVariableDeclaration,
|
||||
intermediateVariables: intermediateVariables,
|
||||
|
@ -385,8 +321,6 @@ class Forest {
|
|||
Expression body,
|
||||
Expression? problem,
|
||||
{bool isAsync = false}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new ForInElement(variable, iterable, synthesizedAssignment,
|
||||
expressionEffects, body, problem,
|
||||
isAsync: isAsync)
|
||||
|
@ -402,8 +336,6 @@ class Forest {
|
|||
MapLiteralEntry body,
|
||||
Expression? problem,
|
||||
{bool isAsync = false}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new ForInMapEntry(variable, iterable, synthesizedAssignment,
|
||||
expressionEffects, body, problem,
|
||||
isAsync: isAsync)
|
||||
|
@ -414,16 +346,12 @@ class Forest {
|
|||
/// initializer list.
|
||||
AssertInitializer createAssertInitializer(
|
||||
int fileOffset, AssertStatement assertStatement) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new AssertInitializer(assertStatement)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
/// Return a representation of an assert that appears as a statement.
|
||||
AssertStatement createAssertStatement(int fileOffset, Expression condition,
|
||||
Expression? message, int conditionStartOffset, int conditionEndOffset) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new AssertStatement(condition,
|
||||
conditionStartOffset: conditionStartOffset,
|
||||
conditionEndOffset: conditionEndOffset,
|
||||
|
@ -432,8 +360,6 @@ class Forest {
|
|||
}
|
||||
|
||||
Expression createAwaitExpression(int fileOffset, Expression operand) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new AwaitExpression(operand)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
|
@ -441,8 +367,6 @@ class Forest {
|
|||
/// [fileOffset].
|
||||
Block createBlock(
|
||||
int fileOffset, int fileEndOffset, List<Statement> statements) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
List<Statement>? copy;
|
||||
for (int i = 0; i < statements.length; i++) {
|
||||
Statement statement = statements[i];
|
||||
|
@ -460,8 +384,6 @@ class Forest {
|
|||
|
||||
/// Return a representation of a break statement.
|
||||
Statement createBreakStatement(int fileOffset, Object? label) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
// TODO(johnniwinther): Use [label]?
|
||||
return new BreakStatementImpl(isContinue: false)
|
||||
..fileOffset = fileOffset
|
||||
|
@ -476,8 +398,6 @@ class Forest {
|
|||
VariableDeclaration? stackTraceParameter,
|
||||
DartType stackTraceType,
|
||||
Statement body) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new Catch(exceptionParameter, body,
|
||||
guard: exceptionType, stackTrace: stackTraceParameter)
|
||||
..fileOffset = fileOffset;
|
||||
|
@ -499,8 +419,6 @@ class Forest {
|
|||
|
||||
/// Return a representation of a continue statement.
|
||||
Statement createContinueStatement(int fileOffset, Object? label) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
// TODO(johnniwinther): Use [label]?
|
||||
return new BreakStatementImpl(isContinue: true)..fileOffset = fileOffset;
|
||||
}
|
||||
|
@ -508,23 +426,17 @@ class Forest {
|
|||
/// Return a representation of a do statement.
|
||||
Statement createDoStatement(
|
||||
int fileOffset, Statement body, Expression condition) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new DoStatement(body, condition)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
/// Return a representation of an expression statement at the given
|
||||
/// [fileOffset] containing the [expression].
|
||||
Statement createExpressionStatement(int fileOffset, Expression expression) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new ExpressionStatement(expression)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
/// Return a representation of an empty statement at the given [fileOffset].
|
||||
Statement createEmptyStatement(int fileOffset) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new EmptyStatement()..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
|
@ -535,8 +447,6 @@ class Forest {
|
|||
Expression? condition,
|
||||
List<Expression> updaters,
|
||||
Statement body) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new ForStatement(variables ?? [], condition, updaters, body)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
@ -544,8 +454,6 @@ class Forest {
|
|||
/// Return a representation of an `if` statement.
|
||||
Statement createIfStatement(int fileOffset, Expression condition,
|
||||
Statement thenStatement, Statement? elseStatement) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new IfStatement(condition, thenStatement, elseStatement)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
@ -553,8 +461,6 @@ class Forest {
|
|||
/// Return a representation of a `switch` statement.
|
||||
Statement createSwitchStatement(
|
||||
int fileOffset, Expression expression, List<SwitchCase> cases) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new SwitchStatement(expression, cases)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
|
@ -565,10 +471,6 @@ class Forest {
|
|||
Expression createIsExpression(
|
||||
int fileOffset, Expression operand, DartType type,
|
||||
{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)
|
||||
..fileOffset = fileOffset
|
||||
..isForNonNullableByDefault = forNonNullableByDefault;
|
||||
|
@ -583,8 +485,6 @@ class Forest {
|
|||
/// (either `&&` or `||`).
|
||||
Expression createLogicalExpression(int fileOffset, Expression leftOperand,
|
||||
String operatorString, Expression rightOperand) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
LogicalExpressionOperator operator;
|
||||
if (operatorString == '&&') {
|
||||
operator = LogicalExpressionOperator.AND;
|
||||
|
@ -600,8 +500,6 @@ class Forest {
|
|||
}
|
||||
|
||||
Expression createNot(int fileOffset, Expression operand) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new Not(operand)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
|
@ -609,10 +507,6 @@ class Forest {
|
|||
/// rethrow at [rethrowFileOffset] and the statement at [statementFileOffset].
|
||||
Statement createRethrowStatement(
|
||||
int rethrowFileOffset, int statementFileOffset) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(rethrowFileOffset != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(statementFileOffset != null);
|
||||
return new ExpressionStatement(
|
||||
new Rethrow()..fileOffset = rethrowFileOffset)
|
||||
..fileOffset = statementFileOffset;
|
||||
|
@ -621,16 +515,12 @@ class Forest {
|
|||
/// Return a representation of a return statement.
|
||||
Statement createReturnStatement(int fileOffset, Expression? expression,
|
||||
{bool isArrow = true}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new ReturnStatementImpl(isArrow, expression)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
Expression createStringConcatenation(
|
||||
int fileOffset, List<Expression> expressions) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
return new StringConcatenation(expressions)..fileOffset = fileOffset;
|
||||
}
|
||||
|
@ -643,15 +533,11 @@ class Forest {
|
|||
}
|
||||
|
||||
Expression createThisExpression(int fileOffset) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new ThisExpression()..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
/// Return a representation of a throw expression at the given [fileOffset].
|
||||
Expression createThrow(int fileOffset, Expression expression) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new Throw(expression)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
|
@ -659,8 +545,6 @@ class Forest {
|
|||
|
||||
Statement createTryStatement(int fileOffset, Statement tryBlock,
|
||||
List<Catch>? catchBlocks, Statement? finallyBlock) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new TryStatement(tryBlock, catchBlocks ?? <Catch>[], finallyBlock)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
@ -692,8 +576,6 @@ class Forest {
|
|||
/// consisting of the given [condition] and [body].
|
||||
Statement createWhileStatement(
|
||||
int fileOffset, Expression condition, Statement body) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new WhileStatement(condition, body)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
|
@ -702,10 +584,6 @@ class Forest {
|
|||
/// statement is a yield* statement.
|
||||
Statement createYieldStatement(int fileOffset, Expression expression,
|
||||
{required bool isYieldStar}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isYieldStar != null);
|
||||
return new YieldStatement(expression, isYieldStar: isYieldStar)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
@ -741,8 +619,6 @@ class Forest {
|
|||
bool isCovariantByDeclaration = false,
|
||||
bool isLocalFunction = false,
|
||||
bool isSynthesized = false}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new VariableDeclarationImpl(name,
|
||||
type: type,
|
||||
initializer: initializer,
|
||||
|
@ -778,8 +654,6 @@ class Forest {
|
|||
DartType returnType = const DynamicType(),
|
||||
AsyncMarker asyncMarker = AsyncMarker.Sync,
|
||||
AsyncMarker? dartAsyncMarker}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new FunctionNode(body,
|
||||
typeParameters: typeParameters,
|
||||
positionalParameters: positionalParameters,
|
||||
|
@ -807,66 +681,48 @@ class Forest {
|
|||
|
||||
FunctionExpression createFunctionExpression(
|
||||
int fileOffset, FunctionNode function) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new FunctionExpression(function)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
Expression createExpressionInvocation(
|
||||
int fileOffset, Expression expression, Arguments arguments) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new ExpressionInvocation(expression, arguments)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
Expression createMethodInvocation(
|
||||
int fileOffset, Expression expression, Name name, Arguments arguments) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new MethodInvocation(expression, name, arguments)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
NamedExpression createNamedExpression(
|
||||
int fileOffset, String name, Expression expression) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new NamedExpression(name, expression)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
StaticInvocation createStaticInvocation(
|
||||
int fileOffset, Procedure procedure, Arguments arguments) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new StaticInvocation(procedure, arguments)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
SuperMethodInvocation createSuperMethodInvocation(
|
||||
int fileOffset, Name name, Procedure procedure, Arguments arguments) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new SuperMethodInvocation(name, arguments, procedure)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
NullCheck createNullCheck(int fileOffset, Expression expression) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new NullCheck(expression)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
Expression createPropertyGet(int fileOffset, Expression receiver, Name name) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new PropertyGet(receiver, name)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
Expression createPropertySet(
|
||||
int fileOffset, Expression receiver, Name name, Expression value,
|
||||
{required bool forEffect, bool readOnlyReceiver = false}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new PropertySet(receiver, name, value,
|
||||
forEffect: forEffect, readOnlyReceiver: readOnlyReceiver)
|
||||
..fileOffset = fileOffset;
|
||||
|
@ -874,25 +730,17 @@ class Forest {
|
|||
|
||||
IndexGet createIndexGet(
|
||||
int fileOffset, Expression receiver, Expression index) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new IndexGet(receiver, index)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
IndexSet createIndexSet(
|
||||
int fileOffset, Expression receiver, Expression index, Expression value,
|
||||
{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)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
VariableGet createVariableGet(int fileOffset, VariableDeclaration variable) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new VariableGetImpl(variable, forNullGuardedAccess: false)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
@ -900,47 +748,33 @@ class Forest {
|
|||
EqualsExpression createEquals(
|
||||
int fileOffset, Expression left, Expression right,
|
||||
{required bool isNot}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNot != null);
|
||||
return new EqualsExpression(left, right, isNot: isNot)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
BinaryExpression createBinary(
|
||||
int fileOffset, Expression left, Name binaryName, Expression right) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new BinaryExpression(left, binaryName, right)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
UnaryExpression createUnary(
|
||||
int fileOffset, Name unaryName, Expression expression) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new UnaryExpression(unaryName, expression)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
ParenthesizedExpression createParenthesized(
|
||||
int fileOffset, Expression expression) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new ParenthesizedExpression(expression)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
ConstructorTearOff createConstructorTearOff(int fileOffset, Member target) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(target is Constructor || (target is Procedure && target.isFactory),
|
||||
"Unexpected constructor tear off target: $target");
|
||||
return new ConstructorTearOff(target)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
StaticTearOff createStaticTearOff(int fileOffset, Procedure procedure) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(procedure.kind == ProcedureKind.Method,
|
||||
"Unexpected static tear off target: $procedure");
|
||||
assert(!procedure.isRedirectingFactory,
|
||||
|
@ -949,24 +783,18 @@ class Forest {
|
|||
}
|
||||
|
||||
StaticGet createStaticGet(int fileOffset, Member target) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(target is Field || (target is Procedure && target.isGetter));
|
||||
return new StaticGet(target)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
RedirectingFactoryTearOff createRedirectingFactoryTearOff(
|
||||
int fileOffset, Procedure procedure) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(procedure.isRedirectingFactory);
|
||||
return new RedirectingFactoryTearOff(procedure)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
Instantiation createInstantiation(
|
||||
int fileOffset, Expression expression, List<DartType> typeArguments) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new Instantiation(expression, typeArguments)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
@ -976,8 +804,6 @@ class Forest {
|
|||
List<TypeParameter> typeParameters,
|
||||
Expression expression,
|
||||
List<DartType> typeArguments) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
return new TypedefTearOff(typeParameters, expression, typeArguments)
|
||||
..fileOffset = fileOffset;
|
||||
}
|
||||
|
|
|
@ -244,8 +244,6 @@ class ForwardingNode {
|
|||
void _createForwardingImplIfNeeded(FunctionNode function, Name name,
|
||||
Class enclosingClass, Member? superTarget,
|
||||
{required bool isForwardingStub}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isForwardingStub != null);
|
||||
if (function.body != null) {
|
||||
// There is already an implementation; nothing further needs to be done.
|
||||
return;
|
||||
|
@ -268,9 +266,6 @@ class ForwardingNode {
|
|||
bool isForwardingSemiStub = isForwardingStub && !procedure.isSynthetic;
|
||||
bool needsSignatureType = false;
|
||||
Expression superCall;
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(superTarget != null,
|
||||
"No super target found for '${name}' in ${enclosingClass}.");
|
||||
assert(
|
||||
!superTarget.isAbstract,
|
||||
"Abstract super target $superTarget found for '${name}' in "
|
||||
|
|
|
@ -152,11 +152,7 @@ abstract class SynthesizedMember extends ClassMember {
|
|||
final bool isProperty;
|
||||
|
||||
SynthesizedMember(this.classBuilder, this.name,
|
||||
{required this.forSetter, required this.isProperty})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(forSetter != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isProperty != null);
|
||||
{required this.forSetter, required this.isProperty});
|
||||
|
||||
@override
|
||||
List<ClassMember> get declarations => throw new UnimplementedError();
|
||||
|
@ -508,11 +504,7 @@ class InheritedClassMemberImplementsInterface extends SynthesizedMember {
|
|||
required this.implementedInterfaceMember,
|
||||
required bool isProperty,
|
||||
required bool forSetter})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(inheritedClassMember != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(implementedInterfaceMember != null),
|
||||
super(classBuilder, name, isProperty: isProperty, forSetter: forSetter);
|
||||
: super(classBuilder, name, isProperty: isProperty, forSetter: forSetter);
|
||||
|
||||
void _ensureMemberAndCovariance(ClassMembersBuilder membersBuilder) {
|
||||
if (_member == null) {
|
||||
|
|
|
@ -150,8 +150,6 @@ class ClassHierarchyBuilder
|
|||
|
||||
for (int i = 0; i < nodes2.length; i++) {
|
||||
ClassHierarchyNode node = nodes2[i];
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node == null) continue;
|
||||
if (node.classBuilder.cls.isAnonymousMixin) {
|
||||
// Never find unnamed mixin application in least upper bound.
|
||||
continue;
|
||||
|
|
|
@ -43,8 +43,6 @@ class ClassHierarchyNodeBuilder {
|
|||
if (supernode == null) {
|
||||
supernode = hierarchy.getNodeFromClassBuilder(objectClass);
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(supernode != null);
|
||||
}
|
||||
|
||||
List<Supertype> superclasses;
|
||||
|
@ -157,11 +155,8 @@ class ClassHierarchyNodeBuilder {
|
|||
for (Supertype superclass in superclasses) {
|
||||
recordSupertype(superclass);
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (interfacesList != null) {
|
||||
for (Supertype superinterface in interfacesList) {
|
||||
recordSupertype(superinterface);
|
||||
}
|
||||
for (Supertype superinterface in interfacesList) {
|
||||
recordSupertype(superinterface);
|
||||
}
|
||||
|
||||
return new ClassHierarchyNode(classBuilder, supernode, mixedInNode,
|
||||
|
@ -224,14 +219,10 @@ class ClassHierarchyNodeBuilder {
|
|||
|
||||
void addInterface(Map<Class, Supertype> interfaces,
|
||||
List<Supertype> superclasses, Supertype type) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (type == null) return null;
|
||||
if (!classBuilder.libraryBuilder.isNonNullableByDefault) {
|
||||
type = legacyErasureSupertype(type);
|
||||
}
|
||||
ClassHierarchyNode node = hierarchy.getNodeFromClass(type.classNode);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node == null) return null;
|
||||
int depth = node.depth;
|
||||
int myDepth = superclasses.length;
|
||||
Supertype? superclass = depth < myDepth ? superclasses[depth] : null;
|
||||
|
|
|
@ -252,8 +252,6 @@ class ClassMembersNodeBuilder {
|
|||
}
|
||||
|
||||
void inferFrom(List<ClassMember> members, {required bool forSetter}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(forSetter != null);
|
||||
CombinedClassMemberSignature combinedMemberSignature =
|
||||
new CombinedClassMemberSignature(
|
||||
membersBuilder, classBuilder, members,
|
||||
|
@ -317,8 +315,6 @@ class ClassMembersNodeBuilder {
|
|||
}
|
||||
|
||||
void inferFrom(List<ClassMember> members, {required bool forSetter}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(forSetter != null);
|
||||
CombinedClassMemberSignature combinedMemberSignature =
|
||||
new CombinedClassMemberSignature(
|
||||
membersBuilder, classBuilder, members,
|
||||
|
@ -418,8 +414,6 @@ class ClassMembersNodeBuilder {
|
|||
|
||||
DartType? inferFrom(List<ClassMember> members,
|
||||
{required bool forSetter}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(forSetter != null);
|
||||
CombinedClassMemberSignature combinedMemberSignature =
|
||||
new CombinedClassMemberSignature(
|
||||
membersBuilder, classBuilder, members,
|
||||
|
@ -917,8 +911,7 @@ class ClassMembersNodeBuilder {
|
|||
"Only inherited members can implement by inheritance: "
|
||||
"${inheritedMember}");
|
||||
inheritedImplementsMap[inheritedMember] = overrides;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (dataForTesting != null && aliasForTesting != null) {
|
||||
if (dataForTesting != null) {
|
||||
dataForTesting.aliasMap[aliasForTesting] = inheritedMember;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -253,11 +253,7 @@ class ForInStatementWithSynthesizedVariable extends InternalStatement {
|
|||
|
||||
ForInStatementWithSynthesizedVariable(this.variable, this.iterable,
|
||||
this.syntheticAssignment, this.expressionEffects, this.body,
|
||||
{required this.isAsync, required this.hasProblem})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(isAsync != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(hasProblem != null) {
|
||||
{required this.isAsync, required this.hasProblem}) {
|
||||
variable?.parent = this;
|
||||
iterable.parent = this;
|
||||
syntheticAssignment?.parent = this;
|
||||
|
@ -286,11 +282,7 @@ class TryStatement extends InternalStatement {
|
|||
List<Catch> catchBlocks;
|
||||
Statement? finallyBlock;
|
||||
|
||||
TryStatement(this.tryBlock, this.catchBlocks, this.finallyBlock)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(tryBlock != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(catchBlocks != null) {
|
||||
TryStatement(this.tryBlock, this.catchBlocks, this.finallyBlock) {
|
||||
tryBlock.parent = this;
|
||||
setParents(catchBlocks, this);
|
||||
finallyBlock?.parent = this;
|
||||
|
@ -328,9 +320,7 @@ class SwitchCaseImpl extends SwitchCase {
|
|||
SwitchCaseImpl(this.caseOffsets, List<Expression> expressions,
|
||||
List<int> expressionOffsets, Statement body,
|
||||
{bool isDefault = false, required this.hasLabel})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(hasLabel != null),
|
||||
super(expressions, expressionOffsets, body, isDefault: isDefault);
|
||||
: super(expressions, expressionOffsets, body, isDefault: isDefault);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
@ -342,10 +332,7 @@ class BreakStatementImpl extends BreakStatement {
|
|||
Statement? targetStatement;
|
||||
final bool isContinue;
|
||||
|
||||
BreakStatementImpl({required this.isContinue})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(isContinue != null),
|
||||
super(dummyLabeledStatement);
|
||||
BreakStatementImpl({required this.isContinue}) : super(dummyLabeledStatement);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
@ -599,11 +586,7 @@ class Cascade extends InternalExpression {
|
|||
/// variable. Caller is responsible for ensuring that [variable]'s
|
||||
/// initializer is the expression preceding the first `..` of the cascade
|
||||
/// expression.
|
||||
Cascade(this.variable, {required this.isNullAware})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(variable != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNullAware != null) {
|
||||
Cascade(this.variable, {required this.isNullAware}) {
|
||||
variable.parent = this;
|
||||
}
|
||||
|
||||
|
@ -651,11 +634,7 @@ class DeferredCheck extends InternalExpression {
|
|||
VariableDeclaration variable;
|
||||
Expression expression;
|
||||
|
||||
DeferredCheck(this.variable, this.expression)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(variable != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(expression != null) {
|
||||
DeferredCheck(this.variable, this.expression) {
|
||||
variable.parent = this;
|
||||
expression.parent = this;
|
||||
}
|
||||
|
@ -856,11 +835,7 @@ class IfNullExpression extends InternalExpression {
|
|||
Expression left;
|
||||
Expression right;
|
||||
|
||||
IfNullExpression(this.left, this.right)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(left != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(right != null) {
|
||||
IfNullExpression(this.left, this.right) {
|
||||
left.parent = this;
|
||||
right.parent = this;
|
||||
}
|
||||
|
@ -995,9 +970,7 @@ class ShadowInvalidFieldInitializer extends LocalInitializer
|
|||
|
||||
ShadowInvalidFieldInitializer(
|
||||
this.field, this.value, VariableDeclaration variable)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(value != null),
|
||||
super(variable) {
|
||||
: super(variable) {
|
||||
value.parent = this;
|
||||
}
|
||||
|
||||
|
@ -1016,11 +989,7 @@ class ExpressionInvocation extends InternalExpression {
|
|||
Expression expression;
|
||||
Arguments arguments;
|
||||
|
||||
ExpressionInvocation(this.expression, this.arguments)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(expression != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(arguments != null) {
|
||||
ExpressionInvocation(this.expression, this.arguments) {
|
||||
expression.parent = this;
|
||||
arguments.parent = this;
|
||||
}
|
||||
|
@ -1056,11 +1025,7 @@ class NullAwareMethodInvocation extends InternalExpression {
|
|||
/// The expression that invokes the method on [variable].
|
||||
Expression invocation;
|
||||
|
||||
NullAwareMethodInvocation(this.variable, this.invocation)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(variable != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(invocation != null) {
|
||||
NullAwareMethodInvocation(this.variable, this.invocation) {
|
||||
variable.parent = this;
|
||||
invocation.parent = this;
|
||||
}
|
||||
|
@ -1121,11 +1086,7 @@ class NullAwarePropertyGet extends InternalExpression {
|
|||
/// The expression that reads the property from [variable].
|
||||
Expression read;
|
||||
|
||||
NullAwarePropertyGet(this.variable, this.read)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(variable != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(read != null) {
|
||||
NullAwarePropertyGet(this.variable, this.read) {
|
||||
variable.parent = this;
|
||||
read.parent = this;
|
||||
}
|
||||
|
@ -1174,11 +1135,7 @@ class NullAwarePropertySet extends InternalExpression {
|
|||
/// The expression that writes the value to the property in [variable].
|
||||
Expression write;
|
||||
|
||||
NullAwarePropertySet(this.variable, this.write)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(variable != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(write != null) {
|
||||
NullAwarePropertySet(this.variable, this.write) {
|
||||
variable.parent = this;
|
||||
write.parent = this;
|
||||
}
|
||||
|
@ -1390,9 +1347,7 @@ class VariableGetImpl extends VariableGet {
|
|||
|
||||
VariableGetImpl(VariableDeclaration variable,
|
||||
{required this.forNullGuardedAccess})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(forNullGuardedAccess != null),
|
||||
super(variable);
|
||||
: super(variable);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
@ -1481,17 +1436,7 @@ class IfNullPropertySet extends InternalExpression {
|
|||
IfNullPropertySet(this.receiver, this.propertyName, this.rhs,
|
||||
{required this.forEffect,
|
||||
required this.readOffset,
|
||||
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) {
|
||||
required this.writeOffset}) {
|
||||
receiver.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.
|
||||
final bool 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) {
|
||||
IfNullSet(this.read, this.write, {required this.forEffect}) {
|
||||
read.parent = this;
|
||||
write.parent = this;
|
||||
}
|
||||
|
@ -1641,19 +1580,7 @@ class CompoundExtensionSet extends InternalExpression {
|
|||
{required this.forEffect,
|
||||
required this.readOffset,
|
||||
required this.binaryOffset,
|
||||
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) {
|
||||
required this.writeOffset}) {
|
||||
receiver.parent = this;
|
||||
rhs.parent = this;
|
||||
}
|
||||
|
@ -1711,19 +1638,7 @@ class CompoundPropertySet extends InternalExpression {
|
|||
{required this.forEffect,
|
||||
required this.readOffset,
|
||||
required this.binaryOffset,
|
||||
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) {
|
||||
required this.writeOffset}) {
|
||||
receiver.parent = this;
|
||||
rhs.parent = this;
|
||||
}
|
||||
|
@ -1772,11 +1687,7 @@ class PropertyPostIncDec extends InternalExpression {
|
|||
/// property on [variable].
|
||||
VariableDeclarationImpl write;
|
||||
|
||||
PropertyPostIncDec(this.variable, this.read, this.write)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(read != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(write != null) {
|
||||
PropertyPostIncDec(this.variable, this.read, this.write) {
|
||||
variable?.parent = this;
|
||||
read.parent = this;
|
||||
write.parent = this;
|
||||
|
@ -1813,11 +1724,7 @@ class LocalPostIncDec extends InternalExpression {
|
|||
/// local variable.
|
||||
VariableDeclarationImpl write;
|
||||
|
||||
LocalPostIncDec(this.read, this.write)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(read != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(write != null) {
|
||||
LocalPostIncDec(this.read, this.write) {
|
||||
read.parent = this;
|
||||
write.parent = this;
|
||||
}
|
||||
|
@ -1849,11 +1756,7 @@ class StaticPostIncDec extends InternalExpression {
|
|||
/// static member.
|
||||
VariableDeclarationImpl write;
|
||||
|
||||
StaticPostIncDec(this.read, this.write)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(read != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(write != null) {
|
||||
StaticPostIncDec(this.read, this.write) {
|
||||
read.parent = this;
|
||||
write.parent = this;
|
||||
}
|
||||
|
@ -1885,11 +1788,7 @@ class SuperPostIncDec extends InternalExpression {
|
|||
/// static member.
|
||||
VariableDeclarationImpl write;
|
||||
|
||||
SuperPostIncDec(this.read, this.write)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(read != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(write != null) {
|
||||
SuperPostIncDec(this.read, this.write) {
|
||||
read.parent = this;
|
||||
write.parent = this;
|
||||
}
|
||||
|
@ -1914,11 +1813,7 @@ class IndexGet extends InternalExpression {
|
|||
/// The index expression of the operation.
|
||||
Expression index;
|
||||
|
||||
IndexGet(this.receiver, this.index)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(receiver != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(index != null) {
|
||||
IndexGet(this.receiver, this.index) {
|
||||
receiver.parent = this;
|
||||
index.parent = this;
|
||||
}
|
||||
|
@ -1968,15 +1863,7 @@ class IndexSet extends InternalExpression {
|
|||
|
||||
final bool 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) {
|
||||
IndexSet(this.receiver, this.index, this.value, {required this.forEffect}) {
|
||||
receiver.parent = this;
|
||||
index.parent = this;
|
||||
value.parent = this;
|
||||
|
@ -2026,11 +1913,7 @@ class SuperIndexSet extends InternalExpression {
|
|||
/// The value expression of the operation.
|
||||
Expression value;
|
||||
|
||||
SuperIndexSet(this.setter, this.index, this.value)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(index != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(value != null) {
|
||||
SuperIndexSet(this.setter, this.index, this.value) {
|
||||
index.parent = this;
|
||||
value.parent = this;
|
||||
}
|
||||
|
@ -2088,13 +1971,7 @@ class ExtensionIndexSet extends InternalExpression {
|
|||
ExtensionIndexSet(this.extension, this.explicitTypeArguments, this.receiver,
|
||||
this.setter, this.index, this.value)
|
||||
: assert(explicitTypeArguments == null ||
|
||||
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) {
|
||||
explicitTypeArguments.length == extension.typeParameters.length) {
|
||||
receiver.parent = this;
|
||||
index.parent = this;
|
||||
value.parent = this;
|
||||
|
@ -2175,21 +2052,7 @@ class IfNullIndexSet extends InternalExpression {
|
|||
{required this.readOffset,
|
||||
required this.testOffset,
|
||||
required this.writeOffset,
|
||||
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) {
|
||||
required this.forEffect}) {
|
||||
receiver.parent = this;
|
||||
index.parent = this;
|
||||
value.parent = this;
|
||||
|
@ -2255,19 +2118,7 @@ class IfNullSuperIndexSet extends InternalExpression {
|
|||
{required this.readOffset,
|
||||
required this.testOffset,
|
||||
required this.writeOffset,
|
||||
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) {
|
||||
required this.forEffect}) {
|
||||
index.parent = this;
|
||||
value.parent = this;
|
||||
}
|
||||
|
@ -2342,21 +2193,7 @@ class IfNullExtensionIndexSet extends InternalExpression {
|
|||
required this.writeOffset,
|
||||
required this.forEffect})
|
||||
: assert(explicitTypeArguments == null ||
|
||||
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) {
|
||||
explicitTypeArguments.length == extension.typeParameters.length) {
|
||||
receiver.parent = this;
|
||||
index.parent = this;
|
||||
value.parent = this;
|
||||
|
@ -2421,23 +2258,7 @@ class CompoundIndexSet extends InternalExpression {
|
|||
required this.binaryOffset,
|
||||
required this.writeOffset,
|
||||
required this.forEffect,
|
||||
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) {
|
||||
required this.forPostIncDec}) {
|
||||
receiver.parent = this;
|
||||
index.parent = this;
|
||||
rhs.parent = this;
|
||||
|
@ -2546,21 +2367,7 @@ class NullAwareCompoundSet extends InternalExpression {
|
|||
required this.binaryOffset,
|
||||
required this.writeOffset,
|
||||
required this.forEffect,
|
||||
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) {
|
||||
required this.forPostIncDec}) {
|
||||
receiver.parent = this;
|
||||
rhs.parent = this;
|
||||
fileOffset = binaryOffset;
|
||||
|
@ -2648,19 +2455,7 @@ class NullAwareIfNullSet extends InternalExpression {
|
|||
{required this.readOffset,
|
||||
required this.writeOffset,
|
||||
required this.testOffset,
|
||||
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) {
|
||||
required this.forEffect}) {
|
||||
receiver.parent = this;
|
||||
value.parent = this;
|
||||
}
|
||||
|
@ -2736,21 +2531,7 @@ class CompoundSuperIndexSet extends InternalExpression {
|
|||
required this.binaryOffset,
|
||||
required this.writeOffset,
|
||||
required this.forEffect,
|
||||
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) {
|
||||
required this.forPostIncDec}) {
|
||||
index.parent = this;
|
||||
rhs.parent = this;
|
||||
fileOffset = binaryOffset;
|
||||
|
@ -2839,23 +2620,7 @@ class CompoundExtensionIndexSet extends InternalExpression {
|
|||
required this.forEffect,
|
||||
required this.forPostIncDec})
|
||||
: assert(explicitTypeArguments == null ||
|
||||
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) {
|
||||
explicitTypeArguments.length == extension.typeParameters.length) {
|
||||
receiver.parent = this;
|
||||
index.parent = this;
|
||||
rhs.parent = this;
|
||||
|
@ -2914,16 +2679,9 @@ class ExtensionSet extends InternalExpression {
|
|||
final bool forEffect;
|
||||
|
||||
ExtensionSet(this.extension, this.explicitTypeArguments, this.receiver,
|
||||
this.target, this.value,
|
||||
{required this.forEffect})
|
||||
this.target, this.value, {required this.forEffect})
|
||||
: assert(explicitTypeArguments == null ||
|
||||
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) {
|
||||
explicitTypeArguments.length == extension.typeParameters.length) {
|
||||
receiver.parent = this;
|
||||
value.parent = this;
|
||||
}
|
||||
|
@ -2953,11 +2711,7 @@ class NullAwareExtension extends InternalExpression {
|
|||
VariableDeclarationImpl variable;
|
||||
Expression expression;
|
||||
|
||||
NullAwareExtension(this.variable, this.expression)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(variable != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(expression != null) {
|
||||
NullAwareExtension(this.variable, this.expression) {
|
||||
variable.parent = this;
|
||||
expression.parent = this;
|
||||
}
|
||||
|
@ -2993,9 +2747,7 @@ class ExtensionTearOff extends InternalExpression {
|
|||
/// The arguments provided to the top-level method.
|
||||
Arguments arguments;
|
||||
|
||||
ExtensionTearOff(this.target, this.arguments)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(arguments != null) {
|
||||
ExtensionTearOff(this.target, this.arguments) {
|
||||
arguments.parent = this;
|
||||
}
|
||||
|
||||
|
@ -3017,13 +2769,7 @@ class EqualsExpression extends InternalExpression {
|
|||
Expression right;
|
||||
bool 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) {
|
||||
EqualsExpression(this.left, this.right, {required this.isNot}) {
|
||||
left.parent = this;
|
||||
right.parent = this;
|
||||
}
|
||||
|
@ -3057,11 +2803,7 @@ class BinaryExpression extends InternalExpression {
|
|||
Name binaryName;
|
||||
Expression right;
|
||||
|
||||
BinaryExpression(this.left, this.binaryName, this.right)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(left != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(right != null) {
|
||||
BinaryExpression(this.left, this.binaryName, this.right) {
|
||||
left.parent = this;
|
||||
right.parent = this;
|
||||
}
|
||||
|
@ -3093,9 +2835,7 @@ class UnaryExpression extends InternalExpression {
|
|||
Name unaryName;
|
||||
Expression expression;
|
||||
|
||||
UnaryExpression(this.unaryName, this.expression)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(expression != null) {
|
||||
UnaryExpression(this.unaryName, this.expression) {
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
|
@ -3128,9 +2868,7 @@ class UnaryExpression extends InternalExpression {
|
|||
class ParenthesizedExpression extends InternalExpression {
|
||||
Expression expression;
|
||||
|
||||
ParenthesizedExpression(this.expression)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(expression != null) {
|
||||
ParenthesizedExpression(this.expression) {
|
||||
expression.parent = this;
|
||||
}
|
||||
|
||||
|
@ -3198,11 +2936,7 @@ class MethodInvocation extends InternalExpression {
|
|||
|
||||
Arguments arguments;
|
||||
|
||||
MethodInvocation(this.receiver, this.name, this.arguments)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(receiver != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(arguments != null) {
|
||||
MethodInvocation(this.receiver, this.name, this.arguments) {
|
||||
receiver.parent = this;
|
||||
arguments.parent = this;
|
||||
}
|
||||
|
@ -3240,9 +2974,7 @@ class PropertyGet extends InternalExpression {
|
|||
|
||||
Name name;
|
||||
|
||||
PropertyGet(this.receiver, this.name)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(receiver != null) {
|
||||
PropertyGet(this.receiver, this.name) {
|
||||
receiver.parent = this;
|
||||
}
|
||||
|
||||
|
@ -3286,15 +3018,7 @@ class PropertySet extends InternalExpression {
|
|||
final bool readOnlyReceiver;
|
||||
|
||||
PropertySet(this.receiver, this.name, this.value,
|
||||
{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) {
|
||||
{required this.forEffect, required this.readOnlyReceiver}) {
|
||||
receiver.parent = this;
|
||||
value.parent = this;
|
||||
}
|
||||
|
|
|
@ -259,14 +259,11 @@ class KernelTarget extends TargetImplementation {
|
|||
|
||||
void _parseCurrentSdkVersion() {
|
||||
bool good = false;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (currentSdkVersionString != null) {
|
||||
List<String> dotSeparatedParts = currentSdkVersionString.split(".");
|
||||
if (dotSeparatedParts.length >= 2) {
|
||||
_currentSdkVersion = new Version(int.tryParse(dotSeparatedParts[0])!,
|
||||
int.tryParse(dotSeparatedParts[1])!);
|
||||
good = true;
|
||||
}
|
||||
List<String> dotSeparatedParts = currentSdkVersionString.split(".");
|
||||
if (dotSeparatedParts.length >= 2) {
|
||||
_currentSdkVersion = new Version(int.tryParse(dotSeparatedParts[0])!,
|
||||
int.tryParse(dotSeparatedParts[1])!);
|
||||
good = true;
|
||||
}
|
||||
if (!good) {
|
||||
throw new StateError(
|
||||
|
@ -1552,8 +1549,7 @@ class KernelTarget extends TargetImplementation {
|
|||
constants.ConstantCoverage coverage = constantEvaluationData.coverage;
|
||||
coverage.constructorCoverage.forEach((Uri fileUri, Set<Reference> value) {
|
||||
Source? source = uriToSource[fileUri];
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (source != null && fileUri != null) {
|
||||
if (source != null) {
|
||||
source.constantCoverageConstructors ??= new Set<Reference>();
|
||||
source.constantCoverageConstructors!.addAll(value);
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@ Statement createGetterWithInitializer(CoreTypes coreTypes, int fileOffset,
|
|||
required Expression createIsSetRead(),
|
||||
required Expression createIsSetWrite(Expression value),
|
||||
required IsSetEncoding isSetEncoding}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isSetEncoding != null);
|
||||
switch (isSetEncoding) {
|
||||
case IsSetEncoding.useIsSetField:
|
||||
// Generate:
|
||||
|
@ -120,8 +118,6 @@ Statement createGetterWithInitializerWithRecheck(CoreTypes coreTypes,
|
|||
required Expression createIsSetWrite(Expression value),
|
||||
required IsSetEncoding isSetEncoding,
|
||||
required bool forField}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(forField != null);
|
||||
Constructor constructor = forField
|
||||
? coreTypes.lateInitializationFieldAssignedDuringInitializationConstructor
|
||||
: coreTypes
|
||||
|
@ -271,10 +267,6 @@ Statement createGetterBodyWithoutInitializer(
|
|||
required Expression createIsSetRead(),
|
||||
required IsSetEncoding isSetEncoding,
|
||||
required bool forField}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(forField != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isSetEncoding != null);
|
||||
Expression exception = new Throw(
|
||||
new ConstructorInvocation(
|
||||
forField
|
||||
|
@ -356,8 +348,6 @@ Statement createSetterBody(CoreTypes coreTypes, int fileOffset, String name,
|
|||
required Expression createVariableWrite(Expression value),
|
||||
required Expression createIsSetWrite(Expression value),
|
||||
required IsSetEncoding isSetEncoding}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isSetEncoding != null);
|
||||
Statement createReturn(Expression value) {
|
||||
if (shouldReturnValue) {
|
||||
return new ReturnStatement(value)..fileOffset = fileOffset;
|
||||
|
@ -406,10 +396,6 @@ Statement createSetterBodyFinal(CoreTypes coreTypes, int fileOffset,
|
|||
required Expression createIsSetWrite(Expression value),
|
||||
required IsSetEncoding isSetEncoding,
|
||||
required bool forField}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(forField != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isSetEncoding != null);
|
||||
Expression exception = new Throw(
|
||||
new ConstructorInvocation(
|
||||
forField
|
||||
|
|
|
@ -155,8 +155,6 @@ class Covariance {
|
|||
/// aspect of [member]. Otherwise, the covariance for the getter/method aspect
|
||||
/// of [member] is computed.
|
||||
factory Covariance.fromMember(Member member, {required bool forSetter}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(forSetter != null);
|
||||
if (member is Procedure) {
|
||||
if (member.kind == ProcedureKind.Getter) {
|
||||
return const Covariance.empty();
|
||||
|
|
|
@ -168,13 +168,6 @@ int computeTypeVariableBuilderVariance(TypeVariableBuilder variable,
|
|||
/// type parameter occurrence or on the type argument replacing it.
|
||||
NullabilityBuilder combineNullabilityBuildersForSubstitution(
|
||||
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()) &&
|
||||
identical(b, const NullabilityBuilder.inherent())) {
|
||||
return const NullabilityBuilder.inherent();
|
||||
|
@ -219,14 +212,6 @@ TypeBuilder substituteRange(
|
|||
List<TypeBuilder>? arguments;
|
||||
TypeDeclarationBuilder? declaration = type.declaration;
|
||||
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(
|
||||
identical(upperSubstitution, lowerSubstitution),
|
||||
"Can only handle unbound named type builders identical "
|
||||
|
@ -445,11 +430,6 @@ List<TypeBuilder> calculateBounds(List<TypeVariableBuilder> variables,
|
|||
TypeBuilder dynamicType, TypeBuilder bottomType,
|
||||
{required List<TypeBuilder> unboundTypes,
|
||||
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(
|
||||
variables.length, (int i) => variables[i].bound ?? dynamicType,
|
||||
growable: false);
|
||||
|
@ -1084,8 +1064,6 @@ void breakCycles(List<List<RawTypeCycleElement>> cycles) {
|
|||
/// Finds generic function type sub-terms in [type].
|
||||
void findUnaliasedGenericFunctionTypes(TypeBuilder? type,
|
||||
{required List<FunctionTypeBuilder> result}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(result != null);
|
||||
if (type is FunctionTypeBuilder) {
|
||||
if (type.typeVariables != null && type.typeVariables!.length > 0) {
|
||||
result.add(type);
|
||||
|
@ -1114,8 +1092,6 @@ void findUnaliasedGenericFunctionTypes(TypeBuilder? type,
|
|||
/// Finds generic function type sub-terms in [type] including the aliased ones.
|
||||
void findGenericFunctionTypes(TypeBuilder? type,
|
||||
{required List<TypeBuilder> result}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(result != null);
|
||||
if (type is FunctionTypeBuilder) {
|
||||
if (type.typeVariables != null && type.typeVariables!.length > 0) {
|
||||
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
|
||||
/// representation (with labels on duplicated names) by the `join()` method.
|
||||
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 = [];
|
||||
type.accept(this);
|
||||
return result;
|
||||
|
@ -44,9 +41,6 @@ class TypeLabeler implements DartTypeVisitor<void>, ConstantVisitor<void> {
|
|||
/// pretty-printed, the returned list can be converted to its string
|
||||
/// representation (with labels on duplicated names) by the `join()` method.
|
||||
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 = [];
|
||||
constant.accept(this);
|
||||
return result;
|
||||
|
|
|
@ -32,8 +32,7 @@ class LibraryGraph implements Graph<Uri> {
|
|||
Uri uri2 = dependency.targetLibrary.fileUri;
|
||||
if (libraries.containsKey(uri1)) {
|
||||
yield uri1;
|
||||
// ignore: unnecessary_null_comparison
|
||||
} else if (uri2 != null) {
|
||||
} else {
|
||||
if (libraries.containsKey(uri2)) {
|
||||
yield uri2;
|
||||
}
|
||||
|
|
|
@ -149,10 +149,7 @@ class MutableScope {
|
|||
final ScopeKind kind;
|
||||
|
||||
MutableScope(this.kind, this._local, this._setters, this._extensions,
|
||||
this._parent, this.classNameOrDebugName) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(classNameOrDebugName != null);
|
||||
}
|
||||
this._parent, this.classNameOrDebugName);
|
||||
|
||||
Scope? get parent => _parent;
|
||||
|
||||
|
|
|
@ -827,10 +827,6 @@ class DietListener extends StackListenerImpl {
|
|||
builder.computeTypeParameterScope(memberScope);
|
||||
final Scope formalParameterScope =
|
||||
builder.computeFormalParameterScope(typeParameterScope);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(typeParameterScope != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(formalParameterScope != null);
|
||||
return createListener(
|
||||
builder.bodyBuilderContext, builder, typeParameterScope,
|
||||
thisVariable: builder.thisVariable,
|
||||
|
|
|
@ -22,11 +22,7 @@ class NameScheme {
|
|||
required this.containerName,
|
||||
required this.containerType,
|
||||
required this.libraryName})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(isInstanceMember != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(libraryName != null),
|
||||
assert((containerName == null) ==
|
||||
: assert((containerName == null) ==
|
||||
(containerType == ContainerType.Library));
|
||||
|
||||
bool get isStatic => !isInstanceMember;
|
||||
|
|
|
@ -536,13 +536,10 @@ class SourceClassBuilder extends ClassBuilderImpl
|
|||
for (int i = 0; i < variables.length; i++) {
|
||||
DartType argument =
|
||||
i < arguments.length ? arguments[i] : const DynamicType();
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (substitutionMap != null) {
|
||||
// TODO(ahe): Investigate if requiring the caller to use
|
||||
// `substituteDeep` from `package:kernel/type_algebra.dart` instead
|
||||
// of `substitute` is faster. If so, we can simply this code.
|
||||
argument = substitute(argument, substitutionMap);
|
||||
}
|
||||
// TODO(ahe): Investigate if requiring the caller to use
|
||||
// `substituteDeep` from `package:kernel/type_algebra.dart` instead
|
||||
// of `substitute` is faster. If so, we can simply this code.
|
||||
argument = substitute(argument, substitutionMap);
|
||||
directSubstitutionMap[variables[i]] = argument;
|
||||
}
|
||||
substitutionMap = directSubstitutionMap;
|
||||
|
@ -1040,50 +1037,39 @@ class SourceClassBuilder extends ClassBuilderImpl
|
|||
procedure.function.namedParameters;
|
||||
DartType returnType = procedure.function.returnType;
|
||||
|
||||
// ignore: unnecessary_null_comparison
|
||||
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 functionParameter in functionTypeParameters) {
|
||||
for (TypeParameter typeParameter in typeParameters) {
|
||||
int returnTypeVariance = computeVariance(typeParameter, returnType);
|
||||
reportVariancePositionIfInvalid(returnTypeVariance, typeParameter,
|
||||
fileUri, procedure.function.fileOffset,
|
||||
isReturnType: true);
|
||||
int typeVariance = Variance.combine(Variance.invariant,
|
||||
computeVariance(typeParameter, functionParameter.bound));
|
||||
reportVariancePositionIfInvalid(
|
||||
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(
|
||||
|
@ -1406,75 +1392,72 @@ class SourceClassBuilder extends ClassBuilderImpl
|
|||
}
|
||||
}
|
||||
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (redirectionTarget != null) {
|
||||
Builder? targetBuilder = redirectionTarget.target;
|
||||
if (declaration.next == null) {
|
||||
// Only the first one (that is, the last on in the linked list)
|
||||
// is actually in the kernel tree. This call creates a StaticGet
|
||||
// to [declaration.target] in a field `_redirecting#` which is
|
||||
// only legal to do to things in the kernel tree.
|
||||
Reference? fieldReference;
|
||||
Reference? getterReference;
|
||||
if (referencesFromIndexed != null) {
|
||||
Name name =
|
||||
new Name(redirectingName, referencesFromIndexed!.library);
|
||||
fieldReference =
|
||||
referencesFromIndexed!.lookupFieldReference(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);
|
||||
Builder? targetBuilder = redirectionTarget.target;
|
||||
if (declaration.next == null) {
|
||||
// Only the first one (that is, the last on in the linked list)
|
||||
// is actually in the kernel tree. This call creates a StaticGet
|
||||
// to [declaration.target] in a field `_redirecting#` which is
|
||||
// only legal to do to things in the kernel tree.
|
||||
Reference? fieldReference;
|
||||
Reference? getterReference;
|
||||
if (referencesFromIndexed != null) {
|
||||
Name name =
|
||||
new Name(redirectingName, referencesFromIndexed!.library);
|
||||
fieldReference =
|
||||
referencesFromIndexed!.lookupFieldReference(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1508,10 +1491,6 @@ class SourceClassBuilder extends ClassBuilderImpl
|
|||
callback(Member interfaceMember, bool isSetter),
|
||||
{required bool isInterfaceCheck,
|
||||
required bool declaredNeedsLegacyErasure}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isInterfaceCheck != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(declaredNeedsLegacyErasure != null);
|
||||
if (declaredMember == interfaceMember) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -157,8 +157,6 @@ class SourceExtensionBuilder extends ExtensionBuilderImpl
|
|||
kind = ExtensionMemberKind.TearOff;
|
||||
break;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(kind != null);
|
||||
extension.members.add(new ExtensionMemberDescriptor(
|
||||
name: new Name(name, libraryBuilder.library),
|
||||
member: memberReference,
|
||||
|
|
|
@ -623,14 +623,6 @@ class RegularFieldEncoding implements FieldEncoding {
|
|||
required Reference? getterReference,
|
||||
required Reference? setterReference,
|
||||
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 =
|
||||
isLate ? (isFinal && hasInitializer) : (isFinal || isConst);
|
||||
_field = isImmutable
|
||||
|
@ -759,9 +751,7 @@ class SourceFieldMember extends BuilderClassMember {
|
|||
@override
|
||||
final bool forSetter;
|
||||
|
||||
SourceFieldMember(this.memberBuilder, {required this.forSetter})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(forSetter != null);
|
||||
SourceFieldMember(this.memberBuilder, {required this.forSetter});
|
||||
|
||||
@override
|
||||
void inferType(ClassMembersBuilder membersBuilder) {
|
||||
|
@ -1011,8 +1001,6 @@ abstract class AbstractLateFieldEncoding implements FieldEncoding {
|
|||
|
||||
Procedure? _createSetter(Uri fileUri, int charOffset, Reference? reference,
|
||||
{required bool isCovariantByDeclaration}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isCovariantByDeclaration != null);
|
||||
VariableDeclaration parameter = new VariableDeclaration("${name}#param")
|
||||
..isCovariantByDeclaration = isCovariantByDeclaration
|
||||
..fileOffset = fileOffset;
|
||||
|
@ -1433,9 +1421,7 @@ class _SynthesizedFieldClassMember implements ClassMember {
|
|||
final bool isInternalImplementation;
|
||||
|
||||
_SynthesizedFieldClassMember(this.fieldBuilder, this._member, this._kind,
|
||||
{this.forSetter = false, required this.isInternalImplementation})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(isInternalImplementation != null);
|
||||
{this.forSetter = false, required this.isInternalImplementation});
|
||||
|
||||
@override
|
||||
Member getMember(ClassMembersBuilder membersBuilder) {
|
||||
|
@ -1519,10 +1505,7 @@ class _SynthesizedFieldClassMember implements ClassMember {
|
|||
String get fullName {
|
||||
String suffix = isSetter ? "=" : "";
|
||||
String className = classBuilder.fullNameForErrors;
|
||||
// ignore: unnecessary_null_comparison
|
||||
return className == null
|
||||
? "${fullNameForErrors}$suffix"
|
||||
: "${className}.${fullNameForErrors}$suffix";
|
||||
return "${className}.${fullNameForErrors}$suffix";
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -1591,17 +1574,7 @@ class AbstractOrExternalFieldEncoding implements FieldEncoding {
|
|||
required bool isFinal,
|
||||
required bool isCovariantByDeclaration,
|
||||
required bool isNonNullableByDefault})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: 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 &&
|
||||
: _isExtensionInstanceMember = isExternal &&
|
||||
nameScheme.isExtensionMember &&
|
||||
nameScheme.isInstanceMember,
|
||||
_isInlineClassInstanceMember = isExternal &&
|
||||
|
|
|
@ -195,8 +195,6 @@ class SourceInlineClassBuilder extends InlineClassBuilderImpl
|
|||
kind = InlineClassMemberKind.TearOff;
|
||||
break;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(kind != null);
|
||||
inlineClass.members.add(new InlineClassMemberDescriptor(
|
||||
name: new Name(name, libraryBuilder.library),
|
||||
member: memberReference,
|
||||
|
|
|
@ -1024,11 +1024,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
SourceLibraryBuilder sourceLibraryBuilder, Scope scope,
|
||||
{required bool checkForInstanceVsStaticConflict,
|
||||
required bool checkForMethodVsSetterConflict}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(checkForInstanceVsStaticConflict != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(checkForMethodVsSetterConflict != null);
|
||||
|
||||
scope.forEachLocalSetter((String name, MemberBuilder setter) {
|
||||
Builder? getable = scope.lookupLocalMember(name, setter: false);
|
||||
if (getable == null) {
|
||||
|
@ -2907,10 +2902,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
AsyncMarker asyncModifier,
|
||||
{required bool isInstanceMember,
|
||||
required bool isExtensionMember}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isInstanceMember != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isExtensionMember != null);
|
||||
assert(!isExtensionMember ||
|
||||
currentTypeParameterScopeBuilder.kind ==
|
||||
TypeParameterScopeKind.extensionDeclaration);
|
||||
|
@ -4337,8 +4328,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
String enclosingName = issue.enclosingType == null
|
||||
? targetName!
|
||||
: getGenericTypeName(issue.enclosingType!);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(enclosingName != null);
|
||||
if (issueInferred) {
|
||||
message = templateIncorrectTypeArgumentInferred.withArguments(
|
||||
argument,
|
||||
|
@ -4577,7 +4566,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
// TODO(cstefantsova): Find a better way than relying on [interfaceTarget].
|
||||
Member? method =
|
||||
membersHierarchy.getDispatchTarget(klass, name) ?? interfaceTarget;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (method == null || method is! Procedure) {
|
||||
return;
|
||||
}
|
||||
|
@ -4669,8 +4657,6 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
|
|||
Uri fileUri,
|
||||
int offset,
|
||||
{required bool inferred}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(inferred != null);
|
||||
if (typeArguments.isEmpty) return;
|
||||
|
||||
List<TypeParameter> functionTypeParameters = functionType.typeParameters;
|
||||
|
@ -5276,10 +5262,7 @@ class TypeParameterScopeBuilder {
|
|||
this.extensions,
|
||||
this._name,
|
||||
this._charOffset,
|
||||
this.parent) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(_name != null);
|
||||
}
|
||||
this.parent);
|
||||
|
||||
TypeParameterScopeBuilder.library()
|
||||
: this(
|
||||
|
@ -5687,9 +5670,6 @@ List<TypeVariableBuilder> _sortTypeVariablesTopologically(
|
|||
|
||||
void _sortTypeVariablesTopologicallyFromRoot(TypeBuilder root,
|
||||
Set<TypeVariableBuilder> unhandled, List<TypeVariableBuilder> result) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(root != null);
|
||||
|
||||
List<TypeVariableBuilder>? typeVariables;
|
||||
List<TypeBuilder>? internalDependents;
|
||||
|
||||
|
|
|
@ -412,10 +412,7 @@ class SourceLoader extends Loader {
|
|||
Message? packageLanguageVersionProblem;
|
||||
if (packageForLanguageVersion != null) {
|
||||
Uri importUri = origin?.importUri ?? uri;
|
||||
if (!importUri.isScheme('dart') &&
|
||||
!importUri.isScheme('package') &&
|
||||
// ignore: unnecessary_null_comparison
|
||||
packageForLanguageVersion.name != null) {
|
||||
if (!importUri.isScheme('dart') && !importUri.isScheme('package')) {
|
||||
packageUri =
|
||||
new Uri(scheme: 'package', path: packageForLanguageVersion.name);
|
||||
}
|
||||
|
@ -1205,8 +1202,6 @@ severity: $severity
|
|||
|
||||
Future<Null> buildOutline(SourceLibraryBuilder library) async {
|
||||
Token tokens = await tokenize(library);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (tokens == null) return;
|
||||
OutlineBuilder listener = new OutlineBuilder(library);
|
||||
new ClassMemberParser(listener,
|
||||
allowPatterns: library.libraryFeatures.patterns.isEnabled)
|
||||
|
@ -1229,10 +1224,6 @@ severity: $severity
|
|||
// second time, and the first time was in [buildOutline] above. So this
|
||||
// time we suppress lexical errors.
|
||||
Token tokens = await tokenize(library, suppressLexicalErrors: true);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (tokens == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.benchmarker != null) {
|
||||
// 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,
|
||||
suppressLexicalErrors: true);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (tokens != null) {
|
||||
listener.uri = part.fileUri;
|
||||
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
|
||||
// instance of InvalidType that isn't identical to `const InvalidType()`.
|
||||
thisType = pendingTypeAliasMarker;
|
||||
DartType builtType = const InvalidType();
|
||||
TypeBuilder type = this.type;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (type != null) {
|
||||
builtType = type.build(libraryBuilder, TypeUse.typedefAlias);
|
||||
// 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();
|
||||
DartType builtType = type.build(libraryBuilder, TypeUse.typedefAlias);
|
||||
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();
|
||||
}
|
||||
return thisType = typedef.type ??= builtType;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,8 +89,6 @@ abstract class StackListenerImpl extends StackListener {
|
|||
|
||||
void reportMissingNonNullableSupport(Token token) {
|
||||
assert(!libraryBuilder.isNonNullableByDefault);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(token != null);
|
||||
if (libraryFeatures.nonNullable.isSupported) {
|
||||
if (libraryBuilder.languageVersion.isExplicit) {
|
||||
addProblem(
|
||||
|
|
|
@ -44,8 +44,6 @@ abstract class ClosureContext {
|
|||
|
||||
factory ClosureContext(InferenceVisitorBase inferrer, AsyncMarker asyncMarker,
|
||||
DartType returnContext, bool needToInferReturnType) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(returnContext != null);
|
||||
DartType declaredReturnType =
|
||||
inferrer.computeGreatestClosure(returnContext);
|
||||
bool isAsync = asyncMarker == AsyncMarker.Async ||
|
||||
|
@ -326,8 +324,6 @@ class _SyncClosureContext implements ClosureContext {
|
|||
DartType inferReturnType(InferenceVisitorBase inferrer,
|
||||
{required bool hasImplicitReturn}) {
|
||||
assert(_needToInferReturnType);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(hasImplicitReturn != null);
|
||||
DartType? actualReturnedType;
|
||||
DartType inferredReturnType;
|
||||
if (inferrer.isNonNullableByDefault) {
|
||||
|
@ -737,8 +733,6 @@ class _AsyncClosureContext implements ClosureContext {
|
|||
DartType inferReturnType(InferenceVisitorBase inferrer,
|
||||
{required bool hasImplicitReturn}) {
|
||||
assert(_needToInferReturnType);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(hasImplicitReturn != null);
|
||||
DartType? inferredType;
|
||||
|
||||
if (inferrer.isNonNullableByDefault) {
|
||||
|
@ -973,8 +967,6 @@ class _SyncStarClosureContext implements ClosureContext {
|
|||
DartType inferReturnType(InferenceVisitorBase inferrer,
|
||||
{required bool hasImplicitReturn}) {
|
||||
assert(_needToInferReturnType);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(hasImplicitReturn != null);
|
||||
DartType? inferredElementType;
|
||||
if (_yieldElementTypes!.isNotEmpty) {
|
||||
// Use the types seen from the explicit return statements.
|
||||
|
@ -1109,8 +1101,6 @@ class _AsyncStarClosureContext implements ClosureContext {
|
|||
DartType inferReturnType(InferenceVisitorBase inferrer,
|
||||
{required bool hasImplicitReturn}) {
|
||||
assert(_needToInferReturnType);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(hasImplicitReturn != null);
|
||||
DartType? inferredElementType;
|
||||
if (_yieldElementTypes!.isNotEmpty) {
|
||||
// Use the types seen from the explicit return statements.
|
||||
|
|
|
@ -222,9 +222,7 @@ class WrapInProblemInferenceResult implements InvocationInferenceResult {
|
|||
|
||||
WrapInProblemInferenceResult(this.inferredType, this.functionType,
|
||||
this.message, this.fileOffset, this.length, this.helper,
|
||||
{required this.isInapplicable, required this.hoistedArguments})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(isInapplicable != null);
|
||||
{required this.isInapplicable, required this.hoistedArguments});
|
||||
|
||||
@override
|
||||
Expression applyResult(Expression expression) {
|
||||
|
@ -345,9 +343,7 @@ class ExpressionInferenceResult {
|
|||
|
||||
ExpressionInferenceResult(this.inferredType, this.expression,
|
||||
{this.postCoercionType = null})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(expression != null),
|
||||
assert(isKnown(inferredType));
|
||||
: assert(isKnown(inferredType));
|
||||
|
||||
/// The guards used for null-aware access if the expression is part of a
|
||||
/// null-shorting.
|
||||
|
@ -377,13 +373,7 @@ class NullAwareGuard {
|
|||
final InferenceVisitorBase _inferrer;
|
||||
|
||||
NullAwareGuard(
|
||||
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) {
|
||||
this._nullAwareVariable, this._nullAwareFileOffset, this._inferrer) {
|
||||
// Ensure the initializer of [_nullAwareVariable] is promoted to
|
||||
// non-nullable.
|
||||
_inferrer.flowAnalysis.nullAwareAccess_rightBegin(
|
||||
|
@ -447,9 +437,7 @@ class NullAwareExpressionInferenceResult implements ExpressionInferenceResult {
|
|||
|
||||
NullAwareExpressionInferenceResult(this.inferredType,
|
||||
this.nullAwareActionType, this.nullAwareGuards, this.nullAwareAction)
|
||||
: assert(nullAwareGuards.isNotEmpty),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(nullAwareAction != null);
|
||||
: assert(nullAwareGuards.isNotEmpty);
|
||||
|
||||
@override
|
||||
Expression get expression {
|
||||
|
|
|
@ -246,11 +246,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
{bool isVoidAllowed = false, bool forEffect = false}) {
|
||||
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;
|
||||
if (expression is ExpressionJudgment) {
|
||||
result = expression.acceptInference(this, typeContext);
|
||||
|
@ -260,9 +255,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
result = expression.accept1(this, typeContext);
|
||||
}
|
||||
DartType inferredType = result.inferredType;
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(inferredType != null,
|
||||
"No type inferred for $expression (${expression.runtimeType}).");
|
||||
if (inferredType is VoidType && !isVoidAllowed) {
|
||||
if (expression.parent is! ArgumentsImpl) {
|
||||
helper.addProblem(
|
||||
|
@ -943,15 +935,11 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
|
||||
BlockExpression _createBlockExpression(
|
||||
int fileOffset, Block body, Expression value) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
return new BlockExpression(body, value)..fileOffset = fileOffset;
|
||||
}
|
||||
|
||||
ExpressionStatement _createExpressionStatement(Expression expression) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(expression != null);
|
||||
assert(expression.fileOffset != TreeNode.noOffset);
|
||||
return new ExpressionStatement(expression)
|
||||
..fileOffset = expression.fileOffset;
|
||||
|
@ -1019,21 +1007,16 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
|
||||
ExpressionInferenceResult visitExtensionTearOff(
|
||||
ExtensionTearOff node, DartType typeContext) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
FunctionType calleeType = node.target != null
|
||||
? node.target.function.computeFunctionType(libraryBuilder.nonNullable)
|
||||
: new FunctionType([], const DynamicType(), libraryBuilder.nonNullable);
|
||||
FunctionType calleeType =
|
||||
node.target.function.computeFunctionType(libraryBuilder.nonNullable);
|
||||
TypeArgumentsInfo typeArgumentsInfo = getTypeArgumentsInfo(node.arguments);
|
||||
InvocationInferenceResult result = inferInvocation(this, typeContext,
|
||||
node.fileOffset, calleeType, node.arguments as ArgumentsImpl,
|
||||
staticTarget: node.target);
|
||||
StaticInvocation replacement =
|
||||
new StaticInvocation(node.target, node.arguments);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node.target != null) {
|
||||
libraryBuilder.checkBoundsInStaticInvocation(
|
||||
replacement, typeSchemaEnvironment, helper.uri, typeArgumentsInfo);
|
||||
}
|
||||
libraryBuilder.checkBoundsInStaticInvocation(
|
||||
replacement, typeSchemaEnvironment, helper.uri, typeArgumentsInfo);
|
||||
return instantiateTearOff(
|
||||
result.inferredType, typeContext, result.applyResult(replacement));
|
||||
}
|
||||
|
@ -1550,9 +1533,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
Statement? expressionEffects,
|
||||
{bool isAsync = false,
|
||||
required bool hasProblem}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(hasProblem != null);
|
||||
|
||||
ForInVariable forInVariable =
|
||||
computeForInVariable(syntheticAssignment, hasProblem);
|
||||
DartType elementType = forInVariable.computeElementType(this);
|
||||
|
@ -3545,8 +3525,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
}
|
||||
|
||||
VariableDeclaration _createVariable(Expression expression, DartType type) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(expression != null);
|
||||
assert(expression.fileOffset != TreeNode.noOffset);
|
||||
return new VariableDeclaration.forValue(expression, type: type)
|
||||
..fileOffset = expression.fileOffset;
|
||||
|
@ -3559,15 +3537,11 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
}
|
||||
|
||||
VariableGet _createVariableGet(VariableDeclaration variable) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(variable != null);
|
||||
assert(variable.fileOffset != TreeNode.noOffset);
|
||||
return new VariableGet(variable)..fileOffset = variable.fileOffset;
|
||||
}
|
||||
|
||||
VariableGet _createNullCheckedVariableGet(VariableDeclaration variable) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(variable != null);
|
||||
assert(variable.fileOffset != TreeNode.noOffset);
|
||||
DartType promotedType =
|
||||
variable.type.withDeclaredNullability(libraryBuilder.nonNullable);
|
||||
|
@ -3581,8 +3555,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
MapLiteral _createMapLiteral(int fileOffset, DartType keyType,
|
||||
DartType valueType, List<MapLiteralEntry> entries,
|
||||
{bool isConst = false}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
return new MapLiteral(entries,
|
||||
keyType: keyType, valueType: valueType, isConst: isConst)
|
||||
|
@ -3592,8 +3564,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
ListLiteral _createListLiteral(
|
||||
int fileOffset, DartType elementType, List<Expression> elements,
|
||||
{bool isConst = false}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
return new ListLiteral(elements,
|
||||
typeArgument: elementType, isConst: isConst)
|
||||
|
@ -3603,8 +3573,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
SetLiteral _createSetLiteral(
|
||||
int fileOffset, DartType elementType, List<Expression> elements,
|
||||
{bool isConst = false}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
return new SetLiteral(elements, typeArgument: elementType, isConst: isConst)
|
||||
..fileOffset = fileOffset;
|
||||
|
@ -3613,10 +3581,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
Expression _createAdd(
|
||||
Expression receiver, InterfaceType receiverType, Expression argument,
|
||||
{required bool isSet}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(receiver != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(argument != null);
|
||||
assert(argument.fileOffset != TreeNode.noOffset,
|
||||
"No fileOffset on ${argument}.");
|
||||
DartType functionType = Substitution.fromInterfaceType(receiverType)
|
||||
|
@ -3635,10 +3599,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
|
||||
Expression _createAddAll(Expression receiver, InterfaceType receiverType,
|
||||
Expression argument, bool isSet) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(receiver != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(argument != null);
|
||||
assert(argument.fileOffset != TreeNode.noOffset,
|
||||
"No fileOffset on ${argument}.");
|
||||
DartType functionType = Substitution.fromInterfaceType(receiverType)
|
||||
|
@ -3658,10 +3618,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
|
||||
Expression _createMapAddAll(
|
||||
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,
|
||||
"No fileOffset on ${argument}.");
|
||||
DartType functionType = Substitution.fromInterfaceType(receiverType)
|
||||
|
@ -3679,8 +3635,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
|
||||
Expression _createEqualsNull(Expression expression,
|
||||
{bool notEquals = false}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(expression != null);
|
||||
assert(expression.fileOffset != TreeNode.noOffset);
|
||||
Expression check = new EqualsNull(expression)
|
||||
..fileOffset = expression.fileOffset;
|
||||
|
@ -3692,8 +3646,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
|
||||
Expression _createIndexSet(int fileOffset, Expression receiver,
|
||||
InterfaceType receiverType, Expression key, Expression value) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
DartType functionType = Substitution.fromInterfaceType(receiverType)
|
||||
.substituteType(engine.mapPutFunctionType);
|
||||
|
@ -3710,8 +3662,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
|
||||
AsExpression _createImplicitAs(
|
||||
int fileOffset, Expression expression, DartType type) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
return new AsExpression(expression, type)
|
||||
..isTypeError = true
|
||||
|
@ -3721,8 +3671,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
|
||||
IfStatement _createIf(int fileOffset, Expression condition, Statement then,
|
||||
[Statement? otherwise]) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
return new IfStatement(condition, then, otherwise)..fileOffset = fileOffset;
|
||||
}
|
||||
|
@ -3730,8 +3678,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
IfCaseStatement _createIfCase(int fileOffset, Expression condition,
|
||||
DartType matchedValueType, PatternGuard patternGuard, Statement then,
|
||||
[Statement? otherwise]) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
return new IfCaseStatement(condition, patternGuard, then, otherwise)
|
||||
..matchedValueType = matchedValueType
|
||||
|
@ -3740,8 +3686,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
|
||||
Expression _createGetKey(
|
||||
int fileOffset, Expression receiver, InterfaceType entryType) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
DartType resultType = Substitution.fromInterfaceType(entryType)
|
||||
.substituteType(engine.mapEntryKey.type);
|
||||
|
@ -3753,8 +3697,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
|
||||
Expression _createGetValue(
|
||||
int fileOffset, Expression receiver, InterfaceType entryType) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
DartType resultType = Substitution.fromInterfaceType(entryType)
|
||||
.substituteType(engine.mapEntryValue.type);
|
||||
|
@ -3766,8 +3708,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
|
||||
Expression _createGetEntries(
|
||||
int fileOffset, Expression receiver, InterfaceType mapType) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
DartType resultType = Substitution.fromInterfaceType(mapType)
|
||||
.substituteType(engine.mapEntries.getterType);
|
||||
|
@ -3783,8 +3723,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
Expression? condition,
|
||||
List<Expression> updates,
|
||||
Statement body) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
return new ForStatement(variables, condition, updates, body)
|
||||
..fileOffset = fileOffset;
|
||||
|
@ -3793,8 +3731,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
ForInStatement _createForInStatement(int fileOffset,
|
||||
VariableDeclaration variable, Expression iterable, Statement body,
|
||||
{bool isAsync = false}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
return new ForInStatement(variable, iterable, body, isAsync: isAsync)
|
||||
..fileOffset = fileOffset;
|
||||
|
@ -3819,8 +3755,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
Expression then,
|
||||
Expression otherwise,
|
||||
DartType type) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fileOffset != null);
|
||||
assert(fileOffset != TreeNode.noOffset);
|
||||
return new ConditionalExpression(condition, then, otherwise, type)
|
||||
..fileOffset = fileOffset;
|
||||
|
@ -6023,8 +5957,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
ExpressionInferenceResult _computeEqualsExpression(
|
||||
int fileOffset, Expression left, DartType leftType, Expression right,
|
||||
{required bool isNot}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNot != null);
|
||||
ExpressionInfo<DartType>? equalityInfo =
|
||||
flowAnalysis.equalityOperand_end(left, leftType);
|
||||
|
||||
|
@ -6693,8 +6625,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
{required bool isThisReceiver,
|
||||
ObjectAccessTarget? readTarget,
|
||||
Expression? propertyGetNode}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isThisReceiver != null);
|
||||
Map<DartType, NonPromotionReason> Function() whyNotPromoted =
|
||||
flowAnalysis.whyNotPromoted(receiver);
|
||||
|
||||
|
@ -6747,8 +6677,6 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
Expression value,
|
||||
{required DartType valueType,
|
||||
required bool forEffect}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(forEffect != null);
|
||||
Expression write;
|
||||
DartType writeType = valueType;
|
||||
switch (writeTarget.kind) {
|
||||
|
@ -8103,19 +8031,14 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
@override
|
||||
ExpressionInferenceResult visitStaticInvocation(
|
||||
StaticInvocation node, DartType typeContext) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
FunctionType calleeType = node.target != null
|
||||
? node.target.function.computeFunctionType(libraryBuilder.nonNullable)
|
||||
: new FunctionType([], const DynamicType(), libraryBuilder.nonNullable);
|
||||
FunctionType calleeType =
|
||||
node.target.function.computeFunctionType(libraryBuilder.nonNullable);
|
||||
TypeArgumentsInfo typeArgumentsInfo = getTypeArgumentsInfo(node.arguments);
|
||||
InvocationInferenceResult result = inferInvocation(this, typeContext,
|
||||
node.fileOffset, calleeType, node.arguments as ArgumentsImpl,
|
||||
staticTarget: node.target);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node.target != null) {
|
||||
libraryBuilder.checkBoundsInStaticInvocation(
|
||||
node, typeSchemaEnvironment, helper.uri, typeArgumentsInfo);
|
||||
}
|
||||
libraryBuilder.checkBoundsInStaticInvocation(
|
||||
node, typeSchemaEnvironment, helper.uri, typeArgumentsInfo);
|
||||
return new ExpressionInferenceResult(
|
||||
result.inferredType, result.applyResult(node));
|
||||
}
|
||||
|
@ -9138,18 +9061,15 @@ class InferenceVisitorImpl extends InferenceVisitorBase
|
|||
receiver.literal.length);
|
||||
return new ExpressionInferenceResult(const DynamicType(), error);
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (intValue != null) {
|
||||
Expression? error = checkWebIntLiteralsErrorIfUnexact(
|
||||
intValue, receiver.literal, receiver.fileOffset);
|
||||
if (error != null) {
|
||||
return new ExpressionInferenceResult(const DynamicType(), error);
|
||||
}
|
||||
expressionResult = new ExpressionInferenceResult(
|
||||
coreTypes.intRawType(libraryBuilder.nonNullable),
|
||||
new IntLiteral(-intValue)
|
||||
..fileOffset = node.expression.fileOffset);
|
||||
Expression? error = checkWebIntLiteralsErrorIfUnexact(
|
||||
intValue, receiver.literal, receiver.fileOffset);
|
||||
if (error != null) {
|
||||
return new ExpressionInferenceResult(const DynamicType(), error);
|
||||
}
|
||||
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(
|
||||
int fileOffset, Message errorMessage, Message warningMessage) {
|
||||
if (libraryBuilder.loader.target.context.options.warnOnReachabilityCheck &&
|
||||
// ignore: unnecessary_null_comparison
|
||||
warningMessage != null) {
|
||||
if (libraryBuilder.loader.target.context.options.warnOnReachabilityCheck) {
|
||||
helper.addProblem(warningMessage, fileOffset, noLength);
|
||||
}
|
||||
Arguments arguments;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (errorMessage != null) {
|
||||
arguments = new Arguments([
|
||||
new StringLiteral(errorMessage.problemMessage)..fileOffset = fileOffset
|
||||
])
|
||||
..fileOffset = fileOffset;
|
||||
} else {
|
||||
arguments = new Arguments([])..fileOffset = fileOffset;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(coreTypes.reachabilityErrorConstructor != null);
|
||||
Arguments arguments = new Arguments([
|
||||
new StringLiteral(errorMessage.problemMessage)..fileOffset = fileOffset
|
||||
])
|
||||
..fileOffset = fileOffset;
|
||||
return new Throw(
|
||||
new ConstructorInvocation(
|
||||
coreTypes.reachabilityErrorConstructor, arguments)
|
||||
|
@ -461,9 +451,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
DartType? runtimeCheckedType,
|
||||
bool isVoidAllowed = false,
|
||||
bool coerceExpression = true}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(contextType != null);
|
||||
|
||||
fileOffset ??= inferenceResult.expression.fileOffset;
|
||||
contextType = computeGreatestClosure(contextType);
|
||||
|
||||
|
@ -554,9 +541,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
Template<Message Function(DartType, DartType, DartType, DartType, bool)>?
|
||||
nullabilityPartErrorTemplate,
|
||||
Map<DartType, NonPromotionReason> Function()? whyNotPromoted}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(contextType != null);
|
||||
|
||||
// [errorTemplate], [nullabilityErrorTemplate], and
|
||||
// [nullabilityPartErrorTemplate] should be provided together.
|
||||
assert((errorTemplate == null) == (nullabilityErrorTemplate == null) &&
|
||||
|
@ -723,9 +707,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
Template<Message Function(DartType, DartType, DartType, DartType, bool)>?
|
||||
nullabilityPartErrorTemplate,
|
||||
Map<DartType, NonPromotionReason> Function()? whyNotPromoted}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(contextType != null);
|
||||
|
||||
if (coerceExpression) {
|
||||
ExpressionInferenceResult? coercionResult = coerceExpressionForAssignment(
|
||||
contextType, inferenceResult,
|
||||
|
@ -757,8 +738,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
|
||||
Expression _wrapTearoffErrorExpression(Expression expression,
|
||||
DartType contextType, Template<Message Function(String)> template) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(template != null);
|
||||
Expression errorNode = new AsExpression(
|
||||
expression,
|
||||
// TODO(ahe): The outline phase doesn't correctly remove invalid
|
||||
|
@ -842,13 +821,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
required bool isVoidAllowed,
|
||||
required bool isExpressionTypePrecise,
|
||||
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
|
||||
// should tear off `.call`.
|
||||
// TODO(paulberry): use resolveTypeParameter. See findInterfaceMember.
|
||||
|
@ -1315,8 +1287,7 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
{required CallSiteAccessKind callSiteAccessKind,
|
||||
bool instrumented = true,
|
||||
bool includeExtensionMethods = false}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(receiverType != null && isKnown(receiverType));
|
||||
assert(isKnown(receiverType));
|
||||
|
||||
bool isSetter = callSiteAccessKind == CallSiteAccessKind.setterInvocation;
|
||||
|
||||
|
@ -1415,10 +1386,8 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
Name name,
|
||||
int fileOffset,
|
||||
Template<Message Function(String, DartType, bool)> errorTemplate) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(receiverType != null && isKnown(receiverType));
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (target.isMissing && errorTemplate != null) {
|
||||
assert(isKnown(receiverType));
|
||||
if (target.isMissing) {
|
||||
int length = name.text.length;
|
||||
if (identical(name.text, callName.text) ||
|
||||
identical(name.text, unaryMinusName.text)) {
|
||||
|
@ -1806,8 +1775,7 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
|
||||
TypeConstraintGatherer? gatherer;
|
||||
if (inferenceNeeded) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (isConst && typeContext != null) {
|
||||
if (isConst) {
|
||||
typeContext = new TypeVariableEliminator(
|
||||
bottomType,
|
||||
isNonNullableByDefault
|
||||
|
@ -2450,8 +2418,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
DartType typeContext,
|
||||
List<VariableDeclaration>? hoistedExpressions,
|
||||
{required bool isImplicitCall}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isImplicitCall != null);
|
||||
InvocationInferenceResult result = inferInvocation(
|
||||
visitor, typeContext, fileOffset, unknownFunction, arguments,
|
||||
hoistedExpressions: hoistedExpressions,
|
||||
|
@ -2476,8 +2442,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
DartType typeContext,
|
||||
List<VariableDeclaration>? hoistedExpressions,
|
||||
{required bool isImplicitCall}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isImplicitCall != null);
|
||||
InvocationInferenceResult result = inferInvocation(
|
||||
visitor, typeContext, fileOffset, unknownFunction, arguments,
|
||||
hoistedExpressions: hoistedExpressions,
|
||||
|
@ -2508,10 +2472,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
required bool isImplicitCall,
|
||||
Name? implicitInvocationPropertyName}) {
|
||||
assert(target.isMissing || target.isAmbiguous);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isExpressionInvocation != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isImplicitCall != null);
|
||||
Expression error = createMissingMethodInvocation(
|
||||
fileOffset, receiverType, name,
|
||||
receiver: receiver,
|
||||
|
@ -2544,8 +2504,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
DartType typeContext,
|
||||
List<VariableDeclaration>? hoistedExpressions,
|
||||
{required bool isImplicitCall}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isImplicitCall != null);
|
||||
assert(target.isExtensionMember ||
|
||||
target.isNullableExtensionMember ||
|
||||
target.isInlineClassMember ||
|
||||
|
@ -2659,8 +2617,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
DartType typeContext,
|
||||
List<VariableDeclaration>? hoistedExpressions,
|
||||
{required bool isImplicitCall}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isImplicitCall != null);
|
||||
assert(target.isCallFunction || target.isNullableCallFunction);
|
||||
FunctionType declaredFunctionType = target.getFunctionType(this);
|
||||
InvocationInferenceResult result = inferInvocation(
|
||||
|
@ -2765,12 +2721,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
{required bool isImplicitCall,
|
||||
required bool isSpecialCasedBinaryOperator,
|
||||
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 ||
|
||||
target.isObjectMember ||
|
||||
target.isNullableInstanceMember);
|
||||
|
@ -2932,8 +2882,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
DartType typeContext,
|
||||
List<VariableDeclaration>? hoistedExpressions,
|
||||
{required bool isExpressionInvocation}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isExpressionInvocation != null);
|
||||
assert(target.isInstanceMember ||
|
||||
target.isObjectMember ||
|
||||
target.isNullableInstanceMember);
|
||||
|
@ -3134,8 +3082,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
DartType typeContext,
|
||||
List<VariableDeclaration>? hoistedExpressions,
|
||||
{required bool isExpressionInvocation}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isExpressionInvocation != null);
|
||||
assert(target.isInstanceMember ||
|
||||
target.isObjectMember ||
|
||||
target.isNullableInstanceMember);
|
||||
|
@ -3310,11 +3256,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
Name? implicitInvocationPropertyName,
|
||||
List<VariableDeclaration>? hoistedExpressions,
|
||||
ObjectAccessTarget? target}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isExpressionInvocation != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isImplicitCall != null);
|
||||
|
||||
target ??= findInterfaceMember(receiverType, name, fileOffset,
|
||||
instrumented: true,
|
||||
includeExtensionMethods: true,
|
||||
|
@ -3593,8 +3534,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
void checkBoundsInInstantiation(
|
||||
FunctionType functionType, List<DartType> arguments, int fileOffset,
|
||||
{required bool inferred}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(inferred != null);
|
||||
// If [arguments] were inferred, check them.
|
||||
|
||||
libraryBuilder.checkBoundsInInstantiation(
|
||||
|
@ -3805,8 +3744,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
MethodContravarianceCheckKind preCheckInvocationContravariance(
|
||||
DartType receiverType, ObjectAccessTarget target,
|
||||
{required bool isThisReceiver}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isThisReceiver != null);
|
||||
if (target.isInstanceMember || target.isObjectMember) {
|
||||
Member interfaceMember = target.member!;
|
||||
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
|
||||
// return it unmodified?
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (type == null) {
|
||||
return coreTypes.futureRawType(libraryBuilder.nullable);
|
||||
}
|
||||
return new FutureOrType(type, libraryBuilder.nonNullable);
|
||||
}
|
||||
|
||||
|
@ -4117,8 +4050,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
required bool isExpressionInvocation,
|
||||
Name? implicitInvocationPropertyName,
|
||||
List<ExtensionAccessCandidate>? extensionAccessCandidates}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isExpressionInvocation != null);
|
||||
assert((receiver == null) == (arguments == null),
|
||||
"Receiver and arguments must be supplied together.");
|
||||
if (implicitInvocationPropertyName != null) {
|
||||
|
@ -4369,8 +4300,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
DartType receiverType, Name propertyName, Expression value,
|
||||
{required bool forEffect,
|
||||
List<ExtensionAccessCandidate>? extensionAccessCandidates}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(forEffect != null);
|
||||
Template<Message Function(String, DartType, bool)> templateMissing;
|
||||
if (receiverType is ExtensionType) {
|
||||
templateMissing = templateUndefinedExtensionSetter;
|
||||
|
@ -4413,8 +4342,6 @@ abstract class InferenceVisitorBase implements InferenceVisitor {
|
|||
DartType receiverType, Expression index, Expression value,
|
||||
{required bool forEffect,
|
||||
List<ExtensionAccessCandidate>? extensionAccessCandidates}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(forEffect != null);
|
||||
Template<Message Function(String, DartType, bool)> templateMissing;
|
||||
if (receiverType is ExtensionType) {
|
||||
templateMissing = templateUndefinedExtensionOperator;
|
||||
|
|
|
@ -102,10 +102,6 @@ abstract class ObjectAccessTarget {
|
|||
factory ObjectAccessTarget.interfaceMember(
|
||||
DartType receiverType, Member member,
|
||||
{required bool isPotentiallyNullable}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(member != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isPotentiallyNullable != null);
|
||||
return isPotentiallyNullable
|
||||
? new InstanceAccessTarget.nullable(receiverType, member)
|
||||
: new InstanceAccessTarget.nonNullable(receiverType, member);
|
||||
|
@ -980,9 +976,7 @@ class ExtensionAccessCandidate {
|
|||
|
||||
ExtensionAccessCandidate(this.memberBuilder, this.onType,
|
||||
this.onTypeInstantiateToBounds, this.target,
|
||||
{required this.isPlatform})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(isPlatform != null);
|
||||
{required this.isPlatform});
|
||||
|
||||
bool? isMoreSpecificThan(TypeSchemaEnvironment typeSchemaEnvironment,
|
||||
ExtensionAccessCandidate other) {
|
||||
|
|
|
@ -151,8 +151,6 @@ abstract class TypeConstraintGatherer {
|
|||
/// type schema.
|
||||
bool _tryNullabilityAwareSubtypeMatch(DartType subtype, DartType supertype,
|
||||
{required bool constrainSupertype}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(constrainSupertype != null);
|
||||
int baseConstraintCount = _protoConstraints.length;
|
||||
bool isMatch = _isNullabilityAwareSubtypeMatch(subtype, supertype,
|
||||
constrainSupertype: constrainSupertype);
|
||||
|
@ -327,13 +325,6 @@ abstract class TypeConstraintGatherer {
|
|||
/// [UnknownType], that is, to be a type schema.
|
||||
bool _isNullabilityAwareSubtypeMatch(DartType p, DartType q,
|
||||
{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,
|
||||
// [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 ->
|
||||
|
@ -1066,18 +1057,15 @@ abstract class TypeConstraintGatherer {
|
|||
Member? callMember = getInterfaceMember(subtype.classNode, callName);
|
||||
if (callMember is Procedure && !callMember.isGetter) {
|
||||
DartType callType = callMember.getterType;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (callType != null) {
|
||||
callType =
|
||||
Substitution.fromInterfaceType(subtype).substituteType(callType);
|
||||
// TODO(kmillikin): The subtype check will fail if the type of a
|
||||
// generic call method is a subtype of a non-generic function type.
|
||||
// For example, if `T call<T>(T arg)` is a subtype of `S->S` for some
|
||||
// S. However, explicitly tearing off that call method will work and
|
||||
// insert an explicit instantiation, so the implicit tear off should
|
||||
// work as well. Figure out how to support this case.
|
||||
return _isNullabilityObliviousSubtypeMatch(callType, supertype);
|
||||
}
|
||||
callType =
|
||||
Substitution.fromInterfaceType(subtype).substituteType(callType);
|
||||
// TODO(kmillikin): The subtype check will fail if the type of a
|
||||
// generic call method is a subtype of a non-generic function type.
|
||||
// For example, if `T call<T>(T arg)` is a subtype of `S->S` for some
|
||||
// S. However, explicitly tearing off that call method will work and
|
||||
// insert an explicit instantiation, so the implicit tear off should
|
||||
// work as well. Figure out how to support this case.
|
||||
return _isNullabilityObliviousSubtypeMatch(callType, supertype);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -104,11 +104,7 @@ class _DemotionNullabilityNormalization extends ReplacementVisitor {
|
|||
|
||||
const _DemotionNullabilityNormalization(
|
||||
{required this.demoteTypeVariables,
|
||||
required this.forNonNullableByDefault})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(demoteTypeVariables != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(forNonNullableByDefault != null);
|
||||
required this.forNonNullableByDefault});
|
||||
|
||||
@override
|
||||
Nullability? visitNullability(DartType node) {
|
||||
|
|
|
@ -142,9 +142,7 @@ class TypeInferrerImpl implements TypeInferrer {
|
|||
this.dataForTesting,
|
||||
FunctionType unknownFunctionNonNullable,
|
||||
FunctionType unknownFunctionLegacy)
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(libraryBuilder != null),
|
||||
unknownFunction = libraryBuilder.isNonNullableByDefault
|
||||
: unknownFunction = libraryBuilder.isNonNullableByDefault
|
||||
? unknownFunctionNonNullable
|
||||
: unknownFunctionLegacy,
|
||||
instrumentation = isTopLevel ? null : engine.instrumentation,
|
||||
|
@ -193,8 +191,6 @@ class TypeInferrerImpl implements TypeInferrer {
|
|||
@override
|
||||
InferredFunctionBody inferFunctionBody(InferenceHelper helper, int fileOffset,
|
||||
DartType returnType, AsyncMarker asyncMarker, Statement body) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(body != null);
|
||||
InferenceVisitorBase visitor = _createInferenceVisitor(helper);
|
||||
ClosureContext closureContext =
|
||||
new ClosureContext(visitor, asyncMarker, returnType, false);
|
||||
|
@ -292,8 +288,6 @@ class TypeInferrerImpl implements TypeInferrer {
|
|||
Expression initializer,
|
||||
DartType declaredType,
|
||||
bool hasDeclaredInitializer) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(declaredType != null);
|
||||
InferenceVisitorBase visitor = _createInferenceVisitor(helper);
|
||||
ExpressionInferenceResult result =
|
||||
visitor.inferExpression(initializer, declaredType);
|
||||
|
|
|
@ -370,8 +370,6 @@ class TypeSchemaEnvironment extends HierarchyBasedTypeEnvironment
|
|||
bool isSpecialCasesBinaryForReceiverType(
|
||||
Procedure member, DartType receiverType,
|
||||
{required bool isNonNullableByDefault}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNonNullableByDefault != null);
|
||||
if (!isNonNullableByDefault) {
|
||||
// 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
|
||||
|
|
|
@ -40,8 +40,6 @@ class UriTranslator {
|
|||
|
||||
/// For a package uri, get the corresponding [Package].
|
||||
Package? getPackage(Uri uri) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (packages == null) return null;
|
||||
if (!uri.isScheme("package")) return null;
|
||||
int firstSlash = uri.path.indexOf('/');
|
||||
if (firstSlash == -1) return null;
|
||||
|
|
|
@ -55,11 +55,6 @@ CompilationUnitEnd getAST(List<int> rawBytes,
|
|||
},
|
||||
);
|
||||
Token firstToken = scanner.tokenize();
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (firstToken == null) {
|
||||
throw "firstToken is null";
|
||||
}
|
||||
|
||||
ParserASTListener listener = new ParserASTListener();
|
||||
Parser parser;
|
||||
if (includeBody) {
|
||||
|
|
|
@ -450,12 +450,6 @@ String? textualOutline(
|
|||
..originalPosition = originalPosition.value++);
|
||||
});
|
||||
Token firstToken = scanner.tokenize();
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (firstToken == null) {
|
||||
if (throwOnUnexpected) throw "firstToken is null";
|
||||
return null;
|
||||
}
|
||||
|
||||
TextualOutlineListener listener = new TextualOutlineListener();
|
||||
ClassMemberParser classMemberParser = new ClassMemberParser(listener);
|
||||
classMemberParser.parseUnit(firstToken);
|
||||
|
@ -866,8 +860,7 @@ class TextualOutlineListener extends Listener {
|
|||
|
||||
@override
|
||||
void endImport(Token importKeyword, Token? augmentToken, Token? semicolon) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (importKeyword != null && semicolon != null) {
|
||||
if (semicolon != null) {
|
||||
importExportsStartToChunk[importKeyword] = new _ImportChunk(
|
||||
importKeyword, semicolon, firstShowOrHide, _combinators);
|
||||
}
|
||||
|
|
|
@ -83,8 +83,6 @@ abstract class DataExtractor<T> extends Visitor<void>
|
|||
|
||||
void computeForMember(Member member) {
|
||||
MemberId id = computeMemberId(member);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (id == null) return;
|
||||
T? value = computeMemberValue(id, 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) {
|
||||
map.forEach((int offset, List<FormattedMessage> list) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (offset == null || offset < 0) {
|
||||
if (offset < 0) {
|
||||
// Position errors without offset in the begin of the file.
|
||||
offset = 0;
|
||||
}
|
||||
|
@ -578,8 +577,7 @@ void printMessageInLocation(
|
|||
if (source == null) {
|
||||
print('$uri@$offset: $message');
|
||||
} else {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (offset != null && offset >= 1) {
|
||||
if (offset >= 1) {
|
||||
Location location = source.getLocation(uri, offset);
|
||||
print('$location: $message');
|
||||
if (!succinct) {
|
||||
|
|
|
@ -80,11 +80,7 @@ class WidgetCache {
|
|||
List<int> oldSource =
|
||||
lastGoodComponent.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 newEndIndex = newSource.length - 1;
|
||||
int oldStartIndex = 0;
|
||||
|
|
|
@ -1106,12 +1106,6 @@ worlds:
|
|||
_isUriNnbd(uri) ? _scannerConfiguration : _scannerConfigurationNonNNBD,
|
||||
lineStarts);
|
||||
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (firstToken == null) {
|
||||
print("Got null token from scanner for $uri");
|
||||
return;
|
||||
}
|
||||
|
||||
int compileTry = 0;
|
||||
Token? token = firstToken;
|
||||
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) {
|
||||
print("Got '$foundLine'");
|
||||
_expectedCrashLine = foundLine;
|
||||
|
@ -2016,11 +2008,6 @@ worlds:
|
|||
nnbd ? _scannerConfiguration : _scannerConfigurationNonNNBD,
|
||||
lineStarts);
|
||||
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (firstToken == null) {
|
||||
throw "Got null token from scanner";
|
||||
}
|
||||
|
||||
ParserTestListener parserTestListener = new ParserTestListener(false);
|
||||
Parser parser = new Parser(parserTestListener,
|
||||
useImplicitCreationExpression: useImplicitCreationExpressionInCfe);
|
||||
|
@ -2034,11 +2021,6 @@ worlds:
|
|||
Token firstToken = parser_suite.scanRawBytes(rawBytes,
|
||||
nnbd ? _scannerConfiguration : _scannerConfigurationNonNNBD, null);
|
||||
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (firstToken == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ParserErrorListener parserErrorListener = new ParserErrorListener();
|
||||
Parser parser = new Parser(parserErrorListener,
|
||||
useImplicitCreationExpression: useImplicitCreationExpressionInCfe);
|
||||
|
|
|
@ -278,16 +278,10 @@ class FolderOptions {
|
|||
// can be null
|
||||
this.overwriteCurrentSdkVersion,
|
||||
this.showOffsets = false})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(nnbdAgnosticMode != null),
|
||||
assert(
|
||||
: assert(
|
||||
// no this doesn't make any sense but left to underline
|
||||
// that this is allowed to be null!
|
||||
defines != null || defines == null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(noVerify != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(target != null);
|
||||
defines != null || defines == null);
|
||||
|
||||
Map<ExperimentalFlag, bool> computeExplicitExperimentalFlags(
|
||||
Map<ExperimentalFlag, bool> forcedExperimentalFlags) {
|
||||
|
@ -315,9 +309,7 @@ class TestOptions {
|
|||
{required this.nnbdMode,
|
||||
required this.allowedExperimentalFlags,
|
||||
required this.experimentEnabledVersion,
|
||||
required this.experimentReleasedVersion})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(linkDependencies != null);
|
||||
required this.experimentReleasedVersion});
|
||||
}
|
||||
|
||||
class FastaContext extends ChainContext with MatchContext {
|
||||
|
@ -2335,10 +2327,7 @@ class Outline extends Step<TestDescription, ComponentResult, FastaContext> {
|
|||
backendTarget.performModularTransformations = true;
|
||||
}
|
||||
try {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (sourceTarget.loader.coreTypes != null) {
|
||||
sourceTarget.runBuildTransformations();
|
||||
}
|
||||
sourceTarget.runBuildTransformations();
|
||||
} finally {
|
||||
if (backendTarget is TestTarget) {
|
||||
backendTarget.performModularTransformations = false;
|
||||
|
@ -2463,10 +2452,7 @@ class Transform extends Step<ComponentResult, ComponentResult, FastaContext> {
|
|||
backendTarget.performModularTransformations = true;
|
||||
}
|
||||
try {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (sourceTarget.loader.coreTypes != null) {
|
||||
sourceTarget.runBuildTransformations();
|
||||
}
|
||||
sourceTarget.runBuildTransformations();
|
||||
} finally {
|
||||
if (backendTarget is TestTarget) {
|
||||
backendTarget.performModularTransformations = false;
|
||||
|
|
|
@ -1475,8 +1475,7 @@ class NewWorldTest {
|
|||
for (Uri uri in component!.uriToSource.keys) {
|
||||
// null is always there, so allow it implicitly.
|
||||
// Dart scheme uris too.
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (uri == null || uri.isScheme("org-dartlang-sdk")) continue;
|
||||
if (uri.isScheme("org-dartlang-sdk")) continue;
|
||||
if (!allowed.contains(uri)) {
|
||||
return new Result<TestData>(
|
||||
data,
|
||||
|
|
|
@ -78,8 +78,6 @@ Future<void> throwOnInsufficientUriToSource(Component component,
|
|||
if (fileSystem != null) {
|
||||
uris = uriFinder.seenUris.toSet();
|
||||
for (Uri uri in uris) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (uri == null) continue;
|
||||
if (!uri.isScheme("org-dartlang-test")) continue;
|
||||
// The file system doesn't have the sources for any modules.
|
||||
// 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>[];
|
||||
Token firstToken = scanUri(uri, shortName, lineStarts: lineStarts);
|
||||
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (firstToken == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
File f = new File.fromUri(uri);
|
||||
List<int> rawBytes = f.readAsBytesSync();
|
||||
Source source = new Source(lineStarts, rawBytes, uri, uri);
|
||||
|
@ -261,11 +256,6 @@ class IntertwinedStep extends Step<TestDescription, TestDescription, Context> {
|
|||
Token firstToken =
|
||||
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);
|
||||
List<int> rawBytes = f.readAsBytesSync();
|
||||
Source source =
|
||||
|
@ -301,11 +291,6 @@ class TokenStep extends Step<TestDescription, TestDescription, Context> {
|
|||
Token firstToken =
|
||||
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 beforeParserWithTypes =
|
||||
tokenStreamToString(firstToken, lineStarts, addTypes: true);
|
||||
|
|
|
@ -210,9 +210,7 @@ class MatchExpectation
|
|||
/// be serialized, deserialized, and the textual representation of that is
|
||||
/// compared. It is still the original component that is returned though.
|
||||
const MatchExpectation(this.suffix,
|
||||
{this.serializeFirst = false, required this.isLastMatchStep})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(isLastMatchStep != null);
|
||||
{this.serializeFirst = false, required this.isLastMatchStep});
|
||||
|
||||
@override
|
||||
String get name => "match expectations";
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
library fasta.tool.entry_points;
|
||||
|
||||
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 'package:_fe_analyzer_shared/src/util/relativize.dart'
|
||||
|
@ -508,13 +508,6 @@ Future<void> compilePlatformInternal(CompilerContext c, Uri fullOutput,
|
|||
|
||||
CompilerResult result =
|
||||
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!);
|
||||
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
|
||||
// want.
|
||||
problemMessage = problemMessage.trimRight();
|
||||
const String ignoreNotNull = "// ignore: unnecessary_null_comparison";
|
||||
var parameters = new Set<String>();
|
||||
var conversions = new Set<String>();
|
||||
var conversions2 = new Set<String>();
|
||||
|
@ -261,8 +260,7 @@ Template compileTemplate(String name, int? index, String? problemMessage,
|
|||
|
||||
case "nameOKEmpty":
|
||||
parameters.add("String nameOKEmpty");
|
||||
conversions.add("$ignoreNotNull\n"
|
||||
"if (nameOKEmpty == null || nameOKEmpty.isEmpty) "
|
||||
conversions.add("if (nameOKEmpty.isEmpty) "
|
||||
"nameOKEmpty = '(unnamed)';");
|
||||
arguments.add("'nameOKEmpty': nameOKEmpty");
|
||||
break;
|
||||
|
@ -306,8 +304,7 @@ Template compileTemplate(String name, int? index, String? problemMessage,
|
|||
|
||||
case "stringOKEmpty":
|
||||
parameters.add("String stringOKEmpty");
|
||||
conversions.add("$ignoreNotNull\n"
|
||||
"if (stringOKEmpty == null || stringOKEmpty.isEmpty) "
|
||||
conversions.add("if (stringOKEmpty.isEmpty) "
|
||||
"stringOKEmpty = '(empty)';");
|
||||
arguments.add("'$name': stringOKEmpty");
|
||||
break;
|
||||
|
@ -344,15 +341,11 @@ Template compileTemplate(String name, int? index, String? problemMessage,
|
|||
|
||||
case "count":
|
||||
parameters.add("int count");
|
||||
conversions.add(
|
||||
"$ignoreNotNull\n" "if (count == null) throw 'No count provided';");
|
||||
arguments.add("'$name': count");
|
||||
break;
|
||||
|
||||
case "count2":
|
||||
parameters.add("int count2");
|
||||
conversions.add("$ignoreNotNull\n"
|
||||
"if (count2 == null) throw 'No count provided';");
|
||||
arguments.add("'$name': count2");
|
||||
break;
|
||||
|
||||
|
@ -367,24 +360,18 @@ Template compileTemplate(String name, int? index, String? problemMessage,
|
|||
|
||||
case "num1":
|
||||
parameters.add("num _num1");
|
||||
conversions.add("$ignoreNotNull\n"
|
||||
"if (_num1 == null) throw 'No number provided';");
|
||||
conversions.add("String num1 = ${format('_num1')};");
|
||||
arguments.add("'$name': _num1");
|
||||
break;
|
||||
|
||||
case "num2":
|
||||
parameters.add("num _num2");
|
||||
conversions.add("$ignoreNotNull\n"
|
||||
"if (_num2 == null) throw 'No number provided';");
|
||||
conversions.add("String num2 = ${format('_num2')};");
|
||||
arguments.add("'$name': _num2");
|
||||
break;
|
||||
|
||||
case "num3":
|
||||
parameters.add("num _num3");
|
||||
conversions.add("$ignoreNotNull\n"
|
||||
"if (_num3 == null) throw 'No number provided';");
|
||||
conversions.add("String num3 = ${format('_num3')};");
|
||||
arguments.add("'$name': _num3");
|
||||
break;
|
||||
|
@ -428,10 +415,7 @@ Template compileTemplate(String name, int? index, String? problemMessage,
|
|||
}
|
||||
|
||||
if (parameters.isEmpty && conversions.isEmpty && arguments.isEmpty) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (problemMessage != null) {
|
||||
codeArguments.add('problemMessage: r"""$problemMessage"""');
|
||||
}
|
||||
codeArguments.add('problemMessage: r"""$problemMessage"""');
|
||||
if (correctionMessage != null) {
|
||||
codeArguments.add('correctionMessage: r"""$correctionMessage"""');
|
||||
}
|
||||
|
@ -447,10 +431,7 @@ const MessageCode message$name =
|
|||
}
|
||||
|
||||
List<String> templateArguments = <String>[];
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (problemMessage != null) {
|
||||
templateArguments.add('problemMessageTemplate: r"""$problemMessage"""');
|
||||
}
|
||||
templateArguments.add('problemMessageTemplate: r"""$problemMessage"""');
|
||||
if (correctionMessage != null) {
|
||||
templateArguments
|
||||
.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 helper(Uri uri) {
|
||||
uri = uriResolver.translate(uri) ?? uri;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (uri == null) return;
|
||||
if (files.containsKey(uri)) return;
|
||||
var contents = readBytesFromFileSync(uri);
|
||||
files[uri] = contents;
|
||||
|
|
|
@ -188,10 +188,6 @@ void processField(
|
|||
|
||||
Token beginToken = classFields.beginToken;
|
||||
Token endToken = classFields.endToken;
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(beginToken != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(endToken != null);
|
||||
|
||||
String frozenCheckCode =
|
||||
"""if (frozen) throw "Trying to modify frozen node!";""";
|
||||
|
|
|
@ -736,8 +736,6 @@ class FrontendCompiler implements CompilerInterface {
|
|||
Future<void> writeJavaScriptBundle(KernelCompilationResults results,
|
||||
String filename, String fileSystemScheme, String moduleFormat,
|
||||
{required bool fullComponent}) async {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(fullComponent != null);
|
||||
var packageConfig = await loadPackageConfigUri(
|
||||
_compilerOptions.packagesFileUri ??
|
||||
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);
|
||||
}
|
||||
|
||||
/// Helper used to trigger the read of a late variable in asserts.
|
||||
bool _lateIsInitialized(dynamic value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
class BinaryBuilder {
|
||||
final List<VariableDeclaration> variableStack = <VariableDeclaration>[];
|
||||
final List<LabeledStatement> labelStack = <LabeledStatement>[];
|
||||
|
@ -945,8 +950,7 @@ class BinaryBuilder {
|
|||
/// if [readCoverage] is true, references are read and that the link table
|
||||
/// thus has to be read first.
|
||||
Map<Uri, Source> readUriToSource({required bool readCoverage}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(!readCoverage || (readCoverage && _linkTable != null));
|
||||
assert(!readCoverage || (readCoverage && _lateIsInitialized(_linkTable)));
|
||||
|
||||
int length = readUint32();
|
||||
|
||||
|
@ -1508,8 +1512,10 @@ class BinaryBuilder {
|
|||
}
|
||||
|
||||
typeParameterStack.length = 0;
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(debugPath.removeLast() != null);
|
||||
assert(() {
|
||||
debugPath.removeLast();
|
||||
return true;
|
||||
}());
|
||||
node.name = name;
|
||||
node.fileUri = fileUri;
|
||||
node.annotations = annotations;
|
||||
|
|
|
@ -955,15 +955,10 @@ class BinaryPrinter implements Visitor<void>, BinarySink {
|
|||
}
|
||||
|
||||
void writeNonNullReference(Reference reference) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (reference == null) {
|
||||
throw new ArgumentError('Got null reference');
|
||||
} else {
|
||||
assert(reference.isConsistent, reference.getInconsistency());
|
||||
CanonicalName name = _ensureCanonicalName(reference);
|
||||
checkCanonicalName(name);
|
||||
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].
|
||||
|
@ -1046,14 +1041,8 @@ class BinaryPrinter implements Visitor<void>, BinarySink {
|
|||
|
||||
void writeNonNullCanonicalNameReference(Reference reference) {
|
||||
CanonicalName name = _ensureCanonicalName(reference);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (name == null) {
|
||||
throw new ArgumentError(
|
||||
'Expected a canonical name to be valid but was `null`.');
|
||||
} else {
|
||||
checkCanonicalName(name);
|
||||
writeUInt30(name.index + 1);
|
||||
}
|
||||
checkCanonicalName(name);
|
||||
writeUInt30(name.index + 1);
|
||||
}
|
||||
|
||||
void writeOffset(int offset) {
|
||||
|
@ -1068,11 +1057,6 @@ class BinaryPrinter implements Visitor<void>, BinarySink {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,10 +94,6 @@ class CanonicalName {
|
|||
int index = -1;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -215,10 +211,6 @@ class CanonicalName {
|
|||
}
|
||||
|
||||
void bindTo(Reference target) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (target == null) {
|
||||
throw '$this cannot be bound to null';
|
||||
}
|
||||
if (_reference == target) return;
|
||||
if (_reference != null) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
|
|
@ -1754,9 +1754,6 @@ class _ClassInfo {
|
|||
} else {
|
||||
canonical = type;
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(canonical != null,
|
||||
"No canonical instantiation computed for $cls in $classNode.");
|
||||
genericSuperType![cls] = canonical;
|
||||
genericSuperTypes![cls] = <Supertype>[type];
|
||||
} else {
|
||||
|
|
|
@ -615,10 +615,7 @@ class CloneVisitorNotMembers implements TreeVisitor<TreeNode> {
|
|||
TypeParameter visitTypeParameter(TypeParameter node) {
|
||||
TypeParameter newNode = typeParams[node]!;
|
||||
newNode.bound = visitType(node.bound);
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node.defaultType != null) {
|
||||
newNode.defaultType = visitType(node.defaultType);
|
||||
}
|
||||
newNode.defaultType = visitType(node.defaultType);
|
||||
return newNode
|
||||
..annotations = cloneAnnotations && !node.annotations.isEmpty
|
||||
? node.annotations.map(clone).toList()
|
||||
|
@ -1209,8 +1206,6 @@ class MixinApplicationCloner extends CloneVisitorWithMembers {
|
|||
cloneAnnotations: cloneAnnotations);
|
||||
|
||||
Member? _findSuperMember(Name name, {required bool isSetter}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isSetter != null);
|
||||
Map<Name, Member> cache;
|
||||
if (isSetter) {
|
||||
cache = _setterMap ??= {};
|
||||
|
|
|
@ -80,11 +80,7 @@ class _ImportTableBuilder extends RecursiveVisitor {
|
|||
if (target == referenceLibrary) return; // Self-reference is special.
|
||||
if (target == null) return;
|
||||
Uri referenceUri = referenceLibrary.importUri;
|
||||
Uri? targetUri = target.importUri;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (targetUri == null) {
|
||||
throw '$referenceUri cannot refer to library without an import URI';
|
||||
}
|
||||
Uri targetUri = target.importUri;
|
||||
// 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:'
|
||||
// or 'package:'.
|
||||
|
|
|
@ -210,9 +210,6 @@ List<DartType> calculateBounds(
|
|||
List<DartType> calculateBoundsInternal(
|
||||
List<TypeParameter> typeParameters, Class objectClass,
|
||||
{required bool isNonNullableByDefault}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNonNullableByDefault != null);
|
||||
|
||||
List<DartType> bounds =
|
||||
new List<DartType>.filled(typeParameters.length, dummyDartType);
|
||||
for (int i = 0; i < typeParameters.length; i++) {
|
||||
|
@ -342,11 +339,6 @@ List<TypeArgumentIssue> findTypeArgumentIssues(DartType type,
|
|||
{required bool allowSuperBounded,
|
||||
required bool isNonNullableByDefault,
|
||||
required bool areGenericArgumentsAllowed}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNonNullableByDefault != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(areGenericArgumentsAllowed != null);
|
||||
|
||||
List<TypeParameter> variables = const <TypeParameter>[];
|
||||
List<DartType> arguments = const <DartType>[];
|
||||
List<TypeArgumentIssue> typedefRhsResult = const <TypeArgumentIssue>[];
|
||||
|
@ -498,11 +490,6 @@ List<TypeArgumentIssue> findTypeArgumentIssuesForInvocation(
|
|||
DartType bottomType,
|
||||
{required bool isNonNullableByDefault,
|
||||
required bool areGenericArgumentsAllowed}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNonNullableByDefault != null);
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(areGenericArgumentsAllowed != null);
|
||||
|
||||
assert(arguments.length == parameters.length);
|
||||
assert(bottomType == const NeverType.nonNullable() || bottomType is NullType);
|
||||
|
||||
|
@ -550,9 +537,6 @@ String getGenericTypeName(DartType type) {
|
|||
DartType? convertSuperBoundedToRegularBounded(
|
||||
TypeEnvironment typeEnvironment, DartType type,
|
||||
{int variance = Variance.covariant, required bool isNonNullableByDefault}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNonNullableByDefault != null);
|
||||
|
||||
return type.accept1(
|
||||
new _SuperBoundedTypeInverter(typeEnvironment,
|
||||
isNonNullableByDefault: isNonNullableByDefault),
|
||||
|
@ -565,11 +549,7 @@ class _SuperBoundedTypeInverter extends ReplacementVisitor {
|
|||
bool isOutermost = true;
|
||||
|
||||
_SuperBoundedTypeInverter(this.typeEnvironment,
|
||||
{required this.isNonNullableByDefault})
|
||||
// ignore: unnecessary_null_comparison
|
||||
: assert(typeEnvironment != null),
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNonNullableByDefault != null);
|
||||
{required this.isNonNullableByDefault});
|
||||
|
||||
bool flipTop(int variance) {
|
||||
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
|
||||
DartType? computeConstCanonicalType(DartType type, CoreTypes coreTypes,
|
||||
{required bool isNonNullableByDefault}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNonNullableByDefault != null);
|
||||
|
||||
return type.accept1(
|
||||
new _ConstCanonicalTypeVisitor(coreTypes,
|
||||
isNonNullableByDefault: isNonNullableByDefault),
|
||||
|
|
|
@ -402,12 +402,6 @@ abstract class Target {
|
|||
{required bool hasInitializer,
|
||||
required bool isFinal,
|
||||
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(
|
||||
hasInitializer: hasInitializer, isFinal: isFinal, isStatic: isStatic);
|
||||
return enabledLateLowerings & mask != 0;
|
||||
|
@ -461,12 +455,6 @@ abstract class Target {
|
|||
{required bool hasInitializer,
|
||||
required bool isFinal,
|
||||
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(
|
||||
hasInitializer: hasInitializer,
|
||||
isFinal: isFinal,
|
||||
|
@ -656,12 +644,6 @@ class LateLowering {
|
|||
{required bool hasInitializer,
|
||||
required bool isFinal,
|
||||
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 (isFinal) {
|
||||
if (isPotentiallyNullable) {
|
||||
|
@ -697,12 +679,6 @@ class LateLowering {
|
|||
{required bool hasInitializer,
|
||||
required bool isFinal,
|
||||
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 (isFinal) {
|
||||
if (isStatic) {
|
||||
|
|
|
@ -79,8 +79,6 @@ class Env {
|
|||
final bool isNonNullableByDefault;
|
||||
|
||||
Env(String source, {required this.isNonNullableByDefault}) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(isNonNullableByDefault != null);
|
||||
Uri libraryUri = Uri.parse('memory:main.dart');
|
||||
Uri coreUri = Uri.parse("dart:core");
|
||||
TypeParserEnvironment coreEnvironment =
|
||||
|
@ -211,8 +209,7 @@ class TypeParserEnvironment {
|
|||
}
|
||||
|
||||
ParameterEnvironment extendToParameterEnvironment(String typeParameters) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
assert(typeParameters != null && typeParameters.isNotEmpty);
|
||||
assert(typeParameters.isNotEmpty);
|
||||
return const _KernelFromParsedType().computeTypeParameterEnvironment(
|
||||
parseTypeVariables("<${typeParameters}>"), this);
|
||||
}
|
||||
|
|
|
@ -191,7 +191,6 @@ String componentToString(Component node) {
|
|||
class NameSystem {
|
||||
final Namer<VariableDeclaration> variables =
|
||||
new NormalNamer<VariableDeclaration>('#t');
|
||||
final Namer<Member> members = new NormalNamer<Member>('#m');
|
||||
final Namer<Class> classes = new NormalNamer<Class>('#class');
|
||||
final Namer<Extension> extensions = new NormalNamer<Extension>('#extension');
|
||||
final Namer<Library> libraries = new NormalNamer<Library>('#lib');
|
||||
|
@ -203,7 +202,6 @@ class NameSystem {
|
|||
new Disambiguator<Reference, CanonicalName>();
|
||||
|
||||
String nameVariable(VariableDeclaration node) => variables.getName(node);
|
||||
String nameMember(Member node) => members.getName(node);
|
||||
String nameClass(Class node) => classes.getName(node);
|
||||
String nameExtension(Extension node) => extensions.getName(node);
|
||||
String nameLibrary(Library node) => libraries.getName(node);
|
||||
|
@ -224,17 +222,13 @@ class NameSystem {
|
|||
if (name != null) {
|
||||
return abbreviateName(name);
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node.importUri != null) {
|
||||
String path = node.importUri.hasEmptyPath
|
||||
? '${node.importUri}'
|
||||
: node.importUri.pathSegments.last;
|
||||
if (path.endsWith('.dart')) {
|
||||
path = path.substring(0, path.length - '.dart'.length);
|
||||
}
|
||||
return abbreviateName(path);
|
||||
String path = node.importUri.hasEmptyPath
|
||||
? '${node.importUri}'
|
||||
: node.importUri.pathSegments.last;
|
||||
if (path.endsWith('.dart')) {
|
||||
path = path.substring(0, path.length - '.dart'.length);
|
||||
}
|
||||
return 'L';
|
||||
return abbreviateName(path);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -327,8 +321,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
}
|
||||
|
||||
String getLibraryReference(Library node) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node == null) return '<No Library>';
|
||||
if (importTable != null && importTable?.getImportIndex(node) != -1) {
|
||||
return syntheticNames.nameLibraryPrefix(node);
|
||||
}
|
||||
|
@ -348,32 +340,24 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
}
|
||||
|
||||
String getClassReference(Class node) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node == null) return '<No Class>';
|
||||
String name = getClassName(node);
|
||||
String library = getLibraryReference(node.enclosingLibrary);
|
||||
return '$library::$name';
|
||||
}
|
||||
|
||||
String getExtensionReference(Extension node) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node == null) return '<No Extension>';
|
||||
String name = getExtensionName(node);
|
||||
String library = getLibraryReference(node.enclosingLibrary);
|
||||
return '$library::$name';
|
||||
}
|
||||
|
||||
String getInlineClassReference(InlineClass node) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node == null) return '<No InlineClass>';
|
||||
String name = getInlineClassName(node);
|
||||
String library = getLibraryReference(node.enclosingLibrary);
|
||||
return '$library::$name';
|
||||
}
|
||||
|
||||
String getTypedefReference(Typedef node) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node == null) return '<No Typedef>';
|
||||
String library = getLibraryReference(node.enclosingLibrary);
|
||||
return '$library::${node.name}';
|
||||
}
|
||||
|
@ -383,14 +367,10 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
|
||||
Name getMemberName(Member node) {
|
||||
if (node.name.text == '') return emptyName;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node.name != null) return node.name;
|
||||
return new Name(syntheticNames.nameMember(node));
|
||||
return node.name;
|
||||
}
|
||||
|
||||
String getMemberReference(Member node) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node == null) return '<No Member>';
|
||||
String name = getMemberName(node).text;
|
||||
Class? enclosingClass = node.enclosingClass;
|
||||
if (enclosingClass != null) {
|
||||
|
@ -407,8 +387,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
}
|
||||
|
||||
String getVariableReference(VariableDeclaration node) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node == null) return '<No VariableDeclaration>';
|
||||
return getVariableName(node);
|
||||
}
|
||||
|
||||
|
@ -417,8 +395,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
}
|
||||
|
||||
String getTypeParameterReference(TypeParameter node) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node == null) return '<No TypeParameter>';
|
||||
String name = getTypeParameterName(node);
|
||||
TreeNode? parent = node.parent;
|
||||
if (parent is FunctionNode && parent.parent is Member) {
|
||||
|
@ -587,11 +563,8 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
if (name != null) {
|
||||
writeWord(name);
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (library.importUri != null) {
|
||||
writeSpaced('from');
|
||||
writeWord('"${library.importUri}"');
|
||||
}
|
||||
writeSpaced('from');
|
||||
writeWord('"${library.importUri}"');
|
||||
String prefix = syntheticNames.nameLibraryPrefix(library);
|
||||
writeSpaced('as');
|
||||
writeWord(prefix);
|
||||
|
@ -716,33 +689,16 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
}
|
||||
|
||||
void writeType(DartType type) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (type == null) {
|
||||
write('<No DartType>');
|
||||
} else {
|
||||
type.accept(this);
|
||||
}
|
||||
}
|
||||
|
||||
void writeOptionalType(DartType type) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (type != null) {
|
||||
type.accept(this);
|
||||
}
|
||||
type.accept(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void visitSupertype(Supertype type) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (type == null) {
|
||||
write('<No Supertype>');
|
||||
} else {
|
||||
writeClassReferenceFromReference(type.className);
|
||||
if (type.typeArguments.isNotEmpty) {
|
||||
writeSymbol('<');
|
||||
writeList(type.typeArguments, writeType);
|
||||
writeSymbol('>');
|
||||
}
|
||||
writeClassReferenceFromReference(type.className);
|
||||
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) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (type == null) return;
|
||||
writeSpaced('→');
|
||||
writeAnnotatedType(type, annotation);
|
||||
}
|
||||
|
@ -976,8 +930,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
}
|
||||
|
||||
String getClassReferenceFromReference(Reference reference) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (reference == null) return '<No Class>';
|
||||
if (reference.node != null) return getClassReference(reference.asClass);
|
||||
if (reference.canonicalName != null) {
|
||||
return getCanonicalNameString(reference.canonicalName!);
|
||||
|
@ -990,8 +942,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
}
|
||||
|
||||
String getExtensionReferenceFromReference(Reference reference) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (reference == null) return '<No Extension>';
|
||||
if (reference.node != null) {
|
||||
return getExtensionReference(reference.asExtension);
|
||||
}
|
||||
|
@ -1006,8 +956,6 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
}
|
||||
|
||||
String getInlineClassReferenceFromReference(Reference reference) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (reference == null) return '<No Extension>';
|
||||
if (reference.node != null) {
|
||||
return getInlineClassReference(reference.asInlineClass);
|
||||
}
|
||||
|
@ -1932,12 +1880,9 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
writeWord('const');
|
||||
writeSpace();
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node.typeArgument != null) {
|
||||
writeSymbol('<');
|
||||
writeType(node.typeArgument);
|
||||
writeSymbol('>');
|
||||
}
|
||||
writeSymbol('<');
|
||||
writeType(node.typeArgument);
|
||||
writeSymbol('>');
|
||||
writeSymbol('[');
|
||||
writeList(node.expressions, writeNode);
|
||||
writeSymbol(']');
|
||||
|
@ -1949,12 +1894,9 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
writeWord('const');
|
||||
writeSpace();
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node.typeArgument != null) {
|
||||
writeSymbol('<');
|
||||
writeType(node.typeArgument);
|
||||
writeSymbol('>');
|
||||
}
|
||||
writeSymbol('<');
|
||||
writeType(node.typeArgument);
|
||||
writeSymbol('>');
|
||||
writeSymbol('{');
|
||||
writeList(node.expressions, writeNode);
|
||||
writeSymbol('}');
|
||||
|
@ -1966,12 +1908,9 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
writeWord('const');
|
||||
writeSpace();
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node.keyType != null) {
|
||||
writeSymbol('<');
|
||||
writeList([node.keyType, node.valueType], writeType);
|
||||
writeSymbol('>');
|
||||
}
|
||||
writeSymbol('<');
|
||||
writeList([node.keyType, node.valueType], writeType);
|
||||
writeSymbol('>');
|
||||
writeSymbol('{');
|
||||
writeList(node.entries, writeNode);
|
||||
writeSymbol('}');
|
||||
|
@ -2172,12 +2111,9 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
}
|
||||
|
||||
void writeStaticType(DartType type) {
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (type != null) {
|
||||
writeSymbol('{');
|
||||
writeType(type);
|
||||
writeSymbol('}');
|
||||
}
|
||||
writeSymbol('{');
|
||||
writeType(type);
|
||||
writeSymbol('}');
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -2533,12 +2469,9 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
@override
|
||||
void visitCatch(Catch node) {
|
||||
writeIndentation();
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node.guard != null) {
|
||||
writeWord('on');
|
||||
writeType(node.guard);
|
||||
writeSpace();
|
||||
}
|
||||
writeWord('on');
|
||||
writeType(node.guard);
|
||||
writeSpace();
|
||||
writeWord('catch');
|
||||
writeSymbol('(');
|
||||
VariableDeclaration? exception = node.exception;
|
||||
|
@ -2590,13 +2523,7 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
writeAnnotationList(node.variable.annotations);
|
||||
writeIndentation();
|
||||
writeWord('function');
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (node.function != null) {
|
||||
writeFunction(node.function, name: getVariableName(node.variable));
|
||||
} else {
|
||||
writeWord(getVariableName(node.variable));
|
||||
endLine('...;');
|
||||
}
|
||||
writeFunction(node.function, name: getVariableName(node.variable));
|
||||
}
|
||||
|
||||
void writeVariableDeclaration(VariableDeclaration node,
|
||||
|
@ -2624,14 +2551,7 @@ class Printer extends Visitor<void> with VisitorVoidMixin {
|
|||
!node.hasDeclaredInitializer) {
|
||||
writeModifier(node.hasDeclaredInitializer, 'has-no-declared-initializer');
|
||||
}
|
||||
// ignore: unnecessary_null_comparison
|
||||
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');
|
||||
}
|
||||
writeAnnotatedType(node.type, annotator?.annotateVariable(this, node));
|
||||
writeWord(getVariableName(node));
|
||||
Expression? initializer = node.initializer;
|
||||
if (initializer != null) {
|
||||
|
|
|
@ -368,8 +368,7 @@ class WidgetCreatorTracker {
|
|||
bool foundLocationClass = false;
|
||||
for (Library library in libraries) {
|
||||
final Uri importUri = library.importUri;
|
||||
// ignore: unnecessary_null_comparison
|
||||
if (importUri != null && importUri.isScheme('package')) {
|
||||
if (importUri.isScheme('package')) {
|
||||
if (importUri.path == 'flutter/src/widgets/framework.dart') {
|
||||
for (Class class_ in library.classes) {
|
||||
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