(&self, module_ref: &'ast ParsedModuleRef)
| 95 | /// different file, Python version, or Salsa revision than the module to which the node belongs. |
| 96 | #[track_caller] |
| 97 | pub fn node<'ast>(&self, module_ref: &'ast ParsedModuleRef) -> &'ast T { |
| 98 | #[cfg(debug_assertions)] |
| 99 | assert_eq!( |
| 100 | ( |
| 101 | module_ref.module().file(), |
| 102 | module_ref.module().python_version() |
| 103 | ), |
| 104 | (self.file, self.python_version), |
| 105 | "an `AstNodeRef` cannot be used with a module parsed for a different file or Python version" |
| 106 | ); |
| 107 | // The user guarantees that the module is from the same file, Python version, and Salsa |
| 108 | // revision, so the file contents cannot have changed. |
| 109 | module_ref |
| 110 | .get_by_index(self.index) |
| 111 | .try_into() |
| 112 | .ok() |
| 113 | .expect("AST indices should never change within the same revision") |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | impl<T> get_size2::GetSize for AstNodeRef<T> {} |
no test coverage detected