MCPcopy Create free account
hub / github.com/nodejs/node / getAsyncAndAwaitOccurrences

Function getAsyncAndAwaitOccurrences

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

Source from the content-addressed store, hash-verified

135866 return keywords;
135867 }
135868 function getAsyncAndAwaitOccurrences(node) {
135869 var func = ts.getContainingFunction(node);
135870 if (!func) {
135871 return undefined;
135872 }
135873 var keywords = [];
135874 if (func.modifiers) {
135875 func.modifiers.forEach(function (modifier) {
135876 pushKeywordIf(keywords, modifier, 131 /* SyntaxKind.AsyncKeyword */);
135877 });
135878 }
135879 ts.forEachChild(func, function (child) {
135880 traverseWithoutCrossingFunction(child, function (node) {
135881 if (ts.isAwaitExpression(node)) {
135882 pushKeywordIf(keywords, node.getFirstToken(), 132 /* SyntaxKind.AwaitKeyword */);
135883 }
135884 });
135885 });
135886 return keywords;
135887 }
135888 function getYieldOccurrences(node) {
135889 var func = ts.getContainingFunction(node);
135890 if (!func) {

Callers 1

getHighlightSpansFunction · 0.85

Calls 4

pushKeywordIfFunction · 0.85
forEachChildMethod · 0.80
forEachMethod · 0.65

Tested by

no test coverage detected