Skip to content

Commit cba7551

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

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/src/migrators/module.dart

+6-3
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

0 commit comments

Comments
 (0)