Creates a new `AstNodeRef` that references `node`. This method may panic or produce unspecified results if the provided module is from a different file, Python version, or Salsa revision than the module to which the node belongs.
(module_ref: &ParsedModuleRef, node: &T)
| 72 | /// This method may panic or produce unspecified results if the provided module is from a |
| 73 | /// different file, Python version, or Salsa revision than the module to which the node belongs. |
| 74 | pub fn new(module_ref: &ParsedModuleRef, node: &T) -> Self { |
| 75 | let index = node.node_index().load(); |
| 76 | debug_assert_eq!(module_ref.get_by_index(index).try_into().ok(), Some(node)); |
| 77 | |
| 78 | Self { |
| 79 | index, |
| 80 | #[cfg(debug_assertions)] |
| 81 | file: module_ref.module().file(), |
| 82 | #[cfg(debug_assertions)] |
| 83 | python_version: module_ref.module().python_version(), |
| 84 | #[cfg(debug_assertions)] |
| 85 | kind: AnyNodeRef::from(node).kind(), |
| 86 | #[cfg(debug_assertions)] |
| 87 | range: node.range(), |
| 88 | _node: PhantomData, |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | /// Returns a reference to the wrapped node. |
| 93 | /// |
nothing calls this directly
no test coverage detected