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

Function getSwitchCaseDefaultOccurrences

test/fixtures/snapshot/typescript.js:135809–135822  ·  view source on GitHub ↗
(switchStatement)

Source from the content-addressed store, hash-verified

135807 return undefined;
135808 }
135809 function getSwitchCaseDefaultOccurrences(switchStatement) {
135810 var keywords = [];
135811 pushKeywordIf(keywords, switchStatement.getFirstToken(), 107 /* SyntaxKind.SwitchKeyword */);
135812 // Go through each clause in the switch statement, collecting the 'case'/'default' keywords.
135813 ts.forEach(switchStatement.caseBlock.clauses, function (clause) {
135814 pushKeywordIf(keywords, clause.getFirstToken(), 82 /* SyntaxKind.CaseKeyword */, 88 /* SyntaxKind.DefaultKeyword */);
135815 ts.forEach(aggregateAllBreakAndContinueStatements(clause), function (statement) {
135816 if (ownsBreakOrContinueStatement(switchStatement, statement)) {
135817 pushKeywordIf(keywords, statement.getFirstToken(), 81 /* SyntaxKind.BreakKeyword */);
135818 }
135819 });
135820 });
135821 return keywords;
135822 }
135823 function getTryCatchFinallyOccurrences(tryStatement, sourceFile) {
135824 var keywords = [];
135825 pushKeywordIf(keywords, tryStatement.getFirstToken(), 111 /* SyntaxKind.TryKeyword */);

Calls 4

pushKeywordIfFunction · 0.85
forEachMethod · 0.65

Tested by

no test coverage detected