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

Function classify_ts_class_member

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

Source from the content-addressed store, hash-verified

843}
844
845fn classify_ts_class_member(node: Node) -> Member {
846 if !matches!(node.kind(), "public_field_definition" | "field_definition") {
847 return Member::Method;
848 }
849 for i in 0..node.named_child_count() {
850 let Some(child) = node.named_child(i) else { continue };
851 if matches!(child.kind(), "arrow_function" | "function_expression") {
852 return Member::Method;
853 }
854 if child.kind() == "call_expression" {
855 if let Some(args) = child.child_by_field_name("arguments") {
856 for j in 0..args.named_child_count() {
857 if let Some(arg) = args.named_child(j) {
858 if matches!(arg.kind(), "arrow_function" | "function_expression") {
859 return Member::Method;
860 }
861 }
862 }
863 }
864 }
865 }
866 Member::Property
867}
868
869/// typescriptExtractor.resolveBody / javascriptExtractor.resolveBody: the body
870/// 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