UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

30 lines (28 loc) 1.15 kB
import { tsUtils } from '@neo-one/ts-utils'; import { SmartContractForBase } from '../SmartContractForBase'; export class SmartContractFor extends SmartContractForBase { emitInitial(sb, _func, node, addressName, options) { if (tsUtils.argumented.getArguments(node).length < 1) { return; } const arg = tsUtils.argumented.getArguments(node)[0]; sb.visit(arg, options); sb.scope.set(sb, arg, options, addressName); } emitInvoke(sb, _func, node, prop, addressName, callBuffer, options) { if (tsUtils.argumented.getArguments(node).length < 1) { return; } const arg = tsUtils.argumented.getArguments(node)[0]; const scriptHash = sb.context.analysis.extractLiteralAddress(arg); if (scriptHash === undefined) { sb.scope.get(sb, arg, options, addressName); sb.emitHelper(prop, options, sb.helpers.unwrapBuffer); sb.emitOp(prop, 'CALL_ED', callBuffer); } else { sb.emitOp(prop, 'CALL_E', Buffer.concat([callBuffer, scriptHash])); } } } //# sourceMappingURL=for.js.map