Skip to content

Commit 9380924

Browse files
stofnex3
andauthored
Fix the operator span when parsing a standalone % (#2667)
Co-authored-by: Natalie Weizenbaum <nweiz@google.com>
1 parent f8a8a51 commit 9380924

File tree

7 files changed

+19
-6
lines changed

7 files changed

+19
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.94.3-dev
2+
3+
* Fix the span reported for standalone `%` expressions followed by whitespace.
4+
15
## 1.94.2
26

37
### Command-Line Interface

lib/src/parse/stylesheet.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2154,11 +2154,12 @@ abstract class StylesheetParser extends Parser {
21542154
length: operator.operator.length,
21552155
);
21562156
}
2157+
var operatorEnd = scanner.position;
21572158
whitespace(consumeNewlines: true);
21582159

21592160
if (operator == BinaryOperator.modulo && !_lookingAtExpression()) {
21602161
addSingleExpression(StringExpression.plain(
2161-
'%', spanFromPosition(scanner.position - 1)));
2162+
'%', spanFromPosition(operatorEnd - 1, operatorEnd)));
21622163
} else {
21632164
operators.add(operator);
21642165
operands.add(singleExpression);

pkg/sass-parser/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.36-dev
2+
3+
* No user-visible changes.
4+
15
## 0.4.35
26

37
* No user-visible changes.

pkg/sass-parser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sass-parser",
3-
"version": "0.4.35",
3+
"version": "0.4.36-dev",
44
"description": "A PostCSS-compatible wrapper of the official Sass parser",
55
"repository": "sass/dart-sass",
66
"author": "Google Inc.",

pkg/sass_api/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 16.0.3-dev
2+
3+
* No user-visible changes.
4+
15
## 16.0.2
26

37
* No user-visible changes.

pkg/sass_api/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: sass_api
22
# Note: Every time we add a new Sass AST node, we need to bump the *major*
33
# version because it's a breaking change for anyone who's implementing the
44
# visitor interface(s).
5-
version: 16.0.2
5+
version: 16.0.3-dev
66
description: Additional APIs for Dart Sass.
77
homepage: https://github.com/sass/dart-sass
88

99
environment:
1010
sdk: ">=3.6.0 <4.0.0"
1111

1212
dependencies:
13-
sass: 1.94.2
13+
sass: 1.94.3
1414

1515
dev_dependencies:
1616
dartdoc: ">=8.0.14 <10.0.0"

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.94.2
2+
version: 1.94.3-dev
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

@@ -45,7 +45,7 @@ dev_dependencies:
4545
grinder: ^0.9.0
4646
node_preamble: ^2.0.2
4747
lints: ">=4.0.0 <7.0.0"
48-
protoc_plugin: ">=22.0.1 <25.0.0"
48+
protoc_plugin: ">=22.0.1 <24.0.0"
4949
pub_api_client: ">=2.1.1 <4.0.0"
5050
pubspec_parse: ^1.3.0
5151
test: ^1.16.7

0 commit comments

Comments
 (0)