UNPKG

calcium-lang

Version:
24 lines 648 B
import * as Expr from "../expression"; import evaluate from "../util/evaluate"; /** * eg. `+=`, `-=` or `*=` */ export default class CompoundAssign { /** * * @param operator same as the correspoding binary operator * @param lhs * @param rhs */ constructor(operator, lhs, rhs) { this.operator = operator; this.lhs = lhs; this.rhs = rhs; } execute(env) { const binOp = new Expr.BinaryOperation(this.operator, this.lhs, this.rhs); const updatedValue = evaluate(binOp, env); this.lhs.assign(updatedValue, env); } } //# sourceMappingURL=compoundAssign.js.map