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

Function classifyTsClassMember

src/extraction/languages/typescript.ts:29–52  ·  view source on GitHub ↗
(node: SyntaxNode)

Source from the content-addressed store, hash-verified

27 * function targets.
28 */
29export function classifyTsClassMember(node: SyntaxNode): 'method' | 'property' {
30 if (node.type !== 'public_field_definition' && node.type !== 'field_definition') {
31 return 'method'; // method_definition, getters/setters — untouched
32 }
33 for (let i = 0; i < node.namedChildCount; i++) {
34 const child = node.namedChild(i);
35 if (!child) continue;
36 if (child.type === 'arrow_function' || child.type === 'function_expression') {
37 return 'method';
38 }
39 if (child.type === 'call_expression') {
40 const args = getChildByField(child, 'arguments');
41 if (args) {
42 for (let j = 0; j < args.namedChildCount; j++) {
43 const arg = args.namedChild(j);
44 if (arg && (arg.type === 'arrow_function' || arg.type === 'function_expression')) {
45 return 'method';
46 }
47 }
48 }
49 }
50 }
51 return 'property';
52}
53
54/**
55 * Flow's own syntax, blanked to spaces (offsets survive) so a Flow file reads

Callers

nothing calls this directly

Calls 1

getChildByFieldFunction · 0.90

Tested by

no test coverage detected