fix serializing loud comment crash when importing the same file twice in a row (#1713)

* fix serializing loud comment crash when importing the same file twice
This commit is contained in:
Goodwine 2022-06-08 16:48:36 -07:00 committed by GitHub
parent 44c2966b8a
commit ae6275e5e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 6 deletions

View File

@ -1,3 +1,8 @@
## 1.52.3
* Fix crash when trailing loud comments (`/* ... */`) appear twice in a row
across two different imports which themselves imported the same file each.
## 1.52.2
* Preserve location of trailing loud comments (`/* ... */`) instead of pushing

View File

@ -1356,6 +1356,11 @@ class _SerializeVisitor
// simple forward search of the previous.span.text as that might contain
// other left braces.
var searchFrom = node.span.start.offset - previous.span.start.offset - 1;
// Imports can cause a node to be "contained" by another node when they are
// actually the same node twice in a row.
if (searchFrom < 0) return false;
var endOffset = previous.span.text.lastIndexOf("{", searchFrom);
endOffset = math.max(0, endOffset);
var span = previous.span.file.span(

View File

@ -1,3 +1,7 @@
## 1.0.0-beta.48
* No user-visible changes.
## 1.0.0-beta.47
* No user-visible changes.

View File

@ -2,18 +2,18 @@ name: sass_api
# Note: Every time we add a new Sass AST node, we need to bump the *major*
# version because it's a breaking change for anyone who's implementing the
# visitor interface(s).
version: 1.0.0-beta.47
version: 1.0.0-beta.48
description: Additional APIs for Dart Sass.
homepage: https://github.com/sass/dart-sass
environment:
sdk: '>=2.12.0 <3.0.0'
sdk: ">=2.12.0 <3.0.0"
dependencies:
sass: 1.52.2
sass: 1.52.3
dev_dependencies:
dartdoc: ^5.0.0
dependency_overrides:
sass: {path: ../..}
sass: { path: ../.. }

View File

@ -1,5 +1,5 @@
name: sass
version: 1.52.2
version: 1.52.3
description: A Sass implementation in Dart.
homepage: https://github.com/sass/dart-sass
@ -8,7 +8,7 @@ executables:
sass: sass
environment:
sdk: '>=2.12.0 <3.0.0'
sdk: ">=2.12.0 <3.0.0"
dependencies:
args: ^2.0.0