Skip to content

Commit 7382fe9

Browse files
stereotype441Commit Queue
authored andcommitted
Remove legacy support from shared type analyzer and flow analysis.
Now that the ability to run in "unsound null safety" mode has been removed (https://dart-review.googlesource.com/c/sdk/+/412881), it is safe to start removing the code that implements legacy (pre-null-safety) analysis. Change-Id: I7f998a081704030ce630d3c343185d0d41d4349a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/413524 Commit-Queue: Paul Berry <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent aeb2581 commit 7382fe9

File tree

11 files changed

+35
-1716
lines changed

11 files changed

+35
-1716
lines changed

pkg/_fe_analyzer_shared/lib/src/flow_analysis/flow_analysis.dart

Lines changed: 0 additions & 735 deletions
Large diffs are not rendered by default.

pkg/_fe_analyzer_shared/lib/src/type_inference/type_analyzer.dart

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -432,17 +432,13 @@ mixin TypeAnalyzer<
432432
if (!options.patternsEnabled) {
433433
Expression? switchScrutinee = context.switchScrutinee;
434434
if (switchScrutinee != null) {
435-
bool nullSafetyEnabled = options.nullSafetyEnabled;
436-
bool matches = nullSafetyEnabled
437-
? operations.isSubtypeOf(expressionType, matchedValueType)
438-
: operations.isAssignableTo(expressionType, matchedValueType);
435+
bool matches = operations.isSubtypeOf(expressionType, matchedValueType);
439436
if (!matches) {
440437
caseExpressionTypeMismatchError = errors.caseExpressionTypeMismatch(
441438
caseExpression: expression,
442439
scrutinee: switchScrutinee,
443440
caseExpressionType: expressionType,
444-
scrutineeType: matchedValueType,
445-
nullSafetyEnabled: nullSafetyEnabled);
441+
scrutineeType: matchedValueType);
446442
}
447443
}
448444
}
@@ -1974,7 +1970,6 @@ mixin TypeAnalyzer<
19741970
// n * Statement), where n = body.length
19751971
lastCaseTerminates = !flow.switchStatement_afterCase();
19761972
if (caseIndex < numCases - 1 &&
1977-
options.nullSafetyEnabled &&
19781973
!options.patternsEnabled &&
19791974
!lastCaseTerminates) {
19801975
(switchCaseCompletesNormallyErrors ??= {})[caseIndex] = errors
@@ -2580,8 +2575,7 @@ abstract class TypeAnalyzerErrors<
25802575
{required Expression scrutinee,
25812576
required Expression caseExpression,
25822577
required Type scrutineeType,
2583-
required Type caseExpressionType,
2584-
required bool nullSafetyEnabled});
2578+
required Type caseExpressionType});
25852579

25862580
/// Called for variable that is assigned more than once.
25872581
///
@@ -2727,14 +2721,10 @@ abstract class TypeAnalyzerErrorsBase {
27272721
///
27282722
/// The client is free to `implement` or `extend` this class.
27292723
class TypeAnalyzerOptions {
2730-
final bool nullSafetyEnabled;
2731-
27322724
final bool patternsEnabled;
27332725

27342726
final bool inferenceUpdate3Enabled;
27352727

27362728
TypeAnalyzerOptions(
2737-
{required this.nullSafetyEnabled,
2738-
required this.patternsEnabled,
2739-
required this.inferenceUpdate3Enabled});
2729+
{required this.patternsEnabled, required this.inferenceUpdate3Enabled});
27402730
}

0 commit comments

Comments
 (0)