From e2412c88ab817ab06edf836835ddd1f623ac615a Mon Sep 17 00:00:00 2001 From: Dunqing <29533304+Dunqing@users.noreply.github.com> Date: Fri, 24 Jan 2025 03:52:56 +0000 Subject: [PATCH] feat(ast): derive `Clone` for `TemplateElement` and `TemplateElementValue` (#8658) In #8614, we need to duplicate the same template literal, and derive `Copy` and `Clone` to avoid using `CloneIn`. --- crates/oxc_ast/src/ast/js.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/oxc_ast/src/ast/js.rs b/crates/oxc_ast/src/ast/js.rs index cdb06e507d41bc..7984e9dc875d48 100644 --- a/crates/oxc_ast/src/ast/js.rs +++ b/crates/oxc_ast/src/ast/js.rs @@ -432,7 +432,7 @@ pub struct TaggedTemplateExpression<'a> { /// /// Represents a quasi element in a template literal. #[ast(visit)] -#[derive(Debug)] +#[derive(Debug, Clone)] #[generate_derive(CloneIn, GetSpan, GetSpanMut, ContentEq, ESTree)] pub struct TemplateElement<'a> { pub span: Span, @@ -442,7 +442,7 @@ pub struct TemplateElement<'a> { /// See [template-strings-cooked-vs-raw](https://exploringjs.com/js/book/ch_template-literals.html#template-strings-cooked-vs-raw) #[ast] -#[derive(Debug)] +#[derive(Debug, Clone)] #[generate_derive(CloneIn, ContentEq, ESTree)] #[estree(no_type)] pub struct TemplateElementValue<'a> {