ifc-expressions
Version:
Parsing and evaluation of IFC expressions
30 lines (29 loc) • 1 kB
JavaScript
import { FuncArg } from "../FuncArg.js";
import { isExprEvalSuccess, } from "../../ExprEvalResult.js";
export class FuncArgBase extends FuncArg {
constructor(required, name, defaultValue) {
super(required, name, defaultValue);
}
transformValue(callingExpr, invocationValue) {
if (isExprEvalSuccess(invocationValue)) {
return this.transformForTypeCheck(callingExpr, invocationValue);
}
return this.transformForError(callingExpr, invocationValue);
}
/**
* Override to type-check the successfully evaluated invocationValue.
* @protected
*/
transformForTypeCheck(callingExpr, invocationValue) {
return invocationValue;
}
/**
* Override to transform the error result obtained from evaluating the invocation value.
* @param invocationValue
* @protected
*/
transformForError(callingExpr, invocationValue) {
return invocationValue;
}
}
//# sourceMappingURL=FuncArgBase.js.map