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

Method extract_name

codegraph-kernel/src/tsjs/mod.rs:1132–1152  ·  view source on GitHub ↗

extractName / extractNameRaw for the TS/JS configs.

(&self, node: Node)

Source from the content-addressed store, hash-verified

1130
1131 /// extractName / extractNameRaw for the TS/JS configs.
1132 fn extract_name(&self, node: Node) -> String {
1133 // javascriptExtractor.resolveName: field_definition names its key the
1134 // `property` field.
1135 if !self.variant.is_ts() && node.kind() == "field_definition" {
1136 if let Some(prop) = node.child_by_field_name("property") {
1137 return self.text(prop).to_string();
1138 }
1139 }
1140 if let Some(name_node) = node.child_by_field_name("name") {
1141 return self.text(name_node).to_string();
1142 }
1143 if matches!(node.kind(), "arrow_function" | "function_expression" | "generator_function") {
1144 return "<anonymous>".to_string();
1145 }
1146 for c in node.named_children(&mut node.walk()) {
1147 if matches!(c.kind(), "identifier" | "type_identifier" | "simple_identifier" | "constant") {
1148 return self.text(c).to_string();
1149 }
1150 }
1151 "<anonymous>".to_string()
1152 }
1153
1154 /// typescriptExtractor.getSignature / javascriptExtractor.getSignature.
1155 fn signature_of(&self, node: Node) -> Option<String> {

Callers 7

extract_functionMethod · 0.45
extract_classMethod · 0.45
extract_methodMethod · 0.45
extract_interfaceMethod · 0.45
extract_enumMethod · 0.45
extract_type_aliasMethod · 0.45

Calls 3

is_tsMethod · 0.80
textMethod · 0.65
walkMethod · 0.45

Tested by

no test coverage detected