mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-26 20:24:42 +01:00
unify complex
This commit is contained in:
parent
9caecbe0d0
commit
ab2d8ae3f3
@ -186,8 +186,8 @@ class Extender {
|
||||
|
||||
var unified = _unifyComplex(group1, group2);
|
||||
if (unified == null) return null;
|
||||
if (unified.members.length > 1) return null;
|
||||
return unified.members.first.members;
|
||||
if (unified.length > 1) return null;
|
||||
return unified.first;
|
||||
});
|
||||
|
||||
var choices = [[initialCombinator]];
|
||||
@ -519,6 +519,24 @@ class Extender {
|
||||
return result;
|
||||
}
|
||||
|
||||
List<List<ComplexSelectorComponent> _unifyComplex(
|
||||
List<SimpleSelector> complex1, List<SimpleSelector> complex2) {
|
||||
var base1 = complex1.members.last;
|
||||
var base2 = complex2.members.last;
|
||||
if (base1 is CompoundSelector && base2 is CompoundSelector) {
|
||||
var unified = _unifyCompound(base2.components, base1.components);
|
||||
if (unified == null) return null;
|
||||
|
||||
return weave([
|
||||
base1.components.take(base1.components.length - 1).toList(),
|
||||
base2.components.take(base2.components.length - 1).toList()
|
||||
..add(unified)
|
||||
]);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
CompoundSelector _unifyCompound(List<SimpleSelector> compound1,
|
||||
List<SimpleSelector> compound2) {
|
||||
var result = compound2;
|
||||
|
Loading…
Reference in New Issue
Block a user