@neo-one/smart-contract-compiler
Version:
NEO•ONE TypeScript smart contract compiler.
27 lines (25 loc) • 997 B
JavaScript
import { tsUtils } from '@neo-one/ts-utils';
import { BuiltinInstanceMemberCall } from '../BuiltinInstanceMemberCall';
export class MapSet extends BuiltinInstanceMemberCall {
canCall(_sb, _func, node) {
return tsUtils.argumented.getArguments(node).length === 2;
}
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 < 2) {
return;
}
if (optionsIn.pushValue) {
sb.emitOp(node, 'DUP');
}
sb.emitHelper(node, options, sb.helpers.unwrapMap);
sb.visit(tsUtils.argumented.getArguments(node)[0], options);
sb.emitSysCall(node, 'Neo.Runtime.Serialize');
sb.visit(tsUtils.argumented.getArguments(node)[1], options);
sb.emitOp(node, 'SETITEM');
}
}
//# sourceMappingURL=set.js.map