mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-26 20:24:42 +01:00
Improve the deprecation message for /-as-division (#1561)
This also changes the string representation of ParenthesizedExpression to fix the recommendations involving them (otherwise the calc recommendation would be an invalid one). Co-authored-by: Natalie Weizenbaum <nweiz@google.com>
This commit is contained in:
parent
97c51d6285
commit
3e231f784b
@ -1,5 +1,7 @@
|
|||||||
## 1.44.0
|
## 1.44.0
|
||||||
|
|
||||||
|
* Suggest `calc()` as an alternative in `/`-as-division deprecation messages.
|
||||||
|
|
||||||
### Dart API
|
### Dart API
|
||||||
|
|
||||||
* Add `SassNumber.convert()` and `SassNumber.convertValue()`. These work like
|
* Add `SassNumber.convert()` and `SassNumber.convertValue()`. These work like
|
||||||
|
@ -23,5 +23,5 @@ class ParenthesizedExpression implements Expression {
|
|||||||
T accept<T>(ExpressionVisitor<T> visitor) =>
|
T accept<T>(ExpressionVisitor<T> visitor) =>
|
||||||
visitor.visitParenthesizedExpression(this);
|
visitor.visitParenthesizedExpression(this);
|
||||||
|
|
||||||
String toString() => expression.toString();
|
String toString() => "($expression)";
|
||||||
}
|
}
|
||||||
|
@ -2125,16 +2125,18 @@ class _EvaluateVisitor
|
|||||||
expression.operator == BinaryOperator.dividedBy) {
|
expression.operator == BinaryOperator.dividedBy) {
|
||||||
return "math.div(${recommendation(expression.left)}, "
|
return "math.div(${recommendation(expression.left)}, "
|
||||||
"${recommendation(expression.right)})";
|
"${recommendation(expression.right)})";
|
||||||
|
} else if (expression is ParenthesizedExpression) {
|
||||||
|
return expression.expression.toString();
|
||||||
} else {
|
} else {
|
||||||
return expression.toString();
|
return expression.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_warn(
|
_warn(
|
||||||
"Using / for division is deprecated and will be removed in "
|
"Using / for division outside of calc() is deprecated "
|
||||||
"Dart Sass 2.0.0.\n"
|
"and will be removed in Dart Sass 2.0.0.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Recommendation: ${recommendation(node)}\n"
|
"Recommendation: ${recommendation(node)} or calc($node)\n"
|
||||||
"\n"
|
"\n"
|
||||||
"More info and automated migrator: "
|
"More info and automated migrator: "
|
||||||
"https://sass-lang.com/d/slash-div",
|
"https://sass-lang.com/d/slash-div",
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
// DO NOT EDIT. This file was generated from async_evaluate.dart.
|
// DO NOT EDIT. This file was generated from async_evaluate.dart.
|
||||||
// See tool/grind/synchronize.dart for details.
|
// See tool/grind/synchronize.dart for details.
|
||||||
//
|
//
|
||||||
// Checksum: 75f2c75c86bcf5397b054a6e88d94e44e59512cf
|
// Checksum: 96397ede2c79b09005bbac9a013d4a6b42faf736
|
||||||
//
|
//
|
||||||
// ignore_for_file: unused_import
|
// ignore_for_file: unused_import
|
||||||
|
|
||||||
@ -2115,16 +2115,18 @@ class _EvaluateVisitor
|
|||||||
expression.operator == BinaryOperator.dividedBy) {
|
expression.operator == BinaryOperator.dividedBy) {
|
||||||
return "math.div(${recommendation(expression.left)}, "
|
return "math.div(${recommendation(expression.left)}, "
|
||||||
"${recommendation(expression.right)})";
|
"${recommendation(expression.right)})";
|
||||||
|
} else if (expression is ParenthesizedExpression) {
|
||||||
|
return expression.expression.toString();
|
||||||
} else {
|
} else {
|
||||||
return expression.toString();
|
return expression.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_warn(
|
_warn(
|
||||||
"Using / for division is deprecated and will be removed in "
|
"Using / for division outside of calc() is deprecated "
|
||||||
"Dart Sass 2.0.0.\n"
|
"and will be removed in Dart Sass 2.0.0.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Recommendation: ${recommendation(node)}\n"
|
"Recommendation: ${recommendation(node)} or calc($node)\n"
|
||||||
"\n"
|
"\n"
|
||||||
"More info and automated migrator: "
|
"More info and automated migrator: "
|
||||||
"https://sass-lang.com/d/slash-div",
|
"https://sass-lang.com/d/slash-div",
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
## 1.0.0-beta.20
|
||||||
|
|
||||||
|
* No user-visible changes.
|
||||||
|
|
||||||
## 1.0.0-beta.19
|
## 1.0.0-beta.19
|
||||||
|
|
||||||
* No user-visible changes.
|
* No user-visible changes.
|
||||||
|
@ -2,7 +2,7 @@ name: sass_api
|
|||||||
# Note: Every time we add a new Sass AST node, we need to bump the *major*
|
# 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
|
# version because it's a breaking change for anyone who's implementing the
|
||||||
# visitor interface(s).
|
# visitor interface(s).
|
||||||
version: 1.0.0-beta.19
|
version: 1.0.0-beta.20
|
||||||
description: Additional APIs for Dart Sass.
|
description: Additional APIs for Dart Sass.
|
||||||
homepage: https://github.com/sass/dart-sass
|
homepage: https://github.com/sass/dart-sass
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: sass
|
name: sass
|
||||||
version: 1.44.0-dev
|
version: 1.44.0
|
||||||
description: A Sass implementation in Dart.
|
description: A Sass implementation in Dart.
|
||||||
homepage: https://github.com/sass/dart-sass
|
homepage: https://github.com/sass/dart-sass
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user