UNPKG

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

Version:

NEO•ONE TypeScript smart contract compiler.

27 lines (25 loc) 985 B
import { tsUtils } from '@neo-one/ts-utils-esnext-esm'; import { BuiltinInstanceMemberCall } from '../../BuiltinInstanceMemberCall'; export class StorageDelete extends BuiltinInstanceMemberCall { constructor(type) { super(); this.type = type; } 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.deleteStructuredStorage({ type: this.type, keyType: type })); } } //# sourceMappingURL=delete.js.map