UNPKG

ifc-expressions

Version:

Parsing and evaluation of IFC expressions

29 lines (28 loc) 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FuncBooleanBinary = void 0; const Func_js_1 = require("../Func.js"); const ExprEvalResult_js_1 = require("../../ExprEvalResult.js"); const Types_js_1 = require("../../../type/Types.js"); const FuncArgLogicalOrBoolean_js_1 = require("../arg/FuncArgLogicalOrBoolean.js"); class FuncBooleanBinary extends Func_js_1.Func { constructor(name, methodName) { super(name, [ new FuncArgLogicalOrBoolean_js_1.FuncArgLogicalOrBoolean(true, FuncBooleanBinary.KEY_LEFT), new FuncArgLogicalOrBoolean_js_1.FuncArgLogicalOrBoolean(true, FuncBooleanBinary.KEY_RIGHT), ]); this.methodName = methodName; } getReturnType(argumentTypes) { return Types_js_1.Types.or(...argumentTypes); } calculateResult(callingExpr, evaluatedArguments) { const left = evaluatedArguments.get(FuncBooleanBinary.KEY_LEFT); const right = evaluatedArguments.get(FuncBooleanBinary.KEY_RIGHT); return new ExprEvalResult_js_1.ExprEvalSuccessObj(left[this.methodName].call(left, right)); } } exports.FuncBooleanBinary = FuncBooleanBinary; FuncBooleanBinary.KEY_LEFT = "left"; FuncBooleanBinary.KEY_RIGHT = "right"; //# sourceMappingURL=FuncBooleanBinary.js.map