UNPKG

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

Version:

NEO•ONE TypeScript smart contract compiler.

52 lines (50 loc) 1.6 kB
import { TypedHelper } from './TypedHelper'; export class IsNullOrUndefinedHelper extends TypedHelper { emit(sb, node, options) { if (!options.pushValue) { sb.emitOp(node, 'DROP'); return; } const pushFalse = () => { sb.emitOp(node, 'DROP'); sb.emitPushBoolean(node, false); }; const pushTrue = () => { sb.emitOp(node, 'DROP'); sb.emitPushBoolean(node, true); }; sb.emitHelper(node, options, sb.helpers.forBuiltinType({ type: this.type, knownType: this.knownType, array: pushFalse, arrayStorage: pushFalse, boolean: pushFalse, buffer: pushFalse, null: pushTrue, number: pushFalse, object: pushFalse, string: pushFalse, symbol: pushFalse, undefined: pushTrue, map: pushFalse, mapStorage: pushFalse, set: pushFalse, setStorage: pushFalse, error: pushFalse, forwardValue: pushFalse, iteratorResult: pushFalse, iterable: pushFalse, iterableIterator: pushFalse, transaction: pushFalse, output: pushFalse, attribute: pushFalse, input: pushFalse, account: pushFalse, asset: pushFalse, contract: pushFalse, header: pushFalse, block: pushFalse, })); } } //# sourceMappingURL=IsNullOrUndefinedHelper.js.map