visitIncludeDirective method

  1. @override
void visitIncludeDirective(
  1. IncludeDirective node
)
override

Implementation

@override
void visitIncludeDirective(IncludeDirective node) {
  final currDef = this.currDef;
  if (map.containsKey(node.name)) {
    var mixinDef = map[node.name];
    if (mixinDef is MixinRulesetDirective) {
      _TopLevelIncludeReplacer.replace(_styleSheet!, node, mixinDef.rulesets);
    } else if (currDef is MixinRulesetDirective && _anyRulesets(currDef)) {
      final mixinRuleset = currDef;
      var index = mixinRuleset.rulesets.indexOf(node);
      mixinRuleset.rulesets.removeAt(index);
      _messages.warning(
          'Using declaration mixin ${node.name} as top-level mixin',
          node.span);
    }
  } else {
    if (currDef is MixinRulesetDirective) {
      var rulesetDirect = currDef;
      rulesetDirect.rulesets.removeWhere((entry) {
        if (entry == node) {
          _messages.warning('Undefined mixin ${node.name}', node.span);
          return true;
        }
        return false;
      });
    }
  }
  super.visitIncludeDirective(node);
}