@neo-one/smart-contract-compiler
Version:
NEO•ONE TypeScript smart contract compiler.
29 lines (27 loc) • 1.13 kB
JavaScript
import { tsUtils } from '@neo-one/ts-utils';
import { Helper } from '../Helper';
export class InvokeSmartContractMethodHelper extends 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(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');
}
}
}
//# sourceMappingURL=InvokeSmartContractMethodHelper.js.map