Skip to content

Commit

Permalink
Fix IsCalculationSafe.visitBinaryOperationExpression
Browse files Browse the repository at this point in the history
This was previously checking whether *either* operator was
calculation-safe, when in fact it should check that *both* are.

Closes #2523
  • Loading branch information
nex3 committed Feb 25, 2025
1 parent c540875 commit 617e043
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## 1.85.1-dev
## 1.85.1

* No user-visible changes.
* Fix a bug where global Sass functions whose names overlap with CSS math
functions could incorrectly be treated as CSS math functions even though they
used Sass-only features, causing compilation failures. For example,
`round(-$var / 2)` previously threw an error but now works as intended.

## 1.85.0

Expand Down
3 changes: 2 additions & 1 deletion lib/src/visitor/is_calculation_safe.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class IsCalculationSafeVisitor implements ExpressionVisitor<bool> {
BinaryOperator.plus,
BinaryOperator.minus,
}).contains(node.operator) &&
(node.left.accept(this) || node.right.accept(this));
node.left.accept(this) &&
node.right.accept(this);

bool visitBooleanExpression(BooleanExpression node) => false;

Expand Down
2 changes: 1 addition & 1 deletion pkg/sass-parser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 0.4.15-dev
## 0.4.15

* Add support for parsing list expressions.

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.15-dev",
"version": "0.4.15",
"description": "A PostCSS-compatible wrapper of the official Sass parser",
"repository": "sass/sass",
"author": "Google Inc.",
Expand Down
2 changes: 1 addition & 1 deletion pkg/sass_api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 15.2.1-dev
## 15.2.1

* No user-visible changes.

Expand Down
2 changes: 1 addition & 1 deletion pkg/sass_api/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ 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.2.1-dev
version: 15.2.1
description: Additional APIs for Dart Sass.
homepage: https://github.com/sass/dart-sass

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.85.1-dev
version: 1.85.1
description: A Sass implementation in Dart.
homepage: https://github.com/sass/dart-sass

Expand Down

0 comments on commit 617e043

Please sign in to comment.