From 3407d470aae9cbeda6a956a270abcebae7a7e0dc Mon Sep 17 00:00:00 2001
From: overlookmotel <557937+overlookmotel@users.noreply.github.com>
Date: Tue, 4 Feb 2025 02:48:18 +0000
Subject: [PATCH] refactor(ast): move `#[clone_in(default)]` to types (#8876)
Remove `#[clone_in(default)]` attributes from struct fields containing semantic IDs, and add that attribute to the `ScopeId`, `SymbolId` and `ReferenceId` types instead. This reduces pointless repetition in the AST type definitions.
---
crates/oxc_ast/src/ast/js.rs | 13 ----
crates/oxc_ast/src/ast/ts.rs | 8 ---
crates/oxc_syntax/src/reference.rs | 1 +
crates/oxc_syntax/src/scope.rs | 1 +
crates/oxc_syntax/src/symbol.rs | 1 +
tasks/ast_tools/src/derives/clone_in.rs | 68 ++++++++++++++-----
tasks/ast_tools/src/schema/defs/enum.rs | 3 +
tasks/ast_tools/src/schema/defs/struct.rs | 4 +-
.../src/schema/extensions/clone_in.rs | 7 ++
9 files changed, 68 insertions(+), 38 deletions(-)
diff --git a/crates/oxc_ast/src/ast/js.rs b/crates/oxc_ast/src/ast/js.rs
index 337477d4f0771..5def04414cae0 100644
--- a/crates/oxc_ast/src/ast/js.rs
+++ b/crates/oxc_ast/src/ast/js.rs
@@ -41,7 +41,6 @@ pub struct Program<'a> {
pub directives: Vec<'a, Directive<'a>>,
pub body: Vec<'a, Statement<'a>>,
#[estree(skip)]
- #[clone_in(default)]
pub scope_id: Cell