UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

34 lines (32 loc) 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SmartContractFor = void 0; const ts_utils_1 = require("@neo-one/ts-utils"); const SmartContractForBase_1 = require("../SmartContractForBase"); class SmartContractFor extends SmartContractForBase_1.SmartContractForBase { emitInitial(sb, _func, node, addressName, options) { if (ts_utils_1.tsUtils.argumented.getArguments(node).length < 1) { return; } const arg = ts_utils_1.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 (ts_utils_1.tsUtils.argumented.getArguments(node).length < 1) { return; } const arg = ts_utils_1.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])); } } } exports.SmartContractFor = SmartContractFor; //# sourceMappingURL=for.js.map