Skip to content

Commit f4908e7

Browse files
authored
Fix a crash when writing @extend without a selector (#2499)
Closes #2497
1 parent 870ba06 commit f4908e7

File tree

7 files changed

+24
-4
lines changed

7 files changed

+24
-4
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.83.5-dev
2+
3+
* Fix the error message for `@extend` without a selector and possibly other
4+
parsing edge-cases in contexts that allow interpolation..
5+
16
## 1.83.4
27

38
* No user-visible changes.

lib/src/interpolation_map.dart

+7
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ final class InterpolationMap {
4646
var target = error.span;
4747
if (target == null) return error;
4848

49+
if (_interpolation.contents.isEmpty) {
50+
return SourceSpanFormatException(
51+
error.message, _interpolation.span, error.source);
52+
}
53+
4954
var source = mapSpan(target);
5055
var startIndex = _indexInContents(target.start);
5156
var endIndex = _indexInContents(target.end);
@@ -83,6 +88,8 @@ final class InterpolationMap {
8388
/// generated from interpolation, this will return the full [FileSpan] for
8489
/// that interpolated expression.
8590
Object /* FileLocation|FileSpan */ _mapLocation(SourceLocation target) {
91+
if (_interpolation.contents.isEmpty) return _interpolation.span;
92+
8693
var index = _indexInContents(target);
8794
if (_interpolation.contents[index] case Expression chunk) {
8895
return chunk.span;

pkg/sass-parser/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.4.13-dev
2+
3+
* No user-visible changes.
4+
15
## 0.4.12
26

37
* Fix more bugs in the automated release process.

pkg/sass-parser/package.json

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

pkg/sass_api/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 15.0.5-dev
2+
3+
* No user-visible changes.
4+
15
## 15.0.4
26

37
* No user-visible changes.

pkg/sass_api/pubspec.yaml

+2-2
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: 15.0.4
5+
version: 15.0.5-dev
66
description: Additional APIs for Dart Sass.
77
homepage: https://github.com/sass/dart-sass
88

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

1212
dependencies:
13-
sass: 1.83.4
13+
sass: 1.83.5
1414

1515
dev_dependencies:
1616
dartdoc: ^8.0.14

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.83.4
2+
version: 1.83.5-dev
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

0 commit comments

Comments
 (0)