mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
style(ast_tools): reorder imports (#6904)
Pure refactor. Re-order imports for clarity.
This commit is contained in:
parent
45333bc8d2
commit
6e68c9398b
17 changed files with 35 additions and 17 deletions
|
|
@ -3,13 +3,14 @@ use proc_macro2::TokenStream;
|
|||
use quote::{format_ident, quote};
|
||||
use syn::Ident;
|
||||
|
||||
use super::{define_derive, Derive};
|
||||
use crate::{
|
||||
codegen::LateCtx,
|
||||
markers::CloneInAttribute,
|
||||
schema::{EnumDef, GetIdent, StructDef, TypeDef},
|
||||
};
|
||||
|
||||
use super::{define_derive, Derive};
|
||||
|
||||
pub struct DeriveCloneIn;
|
||||
|
||||
define_derive!(DeriveCloneIn);
|
||||
|
|
|
|||
|
|
@ -2,13 +2,14 @@ use itertools::Itertools;
|
|||
use proc_macro2::TokenStream;
|
||||
use quote::quote;
|
||||
|
||||
use super::{define_derive, Derive};
|
||||
use crate::{
|
||||
codegen::LateCtx,
|
||||
schema::{EnumDef, GetGenerics, StructDef, ToType, TypeDef},
|
||||
util::ToIdent,
|
||||
};
|
||||
|
||||
use super::{define_derive, Derive};
|
||||
|
||||
pub struct DeriveContentEq;
|
||||
|
||||
define_derive!(DeriveContentEq);
|
||||
|
|
|
|||
|
|
@ -2,13 +2,14 @@ use itertools::Itertools;
|
|||
use proc_macro2::TokenStream;
|
||||
use quote::quote;
|
||||
|
||||
use super::{define_derive, Derive};
|
||||
use crate::{
|
||||
codegen::LateCtx,
|
||||
schema::{EnumDef, GetGenerics, StructDef, ToType, TypeDef},
|
||||
util::ToIdent,
|
||||
};
|
||||
|
||||
use super::{define_derive, Derive};
|
||||
|
||||
pub struct DeriveContentHash;
|
||||
|
||||
define_derive!(DeriveContentHash);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ use convert_case::{Case, Casing};
|
|||
use proc_macro2::TokenStream;
|
||||
use quote::quote;
|
||||
|
||||
use super::{define_derive, Derive};
|
||||
use crate::{
|
||||
codegen::LateCtx,
|
||||
markers::ESTreeStructAttribute,
|
||||
|
|
@ -12,6 +11,8 @@ use crate::{
|
|||
},
|
||||
};
|
||||
|
||||
use super::{define_derive, Derive};
|
||||
|
||||
pub struct DeriveESTree;
|
||||
|
||||
define_derive!(DeriveESTree);
|
||||
|
|
|
|||
|
|
@ -2,13 +2,14 @@ use proc_macro2::TokenStream;
|
|||
use quote::quote;
|
||||
use syn::Ident;
|
||||
|
||||
use super::{define_derive, Derive};
|
||||
use crate::{
|
||||
codegen::LateCtx,
|
||||
schema::{EnumDef, GetGenerics, StructDef, ToType, TypeDef},
|
||||
util::{ToIdent, TypeWrapper},
|
||||
};
|
||||
|
||||
use super::{define_derive, Derive};
|
||||
|
||||
pub struct DeriveGetSpan;
|
||||
|
||||
define_derive!(DeriveGetSpan);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ use proc_macro2::TokenStream;
|
|||
use quote::quote;
|
||||
use syn::Type;
|
||||
|
||||
use super::define_generator;
|
||||
use crate::{
|
||||
codegen::LateCtx,
|
||||
output::{output_path, Output},
|
||||
|
|
@ -11,6 +10,8 @@ use crate::{
|
|||
Generator,
|
||||
};
|
||||
|
||||
use super::define_generator;
|
||||
|
||||
pub struct AssertLayouts;
|
||||
|
||||
define_generator!(AssertLayouts);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use quote::{format_ident, quote, ToTokens};
|
|||
use rustc_hash::FxHashMap;
|
||||
use syn::{parse_quote, Ident, Type};
|
||||
|
||||
use super::define_generator;
|
||||
use crate::{
|
||||
codegen::LateCtx,
|
||||
output::{output_path, Output},
|
||||
|
|
@ -19,6 +18,8 @@ use crate::{
|
|||
Generator,
|
||||
};
|
||||
|
||||
use super::define_generator;
|
||||
|
||||
pub struct AstBuilderGenerator;
|
||||
|
||||
define_generator!(AstBuilderGenerator);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ use itertools::Itertools;
|
|||
use quote::{format_ident, quote};
|
||||
use syn::{parse_quote, Arm, ImplItemFn, Variant};
|
||||
|
||||
use super::define_generator;
|
||||
use crate::{
|
||||
codegen::LateCtx,
|
||||
output::{output_path, Output},
|
||||
|
|
@ -11,6 +10,8 @@ use crate::{
|
|||
Generator,
|
||||
};
|
||||
|
||||
use super::define_generator;
|
||||
|
||||
pub struct AstKindGenerator;
|
||||
|
||||
define_generator!(AstKindGenerator);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use convert_case::{Case, Casing};
|
||||
use itertools::Itertools;
|
||||
|
||||
use super::define_generator;
|
||||
use crate::{
|
||||
codegen::LateCtx,
|
||||
output::{output_path, Output},
|
||||
|
|
@ -12,6 +11,8 @@ use crate::{
|
|||
Generator,
|
||||
};
|
||||
|
||||
use super::define_generator;
|
||||
|
||||
const CUSTOM_TYPESCRIPT: &str = include_str!("../../../../crates/oxc_ast/src/ast/types.d.ts");
|
||||
|
||||
pub struct TypescriptGenerator;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use quote::{format_ident, quote, ToTokens};
|
|||
use rustc_hash::FxHashMap;
|
||||
use syn::{parse_quote, Ident};
|
||||
|
||||
use super::define_generator;
|
||||
use crate::{
|
||||
codegen::LateCtx,
|
||||
generators::ast_kind::BLACK_LIST as KIND_BLACK_LIST,
|
||||
|
|
@ -18,6 +17,8 @@ use crate::{
|
|||
Generator,
|
||||
};
|
||||
|
||||
use super::define_generator;
|
||||
|
||||
pub struct VisitGenerator;
|
||||
|
||||
define_generator!(VisitGenerator);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#![allow(clippy::disallowed_methods)]
|
||||
|
||||
use std::{cell::RefCell, io::Read, path::PathBuf, rc::Rc};
|
||||
|
||||
use bpaf::{Bpaf, Parser};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ use quote::ToTokens;
|
|||
use rustc_hash::FxHashMap;
|
||||
use syn::Type;
|
||||
|
||||
use super::{define_pass, Pass};
|
||||
use crate::{
|
||||
codegen::EarlyCtx,
|
||||
layout::{KnownLayout, Layout},
|
||||
|
|
@ -15,6 +14,8 @@ use crate::{
|
|||
Result,
|
||||
};
|
||||
|
||||
use super::{define_pass, Pass};
|
||||
|
||||
/// We use compiler to infer 64bit type layouts.
|
||||
#[cfg(not(target_pointer_width = "64"))]
|
||||
compile_error!("This module only supports 64bit architectures.");
|
||||
|
|
|
|||
|
|
@ -2,9 +2,10 @@ use std::borrow::Cow;
|
|||
|
||||
use syn::parse_quote;
|
||||
|
||||
use super::{define_pass, AstType, Pass, Result};
|
||||
use crate::{codegen::EarlyCtx, rust_ast::Inherit, util::NormalizeError};
|
||||
|
||||
use super::{define_pass, AstType, Pass, Result};
|
||||
|
||||
pub trait Unresolved {
|
||||
fn unresolved(&self) -> bool;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,11 @@ use syn::{
|
|||
Variant, Visibility,
|
||||
};
|
||||
|
||||
use super::{parse_file, Itertools, PathBuf, Rc, Read, RefCell, Result};
|
||||
use crate::{
|
||||
layout::Layout,
|
||||
parse_file,
|
||||
util::{unexpanded_macro_err, NormalizeError},
|
||||
Itertools, PathBuf, Rc, Read, RefCell, Result,
|
||||
};
|
||||
|
||||
pub type AstRef = Rc<RefCell<AstType>>;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use serde::Serialize;
|
||||
use syn::Ident;
|
||||
|
||||
use super::{with_either, TypeName};
|
||||
use crate::{
|
||||
markers::{
|
||||
DeriveAttributes, ESTreeEnumAttribute, ESTreeStructAttribute, ScopeAttribute, ScopeMarkers,
|
||||
|
|
@ -11,6 +10,8 @@ use crate::{
|
|||
TypeId,
|
||||
};
|
||||
|
||||
use super::{with_either, TypeName};
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum TypeDef {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
use syn::Ident;
|
||||
|
||||
use crate::util::ToIdent;
|
||||
|
||||
use super::{
|
||||
defs::{EnumDef, StructDef, TypeDef},
|
||||
with_either,
|
||||
};
|
||||
use crate::util::ToIdent;
|
||||
|
||||
pub trait GetIdent {
|
||||
fn ident(&self) -> Ident;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
use super::{EnumDef, StructDef, VariantDef};
|
||||
use crate::{markers::ESTreeStructAttribute, schema::GetIdent};
|
||||
use convert_case::{Case, Casing};
|
||||
|
||||
use crate::{markers::ESTreeStructAttribute, schema::GetIdent};
|
||||
|
||||
use super::{EnumDef, StructDef, VariantDef};
|
||||
|
||||
pub fn enum_variant_name(var: &VariantDef, enm: &EnumDef) -> String {
|
||||
match var.markers.derive_attributes.estree.rename.as_ref() {
|
||||
Some(rename) => rename.to_string(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue