From cd7631e9cad24dd7a83c7c604bb72a8dedceb52b Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Fri, 11 Oct 2024 16:35:09 -0700 Subject: [PATCH] Code review/static analysis fixes --- CHANGELOG.md | 2 +- lib/src/parse/sass.dart | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d4653894..f13ad457f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ * Fix a bug where Sass would add an extra `*/` after loud comments with whitespace after an explicit `*/` in the indented syntax. -* **Potentially breaking bug fxi:** Adding text after an explicit `*/` in the +* **Potentially breaking bug fix:** Adding text after an explicit `*/` in the indented syntax is now an error, rather than silently generating invalid CSS. ## 1.79.5 diff --git a/lib/src/parse/sass.dart b/lib/src/parse/sass.dart index 8b072c914..c8c6ae64a 100644 --- a/lib/src/parse/sass.dart +++ b/lib/src/parse/sass.dart @@ -217,7 +217,6 @@ class SassParser extends StylesheetParser { scanner.expect("/*"); var first = true; - var closed = false; var buffer = InterpolationBuffer()..write("/*"); var parentIndentation = currentIndentation; while (true) { @@ -264,25 +263,25 @@ class SassParser extends StylesheetParser { // For backwards compatibility, allow additional comments after // the initial comment is closed. - while (scanner.peekChar().isNewline && _peekIndentation() > parentIndentation) { - while (_lookingAtDoubleNewline()) { - _expectNewline(); - } - _readIndentation(); - whitespace(); + while (scanner.peekChar().isNewline && + _peekIndentation() > parentIndentation) { + while (_lookingAtDoubleNewline()) { + _expectNewline(); } + _readIndentation(); + whitespace(); + } if (!scanner.peekChar().isNewline) { var errorStart = scanner.state; while (!scanner.isDone && !scanner.peekChar().isNewline) { scanner.readChar(); } - throw new MultiSpanSassFormatException( - "Unexpected text after end of comment", - scanner.spanFrom(errorStart), - "extra text", - {span: "comment"} - ); + throw MultiSpanSassFormatException( + "Unexpected text after end of comment", + scanner.spanFrom(errorStart), + "extra text", + {span: "comment"}); } else { return LoudComment(buffer.interpolation(span)); }