Skip to content

Commit

Permalink
Code review/static analysis fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Oct 11, 2024
1 parent 23690dc commit cd7631e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 12 additions & 13 deletions lib/src/parse/sass.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit cd7631e

Please sign in to comment.