@@ -220,9 +220,7 @@ function lazyCaptureLogic(path: NodePath<t.AssignmentExpression>): void {
220
220
locals . push ( path . scope . getBinding ( x ) ! . identifier ) ;
221
221
}
222
222
223
- const nodeStmt = t . isStatement ( path . node ) ?
224
- path . node :
225
- t . expressionStatement ( path . node ) ;
223
+ const nodeStmt = t . expressionStatement ( path . node ) ;
226
224
227
225
const restoreNode =
228
226
t . assignmentExpression ( path . node . operator ,
@@ -253,14 +251,9 @@ function lazyCaptureLogic(path: NodePath<t.AssignmentExpression>): void {
253
251
t . throwStatement ( exn )
254
252
] ) ) ) ;
255
253
256
- const tryApply = t . callExpression ( t . arrowFunctionExpression ( [ ] ,
257
- t . blockStatement ( [ tryStmt ] ) ) , [ ] ) ;
258
254
const stmtParent = path . getStatementParent ( ) ;
259
- path . isStatement ( ) ?
260
- ( path . replaceWith ( tryStmt ) , path . skip ( ) ) :
261
- t . isStatement ( path . parent ) ?
262
- ( stmtParent . replaceWith ( tryStmt ) , stmtParent . skip ( ) ) :
263
- ( path . replaceWith ( tryApply ) , path . skip ( ) ) ;
255
+ stmtParent . replaceWith ( tryStmt ) ;
256
+ stmtParent . skip ( ) ;
264
257
}
265
258
266
259
/**
@@ -306,9 +299,7 @@ function eagerCaptureLogic(path: NodePath<t.AssignmentExpression>): void {
306
299
locals . push ( path . scope . getBinding ( x ) ! . identifier ) ;
307
300
}
308
301
309
- const nodeStmt = t . isStatement ( path . node ) ?
310
- path . node :
311
- t . expressionStatement ( path . node ) ;
302
+ const nodeStmt = t . expressionStatement ( path . node ) ;
312
303
313
304
const stackFrame = t . objectExpression ( [
314
305
t . objectProperty ( t . identifier ( 'kind' ) , t . stringLiteral ( 'rest' ) ) ,
@@ -340,15 +331,9 @@ function eagerCaptureLogic(path: NodePath<t.AssignmentExpression>): void {
340
331
] ) ) ) ;
341
332
( < any > ifStmt ) . isTransformed = true ;
342
333
343
-
344
- const ifApply = t . callExpression ( t . arrowFunctionExpression ( [ ] ,
345
- t . blockStatement ( [ ifStmt ] ) ) , [ ] ) ;
346
334
const stmtParent = path . getStatementParent ( ) ;
347
- path . isStatement ( ) ?
348
- ( path . replaceWith ( ifStmt ) , path . skip ( ) ) :
349
- t . isStatement ( path . parent ) ?
350
- ( stmtParent . replaceWith ( ifStmt ) , stmtParent . skip ( ) ) :
351
- ( path . replaceWith ( ifApply ) , path . skip ( ) ) ;
335
+ stmtParent . replaceWith ( ifStmt ) ;
336
+ stmtParent . skip ( ) ;
352
337
}
353
338
354
339
/**
0 commit comments