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

Function parseForOrForInOrForOfStatement

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

Source from the content-addressed store, hash-verified

35916 return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc);
35917 }
35918 function parseForOrForInOrForOfStatement() {
35919 var pos = getNodePos();
35920 var hasJSDoc = hasPrecedingJSDocComment();
35921 parseExpected(97 /* SyntaxKind.ForKeyword */);
35922 var awaitToken = parseOptionalToken(132 /* SyntaxKind.AwaitKeyword */);
35923 parseExpected(20 /* SyntaxKind.OpenParenToken */);
35924 var initializer;
35925 if (token() !== 26 /* SyntaxKind.SemicolonToken */) {
35926 if (token() === 113 /* SyntaxKind.VarKeyword */ || token() === 119 /* SyntaxKind.LetKeyword */ || token() === 85 /* SyntaxKind.ConstKeyword */) {
35927 initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true);
35928 }
35929 else {
35930 initializer = disallowInAnd(parseExpression);
35931 }
35932 }
35933 var node;
35934 if (awaitToken ? parseExpected(160 /* SyntaxKind.OfKeyword */) : parseOptional(160 /* SyntaxKind.OfKeyword */)) {
35935 var expression = allowInAnd(parseAssignmentExpressionOrHigher);
35936 parseExpected(21 /* SyntaxKind.CloseParenToken */);
35937 node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
35938 }
35939 else if (parseOptional(101 /* SyntaxKind.InKeyword */)) {
35940 var expression = allowInAnd(parseExpression);
35941 parseExpected(21 /* SyntaxKind.CloseParenToken */);
35942 node = factory.createForInStatement(initializer, expression, parseStatement());
35943 }
35944 else {
35945 parseExpected(26 /* SyntaxKind.SemicolonToken */);
35946 var condition = token() !== 26 /* SyntaxKind.SemicolonToken */ && token() !== 21 /* SyntaxKind.CloseParenToken */
35947 ? allowInAnd(parseExpression)
35948 : undefined;
35949 parseExpected(26 /* SyntaxKind.SemicolonToken */);
35950 var incrementor = token() !== 21 /* SyntaxKind.CloseParenToken */
35951 ? allowInAnd(parseExpression)
35952 : undefined;
35953 parseExpected(21 /* SyntaxKind.CloseParenToken */);
35954 node = factory.createForStatement(initializer, condition, incrementor, parseStatement());
35955 }
35956 return withJSDoc(finishNode(node, pos), hasJSDoc);
35957 }
35958 function parseBreakOrContinueStatement(kind) {
35959 var pos = getNodePos();
35960 var hasJSDoc = hasPrecedingJSDocComment();

Callers 1

parseStatementFunction · 0.85

Calls 12

getNodePosFunction · 0.85
hasPrecedingJSDocCommentFunction · 0.85
parseExpectedFunction · 0.85
parseOptionalTokenFunction · 0.85
disallowInAndFunction · 0.85
parseOptionalFunction · 0.85
allowInAndFunction · 0.85
parseStatementFunction · 0.85
withJSDocFunction · 0.85
finishNodeFunction · 0.85
tokenFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…