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

Method as_object

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

Source from the content-addressed store, hash-verified

1219
1220 fn function_returned_object(&self, fn_node: Node<'t>) -> Option<Node<'t>> {
1221 fn as_object<'t>(n: Node<'t>) -> Option<Node<'t>> {
1222 stack_guard!();
1223 match n.kind() {
1224 "object" | "object_expression" => Some(n),
1225 "parenthesized_expression" => {
1226 for i in 0..n.named_child_count() {
1227 if let Some(inner) = n.named_child(i).and_then(as_object) {
1228 return Some(inner);
1229 }
1230 }
1231 None
1232 }
1233 _ => None,
1234 }
1235 }
1236 let body = fn_node.child_by_field_name("body")?;
1237 if let Some(direct) = as_object(body) {
1238 return Some(direct);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected