UNPKG

@neo-one/smart-contract-compiler-esnext-esm

Version:

NEO•ONE TypeScript smart contract compiler.

24 lines (22 loc) 957 B
import { tsUtils } from '@neo-one/ts-utils-esnext-esm'; import { Types } from '../../../constants'; import { BuiltinInstanceMemberCall } from '../../BuiltinInstanceMemberCall'; export class MapStorageGet extends BuiltinInstanceMemberCall { canCall(_sb, _func, node) { return tsUtils.argumented.getArguments(node).length === 1; } emitCall(sb, func, node, optionsIn, visited) { const options = sb.pushValueOptions(optionsIn); if (!visited) { sb.visit(tsUtils.expression.getExpression(func), options); } if (tsUtils.argumented.getArguments(node).length < 1) { return; } const arg = tsUtils.argumented.getArguments(node)[0]; const type = sb.context.analysis.getType(arg); sb.visit(arg, options); sb.emitHelper(node, optionsIn, sb.helpers.getStructuredStorage({ type: Types.MapStorage, keyType: type })); } } //# sourceMappingURL=get.js.map