mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-26 20:24:42 +01:00
Allow extra whitespace in min, max, and calculations (#1483)
Closes sass/dart-sass#1444
This commit is contained in:
parent
7de7ab405d
commit
30cc9dcbfb
@ -11,6 +11,9 @@
|
|||||||
to be within the current shadow DOM. The `@extend` logic has been updated
|
to be within the current shadow DOM. The `@extend` logic has been updated
|
||||||
accordingly as well.
|
accordingly as well.
|
||||||
|
|
||||||
|
* Fix a bug where extra whitespace in `min()`, `max()`, `clamp()`, and `calc()`
|
||||||
|
expressions could cause bogus parse errors.
|
||||||
|
|
||||||
* Fix a bug where the right-hand operand of a `-` in a calculation could
|
* Fix a bug where the right-hand operand of a `-` in a calculation could
|
||||||
incorrectly be stripped of parentheses.
|
incorrectly be stripped of parentheses.
|
||||||
|
|
||||||
|
@ -2802,6 +2802,8 @@ abstract class StylesheetParser extends Parser {
|
|||||||
/// productions separated by commas.
|
/// productions separated by commas.
|
||||||
bool _tryMinMaxContents(InterpolationBuffer buffer,
|
bool _tryMinMaxContents(InterpolationBuffer buffer,
|
||||||
{bool allowComma = true}) {
|
{bool allowComma = true}) {
|
||||||
|
whitespace();
|
||||||
|
|
||||||
// The number of open parentheses that need to be closed.
|
// The number of open parentheses that need to be closed.
|
||||||
while (true) {
|
while (true) {
|
||||||
var next = scanner.peekChar();
|
var next = scanner.peekChar();
|
||||||
@ -3013,7 +3015,13 @@ abstract class StylesheetParser extends Parser {
|
|||||||
} else if (next == $lparen) {
|
} else if (next == $lparen) {
|
||||||
var start = scanner.state;
|
var start = scanner.state;
|
||||||
scanner.readChar();
|
scanner.readChar();
|
||||||
var value = _tryCalculationInterpolation() ?? _calculationSum();
|
|
||||||
|
Expression? value = _tryCalculationInterpolation();
|
||||||
|
if (value == null) {
|
||||||
|
whitespace();
|
||||||
|
value = _calculationSum();
|
||||||
|
}
|
||||||
|
|
||||||
whitespace();
|
whitespace();
|
||||||
scanner.expectChar($rparen);
|
scanner.expectChar($rparen);
|
||||||
return ParenthesizedExpression(value, scanner.spanFrom(start));
|
return ParenthesizedExpression(value, scanner.spanFrom(start));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: sass
|
name: sass
|
||||||
version: 1.41.0-dev
|
version: 1.41.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