Skip to content

Commit

Permalink
Remove some dead code (#1565)
Browse files Browse the repository at this point in the history
This change preserves behavior, though the current behavior has the
appearance of a bug so an author more familiar with the intention may
want to add a test.

There are no assignments to `first` so the conditional can be removed.
When building internally the analyze is surfacing a `dead_code`
diagnostic which needs to be ignored. Fixing the code will allow us to
remove the ignore.

I don't know why the diagnostic does not show up when analyzing using
the external analyzer.
dart-lang/sdk#47837
  • Loading branch information
natebosch committed Dec 11, 2021
1 parent 1798a7c commit 6b35eb6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/src/ast/sass/statement/if_rule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import 'package:collection/collection.dart';
import 'package:meta/meta.dart';
import 'package:source_span/source_span.dart';

Expand Down Expand Up @@ -41,10 +42,9 @@ class IfRule implements Statement {
T accept<T>(StatementVisitor<T> visitor) => visitor.visitIfRule(this);

String toString() {
var first = true;
var result = clauses
.map((clause) =>
"@${first ? 'if' : 'else if'} {${clause.children.join(' ')}}")
.mapIndexed((index, clause) =>
"@${index == 0 ? 'if' : 'else if'} {${clause.children.join(' ')}}")
.join(' ');

var lastClause = this.lastClause;
Expand Down

0 comments on commit 6b35eb6

Please sign in to comment.