@@ -361,8 +361,6 @@ module ts {
361361 child ( ( < ConditionalExpression > node ) . whenTrue ) ||
362362 child ( ( < ConditionalExpression > node ) . whenFalse ) ;
363363 case SyntaxKind . Block :
364- case SyntaxKind . TryBlock :
365- case SyntaxKind . FinallyBlock :
366364 case SyntaxKind . ModuleBlock :
367365 return children ( ( < Block > node ) . statements ) ;
368366 case SyntaxKind . SourceFile :
@@ -492,9 +490,7 @@ module ts {
492490 case SyntaxKind . DefaultClause :
493491 case SyntaxKind . LabeledStatement :
494492 case SyntaxKind . TryStatement :
495- case SyntaxKind . TryBlock :
496493 case SyntaxKind . CatchClause :
497- case SyntaxKind . FinallyBlock :
498494 return forEachChild ( node , traverse ) ;
499495 }
500496 }
@@ -3529,8 +3525,8 @@ module ts {
35293525 }
35303526
35313527 // STATEMENTS
3532- function parseBlock ( kind : SyntaxKind , ignoreMissingOpenBrace : boolean , checkForStrictMode : boolean , diagnosticMessage ?: DiagnosticMessage ) : Block {
3533- var node = < Block > createNode ( kind ) ;
3528+ function parseBlock ( ignoreMissingOpenBrace : boolean , checkForStrictMode : boolean , diagnosticMessage ?: DiagnosticMessage ) : Block {
3529+ var node = < Block > createNode ( SyntaxKind . Block ) ;
35343530 if ( parseExpected ( SyntaxKind . OpenBraceToken , diagnosticMessage ) || ignoreMissingOpenBrace ) {
35353531 node . statements = parseList ( ParsingContext . BlockStatements , checkForStrictMode , parseStatement ) ;
35363532 parseExpected ( SyntaxKind . CloseBraceToken ) ;
@@ -3545,7 +3541,7 @@ module ts {
35453541 var savedYieldContext = inYieldContext ( ) ;
35463542 setYieldContext ( allowYield ) ;
35473543
3548- var block = parseBlock ( SyntaxKind . Block , ignoreMissingOpenBrace , /*checkForStrictMode*/ true , diagnosticMessage ) ;
3544+ var block = parseBlock ( ignoreMissingOpenBrace , /*checkForStrictMode*/ true , diagnosticMessage ) ;
35493545
35503546 setYieldContext ( savedYieldContext ) ;
35513547
@@ -3739,25 +3735,19 @@ module ts {
37393735 // TODO: Review for error recovery
37403736 function parseTryStatement ( ) : TryStatement {
37413737 var node = < TryStatement > createNode ( SyntaxKind . TryStatement ) ;
3742- node . tryBlock = parseTokenAndBlock ( SyntaxKind . TryKeyword ) ;
3738+
3739+ parseExpected ( SyntaxKind . TryKeyword ) ;
3740+ node . tryBlock = parseBlock ( /*ignoreMissingOpenBrace:*/ false , /*checkForStrictMode*/ false ) ;
37433741 node . catchClause = token === SyntaxKind . CatchKeyword ? parseCatchClause ( ) : undefined ;
37443742
37453743 // If we don't have a catch clause, then we must have a finally clause. Try to parse
37463744 // one out no matter what.
3747- node . finallyBlock = ! node . catchClause || token === SyntaxKind . FinallyKeyword
3748- ? parseTokenAndBlock ( SyntaxKind . FinallyKeyword )
3749- : undefined ;
3750- return finishNode ( node ) ;
3751- }
3745+ if ( ! node . catchClause || token === SyntaxKind . FinallyKeyword ) {
3746+ parseExpected ( SyntaxKind . FinallyKeyword ) ;
3747+ node . finallyBlock = parseBlock ( /*ignoreMissingOpenBrace:*/ false , /*checkForStrictMode*/ false ) ;
3748+ }
37523749
3753- function parseTokenAndBlock ( token : SyntaxKind ) : Block {
3754- var pos = getNodePos ( ) ;
3755- parseExpected ( token ) ;
3756- var result = parseBlock (
3757- token === SyntaxKind . TryKeyword ? SyntaxKind . TryBlock : SyntaxKind . FinallyBlock ,
3758- /* ignoreMissingOpenBrace */ false , /*checkForStrictMode*/ false ) ;
3759- result . pos = pos ;
3760- return result ;
3750+ return finishNode ( node ) ;
37613751 }
37623752
37633753 function parseCatchClause ( ) : CatchClause {
@@ -3767,7 +3757,7 @@ module ts {
37673757 result . name = parseIdentifier ( ) ;
37683758 result . type = parseTypeAnnotation ( ) ;
37693759 parseExpected ( SyntaxKind . CloseParenToken ) ;
3770- result . block = parseBlock ( SyntaxKind . Block , /* ignoreMissingOpenBrace */ false , /*checkForStrictMode*/ false ) ;
3760+ result . block = parseBlock ( /* ignoreMissingOpenBrace: */ false , /*checkForStrictMode: */ false ) ;
37713761 return finishNode ( result ) ;
37723762 }
37733763
@@ -3876,7 +3866,7 @@ module ts {
38763866 function parseStatement ( ) : Statement {
38773867 switch ( token ) {
38783868 case SyntaxKind . OpenBraceToken :
3879- return parseBlock ( SyntaxKind . Block , /* ignoreMissingOpenBrace */ false , /*checkForStrictMode*/ false ) ;
3869+ return parseBlock ( /* ignoreMissingOpenBrace: */ false , /*checkForStrictMode: */ false ) ;
38803870 case SyntaxKind . VarKeyword :
38813871 case SyntaxKind . ConstKeyword :
38823872 // const here should always be parsed as const declaration because of check in 'isStatement'
@@ -4715,7 +4705,7 @@ module ts {
47154705 inFunctionBlock = true ;
47164706 }
47174707 var savedInBlock = inBlock ;
4718- if ( node . kind === SyntaxKind . Block || node . kind === SyntaxKind . TryBlock || node . kind === SyntaxKind . FinallyBlock ) {
4708+ if ( node . kind === SyntaxKind . Block ) {
47194709 inBlock = true ;
47204710 }
47214711 var savedInObjectLiteralExpression = inObjectLiteralExpression ;
0 commit comments