@@ -56,8 +56,8 @@ const func = {
5656 exit ( path : NodePath < t . FunctionDeclaration | t . FunctionExpression > ) {
5757 const toDecl : t . Identifier [ ] | undefined = ( < any > path . node ) . toDecl
5858 if ( toDecl && toDecl . length > 0 ) {
59- path . node . body . body . unshift ( t . variableDeclaration ( 'var' ,
60- lifted ( toDecl . map ( d => t . variableDeclarator ( d ) ) ) ) )
59+ path . node . body . body . unshift ( lifted ( t . variableDeclaration ( 'var' ,
60+ toDecl . map ( d => t . variableDeclarator ( d ) ) ) ) )
6161 }
6262 }
6363}
@@ -69,8 +69,8 @@ const prog = {
6969 exit ( path : NodePath < t . Program > ) {
7070 const toDecl : t . Identifier [ ] | undefined = ( < any > path . node ) . toDecl
7171 if ( toDecl && toDecl . length > 0 ) {
72- path . node . body . unshift ( t . variableDeclaration ( 'var' ,
73- lifted ( toDecl . map ( d => t . variableDeclarator ( d ) ) ) ) )
72+ path . node . body . unshift ( lifted ( t . variableDeclaration ( 'var' ,
73+ toDecl . map ( d => t . variableDeclarator ( d ) ) ) ) )
7474 }
7575 }
7676}
@@ -113,10 +113,10 @@ const lift: Visitor = {
113113 // Therefore, we do not need to lift x. Instead, we eliminate the
114114 // declaration and only turn it into an assignment.
115115 if ( ( kind === 'var' && topArgs . includes ( id ) ) === false ) {
116- ( < any > topScope . node ) . toDecl . push ( decl . id )
117116 //const newDecl = t.variableDeclaration(kind,
118117 //[t.variableDeclarator(decl.id)]);
119118 //getBlock(topScope.node).unshift(lifted(newDecl));
119+ ( < any > topScope . node ) . toDecl . push ( decl . id )
120120 }
121121 if ( decl . init !== null ) {
122122 // If we call path.insertAfter here, we will add assignments in reverse
0 commit comments