@@ -327,9 +327,10 @@ namespace ts.formatting {
327
327
328
328
export function getContainingList ( node : Node , sourceFile : SourceFile ) : NodeArray < Node > {
329
329
if ( node . parent ) {
330
+ const { end } = node ;
330
331
switch ( node . parent . kind ) {
331
332
case SyntaxKind . TypeReference :
332
- return getListIfStartEndIsInListRange ( ( < TypeReferenceNode > node . parent ) . typeArguments , node . getStart ( sourceFile ) , node . getEnd ( ) ) ;
333
+ return getListIfStartEndIsInListRange ( ( < TypeReferenceNode > node . parent ) . typeArguments , node . getStart ( sourceFile ) , end ) ;
333
334
case SyntaxKind . ObjectLiteralExpression :
334
335
return ( < ObjectLiteralExpression > node . parent ) . properties ;
335
336
case SyntaxKind . ArrayLiteralExpression :
@@ -344,22 +345,25 @@ namespace ts.formatting {
344
345
case SyntaxKind . ConstructorType :
345
346
case SyntaxKind . ConstructSignature : {
346
347
const start = node . getStart ( sourceFile ) ;
347
- return getListIfStartEndIsInListRange ( ( < SignatureDeclaration > node . parent ) . typeParameters , start , node . getEnd ( ) ) ||
348
- getListIfStartEndIsInListRange ( ( < SignatureDeclaration > node . parent ) . parameters , start , node . getEnd ( ) ) ;
348
+ return getListIfStartEndIsInListRange ( ( < SignatureDeclaration > node . parent ) . typeParameters , start , end ) ||
349
+ getListIfStartEndIsInListRange ( ( < SignatureDeclaration > node . parent ) . parameters , start , end ) ;
349
350
}
350
351
case SyntaxKind . ClassDeclaration :
351
- return getListIfStartEndIsInListRange ( ( < ClassDeclaration > node . parent ) . typeParameters , node . getStart ( sourceFile ) , node . getEnd ( ) ) ;
352
+ return getListIfStartEndIsInListRange ( ( < ClassDeclaration > node . parent ) . typeParameters , node . getStart ( sourceFile ) , end ) ;
352
353
case SyntaxKind . NewExpression :
353
354
case SyntaxKind . CallExpression : {
354
355
const start = node . getStart ( sourceFile ) ;
355
- return getListIfStartEndIsInListRange ( ( < CallExpression > node . parent ) . typeArguments , start , node . getEnd ( ) ) ||
356
- getListIfStartEndIsInListRange ( ( < CallExpression > node . parent ) . arguments , start , node . getEnd ( ) ) ;
356
+ return getListIfStartEndIsInListRange ( ( < CallExpression > node . parent ) . typeArguments , start , end ) ||
357
+ getListIfStartEndIsInListRange ( ( < CallExpression > node . parent ) . arguments , start , end ) ;
357
358
}
358
359
case SyntaxKind . VariableDeclarationList :
359
- return getListIfStartEndIsInListRange ( ( < VariableDeclarationList > node . parent ) . declarations , node . getStart ( sourceFile ) , node . getEnd ( ) ) ;
360
+ return getListIfStartEndIsInListRange ( ( < VariableDeclarationList > node . parent ) . declarations , node . getStart ( sourceFile ) , end ) ;
360
361
case SyntaxKind . NamedImports :
361
362
case SyntaxKind . NamedExports :
362
- return getListIfStartEndIsInListRange ( ( < NamedImportsOrExports > node . parent ) . elements , node . getStart ( sourceFile ) , node . getEnd ( ) ) ;
363
+ return getListIfStartEndIsInListRange ( ( < NamedImportsOrExports > node . parent ) . elements , node . getStart ( sourceFile ) , end ) ;
364
+ case SyntaxKind . ObjectBindingPattern :
365
+ case SyntaxKind . ArrayBindingPattern :
366
+ return getListIfStartEndIsInListRange ( ( < ObjectBindingPattern | ArrayBindingPattern > node . parent ) . elements , node . getStart ( sourceFile ) , end ) ;
363
367
}
364
368
}
365
369
return undefined ;
0 commit comments