Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(transformer): move BoundIdentifier into oxc_traverse crate #6293

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions crates/oxc_transformer/src/es2015/arrow_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,10 @@ use oxc_syntax::{
scope::{ScopeFlags, ScopeId},
symbol::SymbolFlags,
};
use oxc_traverse::{Ancestor, Traverse, TraverseCtx};
use oxc_traverse::{Ancestor, BoundIdentifier, Traverse, TraverseCtx};

use serde::Deserialize;

use crate::helpers::bindings::BoundIdentifier;

#[derive(Debug, Default, Clone, Deserialize)]
pub struct ArrowFunctionsOptions {
/// This option enables the following:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ use oxc_ast::ast::*;
use oxc_semantic::{ReferenceFlags, SymbolFlags};
use oxc_span::SPAN;
use oxc_syntax::operator::{AssignmentOperator, LogicalOperator};
use oxc_traverse::{Traverse, TraverseCtx};
use oxc_traverse::{BoundIdentifier, Traverse, TraverseCtx};

use crate::{helpers::bindings::BoundIdentifier, TransformCtx};
use crate::TransformCtx;

pub struct LogicalAssignmentOperators<'a, 'ctx> {
ctx: &'ctx TransformCtx<'a>,
Expand Down
4 changes: 0 additions & 4 deletions crates/oxc_transformer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ mod typescript;

mod plugins;

mod helpers {
pub mod bindings;
}

use std::path::Path;

use common::Common;
Expand Down
7 changes: 3 additions & 4 deletions crates/oxc_transformer/src/react/jsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,16 @@ use oxc_syntax::{
symbol::SymbolFlags,
xml_entities::XML_ENTITIES,
};
use oxc_traverse::{Traverse, TraverseCtx};
use oxc_traverse::{BoundIdentifier, Traverse, TraverseCtx};

use crate::{common::module_imports::NamedImport, TransformCtx};

use super::diagnostics;
pub use super::{
jsx_self::ReactJsxSelf,
jsx_source::ReactJsxSource,
options::{JsxOptions, JsxRuntime},
};
use crate::{
common::module_imports::NamedImport, helpers::bindings::BoundIdentifier, TransformCtx,
};

pub struct ReactJsx<'a, 'ctx> {
options: JsxOptions,
Expand Down
5 changes: 3 additions & 2 deletions crates/oxc_transformer/src/react/jsx_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,12 @@ use oxc_ast::{ast::*, NONE};
use oxc_diagnostics::OxcDiagnostic;
use oxc_span::{Span, SPAN};
use oxc_syntax::{number::NumberBase, symbol::SymbolFlags};
use oxc_traverse::{Traverse, TraverseCtx};
use oxc_traverse::{BoundIdentifier, Traverse, TraverseCtx};
use ropey::Rope;

use crate::TransformCtx;

use super::utils::get_line_column;
use crate::{helpers::bindings::BoundIdentifier, TransformCtx};

const SOURCE: &str = "__source";
const FILE_NAME_VAR: &str = "jsxFileName";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use oxc_syntax::{
scope::ScopeId,
symbol::{SymbolFlags, SymbolId},
};
use oxc_traverse::TraverseCtx;

use crate::TraverseCtx;

/// Info about a binding, from which one can create a `BindingIdentifier` or `IdentifierReference`s.
///
Expand Down
3 changes: 3 additions & 0 deletions crates/oxc_traverse/src/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ use oxc_syntax::{
};

use crate::ancestor::{Ancestor, AncestorType};

mod ancestry;
mod ast_operations;
mod bound_identifier;
use ancestry::PopToken;
pub use ancestry::TraverseAncestry;
pub use bound_identifier::BoundIdentifier;
mod identifier;
mod scoping;
pub use scoping::TraverseScoping;
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_traverse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ use oxc_ast::ast::Program;
use oxc_semantic::{ScopeTree, SymbolTable};

mod context;
pub use context::{TraverseAncestry, TraverseCtx, TraverseScoping};
pub use context::{BoundIdentifier, TraverseAncestry, TraverseCtx, TraverseScoping};

mod generated {
pub mod ancestor;
Expand Down