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>)
| 1062 | /// identifiers only (`rocket::routes![…]` is skipped); identifier runs in |
| 1063 | /// the token tree join with `::`, flushed on `,` and at end. |
| 1064 | fn extract_rust_route_macro(&mut self, node: Node<'t>) { |
| 1065 | let Some(macro_name) = node.named_child(0) else { return }; |
| 1066 | let name = self.text(macro_name); |
| 1067 | if name != "routes" && name != "catchers" { |
| 1068 | return; |
| 1069 | } |
| 1070 | let token_tree = (0..node.named_child_count()) |
| 1071 | .filter_map(|i| node.named_child(i)) |
| 1072 | .find(|c| c.kind() == "token_tree"); |
| 1073 | let Some(token_tree) = token_tree else { return }; |
| 1074 | if self.stack.is_empty() { |
| 1075 | return; |
| 1076 | } |
| 1077 | let from = self.top_row(); |
| 1078 | let refs_kind = edge_kind_index("references").unwrap(); |
| 1079 | |
| 1080 | let mut parts: Vec<&str> = Vec::new(); |
| 1081 | let mut line = 0u32; |
| 1082 | let mut column_byte = 0usize; |
| 1083 | let mut row = 0usize; |
| 1084 | macro_rules! flush { |
| 1085 | () => { |
| 1086 | if !parts.is_empty() { |
| 1087 | let joined = parts.join("::"); |
| 1088 | let column = util::col16(self.src, &self.line_starts, row, column_byte); |
| 1089 | let name_ref = self.arena.put(&joined); |
| 1090 | self.tables.push_ref(&RefRow { |
| 1091 | from_idx: from, |
| 1092 | kind: refs_kind, |
| 1093 | line, |
| 1094 | column, |
| 1095 | reference_name: name_ref, |
| 1096 | candidates: NONE_STR, |
| 1097 | from_id_str: NONE_STR, |
| 1098 | }); |
| 1099 | parts.clear(); |
| 1100 | } |
| 1101 | }; |
| 1102 | } |
| 1103 | for i in 0..token_tree.child_count() { |
| 1104 | let Some(t) = token_tree.child(i) else { continue }; |
| 1105 | if t.kind() == "identifier" { |
| 1106 | if parts.is_empty() { |
| 1107 | line = t.start_position().row as u32 + 1; |
| 1108 | column_byte = t.start_byte(); |
| 1109 | row = t.start_position().row; |
| 1110 | } |
| 1111 | parts.push(self.text(t)); |
| 1112 | } else if t.kind() == "," { |
| 1113 | flush!(); |
| 1114 | } |
| 1115 | } |
| 1116 | flush!(); |
| 1117 | } |
| 1118 | |
| 1119 | /// extractInheritance — the rust-reachable cases: trait_bounds |
| 1120 | /// (supertraits; a scoped `fmt::Debug` bound matches NO case and is |
no test coverage detected