UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

38 lines (36 loc) 1.22 kB
import { tsUtils } from '@neo-one/ts-utils'; import { Helper } from '../Helper'; export class ProcessStatementsHelper extends Helper { constructor({ createScope }) { super(); this.createScope = createScope; } emit(sb, node, options) { if (this.createScope) { sb.withScope(node, options, (innerOptions) => { this.emitStatements(sb, node, innerOptions); }); } else { this.emitStatements(sb, node, options); } } emitStatements(sb, node, options) { tsUtils.statement.getFunctions(node).forEach((func) => { const name = tsUtils.node.getName(func); if (name !== undefined) { sb.scope.add(name); } }); tsUtils.statement.getVariableDeclarations(node).forEach((decl) => { const name = tsUtils.node.getName(decl); if (name !== undefined) { sb.scope.add(name); } }); tsUtils.statement.getStatements(node).forEach((statement) => { sb.visit(statement, sb.noValueOptions(options)); }); } } //# sourceMappingURL=ProcessStatementsHelper.js.map