MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / javaCaseText

Function javaCaseText

src/graph/branch-guards.ts:1630–1635  ·  view source on GitHub ↗

`case A:` / `case A ->` / `default` labels of a Java switch group or rule, as one condition text.

(labels: SyntaxNode[], subject: string)

Source from the content-addressed store, hash-verified

1628
1629/** `case A:` / `case A ->` / `default` labels of a Java switch group or rule, as one condition text. */
1630function javaCaseText(labels: SyntaxNode[], subject: string): string {
1631 const values = labels.map((l) => namedChildren(l).map((n) => condText(n)).filter(Boolean).join(', ')).filter(Boolean);
1632 if (values.length === 0) return subject ? `${subject}: default` : 'default';
1633 const value = values.join(', ');
1634 return subject ? `${subject} == ${value}` : value;
1635}
1636
1637const JAVA: Rules = {
1638 boundaries: new Set([

Callers 1

enclosingFunction · 0.85

Calls 4

namedChildrenFunction · 0.85
condTextFunction · 0.85
mapMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected