evalCall method

Ruleset evalCall (Contexts context, List<MixinArgs> args, { bool important })

Implementation

Ruleset evalCall(Contexts context, List<MixinArgs> args, {bool important}) {
  final List<Node> _arguments = <Node>[];
  List<Node> rules;
  Ruleset ruleset;

  final List<Node> mixinFrames = <Node>[
    ...frames ?? <Node>[],
    ...context.frames
  ];

  final Ruleset frame = evalParams(
      context, Contexts.eval(context, mixinFrames), args, _arguments)
    ..prependRule(
        Declaration('@arguments', Expression(_arguments).eval(context)));

  rules = this.rules.sublist(0);

  ruleset = Ruleset(null, rules)
    ..originalRuleset = this
    ..id = id;

  ruleset = ruleset
      .eval(Contexts.eval(context, <Node>[this, frame, ...mixinFrames]));

  if (important) ruleset = ruleset.makeImportant();
  return ruleset;

//3.0.0 20160714
// Definition.prototype.evalCall = function (context, args, important) {
//     var _arguments = [],
//         mixinFrames = this.frames ? this.frames.concat(context.frames) : context.frames,
//         frame = this.evalParams(context, new contexts.Eval(context, mixinFrames), args, _arguments),
//         rules, ruleset;
//
//     frame.prependRule(new Declaration('@arguments', new Expression(_arguments).eval(context)));
//
//     rules = utils.copyArray(this.rules);
//
//     ruleset = new Ruleset(null, rules);
//     ruleset.originalRuleset = this;
//     ruleset = ruleset.eval(new contexts.Eval(context, [this, frame].concat(mixinFrames)));
//     if (important) {
//         ruleset = ruleset.makeImportant();
//     }
//     return ruleset;
// };
}