extractRustRouteMacro — body-walker-only; bare `routes`/`catchers` identifiers only (`rocket::routes![…]` is skipped); identifier runs in the token tree join with `::`, flushed on `,` and at end.
(&mut self, node: Node<'t>)
| 904 | /// identifiers only (`rocket::routes![…]` is skipped); identifier runs in |
| 905 | /// the token tree join with `::`, flushed on `,` and at end. |
| 906 | fn extract_rust_route_macro(&mut self, node: Node<'t>) { |
| 907 | let Some(macro_name) = node.named_child(0) else { return }; |
| 908 | let name = self.text(macro_name); |
| 909 | if name != "routes" && name != "catchers" { |
| 910 | return; |
| 911 | } |
| 912 | let token_tree = (0..node.named_child_count()) |
| 913 | .filter_map(|i| node.named_child(i)) |
| 914 | .find(|c| c.kind() == "token_tree"); |
| 915 | let Some(token_tree) = token_tree else { return }; |
| 916 | if self.stack.is_empty() { |
| 917 | return; |
| 918 | } |
| 919 | let from = self.top_row(); |
| 920 | let refs_kind = edge_kind_index("references").unwrap(); |
| 921 | |
| 922 | let mut parts: Vec<&str> = Vec::new(); |
| 923 | let mut line = 0u32; |
| 924 | let mut column_byte = 0usize; |
| 925 | let mut row = 0usize; |
| 926 | macro_rules! flush { |
| 927 | () => { |
| 928 | if !parts.is_empty() { |
| 929 | let joined = parts.join("::"); |
| 930 | let column = util::col16(self.src, &self.line_starts, row, column_byte); |
| 931 | let name_ref = self.arena.put(&joined); |
| 932 | self.tables.push_ref(&RefRow { |
| 933 | from_idx: from, |
| 934 | kind: refs_kind, |
| 935 | line, |
| 936 | column, |
| 937 | reference_name: name_ref, |
| 938 | candidates: NONE_STR, |
| 939 | from_id_str: NONE_STR, |
| 940 | }); |
| 941 | parts.clear(); |
| 942 | } |
| 943 | }; |
| 944 | } |
| 945 | for i in 0..token_tree.child_count() { |
| 946 | let Some(t) = token_tree.child(i) else { continue }; |
| 947 | if t.kind() == "identifier" { |
| 948 | if parts.is_empty() { |
| 949 | line = t.start_position().row as u32 + 1; |
| 950 | column_byte = t.start_byte(); |
| 951 | row = t.start_position().row; |
| 952 | } |
| 953 | parts.push(self.text(t)); |
| 954 | } else if t.kind() == "," { |
| 955 | flush!(); |
| 956 | } |
| 957 | } |
| 958 | flush!(); |
| 959 | } |
| 960 | |
| 961 | /// extractInheritance — the rust-reachable cases: trait_bounds |
| 962 | /// (supertraits; a scoped `fmt::Debug` bound matches NO case and is |
no test coverage detected