UNPKG

ifc-expressions

Version:

Parsing and evaluation of IFC expressions

36 lines (35 loc) 1.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FuncArgIfcDateTimeString = void 0; const StringValue_js_1 = require("../../../value/StringValue.js"); const ExprEvalResult_js_1 = require("../../ExprEvalResult.js"); const ExprKind_js_1 = require("../../ExprKind.js"); const Types_js_1 = require("../../../type/Types.js"); const IfcDateTimeValue_js_1 = require("../../../value/IfcDateTimeValue.js"); const FuncArgBase_js_1 = require("./FuncArgBase.js"); class FuncArgIfcDateTimeString extends FuncArgBase_js_1.FuncArgBase { constructor(required, name, defaultValue) { super(required, name, defaultValue); } getType() { return Types_js_1.Types.or(Types_js_1.Type.STRING); } transformForTypeCheck(callingExpr, invocationValue) { const val = super.transformForTypeCheck(callingExpr, invocationValue); if ((0, ExprEvalResult_js_1.isExprEvalError)(val)) { return val; } const result = val.result; if (result instanceof StringValue_js_1.StringValue) { const stringValue = result.getValue(); if (!IfcDateTimeValue_js_1.IfcDateTimeValue.isValidStringRepresentation(stringValue)) { return new ExprEvalResult_js_1.ExprEvalTypeErrorObj(ExprKind_js_1.ExprKind.FUNCTION_ARGUMENTS, `Argument ${this.name} is an IfcDateTime of the form 'YYYY-MM-DDTHH:MM:SS.sss...', ` + `a leading + or - and a trailing time zone specification are allowed.` + `The provided value, '${stringValue}' is not allowed. `, callingExpr.getTextSpan()); } return val; } } } exports.FuncArgIfcDateTimeString = FuncArgIfcDateTimeString; //# sourceMappingURL=FuncArgIfcDateTimeString.js.map