MCPcopy Create free account
hub / github.com/microsoft/vscode-js-debug / statementToExpression

Function statementToExpression

src/common/sourceCodeManipulations.ts:226–242  ·  view source on GitHub ↗
(stmt: Statement)

Source from the content-addressed store, hash-verified

224}
225
226export 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
244export const enum VisitorOption {
245 /** Immediately stop and unwind the transerveral */

Callers 1

statementToFunctionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected