(stmt: Statement)
| 224 | } |
| 225 | |
| 226 | export function statementToExpression(stmt: Statement): Expression | undefined { |
| 227 | switch (stmt.type) { |
| 228 | case 'ExpressionStatement': |
| 229 | return stmt.expression; |
| 230 | case 'BlockStatement': |
| 231 | return { |
| 232 | type: 'CallExpression', |
| 233 | arguments: [], |
| 234 | callee: { type: 'ArrowFunctionExpression', params: [], expression: false, body: stmt }, |
| 235 | optional: false, |
| 236 | }; |
| 237 | case 'ReturnStatement': |
| 238 | return stmt.argument || undefined; |
| 239 | default: |
| 240 | return undefined; |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | export const enum VisitorOption { |
| 245 | /** Immediately stop and unwind the transerveral */ |
no outgoing calls
no test coverage detected