UNPKG

ifc-expressions

Version:

Parsing and evaluation of IFC expressions

22 lines (21 loc) 901 B
import { FuncArgBase } from "./FuncArgBase.js"; import { ExprEvalTypeErrorObj, } from "../../ExprEvalResult.js"; import { ExprKind } from "../../ExprKind.js"; import { StringValue } from "../../../value/StringValue.js"; import { Type } from "../../../type/Types.js"; export class FuncArgString extends FuncArgBase { constructor(required, name, defaultValue) { super(required, name, defaultValue); } getType() { return Type.STRING; } transformForTypeCheck(callingExpr, invocationValue) { const result = invocationValue.result; if (StringValue.isStringValueType(result)) { return invocationValue; } return new ExprEvalTypeErrorObj(ExprKind.FUNCTION_ARGUMENTS, `Argument ${this.name} must be a string, but was ${JSON.stringify(result)}`, result, callingExpr.getTextSpan()); } } //# sourceMappingURL=FuncArgString.js.map