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

Function parseDeclaration

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

Source from the content-addressed store, hash-verified

36337 return modifier.kind === 135 /* SyntaxKind.DeclareKeyword */;
36338 }
36339 function parseDeclaration() {
36340 // TODO: Can we hold onto the parsed decorators/modifiers and advance the scanner
36341 // if we can't reuse the declaration, so that we don't do this work twice?
36342 //
36343 // `parseListElement` attempted to get the reused node at this position,
36344 // but the ambient context flag was not yet set, so the node appeared
36345 // not reusable in that context.
36346 var isAmbient = ts.some(lookAhead(function () { return (parseDecorators(), parseModifiers()); }), isDeclareModifier);
36347 if (isAmbient) {
36348 var node = tryReuseAmbientDeclaration();
36349 if (node) {
36350 return node;
36351 }
36352 }
36353 var pos = getNodePos();
36354 var hasJSDoc = hasPrecedingJSDocComment();
36355 var decorators = parseDecorators();
36356 var modifiers = parseModifiers();
36357 if (isAmbient) {
36358 for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
36359 var m = _a[_i];
36360 m.flags |= 16777216 /* NodeFlags.Ambient */;
36361 }
36362 return doInsideOfContext(16777216 /* NodeFlags.Ambient */, function () { return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers); });
36363 }
36364 else {
36365 return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers);
36366 }
36367 }
36368 function tryReuseAmbientDeclaration() {
36369 return doInsideOfContext(16777216 /* NodeFlags.Ambient */, function () {
36370 var node = currentNode(parsingContext);

Callers 1

parseStatementFunction · 0.85

Calls 9

lookAheadFunction · 0.85
parseDecoratorsFunction · 0.85
parseModifiersFunction · 0.85
getNodePosFunction · 0.85
hasPrecedingJSDocCommentFunction · 0.85
doInsideOfContextFunction · 0.85
parseDeclarationWorkerFunction · 0.85
someMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…