1
Fork 0
mirror of https://github.com/RGBCube/cstree synced 2025-07-27 09:07:44 +00:00

fix Clone impls for resolved elements

This commit is contained in:
Domenic Quirl 2021-06-23 13:46:47 +02:00
parent b3390aeea6
commit 87699336bb

View file

@ -22,7 +22,6 @@ use crate::{
/// # See also /// # See also
/// [`SyntaxNode`] /// [`SyntaxNode`]
/// [`SyntaxNode::new_root_with_resolver`] /// [`SyntaxNode::new_root_with_resolver`]
#[derive(Clone)]
#[repr(transparent)] #[repr(transparent)]
pub struct ResolvedNode<L: Language, D: 'static = ()> { pub struct ResolvedNode<L: Language, D: 'static = ()> {
pub(super) syntax: SyntaxNode<L, D>, pub(super) syntax: SyntaxNode<L, D>,
@ -41,6 +40,14 @@ impl<L: Language, D> ResolvedNode<L, D> {
} }
} }
impl<L: Language, D> Clone for ResolvedNode<L, D> {
fn clone(&self) -> Self {
Self {
syntax: self.syntax.clone(),
}
}
}
impl<L: Language, D> Deref for ResolvedNode<L, D> { impl<L: Language, D> Deref for ResolvedNode<L, D> {
type Target = SyntaxNode<L, D>; type Target = SyntaxNode<L, D>;
@ -77,6 +84,14 @@ impl<L: Language, D> ResolvedToken<L, D> {
} }
} }
impl<L: Language, D> Clone for ResolvedToken<L, D> {
fn clone(&self) -> Self {
Self {
syntax: self.syntax.clone(),
}
}
}
impl<L: Language, D> Deref for ResolvedToken<L, D> { impl<L: Language, D> Deref for ResolvedToken<L, D> {
type Target = SyntaxToken<L, D>; type Target = SyntaxToken<L, D>;