| 3264 | } |
| 3265 | |
| 3266 | static void rs_item_impl(rs_scan_t *s, TSNode n, int mod) { |
| 3267 | TSNode type = rs_field(n, "type"); |
| 3268 | TSNode trait = rs_field(n, "trait"); |
| 3269 | TSNode tparams = rs_field(n, "type_parameters"); |
| 3270 | char self_path[RS_SCAN_PATH_CAP]; |
| 3271 | char trait_path[RS_SCAN_PATH_CAP]; |
| 3272 | bool has_self = rs_type_path(s, type, self_path, sizeof(self_path)) && |
| 3273 | !rs_is_generic(s, tparams, self_path); |
| 3274 | bool has_trait = !ts_node_is_null(trait); |
| 3275 | bool trait_ok = has_trait && rs_type_path(s, trait, trait_path, sizeof(trait_path)); |
| 3276 | rs_rec(s, 'I'); |
| 3277 | rs_rec_u(s, (uint32_t)mod); |
| 3278 | rs_rec_u(s, rs_line_of(n)); |
| 3279 | rs_rec_u(s, rs_end_line_of(n)); |
| 3280 | rs_rec_s(s, has_self ? self_path : "?"); |
| 3281 | rs_rec_s(s, has_trait ? (trait_ok ? trait_path : "?") : "-"); |
| 3282 | rs_rec_end(s); |
| 3283 | /* the extractor names a method <type text up to '<'>.<name> */ |
| 3284 | const char *owner_qn = NULL; |
| 3285 | if (has_self && !ts_node_is_null(type)) { |
| 3286 | uint32_t a = ts_node_start_byte(type); |
| 3287 | uint32_t b = ts_node_end_byte(type); |
| 3288 | const char *lt = b > a ? (const char *)memchr(s->src + a, '<', b - a) : NULL; |
| 3289 | size_t len = lt ? (size_t)(lt - (s->src + a)) : (size_t)(b - a); |
| 3290 | owner_qn = rs_owner_qn(s, s->src + a, len); |
| 3291 | } |
| 3292 | rs_scan_members(s, mod, rs_field(n, "body"), owner_qn, tparams, false); |
| 3293 | } |
| 3294 | |
| 3295 | /* What the scan does with a module-level item of one node kind. */ |
| 3296 | typedef struct { |
no test coverage detected