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

Function getThrowOccurrences

test/fixtures/snapshot/typescript.js:135835–135852  ·  view source on GitHub ↗
(throwStatement, sourceFile)

Source from the content-addressed store, hash-verified

135833 return keywords;
135834 }
135835 function getThrowOccurrences(throwStatement, sourceFile) {
135836 var owner = getThrowStatementOwner(throwStatement);
135837 if (!owner) {
135838 return undefined;
135839 }
135840 var keywords = [];
135841 ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) {
135842 keywords.push(ts.findChildOfKind(throwStatement, 109 /* SyntaxKind.ThrowKeyword */, sourceFile));
135843 });
135844 // If the "owner" is a function, then we equate 'return' and 'throw' statements in their
135845 // ability to "jump out" of the function, and include occurrences for both.
135846 if (ts.isFunctionBlock(owner)) {
135847 ts.forEachReturnStatement(owner, function (returnStatement) {
135848 keywords.push(ts.findChildOfKind(returnStatement, 105 /* SyntaxKind.ReturnKeyword */, sourceFile));
135849 });
135850 }
135851 return keywords;
135852 }
135853 function getReturnOccurrences(returnStatement, sourceFile) {
135854 var func = ts.getContainingFunction(returnStatement);
135855 if (!func) {

Callers

nothing calls this directly

Calls 4

getThrowStatementOwnerFunction · 0.85
forEachMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected