Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug where comments were incorrectly forbidden in some cases #2264

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per the lint error, I think this is missing a changelog update

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
Loading