dynamic evaluate(EvaluationType type, ContextModel context)

Evaluates this expression according to given type and context.

Source

evaluate(EvaluationType type, ContextModel context) {
  var firstEval = first.evaluate(type, context);
  var secondEval = second.evaluate(type, context);

  if (type == EvaluationType.VECTOR) {
    if (secondEval is double) {
      // scale - nothing special to do
    } else {
      // multiply
      return firstEval.multiply(secondEval);
    }
  }

  return firstEval * secondEval;
}