Skip to content

Commit 7aae1e6

Browse files
authored
Fix a bug where comments were incorrectly forbidden in some cases (#2264)
1 parent cf6f9d0 commit 7aae1e6

File tree

5 files changed

+26
-9
lines changed

5 files changed

+26
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.77.6
2+
3+
* Fix a few cases where comments and occasionally even whitespace wasn't allowed
4+
between the end of Sass statements and the following semicolon.
5+
16
## 1.77.5
27

38
* Fully trim redundant selectors generated by `@extend`.

lib/src/parse/stylesheet.dart

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -770,10 +770,15 @@ abstract class StylesheetParser extends Parser {
770770
scanner.spanFrom(start));
771771
}
772772

773+
var beforeWhitespace = scanner.location;
773774
whitespace();
774-
var arguments = scanner.peekChar() == $lparen
775-
? _argumentInvocation(mixin: true)
776-
: ArgumentInvocation.empty(scanner.emptySpan);
775+
ArgumentInvocation arguments;
776+
if (scanner.peekChar() == $lparen) {
777+
arguments = _argumentInvocation(mixin: true);
778+
whitespace();
779+
} else {
780+
arguments = ArgumentInvocation.empty(beforeWhitespace.pointSpan());
781+
}
777782

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

836841
var value = almostAnyValue();
837842
var optional = scanner.scanChar($exclamation);
838-
if (optional) expectIdentifier("optional");
843+
if (optional) {
844+
expectIdentifier("optional");
845+
whitespace();
846+
}
839847
expectStatementSeparator("@extend rule");
840848
return ExtendRule(value, scanner.spanFrom(start), optional: optional);
841849
}
@@ -954,6 +962,7 @@ abstract class StylesheetParser extends Parser {
954962
}
955963

956964
var configuration = _configuration(allowGuarded: true);
965+
whitespace();
957966

958967
expectStatementSeparator("@forward rule");
959968
var span = scanner.spanFrom(start);
@@ -1419,8 +1428,7 @@ abstract class StylesheetParser extends Parser {
14191428
var namespace = _useNamespace(url, start);
14201429
whitespace();
14211430
var configuration = _configuration();
1422-
1423-
expectStatementSeparator("@use rule");
1431+
whitespace();
14241432

14251433
var span = scanner.spanFrom(start);
14261434
if (!_isUseAllowed) {

pkg/sass_api/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 10.4.6
2+
3+
* No user-visible changes.
4+
15
## 10.4.5
26

37
* No user-visible changes.

pkg/sass_api/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: sass_api
22
# Note: Every time we add a new Sass AST node, we need to bump the *major*
33
# version because it's a breaking change for anyone who's implementing the
44
# visitor interface(s).
5-
version: 10.4.5
5+
version: 10.4.6
66
description: Additional APIs for Dart Sass.
77
homepage: https://github.com/sass/dart-sass
88

99
environment:
1010
sdk: ">=3.0.0 <4.0.0"
1111

1212
dependencies:
13-
sass: 1.77.5
13+
sass: 1.77.6
1414

1515
dev_dependencies:
1616
dartdoc: ">=6.0.0 <9.0.0"

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.77.5
2+
version: 1.77.6
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

0 commit comments

Comments
 (0)