UNPKG

ifc-expressions

Version:

Parsing and evaluation of IFC expressions

26 lines (25 loc) 1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FuncArgString = void 0; const FuncArgBase_js_1 = require("./FuncArgBase.js"); const ExprEvalResult_js_1 = require("../../ExprEvalResult.js"); const ExprKind_js_1 = require("../../ExprKind.js"); const StringValue_js_1 = require("../../../value/StringValue.js"); const Types_js_1 = require("../../../type/Types.js"); class FuncArgString extends FuncArgBase_js_1.FuncArgBase { constructor(required, name, defaultValue) { super(required, name, defaultValue); } getType() { return Types_js_1.Type.STRING; } transformForTypeCheck(callingExpr, invocationValue) { const result = invocationValue.result; if (StringValue_js_1.StringValue.isStringValueType(result)) { return invocationValue; } return new ExprEvalResult_js_1.ExprEvalTypeErrorObj(ExprKind_js_1.ExprKind.FUNCTION_ARGUMENTS, `Argument ${this.name} must be a string, but was ${JSON.stringify(result)}`, result, callingExpr.getTextSpan()); } } exports.FuncArgString = FuncArgString; //# sourceMappingURL=FuncArgString.js.map