ifc-expressions
Version:
Parsing and evaluation of IFC expressions
22 lines (21 loc) • 877 B
JavaScript
import { FuncArgBase } from "./FuncArgBase.js";
import { Type, Types } from "../../../type/Types.js";
import { ExprEvalTypeErrorObj, } from "../../ExprEvalResult.js";
import { ExprKind } from "../../ExprKind.js";
export class FuncArgArray extends FuncArgBase {
constructor(required, name, defaultValue) {
super(required, name, defaultValue);
}
getType() {
return Types.array(Type.ANY);
}
transformForTypeCheck(callingExpr, invocationValue) {
const result = invocationValue.result;
const value = result.getValue();
if (Array.isArray(value)) {
return invocationValue;
}
return new ExprEvalTypeErrorObj(ExprKind.FUNCTION_ARGUMENTS, `Argument ${this.name} must be an array, but was ${JSON.stringify(value)}`, value, callingExpr.getTextSpan());
}
}
//# sourceMappingURL=FuncArgArray.js.map