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

Function parseBlock

test/fixtures/snapshot/typescript.js:35829–35849  ·  view source on GitHub ↗
(ignoreMissingOpenBrace, diagnosticMessage)

Source from the content-addressed store, hash-verified

35827 }
35828 // STATEMENTS
35829 function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
35830 var pos = getNodePos();
35831 var hasJSDoc = hasPrecedingJSDocComment();
35832 var openBracePosition = scanner.getTokenPos();
35833 var openBraceParsed = parseExpected(18 /* SyntaxKind.OpenBraceToken */, diagnosticMessage);
35834 if (openBraceParsed || ignoreMissingOpenBrace) {
35835 var multiLine = scanner.hasPrecedingLineBreak();
35836 var statements = parseList(1 /* ParsingContext.BlockStatements */, parseStatement);
35837 parseExpectedMatchingBrackets(18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */, openBraceParsed, openBracePosition);
35838 var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc);
35839 if (token() === 63 /* SyntaxKind.EqualsToken */) {
35840 parseErrorAtCurrentToken(ts.Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses);
35841 nextToken();
35842 }
35843 return result;
35844 }
35845 else {
35846 var statements = createMissingList();
35847 return withJSDoc(finishNode(factory.createBlock(statements, /*multiLine*/ undefined), pos), hasJSDoc);
35848 }
35849 }
35850 function parseFunctionBlock(flags, diagnosticMessage) {
35851 var savedYieldContext = inYieldContext();
35852 setYieldContext(!!(flags & 1 /* SignatureFlags.Yield */));

Callers 5

parseFunctionBlockFunction · 0.85
parseTryStatementFunction · 0.85
parseCatchClauseFunction · 0.85
parseStatementFunction · 0.85

Calls 11

getNodePosFunction · 0.85
hasPrecedingJSDocCommentFunction · 0.85
parseExpectedFunction · 0.85
parseListFunction · 0.85
withJSDocFunction · 0.85
finishNodeFunction · 0.85
parseErrorAtCurrentTokenFunction · 0.85
nextTokenFunction · 0.85
createMissingListFunction · 0.85
tokenFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…