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

Method cpp_array_arities

codegraph-kernel/src/ccpp/mod.rs:1930–1948  ·  view source on GitHub ↗
(list: Node<'t>, dimensions: &[Option<usize>], arities: &mut Vec<usize>)

Source from the content-addressed store, hash-verified

1928 }
1929
1930 fn cpp_array_arities(list: Node<'t>, dimensions: &[Option<usize>], arities: &mut Vec<usize>) {
1931 let entries: Vec<_> = (0..list.named_child_count()).filter_map(|j| list.named_child(j))
1932 .filter(|n| n.kind() != "comment").collect();
1933 let mut elided = false;
1934 for entry in &entries {
1935 if dimensions.len() > 1 {
1936 if entry.kind() == "initializer_list" { Self::cpp_array_arities(*entry, &dimensions[1..], arities); }
1937 else { elided = true; }
1938 } else {
1939 arities.push(if entry.kind() == "initializer_list" {
1940 (0..entry.named_child_count()).filter_map(|j| entry.named_child(j))
1941 .filter(|n| n.kind() != "comment").count()
1942 } else { 1 });
1943 }
1944 }
1945 if !elided && (entries.is_empty() || dimensions[0].map(|n| n > entries.len()).unwrap_or(false)) {
1946 arities.push(0);
1947 }
1948 }
1949
1950 fn cpp_object_array(&self, node: Node<'t>) -> bool {
1951 let mut element = node.child_by_field_name("declarator");

Callers

nothing calls this directly

Calls 4

lenMethod · 0.80
pushMethod · 0.80
mapMethod · 0.80
collectMethod · 0.45

Tested by

no test coverage detected