Skip to content

Commit aa76c8a

Browse files
committed
Always create scopes for nested imports
1 parent f1410ff commit aa76c8a

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.23.8
2+
3+
* **Potentially breaking bug fix:** Members loaded through a nested `@import`
4+
are no longer ever accessible outside that nested context.
5+
16
## 1.23.7
27

38
* No user-visible changes.

lib/src/ast/sass/statement/if_rule.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import 'package:source_span/source_span.dart';
66

77
import '../../../visitor/interface/statement.dart';
88
import '../expression.dart';
9+
import '../import/dynamic.dart';
910
import '../statement.dart';
1011
import 'function_rule.dart';
12+
import 'import_rule.dart';
1113
import 'mixin_rule.dart';
1214
import 'variable_declaration.dart';
1315

@@ -69,7 +71,9 @@ class IfClause {
6971
: hasDeclarations = children.any((child) =>
7072
child is VariableDeclaration ||
7173
child is FunctionRule ||
72-
child is MixinRule);
74+
child is MixinRule ||
75+
(child is ImportRule &&
76+
child.imports.any((import) => import is DynamicImport)));
7377

7478
String toString() =>
7579
(expression == null ? "@else" : "@if $expression") +

lib/src/ast/sass/statement/parent.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
// MIT-style license that can be found in the LICENSE file or at
33
// https://opensource.org/licenses/MIT.
44

5+
import '../import/dynamic.dart';
56
import '../statement.dart';
67
import 'function_rule.dart';
8+
import 'import_rule.dart';
79
import 'mixin_rule.dart';
810
import 'variable_declaration.dart';
911

@@ -12,13 +14,16 @@ abstract class ParentStatement implements Statement {
1214
/// The child statements of this statement.
1315
final List<Statement> children;
1416

15-
/// Whether any of [children] is a variable, function, or mixin declaration.
17+
/// Whether any of [children] is a variable, function, or mixin declaration,
18+
/// or a dynamic import rule.
1619
final bool hasDeclarations;
1720

1821
ParentStatement(this.children)
1922
: hasDeclarations = children?.any((child) =>
2023
child is VariableDeclaration ||
2124
child is FunctionRule ||
22-
child is MixinRule) ??
25+
child is MixinRule ||
26+
(child is ImportRule &&
27+
child.imports.any((import) => import is DynamicImport))) ??
2328
false;
2429
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.23.7
2+
version: 1.23.8-dev
33
description: A Sass implementation in Dart.
44
author: Sass Team
55
homepage: https://github.com/sass/dart-sass

0 commit comments

Comments
 (0)