UNPKG

ifc-expressions

Version:

Parsing and evaluation of IFC expressions

39 lines (38 loc) 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExprFacade = void 0; const ExprEvalResult_js_1 = require("./ExprEvalResult.js"); const IfcExpressionUtils_js_1 = require("../util/IfcExpressionUtils.js"); class ExprFacade { constructor(delegate) { this.delegate = delegate; } evaluate(ctx) { try { let span = this.delegate.getTextSpan(); if ((0, IfcExpressionUtils_js_1.isNullish)(span)) { this.delegate.toExprString(); } return this.delegate.evaluate(ctx, new Map()); } catch (e) { return new ExprEvalResult_js_1.ExprEvalErrorObj(this.delegate.getKind(), ExprEvalResult_js_1.ExprEvalStatus.ERROR, "Unexpected error occurred during expression evaluation, this is a bug - please report." + ((0, IfcExpressionUtils_js_1.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(); } } exports.ExprFacade = ExprFacade; //# sourceMappingURL=ExprFacade.js.map