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

Function tryReparseOptionalChain

test/fixtures/snapshot/typescript.js:35466–35486  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

35464 && lookAhead(nextTokenIsIdentifierOrKeywordOrOpenBracketOrTemplate);
35465 }
35466 function tryReparseOptionalChain(node) {
35467 if (node.flags & 32 /* NodeFlags.OptionalChain */) {
35468 return true;
35469 }
35470 // check for an optional chain in a non-null expression
35471 if (ts.isNonNullExpression(node)) {
35472 var expr = node.expression;
35473 while (ts.isNonNullExpression(expr) && !(expr.flags & 32 /* NodeFlags.OptionalChain */)) {
35474 expr = expr.expression;
35475 }
35476 if (expr.flags & 32 /* NodeFlags.OptionalChain */) {
35477 // this is part of an optional chain. Walk down from `node` to `expression` and set the flag.
35478 while (ts.isNonNullExpression(node)) {
35479 node.flags |= 32 /* NodeFlags.OptionalChain */;
35480 node = node.expression;
35481 }
35482 return true;
35483 }
35484 }
35485 return false;
35486 }
35487 function parsePropertyAccessExpressionRest(pos, expression, questionDotToken) {
35488 var name = parseRightSideOfDot(/*allowIdentifierNames*/ true, /*allowPrivateIdentifiers*/ true);
35489 var isOptionalChain = questionDotToken || tryReparseOptionalChain(expression);

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…