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

Method cpp_array_arities

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

Source from the content-addressed store, hash-verified

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