UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

33 lines (31 loc) 1.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.findDeployInfo = exports.findSuperDeployPropInfo = exports.createWrapParam = void 0; const ts_utils_1 = require("@neo-one/ts-utils"); exports.createWrapParam = (sb) => (param, innerOptions) => { let type = sb.context.analysis.getType(param); if (type !== undefined && ts_utils_1.tsUtils.parameter.isRestParameter(param)) { type = ts_utils_1.tsUtils.type_.getArrayType(type); } sb.emitHelper(param, innerOptions, sb.helpers.wrapValRecursive({ type, checkValue: true, optional: ts_utils_1.tsUtils.initializer.getInitializer(param) !== undefined, })); }; exports.findSuperDeployPropInfo = (contractInfo) => { const superSmartContract = contractInfo.superSmartContract; if (superSmartContract === undefined) { return undefined; } const superDeployPropInfo = superSmartContract.propInfos.find((propInfo) => propInfo.type === 'deploy'); if (superDeployPropInfo !== undefined) { return [superSmartContract, superDeployPropInfo]; } return exports.findSuperDeployPropInfo(superSmartContract); }; exports.findDeployInfo = (contractInfo) => { const deployInfo = contractInfo.propInfos.find((propInfo) => propInfo.type === 'deploy'); return deployInfo === undefined ? exports.findSuperDeployPropInfo(contractInfo) : [contractInfo, deployInfo]; }; //# sourceMappingURL=utils.js.map