operator + method

  1. @override
ASTValue operator +(
  1. ASTValue other
)
override

Implementation

@override
ASTValue operator +(ASTValue other) {
  if (other is ASTValueInt) {
    return ASTValueDouble(value + other.value);
  } else if (other is ASTValueDouble) {
    return ASTValueDouble(value + other.value);
  } else if (other is ASTValueString) {
    return ASTValueString('$value${other.value}');
  } else {
    throw UnsupportedValueOperationError(
        "Can't do '+' operation with: $other");
  }
}