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

Function getLoopBreakContinueOccurrences

test/fixtures/snapshot/typescript.js:135773–135792  ·  view source on GitHub ↗
(loopNode)

Source from the content-addressed store, hash-verified

135771 return false;
135772 }
135773 function getLoopBreakContinueOccurrences(loopNode) {
135774 var keywords = [];
135775 if (pushKeywordIf(keywords, loopNode.getFirstToken(), 97 /* SyntaxKind.ForKeyword */, 115 /* SyntaxKind.WhileKeyword */, 90 /* SyntaxKind.DoKeyword */)) {
135776 // If we succeeded and got a do-while loop, then start looking for a 'while' keyword.
135777 if (loopNode.kind === 240 /* SyntaxKind.DoStatement */) {
135778 var loopTokens = loopNode.getChildren();
135779 for (var i = loopTokens.length - 1; i >= 0; i--) {
135780 if (pushKeywordIf(keywords, loopTokens[i], 115 /* SyntaxKind.WhileKeyword */)) {
135781 break;
135782 }
135783 }
135784 }
135785 }
135786 ts.forEach(aggregateAllBreakAndContinueStatements(loopNode.statement), function (statement) {
135787 if (ownsBreakOrContinueStatement(loopNode, statement)) {
135788 pushKeywordIf(keywords, statement.getFirstToken(), 81 /* SyntaxKind.BreakKeyword */, 86 /* SyntaxKind.ContinueKeyword */);
135789 }
135790 });
135791 return keywords;
135792 }
135793 function getBreakOrContinueStatementOccurrences(breakOrContinueStatement) {
135794 var owner = getBreakOrContinueOwner(breakOrContinueStatement);
135795 if (owner) {

Calls 5

pushKeywordIfFunction · 0.85
getChildrenMethod · 0.80
forEachMethod · 0.65

Tested by

no test coverage detected