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 source span for calculation deprecation warnings #2084

Merged
merged 3 commits into from
Sep 15, 2023
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
9 changes: 8 additions & 1 deletion lib/src/visitor/async_evaluate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2431,8 +2431,12 @@ final class _EvaluateVisitor
return SassCalculation.unsimplified(node.name, arguments);
}

var oldCallableNode = _callableNode;
_callableNode = node;

Value result;
try {
return switch (node.name.toLowerCase()) {
result = switch (node.name.toLowerCase()) {
"calc" => SassCalculation.calc(arguments[0]),
"sqrt" => SassCalculation.sqrt(arguments[0]),
"sin" => SassCalculation.sin(arguments[0]),
Expand Down Expand Up @@ -2472,6 +2476,9 @@ final class _EvaluateVisitor
}
throwWithTrace(_exception(error.message, node.span), error, stackTrace);
}
_callableNode = oldCallableNode;
ntkme marked this conversation as resolved.
Show resolved Hide resolved

return result;
}

/// Verifies that the calculation [node] has the correct number of arguments.
Expand Down
11 changes: 9 additions & 2 deletions 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: db452638565e552a9310a99bc8573bf038d67d7d
//
// ignore_for_file: unused_import

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

var oldCallableNode = _callableNode;
_callableNode = node;

Value result;
try {
return switch (node.name.toLowerCase()) {
result = switch (node.name.toLowerCase()) {
"calc" => SassCalculation.calc(arguments[0]),
"sqrt" => SassCalculation.sqrt(arguments[0]),
"sin" => SassCalculation.sin(arguments[0]),
Expand Down Expand Up @@ -2452,6 +2456,9 @@ final class _EvaluateVisitor
}
throwWithTrace(_exception(error.message, node.span), error, stackTrace);
}
_callableNode = oldCallableNode;

return result;
}

/// Verifies that the calculation [node] has the correct number of arguments.
Expand Down