UNPKG

ifc-expressions

Version:

Parsing and evaluation of IFC expressions

24 lines (23 loc) 909 B
import { Expr2 } from "../Expr2.js"; import { NumericValue } from "../../value/NumericValue.js"; import { ExprKind } from "../ExprKind.js"; import { ExprEvalError2Obj, ExprEvalStatus, } from "../ExprEvalResult.js"; import { Type } from "../../type/Types.js"; export class DivideExpr extends Expr2 { constructor(left, right) { super(ExprKind.NUM_DIVIDE, left, right); } calculateResult(ctx, localCtx, left, right) { return NumericValue.of(left.getValue().dividedBy(right.getValue())); } handleError(error, leftResult, rightResult) { return new ExprEvalError2Obj(error, leftResult, rightResult, ExprEvalStatus.MATH_ERROR, error, this.getTextSpan()); } buildExprString(builder) { builder.appendExpr(this.left).appendString(" / ").appendExpr(this.right); } getType() { return Type.NUMERIC; } } //# sourceMappingURL=DivideExpr.js.map