UNPKG

ifc-expressions

Version:

Parsing and evaluation of IFC expressions

35 lines (34 loc) 1.68 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FuncArgIfcTimeString = 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 IfcTimeValue_js_1 = require("../../../value/IfcTimeValue.js"); const FuncArgBase_js_1 = require("./FuncArgBase.js"); class FuncArgIfcTimeString 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; } if (val.result instanceof StringValue_js_1.StringValue) { const stringValue = val.result.getValue(); if (!IfcTimeValue_js_1.IfcTimeValue.isValidStringRepresentation(stringValue)) { return new ExprEvalResult_js_1.ExprEvalTypeErrorObj(ExprKind_js_1.ExprKind.FUNCTION_ARGUMENTS, `Argument ${this.name} is an IfcTime of the form 'HH:MM:SS.sss...'.` + `a trailing time zone specification is allowed.` + `The provided value, '${stringValue}' is not allowed. `, callingExpr.getTextSpan()); } return val; } } } exports.FuncArgIfcTimeString = FuncArgIfcTimeString; //# sourceMappingURL=FuncArgIfcTimeString.js.map