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

Method cpp_array_arities

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

Source from the content-addressed store, hash-verified

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