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

Function classify_ts_class_member

codegraph-kernel/src/tsjs/mod.rs:1131–1153  ·  view source on GitHub ↗
(node: Node)

Source from the content-addressed store, hash-verified

1129}
1130
1131fn classify_ts_class_member(node: Node) -> Member {
1132 if !matches!(node.kind(), "public_field_definition" | "field_definition") {
1133 return Member::Method;
1134 }
1135 for i in 0..node.named_child_count() {
1136 let Some(child) = node.named_child(i) else { continue };
1137 if matches!(child.kind(), "arrow_function" | "function_expression") {
1138 return Member::Method;
1139 }
1140 if child.kind() == "call_expression" {
1141 if let Some(args) = child.child_by_field_name("arguments") {
1142 for j in 0..args.named_child_count() {
1143 if let Some(arg) = args.named_child(j) {
1144 if matches!(arg.kind(), "arrow_function" | "function_expression") {
1145 return Member::Method;
1146 }
1147 }
1148 }
1149 }
1150 }
1151 }
1152 Member::Property
1153}
1154
1155/// typescriptExtractor.resolveBody / javascriptExtractor.resolveBody: the body
1156/// of a function-valued class field, nested in the arrow / HOF-wrapped arrow.

Callers 1

visit_nodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected