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

Print the values of deprecated numbers passed to color functions #1184

Merged
merged 1 commit into from Jan 6, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,8 @@
## 1.32.2

* Print the actual number that was received in unit deprecation warnings for
color functions.

## 1.32.1

* Don't emit permissions errors on Windows and OS X when trying to determine the
Expand Down
13 changes: 8 additions & 5 deletions lib/src/functions/color.dart
Expand Up @@ -233,7 +233,8 @@ final module = BuiltInModule("color", functions: [

var result = _functionString("invert", arguments.take(1));
warn(
"Passing a number to color.invert() is deprecated.\n"
"Passing a number (${arguments[0]}) to color.invert() is "
"deprecated.\n"
"\n"
"Recommendation: $result",
deprecation: true);
Expand All @@ -259,7 +260,8 @@ final module = BuiltInModule("color", functions: [
if (arguments[0] is SassNumber) {
var result = _functionString("grayscale", arguments.take(1));
warn(
"Passing a number to color.grayscale() is deprecated.\n"
"Passing a number (${arguments[0]}) to color.grayscale() is "
"deprecated.\n"
"\n"
"Recommendation: $result",
deprecation: true);
Expand Down Expand Up @@ -347,7 +349,8 @@ final module = BuiltInModule("color", functions: [
if (arguments[0] is SassNumber) {
var result = _functionString("opacity", arguments);
warn(
"Passing a number to color.opacity() is deprecated.\n"
"Passing a number (${arguments[0]} to color.opacity() is "
"deprecated.\n"
"\n"
"Recommendation: $result",
deprecation: true);
Expand Down Expand Up @@ -635,7 +638,7 @@ void _checkAngle(SassNumber angle, [String name]) {
if (!angle.hasUnits || angle.hasUnit('deg')) return;

var message = StringBuffer()
..writeln("\$$name: Passing a unit other than deg is deprecated.")
..writeln("\$$name: Passing a unit other than deg ($angle) is deprecated.")
..writeln();

if (angle.compatibleWithUnit('deg')) {
Expand Down Expand Up @@ -667,7 +670,7 @@ void _checkPercent(SassNumber number, String name) {
if (number.hasUnit('%')) return;

warn(
"\$$name: Passing a number without unit % is deprecated.\n"
"\$$name: Passing a number without unit % ($number) is deprecated.\n"
"\n"
"To preserve current behavior: \$$name${_removeUnits(number)} * 1%",
deprecation: true);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,5 +1,5 @@
name: sass
version: 1.32.1
version: 1.32.2
description: A Sass implementation in Dart.
author: Sass Team
homepage: https://github.com/sass/dart-sass
Expand Down