@neo-one/smart-contract-compiler
Version:
NEO•ONE TypeScript smart contract compiler.
33 lines (31 loc) • 1.05 kB
JavaScript
import { Helper } from '../Helper';
export class CreateConstructArrayHelper extends Helper {
constructor({ body, withScope }) {
super();
this.body = body;
this.withScope = withScope;
}
emit(sb, node, outerOptions) {
if (!outerOptions.pushValue) {
return;
}
const emit = (options) => {
this.body(sb.noPushValueOptions(options));
sb.emitHelper(node, sb.pushValueOptions(options), sb.helpers.wrapUndefined);
sb.emitHelper(node, options, sb.helpers.return);
};
sb.emitHelper(node, outerOptions, sb.helpers.createFunctionArray({
body: (innerOptions) => {
if (this.withScope) {
sb.withScope(node, innerOptions, (options) => {
emit(options);
});
}
else {
emit(innerOptions);
}
},
}));
}
}
//# sourceMappingURL=CreateConstructArrayHelper.js.map