UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

33 lines (31 loc) 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InvokeSmartContractMethodHelper = void 0; const ts_utils_1 = require("@neo-one/ts-utils"); const Helper_1 = require("../Helper"); class InvokeSmartContractMethodHelper extends Helper_1.Helper { constructor({ method }) { super(); this.method = method; } emit(sb, node, optionsIn) { const options = sb.pushValueOptions(optionsIn); sb.withProgramCounter((finallyPC) => { sb.withProgramCounter((catchPC) => { const rootOptions = sb.finallyPCOptions(sb.catchPCOptions(options, catchPC.getLast()), finallyPC.getLast()); sb.visit(ts_utils_1.tsUtils.body.getBodyOrThrow(this.method), rootOptions); sb.emitHelper(this.method, rootOptions, sb.helpers.wrapUndefined); sb.emitHelper(this.method, rootOptions, sb.helpers.return); }); sb.emitOp(node, 'DROP'); sb.emitHelper(node, options, sb.helpers.throwCompletion); }); sb.emitOp(node, 'DROP'); sb.emitOp(node, 'DROP'); if (!optionsIn.pushValue) { sb.emitOp(node, 'DROP'); } } } exports.InvokeSmartContractMethodHelper = InvokeSmartContractMethodHelper; //# sourceMappingURL=InvokeSmartContractMethodHelper.js.map