Skip to content

Properly add ParenthesizedExpression for comma-separated lists #2583

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

Merged
merged 2 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.89.1

* No user-visible changes.

## 1.89.0

* Allow the Node package importer to load files even when there are multiple
Expand Down
8 changes: 5 additions & 3 deletions lib/src/parse/stylesheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2396,6 +2396,7 @@ abstract class StylesheetParser extends Parser {
var start = scanner.state;
scanner.expectChar($lparen);
whitespace(consumeNewlines: true);
var inside = scanner.state;
if (!_lookingAtExpression()) {
scanner.expectChar($rparen);
return ListExpression(
Expand Down Expand Up @@ -2425,12 +2426,13 @@ abstract class StylesheetParser extends Parser {
whitespace(consumeNewlines: true);
}

scanner.expectChar($rparen);
return ListExpression(
var list = ListExpression(
expressions,
ListSeparator.comma,
scanner.spanFrom(start),
scanner.spanFrom(inside),
);
scanner.expectChar($rparen);
return ParenthesizedExpression(list, scanner.spanFrom(start));
} finally {
_inParentheses = wasInParentheses;
}
Expand Down
7 changes: 7 additions & 0 deletions pkg/sass-parser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.4.23

* Update types for compatibility with the latest PostCSS.

* **Potentially-breaking bug fix**: parenthesized, comma-separated lists are now
correctly wrapped in a `ParenthesizedExpression`.

## 0.4.22

* No user-visible changes.
Expand Down
7 changes: 6 additions & 1 deletion pkg/sass-parser/lib/src/node.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ declare abstract class Node
opts?: Pick<postcss.WarningOptions, 'index' | 'word'>,
): postcss.Position;
positionInside(index: number): postcss.Position;
rangeBy(opts?: Pick<postcss.WarningOptions, 'endIndex' | 'index' | 'word'>): {
rangeBy(
opts?: Pick<
postcss.WarningOptions,
'end' | 'endIndex' | 'index' | 'start' | 'word'
>,
): {
start: postcss.Position;
end: postcss.Position;
};
Expand Down
2 changes: 1 addition & 1 deletion pkg/sass-parser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sass-parser",
"version": "0.4.22",
"version": "0.4.23",
"description": "A PostCSS-compatible wrapper of the official Sass parser",
"repository": "sass/sass",
"author": "Google Inc.",
Expand Down
5 changes: 5 additions & 0 deletions pkg/sass_api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 15.7.0

* **Potentially-breaking bug fix**: parenthesized, comma-separated lists are now
correctly wrapped in a `ParenthesizedExpression`.

## 15.6.0

* 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: 15.6.0
version: 15.7.0
description: Additional APIs for Dart Sass.
homepage: https://github.com/sass/dart-sass

environment:
sdk: ">=3.6.0 <4.0.0"

dependencies:
sass: 1.89.0
sass: 1.89.1

dev_dependencies:
dartdoc: ^8.0.14
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.89.0
version: 1.89.1
description: A Sass implementation in Dart.
homepage: https://github.com/sass/dart-sass

Expand Down