UNPKG

ifc-expressions

Version:

Parsing and evaluation of IFC expressions

29 lines (28 loc) 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FuncArgIfcTimeStampNumeric = void 0; const ExprEvalResult_js_1 = require("../../ExprEvalResult.js"); const ExprKind_js_1 = require("../../ExprKind.js"); const FuncArgNumeric_js_1 = require("./FuncArgNumeric.js"); const NumericValue_js_1 = require("../../../value/NumericValue.js"); const Types_js_1 = require("../../../type/Types.js"); class FuncArgIfcTimeStampNumeric extends FuncArgNumeric_js_1.FuncArgNumeric { constructor(required, name, defaultValue) { super(required, name, defaultValue); } getType() { return Types_js_1.Types.or(Types_js_1.Type.NUMERIC); } transformForTypeCheck(callingExpr, invocationValue) { const result = invocationValue.result; if (result instanceof NumericValue_js_1.NumericValue) { const value = result.getValue(); if (value.isInteger()) { return invocationValue; } } return new ExprEvalResult_js_1.ExprEvalTypeErrorObj(ExprKind_js_1.ExprKind.FUNCTION_ARGUMENTS, `Argument ${this.name} must be an integer or an IfcDateTimeValue, but was ${JSON.stringify(result.getValue())}`, result.getValue(), callingExpr.getTextSpan()); } } exports.FuncArgIfcTimeStampNumeric = FuncArgIfcTimeStampNumeric; //# sourceMappingURL=FuncArgIfcTimeStampNumeric.js.map