eval method

  1. @override
Selector eval(
  1. Contexts context
)
override

Implementation

@override
Selector eval(Contexts context) {
  //evaldCondition null is ok
  final evaldCondition = condition?.eval(context)?.evaluated;

  var elements = this.elements;
  var extendList = this.extendList;

  if (elements != null) {
    elements = elements.map((Element e) => e.eval(context)).toList();
  }
  if (extendList != null) {
    extendList =
        extendList.map((Extend extend) => extend.eval(context)).toList();
  }

  return createDerived(elements,
      extendList: extendList, evaldCondition: evaldCondition);

//2.3.1
//  Selector.prototype.eval = function (context) {
//      var evaldCondition = this.condition && this.condition.eval(context),
//          elements = this.elements, extendList = this.extendList;
//
//      elements = elements && elements.map(function (e) { return e.eval(context); });
//      extendList = extendList && extendList.map(function(extend) { return extend.eval(context); });
//
//      return this.createDerived(elements, extendList, evaldCondition);
//  };
}