@neo-one/smart-contract-compiler
Version:
NEO•ONE TypeScript smart contract compiler.
28 lines (26 loc) • 851 B
JavaScript
import { Helper } from '../Helper';
export class ArrForEachHelper extends Helper {
constructor(options) {
super();
this.each = options.each;
this.withIndex = options.withIndex || false;
}
emit(sb, node, options) {
if (this.withIndex) {
sb.emitSysCall(node, 'Neo.Iterator.Create');
sb.emitHelper(node, options, sb.helpers.rawIteratorForEach({
each: (innerOptions) => {
sb.emitOp(node, 'SWAP');
this.each(innerOptions);
},
}));
}
else {
sb.emitSysCall(node, 'Neo.Enumerator.Create');
sb.emitHelper(node, options, sb.helpers.rawEnumeratorForEach({
each: this.each,
}));
}
}
}
//# sourceMappingURL=ArrForEachHelper.js.map