UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

30 lines (28 loc) 1.09 kB
import { StructuredStorageBaseHelper } from './StructuredStorageBaseHelper'; export class StructuredStorageReduceValHelper extends StructuredStorageBaseHelper { constructor({ each, ...rest }) { super(rest); this.each = each; } emit(sb, node, options) { sb.emitHelper(node, options, sb.helpers.structuredStorageReduceBase({ type: this.type, each: (innerOptions) => { sb.emitOp(node, 'SWAP'); sb.emitHelper(node, innerOptions, sb.helpers.if({ condition: () => { sb.emitHelper(node, innerOptions, sb.helpers.handleValValueStructuredStorage); }, whenTrue: () => { sb.emitOp(node, 'SWAP'); this.each(innerOptions); }, whenFalse: () => { sb.emitOp(node, 'DROP'); }, })); }, })); } } //# sourceMappingURL=StructuredStorageReduceValHelper.js.map