pub struct OriginMap {
pub definition: HashMap<NodeId, CstNodeId>,
pub value: HashMap<NodeId, CstNodeId>,
pub key: HashMap<(NodeId, ObjectKey), CstNodeId>,
pub key_span: HashMap<(NodeId, ObjectKey), InputSpan>,
pub key_span_by_cst: HashMap<(CstNodeId, ObjectKey), InputSpan>,
}Expand description
Origin tracking for document nodes and map keys.
This structure provides span resolution for error reporting:
definition: Where the node’s key/name is defined (for MissingRequiredField)value: The full value expression (for TypeMismatch, etc.)key: Maps (MapNodeId, ObjectKey) to the key’s CstNodeId (for precise key spans)
Fields§
§definition: HashMap<NodeId, CstNodeId>Definition span (where the node’s key/name is defined). Only the first definition is kept (via entry().or_insert()).
value: HashMap<NodeId, CstNodeId>Value span (the full value expression). Later values overwrite earlier ones.
key: HashMap<(NodeId, ObjectKey), CstNodeId>(MapNodeId, ObjectKey) -> key’s CstNodeId. Used for precise error spans on map keys.
key_span: HashMap<(NodeId, ObjectKey), InputSpan>Direct span storage for special cases (e.g., split float keys). Used when we need precise sub-spans that don’t correspond to a single CST node.
key_span_by_cst: HashMap<(CstNodeId, ObjectKey), InputSpan>CST-based key span storage: (CstNodeId, ObjectKey) -> InputSpan. Used for error reporting when we only have the CST node ID, not the document NodeId.
Implementations§
Source§impl OriginMap
impl OriginMap
Sourcepub fn record_definition(&mut self, node_id: NodeId, cst_node_id: CstNodeId)
pub fn record_definition(&mut self, node_id: NodeId, cst_node_id: CstNodeId)
Record a definition span for a node (typically the key). Only the first definition is kept.
Sourcepub fn record_value(&mut self, node_id: NodeId, cst_node_id: CstNodeId)
pub fn record_value(&mut self, node_id: NodeId, cst_node_id: CstNodeId)
Record a value span for a node (the full expression). Later values overwrite earlier ones.
Sourcepub fn record_key(
&mut self,
map_node_id: NodeId,
key: ObjectKey,
cst_node_id: CstNodeId,
)
pub fn record_key( &mut self, map_node_id: NodeId, key: ObjectKey, cst_node_id: CstNodeId, )
Record a map key origin.
Sourcepub fn record_key_span(
&mut self,
map_node_id: NodeId,
key: ObjectKey,
span: InputSpan,
)
pub fn record_key_span( &mut self, map_node_id: NodeId, key: ObjectKey, span: InputSpan, )
Record a map key origin with direct InputSpan. Used for special cases where the key span doesn’t correspond to a CST node.
Sourcepub fn record_key_span_by_cst(
&mut self,
cst_node_id: CstNodeId,
key: ObjectKey,
span: InputSpan,
)
pub fn record_key_span_by_cst( &mut self, cst_node_id: CstNodeId, key: ObjectKey, span: InputSpan, )
Record a map key origin with direct InputSpan, indexed by CST node ID. Used for error reporting when we only have the CST node ID.
Sourcepub fn get_value_span(&self, node_id: NodeId, cst: &Cst) -> Option<InputSpan>
pub fn get_value_span(&self, node_id: NodeId, cst: &Cst) -> Option<InputSpan>
Get the value span for a node (the full value expression). Used for TypeMismatch and other value-related errors.
Trait Implementations§
impl Eq for OriginMap
impl StructuralPartialEq for OriginMap
Auto Trait Implementations§
impl Freeze for OriginMap
impl RefUnwindSafe for OriginMap
impl Send for OriginMap
impl Sync for OriginMap
impl Unpin for OriginMap
impl UnwindSafe for OriginMap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.