MCPcopy Index your code
hub / github.com/nodejs/node / parseTryStatement

Function parseTryStatement

test/fixtures/snapshot/typescript.js:36046–36060  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36044 }
36045 // TODO: Review for error recovery
36046 function parseTryStatement() {
36047 var pos = getNodePos();
36048 var hasJSDoc = hasPrecedingJSDocComment();
36049 parseExpected(111 /* SyntaxKind.TryKeyword */);
36050 var tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
36051 var catchClause = token() === 83 /* SyntaxKind.CatchKeyword */ ? parseCatchClause() : undefined;
36052 // If we don't have a catch clause, then we must have a finally clause. Try to parse
36053 // one out no matter what.
36054 var finallyBlock;
36055 if (!catchClause || token() === 96 /* SyntaxKind.FinallyKeyword */) {
36056 parseExpected(96 /* SyntaxKind.FinallyKeyword */, ts.Diagnostics.catch_or_finally_expected);
36057 finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
36058 }
36059 return withJSDoc(finishNode(factory.createTryStatement(tryBlock, catchClause, finallyBlock), pos), hasJSDoc);
36060 }
36061 function parseCatchClause() {
36062 var pos = getNodePos();
36063 parseExpected(83 /* SyntaxKind.CatchKeyword */);

Callers 1

parseStatementFunction · 0.85

Calls 8

getNodePosFunction · 0.85
hasPrecedingJSDocCommentFunction · 0.85
parseExpectedFunction · 0.85
parseBlockFunction · 0.85
parseCatchClauseFunction · 0.85
withJSDocFunction · 0.85
finishNodeFunction · 0.85
tokenFunction · 0.70

Tested by

no test coverage detected