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

Function parseJSDocUnknownOrNullableType

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

Source from the content-addressed store, hash-verified

33317 return finishNode(factory.createJSDocNonNullableType(parseNonArrayType(), /*postfix*/ false), pos);
33318 }
33319 function parseJSDocUnknownOrNullableType() {
33320 var pos = getNodePos();
33321 // skip the ?
33322 nextToken();
33323 // Need to lookahead to decide if this is a nullable or unknown type.
33324 // Here are cases where we'll pick the unknown type:
33325 //
33326 // Foo(?,
33327 // { a: ? }
33328 // Foo(?)
33329 // Foo<?>
33330 // Foo(?=
33331 // (?|
33332 if (token() === 27 /* SyntaxKind.CommaToken */ ||
33333 token() === 19 /* SyntaxKind.CloseBraceToken */ ||
33334 token() === 21 /* SyntaxKind.CloseParenToken */ ||
33335 token() === 31 /* SyntaxKind.GreaterThanToken */ ||
33336 token() === 63 /* SyntaxKind.EqualsToken */ ||
33337 token() === 51 /* SyntaxKind.BarToken */) {
33338 return finishNode(factory.createJSDocUnknownType(), pos);
33339 }
33340 else {
33341 return finishNode(factory.createJSDocNullableType(parseType(), /*postfix*/ false), pos);
33342 }
33343 }
33344 function parseJSDocFunctionType() {
33345 var pos = getNodePos();
33346 var hasJSDoc = hasPrecedingJSDocComment();

Callers 1

parseNonArrayTypeFunction · 0.85

Calls 5

getNodePosFunction · 0.85
nextTokenFunction · 0.85
finishNodeFunction · 0.85
parseTypeFunction · 0.85
tokenFunction · 0.70

Tested by

no test coverage detected