File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -565,26 +565,14 @@ namespace ts.formatting {
565565 function isControlFlowEndingStatement ( kind : SyntaxKind , parent : TextRangeWithKind ) : boolean {
566566 switch ( kind ) {
567567 case SyntaxKind . ReturnStatement :
568- case SyntaxKind . ThrowStatement :
569- switch ( parent . kind ) {
570- case SyntaxKind . Block :
571- const grandParent = ( parent as Node ) . parent ;
572- switch ( grandParent && grandParent . kind ) {
573- case SyntaxKind . FunctionDeclaration :
574- case SyntaxKind . FunctionExpression :
575- // We may want to write inner functions after this.
576- return false ;
577- default :
578- return true ;
579- }
580- case SyntaxKind . CaseClause :
581- case SyntaxKind . DefaultClause :
582- case SyntaxKind . SourceFile :
583- case SyntaxKind . ModuleBlock :
584- return true ;
585- default :
586- throw Debug . fail ( ) ;
568+ case SyntaxKind . ThrowStatement : {
569+ if ( parent . kind !== SyntaxKind . Block ) {
570+ return true ;
587571 }
572+ const grandParent = ( parent as Node ) . parent ;
573+ // In a function, we may want to write inner functions after this.
574+ return ! ( grandParent && grandParent . kind === SyntaxKind . FunctionExpression || grandParent . kind === SyntaxKind . FunctionDeclaration ) ;
575+ }
588576 case SyntaxKind . ContinueStatement :
589577 case SyntaxKind . BreakStatement :
590578 return true ;
You can’t perform that action at this time.
0 commit comments