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