Skip to content

Commit 5e8b254

Browse files
Delete unreachable default clauses. (#3209)
The Dart analyzer will soon be changed so that if the `default` clause of a `switch` statement is determined to be unreachable by the exhaustiveness checker, a new warning of type `unreachable_switch_default` will be issued. This parallels the behavior of the existing `unreachable_switch_case` warning, which is issued whenever a `case` clause of a `switch` statement is determined to be unreachable. For details see dart-lang/sdk#54575. This PR deletes unreachable `default` clauses from `drift` now, to avoid spurious warnings when the analyzer change lands. --------- Co-authored-by: Simon Binder <[email protected]>
1 parent 74af262 commit 5e8b254

File tree

2 files changed

+0
-7
lines changed

2 files changed

+0
-7
lines changed

drift/lib/src/runtime/executor/helpers/engines.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,16 +493,12 @@ class DelegatedDatabase extends _BaseExecutor {
493493
@override
494494
// ignore: library_private_types_in_public_api
495495
TransactionExecutor beginTransactionInContext(_BaseExecutor context) {
496-
final transactionDelegate = delegate.transactionDelegate;
497-
498496
switch (delegate.transactionDelegate) {
499497
case NoTransactionDelegate noTransactionDelegate:
500498
return _StatementBasedTransactionExecutor(
501499
this, context, noTransactionDelegate);
502500
case SupportedTransactionDelegate supported:
503501
return _WrappingTransactionExecutor(this, supported);
504-
default:
505-
throw StateError('Unknown transaction delegate: $transactionDelegate');
506502
}
507503
}
508504

sqlparser/lib/utils/node_to_text.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,6 @@ class NodeSqlBuilder extends AstVisitor<void, void> {
403403
keyword(TokenType.instead);
404404
keyword(TokenType.of);
405405
break;
406-
default:
407-
// Can happen if e.mode == null
408-
break;
409406
}
410407

411408
visit(e.target, arg);

0 commit comments

Comments
 (0)