ifc-expressions
Version:
Parsing and evaluation of IFC expressions
35 lines (34 loc) • 1.15 kB
JavaScript
import { ExprEvalErrorObj, ExprEvalStatus, } from "./ExprEvalResult.js";
import { isNullish } from "../util/IfcExpressionUtils.js";
export class ExprFacade {
constructor(delegate) {
this.delegate = delegate;
}
evaluate(ctx) {
try {
let span = this.delegate.getTextSpan();
if (isNullish(span)) {
this.delegate.toExprString();
}
return this.delegate.evaluate(ctx, new Map());
}
catch (e) {
return new ExprEvalErrorObj(this.delegate.getKind(), ExprEvalStatus.ERROR, "Unexpected error occurred during expression evaluation, this is a bug - please report." +
(isNullish(e.message)
? ""
: "\nMessage of caught error is: " + e.message) +
"\nStacktrace:\n" +
e.stack, this.delegate.getTextSpan());
}
}
getKind() {
return this.delegate.getKind();
}
getType() {
return this.delegate.getType();
}
toExprString() {
return this.delegate.toExprString();
}
}
//# sourceMappingURL=ExprFacade.js.map