Skip to content

Commit ebb3b65

Browse files
committed
Make _isPrivate match Sass semantics
1 parent 23d0b2b commit ebb3b65

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/src/migrators/module.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ class _ModuleMigrationVisitor extends MigrationVisitor {
352352
if (declaration.isForwarded) return;
353353

354354
var name = declaration.name;
355-
if (_isPrivate(name)
355+
if (_isPrivate(name) &&
356356
references.referencedOutsideDeclaringStylesheet(declaration)) {
357357
// Remove leading `-` since private members can't be accessed outside
358358
// the module they're declared in.
@@ -365,8 +365,11 @@ class _ModuleMigrationVisitor extends MigrationVisitor {
365365
}
366366
}
367367

368-
bool _isPrivate(String name) {
369-
return name.startsWith('-') && !name.startsWith('--');
368+
/// Returns whether [identifier] is a private member name.
369+
///
370+
/// Assumes [identifier] is a valid CSS identifier.
371+
bool _isPrivate(String identifier) {
372+
return identifier.startsWith('-') || identifier.startsWith('_');
370373
}
371374

372375
/// Returns whether the member named [name] should be forwarded in the
@@ -1029,8 +1032,7 @@ class _ModuleMigrationVisitor extends MigrationVisitor {
10291032
newName = declaration.name.substring(importOnlyPrefix.length);
10301033
}
10311034

1032-
if (_shouldForward(declaration.name) &&
1033-
!_isPrivate(declaration.name)) {
1035+
if (_shouldForward(declaration.name) && !_isPrivate(declaration.name)) {
10341036
var subprefix = "";
10351037
if (importOnlyPrefix != null) {
10361038
var prefix = _prefixFor(declaration.name);

0 commit comments

Comments
 (0)