Skip to content

Commit

Permalink
Fix source span for calculation deprecation warnings (#2084)
Browse files Browse the repository at this point in the history
Co-authored-by: Natalie Weizenbaum <[email protected]>
  • Loading branch information
ntkme and nex3 authored Sep 15, 2023
1 parent 7370d6a commit 37e0ed5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.67.1

* Fix the source spans associated with the `abs-percent` deprecation.

## 1.67.0

* All functions defined in CSS Values and Units 4 are now once again parsed as
Expand Down
5 changes: 5 additions & 0 deletions lib/src/visitor/async_evaluate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2431,6 +2431,9 @@ final class _EvaluateVisitor
return SassCalculation.unsimplified(node.name, arguments);
}

var oldCallableNode = _callableNode;
_callableNode = node;

try {
return switch (node.name.toLowerCase()) {
"calc" => SassCalculation.calc(arguments[0]),
Expand Down Expand Up @@ -2471,6 +2474,8 @@ final class _EvaluateVisitor
_verifyCompatibleNumbers(arguments, node.arguments.positional);
}
throwWithTrace(_exception(error.message, node.span), error, stackTrace);
} finally {
_callableNode = oldCallableNode;
}
}

Expand Down
7 changes: 6 additions & 1 deletion lib/src/visitor/evaluate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// DO NOT EDIT. This file was generated from async_evaluate.dart.
// See tool/grind/synchronize.dart for details.
//
// Checksum: ccd4ec1a65cfc2487fccd30481d427086f5c76cc
// Checksum: 7669de19668af665d1a9a60cf67e53e071bf415e
//
// ignore_for_file: unused_import

Expand Down Expand Up @@ -2411,6 +2411,9 @@ final class _EvaluateVisitor
return SassCalculation.unsimplified(node.name, arguments);
}

var oldCallableNode = _callableNode;
_callableNode = node;

try {
return switch (node.name.toLowerCase()) {
"calc" => SassCalculation.calc(arguments[0]),
Expand Down Expand Up @@ -2451,6 +2454,8 @@ final class _EvaluateVisitor
_verifyCompatibleNumbers(arguments, node.arguments.positional);
}
throwWithTrace(_exception(error.message, node.span), error, stackTrace);
} finally {
_callableNode = oldCallableNode;
}
}

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

Expand Down

0 comments on commit 37e0ed5

Please sign in to comment.