Get the root field name from this operation For NamedField/UnnamedField, returns that name For Chained, recursively finds the first field access (skipping Deref operations)
(&self)
| 213 | /// For NamedField/UnnamedField, returns that name |
| 214 | /// For Chained, recursively finds the first field access (skipping Deref operations) |
| 215 | pub(crate) fn root_field_name(&self) -> FieldName { |
| 216 | match self { |
| 217 | FieldOperation::NamedField { name, .. } => FieldName::Ident(name.clone()), |
| 218 | FieldOperation::UnnamedField { index, .. } => FieldName::Index(*index), |
| 219 | FieldOperation::Chained { operations, .. } => { |
| 220 | // Find the first non-Deref operation and get its root field name |
| 221 | operations |
| 222 | .iter() |
| 223 | .find(|op| !matches!(op, FieldOperation::Deref { .. })) |
| 224 | .expect("Chained operation must have at least one non-Deref operation") |
| 225 | .root_field_name() |
| 226 | } |
| 227 | _ => panic!("Cannot extract root field name from {:?}", self), |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | /// Get operations after the root field access (tail operations) |
| 232 | /// For NamedField/UnnamedField alone, returns None (no additional operations) |
no outgoing calls
no test coverage detected