@@ -49,7 +49,6 @@ export function genExpression(
4949 return genIdentifier ( content , context , loc , assignment )
5050 }
5151
52- const shouldWrap = ast && TS_NODE_TYPES . includes ( ast . type )
5352 const ids : Identifier [ ] = [ ]
5453 const parentStackMap = new Map < Identifier , Node [ ] > ( )
5554 const parentStack : Node [ ] = [ ]
@@ -66,6 +65,8 @@ export function genExpression(
6665 let hasMemberExpression = false
6766 if ( ids . length ) {
6867 const [ frag , push ] = buildCodeFragment ( )
68+ const shouldWrap = ast && TS_NODE_TYPES . includes ( ast . type )
69+ if ( shouldWrap ) push ( '(' )
6970 ids
7071 . sort ( ( a , b ) => a . start ! - b . start ! )
7172 . forEach ( ( id , i ) => {
@@ -87,7 +88,6 @@ export function genExpression(
8788 parent . type === 'OptionalMemberExpression' )
8889
8990 push (
90- shouldWrap ? '(' : '' ,
9191 ...genIdentifier (
9292 source ,
9393 context ,
@@ -106,8 +106,8 @@ export function genExpression(
106106 if ( i === ids . length - 1 && end < content . length ) {
107107 push ( [ content . slice ( end ) , NewlineType . Unknown ] )
108108 }
109- push ( shouldWrap ? ')' : '' )
110109 } )
110+ if ( shouldWrap ) push ( ')' )
111111
112112 if ( assignment && hasMemberExpression ) {
113113 push ( ` = ${ assignment } ` )
0 commit comments