mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-30 04:39:03 +01:00
Improve errors for alpha() with the wrong number of arguments
Closes #700
This commit is contained in:
parent
ed06a41afc
commit
9838caff6f
@ -4,6 +4,9 @@
|
||||
function is now `$amount`, to match the name in LibSass and originally in Ruby
|
||||
Sass.
|
||||
|
||||
* The `alpha()` function now produces clearer error messages when the wrong
|
||||
number of arguments are passed.
|
||||
|
||||
## 1.22.2
|
||||
|
||||
### JavaScript API
|
||||
|
@ -171,17 +171,23 @@ final global = UnmodifiableListView([
|
||||
return SassNumber(color.alpha);
|
||||
},
|
||||
r"$args...": (arguments) {
|
||||
if (arguments[0].asList.every((argument) =>
|
||||
argument is SassString &&
|
||||
!argument.hasQuotes &&
|
||||
argument.text.contains(_microsoftFilterStart))) {
|
||||
var argList = arguments[0].asList;
|
||||
if (argList.isNotEmpty &&
|
||||
argList.every((argument) =>
|
||||
argument is SassString &&
|
||||
!argument.hasQuotes &&
|
||||
argument.text.contains(_microsoftFilterStart))) {
|
||||
// Suport the proprietary Microsoft alpha() function.
|
||||
return _functionString("alpha", arguments);
|
||||
}
|
||||
|
||||
assert(arguments.length != 1);
|
||||
throw SassScriptException(
|
||||
"Only 1 argument allowed, but ${arguments.length} were passed.");
|
||||
assert(argList.length != 1);
|
||||
if (argList.isEmpty) {
|
||||
throw SassScriptException("Missing argument \$color.");
|
||||
} else {
|
||||
throw SassScriptException(
|
||||
"Only 1 argument allowed, but ${argList.length} were passed.");
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user