@neo-one/smart-contract-compiler
Version:
NEO•ONE TypeScript smart contract compiler.
34 lines (32 loc) • 1.41 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.InvokeCallHelper = void 0;
const tslib_1 = require("tslib");
const safe_stable_stringify_1 = tslib_1.__importDefault(require("safe-stable-stringify"));
const Helper_1 = require("../Helper");
class InvokeCallHelper extends Helper_1.Helper {
constructor(options = { bindThis: false, noArgs: false }) {
super();
this.bindThis = options.bindThis || false;
this.overwriteThis = options.overwriteThis || false;
this.noArgs = options.noArgs || false;
}
static getKey(options = { bindThis: false, noArgs: false }) {
const bindThis = options.bindThis || false;
const overwriteThis = options.overwriteThis || false;
const noArgs = options.noArgs || false;
return safe_stable_stringify_1.default({ bindThis, overwriteThis, noArgs });
}
emit(sb, node, optionsIn) {
const options = sb.pushValueOptions(optionsIn);
sb.emitHelper(node, options, sb.helpers.getCallable({ bindThis: this.bindThis, overwriteThis: this.overwriteThis }));
if (this.noArgs) {
sb.emitPushInt(node, 0);
sb.emitOp(node, 'NEWARRAY');
sb.emitOp(node, 'SWAP');
}
sb.emitHelper(node, optionsIn, sb.helpers.call);
}
}
exports.InvokeCallHelper = InvokeCallHelper;
//# sourceMappingURL=InvokeCallHelper.js.map