Skip to content

Commit

Permalink
Fix a bug where comments were incorrectly forbidden in some cases (#2264
Browse files Browse the repository at this point in the history
)
  • Loading branch information
nex3 committed Jun 17, 2024
1 parent cf6f9d0 commit 7aae1e6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.77.6

* Fix a few cases where comments and occasionally even whitespace wasn't allowed
between the end of Sass statements and the following semicolon.

## 1.77.5

* Fully trim redundant selectors generated by `@extend`.
Expand Down
20 changes: 14 additions & 6 deletions lib/src/parse/stylesheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,15 @@ abstract class StylesheetParser extends Parser {
scanner.spanFrom(start));
}

var beforeWhitespace = scanner.location;
whitespace();
var arguments = scanner.peekChar() == $lparen
? _argumentInvocation(mixin: true)
: ArgumentInvocation.empty(scanner.emptySpan);
ArgumentInvocation arguments;
if (scanner.peekChar() == $lparen) {
arguments = _argumentInvocation(mixin: true);
whitespace();
} else {
arguments = ArgumentInvocation.empty(beforeWhitespace.pointSpan());
}

expectStatementSeparator("@content rule");
return ContentRule(arguments, scanner.spanFrom(start));
Expand Down Expand Up @@ -835,7 +840,10 @@ abstract class StylesheetParser extends Parser {

var value = almostAnyValue();
var optional = scanner.scanChar($exclamation);
if (optional) expectIdentifier("optional");
if (optional) {
expectIdentifier("optional");
whitespace();
}
expectStatementSeparator("@extend rule");
return ExtendRule(value, scanner.spanFrom(start), optional: optional);
}
Expand Down Expand Up @@ -954,6 +962,7 @@ abstract class StylesheetParser extends Parser {
}

var configuration = _configuration(allowGuarded: true);
whitespace();

expectStatementSeparator("@forward rule");
var span = scanner.spanFrom(start);
Expand Down Expand Up @@ -1419,8 +1428,7 @@ abstract class StylesheetParser extends Parser {
var namespace = _useNamespace(url, start);
whitespace();
var configuration = _configuration();

expectStatementSeparator("@use rule");
whitespace();

var span = scanner.spanFrom(start);
if (!_isUseAllowed) {
Expand Down
4 changes: 4 additions & 0 deletions pkg/sass_api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 10.4.6

* No user-visible changes.

## 10.4.5

* No user-visible changes.
Expand Down
4 changes: 2 additions & 2 deletions pkg/sass_api/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ name: sass_api
# Note: Every time we add a new Sass AST node, we need to bump the *major*
# version because it's a breaking change for anyone who's implementing the
# visitor interface(s).
version: 10.4.5
version: 10.4.6
description: Additional APIs for Dart Sass.
homepage: https://github.com/sass/dart-sass

environment:
sdk: ">=3.0.0 <4.0.0"

dependencies:
sass: 1.77.5
sass: 1.77.6

dev_dependencies:
dartdoc: ">=6.0.0 <9.0.0"
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: sass
version: 1.77.5
version: 1.77.6
description: A Sass implementation in Dart.
homepage: https://github.com/sass/dart-sass

Expand Down

0 comments on commit 7aae1e6

Please sign in to comment.