mirror of
https://github.com/danog/dart-sass.git
synced 2024-12-02 09:37:49 +01:00
Fix deprotofy SassCalculation.clamp (#2043)
This commit is contained in:
parent
b1d56a4f07
commit
2836216ba5
@ -1,3 +1,10 @@
|
|||||||
|
## 1.64.1
|
||||||
|
|
||||||
|
### Embedded Sass
|
||||||
|
|
||||||
|
* Fix a bug where a valid `SassCalculation.clamp()` with less than 3 arguments
|
||||||
|
would throw an error.
|
||||||
|
|
||||||
## 1.64.0
|
## 1.64.0
|
||||||
|
|
||||||
* Comments that appear before or between `@use` and `@forward` rules are now
|
* Comments that appear before or between `@use` and `@forward` rules are now
|
||||||
|
@ -350,16 +350,20 @@ class Protofier {
|
|||||||
return SassCalculation.calc(
|
return SassCalculation.calc(
|
||||||
_deprotofyCalculationValue(calculation.arguments[0]));
|
_deprotofyCalculationValue(calculation.arguments[0]));
|
||||||
} else if (calculation.name == "clamp") {
|
} else if (calculation.name == "clamp") {
|
||||||
if (calculation.arguments.length != 3) {
|
if (calculation.arguments.isEmpty || calculation.arguments.length > 3) {
|
||||||
throw paramsError(
|
throw paramsError(
|
||||||
"Value.Calculation.arguments must have exactly 3 arguments for "
|
"Value.Calculation.arguments must have 1 to 3 arguments for "
|
||||||
"clamp().");
|
"clamp().");
|
||||||
}
|
}
|
||||||
|
|
||||||
return SassCalculation.clamp(
|
return SassCalculation.clamp(
|
||||||
_deprotofyCalculationValue(calculation.arguments[0]),
|
_deprotofyCalculationValue(calculation.arguments[0]),
|
||||||
_deprotofyCalculationValue(calculation.arguments[1]),
|
calculation.arguments.length > 1
|
||||||
_deprotofyCalculationValue(calculation.arguments[2]));
|
? _deprotofyCalculationValue(calculation.arguments[1])
|
||||||
|
: null,
|
||||||
|
calculation.arguments.length > 2
|
||||||
|
? _deprotofyCalculationValue(calculation.arguments[2])
|
||||||
|
: null);
|
||||||
} else if (calculation.name == "min") {
|
} else if (calculation.name == "min") {
|
||||||
if (calculation.arguments.isEmpty) {
|
if (calculation.arguments.isEmpty) {
|
||||||
throw paramsError(
|
throw paramsError(
|
||||||
|
@ -10,7 +10,7 @@ environment:
|
|||||||
sdk: ">=3.0.0 <4.0.0"
|
sdk: ">=3.0.0 <4.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
sass: 1.64.0
|
sass: 1.64.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
dartdoc: ^5.0.0
|
dartdoc: ^5.0.0
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: sass
|
name: sass
|
||||||
version: 1.64.0
|
version: 1.64.1
|
||||||
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
|
||||||
|
|
||||||
|
@ -1699,7 +1699,7 @@ void main() {
|
|||||||
..number = (Value_Number()..value = 3.0))
|
..number = (Value_Number()..value = 3.0))
|
||||||
..arguments.add(Value_Calculation_CalculationValue()
|
..arguments.add(Value_Calculation_CalculationValue()
|
||||||
..number = (Value_Number()..value = 4.0))),
|
..number = (Value_Number()..value = 4.0))),
|
||||||
equals("Value.Calculation.arguments must have exactly 3 "
|
equals("Value.Calculation.arguments must have 1 to 3 "
|
||||||
"arguments for clamp()."));
|
"arguments for clamp()."));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1714,14 +1714,8 @@ void main() {
|
|||||||
|
|
||||||
test("for clamp", () async {
|
test("for clamp", () async {
|
||||||
await _expectDeprotofyError(
|
await _expectDeprotofyError(
|
||||||
Value()
|
Value()..calculation = (Value_Calculation()..name = "clamp"),
|
||||||
..calculation = (Value_Calculation()
|
equals("Value.Calculation.arguments must have 1 to 3 "
|
||||||
..name = "clamp"
|
|
||||||
..arguments.add(Value_Calculation_CalculationValue()
|
|
||||||
..number = (Value_Number()..value = 1.0))
|
|
||||||
..arguments.add(Value_Calculation_CalculationValue()
|
|
||||||
..number = (Value_Number()..value = 2.0))),
|
|
||||||
equals("Value.Calculation.arguments must have exactly 3 "
|
|
||||||
"arguments for clamp()."));
|
"arguments for clamp()."));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user