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

Method as_object

codegraph-kernel/src/tsjs/extractors.rs:1078–1092  ·  view source on GitHub ↗
(n: Node<'t>)

Source from the content-addressed store, hash-verified

1076
1077 fn function_returned_object(&self, fn_node: Node<'t>) -> Option<Node<'t>> {
1078 fn as_object<'t>(n: Node<'t>) -> Option<Node<'t>> {
1079 stack_guard!();
1080 match n.kind() {
1081 "object" | "object_expression" => Some(n),
1082 "parenthesized_expression" => {
1083 for i in 0..n.named_child_count() {
1084 if let Some(inner) = n.named_child(i).and_then(as_object) {
1085 return Some(inner);
1086 }
1087 }
1088 None
1089 }
1090 _ => None,
1091 }
1092 }
1093 let body = fn_node.child_by_field_name("body")?;
1094 if let Some(direct) = as_object(body) {
1095 return Some(direct);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected