@@ -73,7 +73,7 @@ namespace ts {
73
73
74
74
let thisArg : Expression | undefined ;
75
75
if ( captureThisArg ) {
76
- if ( shouldCaptureInTempVariable ( expression ) ) {
76
+ if ( ! isSimpleCopiableExpression ( expression ) ) {
77
77
thisArg = createTempVariable ( hoistVariableDeclaration ) ;
78
78
expression = createAssignment ( thisArg , expression ) ;
79
79
// if (inParameterInitializer) tempVariableInParameter = true;
@@ -113,7 +113,7 @@ namespace ts {
113
113
const leftThisArg = isSyntheticReference ( left ) ? left . thisArg : undefined ;
114
114
let leftExpression = isSyntheticReference ( left ) ? left . expression : left ;
115
115
let capturedLeft : Expression = leftExpression ;
116
- if ( shouldCaptureInTempVariable ( leftExpression ) ) {
116
+ if ( ! isSimpleCopiableExpression ( leftExpression ) ) {
117
117
capturedLeft = createTempVariable ( hoistVariableDeclaration ) ;
118
118
leftExpression = createAssignment ( capturedLeft , leftExpression ) ;
119
119
// if (inParameterInitializer) tempVariableInParameter = true;
@@ -126,7 +126,7 @@ namespace ts {
126
126
case SyntaxKind . PropertyAccessExpression :
127
127
case SyntaxKind . ElementAccessExpression :
128
128
if ( i === chain . length - 1 && captureThisArg ) {
129
- if ( shouldCaptureInTempVariable ( rightExpression ) ) {
129
+ if ( ! isSimpleCopiableExpression ( rightExpression ) ) {
130
130
thisArg = createTempVariable ( hoistVariableDeclaration ) ;
131
131
rightExpression = createAssignment ( thisArg , rightExpression ) ;
132
132
// if (inParameterInitializer) tempVariableInParameter = true;
@@ -184,7 +184,7 @@ namespace ts {
184
184
function transformNullishCoalescingExpression ( node : BinaryExpression ) {
185
185
let left = visitNode ( node . left , visitor , isExpression ) ;
186
186
let right = left ;
187
- if ( shouldCaptureInTempVariable ( left ) ) {
187
+ if ( ! isSimpleCopiableExpression ( left ) ) {
188
188
right = createTempVariable ( hoistVariableDeclaration ) ;
189
189
left = createAssignment ( right , left ) ;
190
190
// if (inParameterInitializer) tempVariableInParameter = true;
0 commit comments