visitDeclarationGroup method
Implementation
@override
void visitDeclarationGroup(DeclarationGroup node) {
var span = node.span;
var currentGroup = DeclarationGroup([], span);
var oldGroup = _flatDeclarationGroup;
_flatDeclarationGroup = currentGroup;
var expandedLength = _expandedRuleSets.length;
super.visitDeclarationGroup(node);
// We're done with the group.
_flatDeclarationGroup = oldGroup;
// No nested rule to process it's a top-level rule.
if (_nestedSelectorGroup == _topLevelSelectorGroup) return;
// If flatten selector's declaration is empty skip this selector, no need
// to emit an empty nested selector.
if (currentGroup.declarations.isEmpty) return;
var selectorGroup = _nestedSelectorGroup;
// Build new rule set from the nested selectors and declarations.
var newRuleSet = RuleSet(selectorGroup, currentGroup, span);
// Place in order so outer-most rule is first.
if (expandedLength == _expandedRuleSets.length) {
_expandedRuleSets.add(newRuleSet);
} else {
_expandedRuleSets.insert(expandedLength, newRuleSet);
}
}