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

Method as_object

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

Source from the content-addressed store, hash-verified

1179
1180 fn function_returned_object(&self, fn_node: Node<'t>) -> Option<Node<'t>> {
1181 fn as_object<'t>(n: Node<'t>) -> Option<Node<'t>> {
1182 stack_guard!();
1183 match n.kind() {
1184 "object" | "object_expression" => Some(n),
1185 "parenthesized_expression" => {
1186 for i in 0..n.named_child_count() {
1187 if let Some(inner) = n.named_child(i).and_then(as_object) {
1188 return Some(inner);
1189 }
1190 }
1191 None
1192 }
1193 _ => None,
1194 }
1195 }
1196 let body = fn_node.child_by_field_name("body")?;
1197 if let Some(direct) = as_object(body) {
1198 return Some(direct);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected