Remove unnecessary null checks in dev/benchmarks (#118840)

* Remove unnecessary null checks in dev/benchmarks

* empty
This commit is contained in:
Michael Goderbauer
2023-01-19 20:04:11 -08:00
committed by GitHub
parent ec51d3271e
commit 54217bd4b1
13 changed files with 18 additions and 69 deletions

View File

@@ -83,11 +83,9 @@ Iterable<InlineSpanSemanticsInformation> combineSemanticsInfoSyncStar(List<Inlin
String? workingLabel;
for (final InlineSpanSemanticsInformation info in inputs) {
if (info.requiresOwnNode) {
if (workingText != null) {
yield InlineSpanSemanticsInformation(workingText, semanticsLabel: workingLabel ?? workingText);
workingText = '';
workingLabel = null;
}
yield InlineSpanSemanticsInformation(workingText, semanticsLabel: workingLabel ?? workingText);
workingText = '';
workingLabel = null;
yield info;
} else {
workingText += info.text;
@@ -100,11 +98,7 @@ Iterable<InlineSpanSemanticsInformation> combineSemanticsInfoSyncStar(List<Inlin
}
}
}
if (workingText != null) {
yield InlineSpanSemanticsInformation(workingText, semanticsLabel: workingLabel);
} else {
assert(workingLabel != null);
}
assert(workingLabel != null);
}
Iterable<InlineSpanSemanticsInformation> combineSemanticsInfoList(List<InlineSpanSemanticsInformation> inputs) {
@@ -113,11 +107,9 @@ Iterable<InlineSpanSemanticsInformation> combineSemanticsInfoList(List<InlineSpa
final List<InlineSpanSemanticsInformation> result = <InlineSpanSemanticsInformation>[];
for (final InlineSpanSemanticsInformation info in inputs) {
if (info.requiresOwnNode) {
if (workingText != null) {
result.add(InlineSpanSemanticsInformation(workingText, semanticsLabel: workingLabel ?? workingText));
workingText = '';
workingLabel = null;
}
result.add(InlineSpanSemanticsInformation(workingText, semanticsLabel: workingLabel ?? workingText));
workingText = '';
workingLabel = null;
result.add(info);
} else {
workingText += info.text;
@@ -130,10 +122,6 @@ Iterable<InlineSpanSemanticsInformation> combineSemanticsInfoList(List<InlineSpa
}
}
}
if (workingText != null) {
result.add(InlineSpanSemanticsInformation(workingText, semanticsLabel: workingLabel));
} else {
assert(workingLabel != null);
}
assert(workingLabel != null);
return result;
}