@@ -73,7 +73,7 @@ namespace ts {
7373
7474 let thisArg : Expression | undefined ;
7575 if ( captureThisArg ) {
76- if ( shouldCaptureInTempVariable ( expression ) ) {
76+ if ( ! isSimpleCopiableExpression ( expression ) ) {
7777 thisArg = createTempVariable ( hoistVariableDeclaration ) ;
7878 expression = createAssignment ( thisArg , expression ) ;
7979 // if (inParameterInitializer) tempVariableInParameter = true;
@@ -113,7 +113,7 @@ namespace ts {
113113 const leftThisArg = isSyntheticReference ( left ) ? left . thisArg : undefined ;
114114 let leftExpression = isSyntheticReference ( left ) ? left . expression : left ;
115115 let capturedLeft : Expression = leftExpression ;
116- if ( shouldCaptureInTempVariable ( leftExpression ) ) {
116+ if ( ! isSimpleCopiableExpression ( leftExpression ) ) {
117117 capturedLeft = createTempVariable ( hoistVariableDeclaration ) ;
118118 leftExpression = createAssignment ( capturedLeft , leftExpression ) ;
119119 // if (inParameterInitializer) tempVariableInParameter = true;
@@ -126,7 +126,7 @@ namespace ts {
126126 case SyntaxKind . PropertyAccessExpression :
127127 case SyntaxKind . ElementAccessExpression :
128128 if ( i === chain . length - 1 && captureThisArg ) {
129- if ( shouldCaptureInTempVariable ( rightExpression ) ) {
129+ if ( ! isSimpleCopiableExpression ( rightExpression ) ) {
130130 thisArg = createTempVariable ( hoistVariableDeclaration ) ;
131131 rightExpression = createAssignment ( thisArg , rightExpression ) ;
132132 // if (inParameterInitializer) tempVariableInParameter = true;
@@ -184,7 +184,7 @@ namespace ts {
184184 function transformNullishCoalescingExpression ( node : BinaryExpression ) {
185185 let left = visitNode ( node . left , visitor , isExpression ) ;
186186 let right = left ;
187- if ( shouldCaptureInTempVariable ( left ) ) {
187+ if ( ! isSimpleCopiableExpression ( left ) ) {
188188 right = createTempVariable ( hoistVariableDeclaration ) ;
189189 left = createAssignment ( right , left ) ;
190190 // if (inParameterInitializer) tempVariableInParameter = true;
0 commit comments