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>)
| 938 | /// identifiers only (`rocket::routes![…]` is skipped); identifier runs in |
| 939 | /// the token tree join with `::`, flushed on `,` and at end. |
| 940 | fn extract_rust_route_macro(&mut self, node: Node<'t>) { |
| 941 | let Some(macro_name) = node.named_child(0) else { return }; |
| 942 | let name = self.text(macro_name); |
| 943 | if name != "routes" && name != "catchers" { |
| 944 | return; |
| 945 | } |
| 946 | let token_tree = (0..node.named_child_count()) |
| 947 | .filter_map(|i| node.named_child(i)) |
| 948 | .find(|c| c.kind() == "token_tree"); |
| 949 | let Some(token_tree) = token_tree else { return }; |
| 950 | if self.stack.is_empty() { |
| 951 | return; |
| 952 | } |
| 953 | let from = self.top_row(); |
| 954 | let refs_kind = edge_kind_index("references").unwrap(); |
| 955 | |
| 956 | let mut parts: Vec<&str> = Vec::new(); |
| 957 | let mut line = 0u32; |
| 958 | let mut column_byte = 0usize; |
| 959 | let mut row = 0usize; |
| 960 | macro_rules! flush { |
| 961 | () => { |
| 962 | if !parts.is_empty() { |
| 963 | let joined = parts.join("::"); |
| 964 | let column = util::col16(self.src, &self.line_starts, row, column_byte); |
| 965 | let name_ref = self.arena.put(&joined); |
| 966 | self.tables.push_ref(&RefRow { |
| 967 | from_idx: from, |
| 968 | kind: refs_kind, |
| 969 | line, |
| 970 | column, |
| 971 | reference_name: name_ref, |
| 972 | candidates: NONE_STR, |
| 973 | from_id_str: NONE_STR, |
| 974 | }); |
| 975 | parts.clear(); |
| 976 | } |
| 977 | }; |
| 978 | } |
| 979 | for i in 0..token_tree.child_count() { |
| 980 | let Some(t) = token_tree.child(i) else { continue }; |
| 981 | if t.kind() == "identifier" { |
| 982 | if parts.is_empty() { |
| 983 | line = t.start_position().row as u32 + 1; |
| 984 | column_byte = t.start_byte(); |
| 985 | row = t.start_position().row; |
| 986 | } |
| 987 | parts.push(self.text(t)); |
| 988 | } else if t.kind() == "," { |
| 989 | flush!(); |
| 990 | } |
| 991 | } |
| 992 | flush!(); |
| 993 | } |
| 994 | |
| 995 | /// extractInheritance — the rust-reachable cases: trait_bounds |
| 996 | /// (supertraits; a scoped `fmt::Debug` bound matches NO case and is |
no test coverage detected