diff --git a/CHANGELOG.md b/CHANGELOG.md index f4d6dabb6..0d59d043b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/src/visitor/serialize.dart b/lib/src/visitor/serialize.dart index 8e9a69178..d13cd145b 100644 --- a/lib/src/visitor/serialize.dart +++ b/lib/src/visitor/serialize.dart @@ -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( diff --git a/pkg/sass_api/CHANGELOG.md b/pkg/sass_api/CHANGELOG.md index 65fa3d064..570145877 100644 --- a/pkg/sass_api/CHANGELOG.md +++ b/pkg/sass_api/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.0-beta.48 + +* No user-visible changes. + ## 1.0.0-beta.47 * No user-visible changes. diff --git a/pkg/sass_api/pubspec.yaml b/pkg/sass_api/pubspec.yaml index ec67fd6a6..208a0676e 100644 --- a/pkg/sass_api/pubspec.yaml +++ b/pkg/sass_api/pubspec.yaml @@ -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: ../.. } diff --git a/pubspec.yaml b/pubspec.yaml index a8639965d..26d6f56a0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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