UNPKG

@harmoniclabs/plu-ts-onchain

Version:

An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript

77 lines (76 loc) 2.83 kB
"use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.IRError = void 0; var isIRParentTerm_1 = require("../utils/isIRParentTerm.js"); var IRHash_1 = require("../IRHash.js"); var IRNodeKind_1 = require("../IRNodeKind.js"); var irErrorBitTag = new Uint8Array([IRNodeKind_1.IRNodeKind.Error]); var errorHash = (0, IRHash_1.hashIrData)(irErrorBitTag.slice()); var IRError = /** @class */ (function () { function IRError(msg, addInfos) { this.msg = msg; this.addInfos = addInfos !== null && addInfos !== void 0 ? addInfos : {}; this.meta = {}; this._parent = undefined; } Object.defineProperty(IRError, "kind", { get: function () { return IRNodeKind_1.IRNodeKind.Error; }, enumerable: false, configurable: true }); Object.defineProperty(IRError.prototype, "kind", { get: function () { return IRError.kind; }, enumerable: false, configurable: true }); Object.defineProperty(IRError, "tag", { get: function () { return irErrorBitTag.slice(); }, enumerable: false, configurable: true }); Object.defineProperty(IRError.prototype, "hash", { get: function () { return errorHash; }, enumerable: false, configurable: true }); IRError.prototype.isHashPresent = function () { return true; }; IRError.prototype.markHashAsInvalid = function () { throw new Error("IRError.markHashAsInvalid was called but error doesn't have childs"); }; Object.defineProperty(IRError.prototype, "parent", { get: function () { return this._parent; }, set: function (newParent) { if (!( // assert // new parent value is different than current this._parent !== newParent && ( // and the new parent value is valid newParent === undefined || (0, isIRParentTerm_1.isIRParentTerm)(newParent)))) return; this._parent = newParent; }, enumerable: false, configurable: true }); IRError.prototype.clone = function () { return new IRError(this.msg, __assign({}, this.addInfos)); }; IRError.prototype.toJSON = function () { return this.toJson(); }; IRError.prototype.toJson = function () { return { type: "IRError" }; }; return IRError; }()); exports.IRError = IRError; ;