Skip to content

Commit 2366a35

Browse files
stereotype441Commit Queue
authored and
Commit Queue
committed
Clean up hacky code in Parser.parseTopLevelMethod
This hack was needed to cover a short time period in 2020 where an improvement to flow analysis had landed in master but hadn't yet landed in the checked-in SDK that is used for presubmit checks. We are long past needing it anymore. Change-Id: I0d0cd3d4d9829cc4b0798a07feaac09bb4929f31 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291841 Reviewed-by: Jens Johansen <[email protected]> Commit-Queue: Paul Berry <[email protected]>
1 parent 591e92c commit 2366a35

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3684,25 +3684,10 @@ class Parser {
36843684
if (getOrSet != null && !inPlainSync && optional("set", getOrSet)) {
36853685
reportRecoverableError(asyncToken, codes.messageSetterNotSync);
36863686
}
3687-
// TODO(paulberry): code below is slightly hacky to allow for implementing
3688-
// the feature "Infer non-nullability from local boolean variables"
3689-
// (https://github.com/dart-lang/language/issues/1274). Since the version
3690-
// of Dart that is used for presubmit checks lags slightly behind master,
3691-
// we need the code to analyze correctly regardless of whether local boolean
3692-
// variables cause promotion or not. Once the version of dart used for
3693-
// presubmit checks has been updated, this can be cleaned up to:
3694-
// bool isExternal = externalToken != null;
3695-
// if (externalToken != null && !optional(';', token.next!)) {
3696-
// reportRecoverableError(
3697-
// externalToken, codes.messageExternalMethodWithBody);
3698-
// }
3699-
bool isExternal = false;
3700-
if (externalToken != null) {
3701-
isExternal = true;
3702-
if (!optional(';', token.next!)) {
3703-
reportRecoverableError(
3704-
externalToken, codes.messageExternalMethodWithBody);
3705-
}
3687+
bool isExternal = externalToken != null;
3688+
if (isExternal && !optional(';', token.next!)) {
3689+
reportRecoverableError(
3690+
externalToken, codes.messageExternalMethodWithBody);
37063691
}
37073692
token = parseFunctionBody(
37083693
token, /* ofFunctionExpression = */ false, isExternal);

0 commit comments

Comments
 (0)