mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(ast_codegen): reorder imports (#4709)
Pure refactor. Reorder imports to clarify what's an external crate and what's a local module.
This commit is contained in:
parent
654a6e67fa
commit
06efae6e4c
6 changed files with 30 additions and 29 deletions
|
|
@ -8,12 +8,12 @@ use proc_macro2::TokenStream;
|
||||||
use quote::{format_ident, quote, ToTokens};
|
use quote::{format_ident, quote, ToTokens};
|
||||||
use syn::{parse_quote, Ident, Type};
|
use syn::{parse_quote, Ident, Type};
|
||||||
|
|
||||||
use crate::schema::{
|
|
||||||
EnumDef, FieldDef, GetIdent, InheritDef, StructDef, ToType, TypeDef, TypeName, VariantDef,
|
|
||||||
};
|
|
||||||
use crate::{
|
use crate::{
|
||||||
generators::generated_header,
|
generators::generated_header,
|
||||||
output,
|
output,
|
||||||
|
schema::{
|
||||||
|
EnumDef, FieldDef, GetIdent, InheritDef, StructDef, ToType, TypeDef, TypeName, VariantDef,
|
||||||
|
},
|
||||||
util::{TypeAnalysis, TypeWrapper},
|
util::{TypeAnalysis, TypeWrapper},
|
||||||
Generator, GeneratorOutput, LateCtx,
|
Generator, GeneratorOutput, LateCtx,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,10 @@
|
||||||
|
use std::{cell::RefCell, collections::HashMap, io::Read, path::PathBuf, rc::Rc};
|
||||||
|
|
||||||
|
use bpaf::{Bpaf, Parser};
|
||||||
|
use itertools::Itertools;
|
||||||
|
use proc_macro2::TokenStream;
|
||||||
|
use syn::parse_file;
|
||||||
|
|
||||||
mod fmt;
|
mod fmt;
|
||||||
mod generators;
|
mod generators;
|
||||||
mod layout;
|
mod layout;
|
||||||
|
|
@ -7,19 +14,12 @@ mod rust_ast;
|
||||||
mod schema;
|
mod schema;
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
use std::{cell::RefCell, collections::HashMap, io::Read, path::PathBuf, rc::Rc};
|
|
||||||
|
|
||||||
use bpaf::{Bpaf, Parser};
|
|
||||||
use fmt::{cargo_fmt, pprint};
|
use fmt::{cargo_fmt, pprint};
|
||||||
use itertools::Itertools;
|
|
||||||
use passes::{CalcLayout, Linker, Pass};
|
|
||||||
use proc_macro2::TokenStream;
|
|
||||||
use syn::parse_file;
|
|
||||||
|
|
||||||
use generators::{
|
use generators::{
|
||||||
AssertLayouts, AstBuilderGenerator, AstKindGenerator, Generator, VisitGenerator,
|
AssertLayouts, AstBuilderGenerator, AstKindGenerator, Generator, VisitGenerator,
|
||||||
VisitMutGenerator,
|
VisitMutGenerator,
|
||||||
};
|
};
|
||||||
|
use passes::{CalcLayout, Linker, Pass};
|
||||||
use rust_ast::AstRef;
|
use rust_ast::AstRef;
|
||||||
use schema::{lower_ast_types, Schema, TypeDef};
|
use schema::{lower_ast_types, Schema, TypeDef};
|
||||||
use util::{write_all_to, NormalizeError};
|
use util::{write_all_to, NormalizeError};
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
/// We use compiler to infer 64bit type layouts.
|
|
||||||
#[cfg(not(target_pointer_width = "64"))]
|
|
||||||
compile_error!("`oxc_ast_codegen::layout` only supports 64 architectures.");
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
@ -17,6 +14,10 @@ use crate::{
|
||||||
|
|
||||||
use super::{define_pass, Pass};
|
use super::{define_pass, Pass};
|
||||||
|
|
||||||
|
/// We use compiler to infer 64bit type layouts.
|
||||||
|
#[cfg(not(target_pointer_width = "64"))]
|
||||||
|
compile_error!("`oxc_ast_codegen::calc_layout` only supports 64 architectures.");
|
||||||
|
|
||||||
type WellKnown = HashMap<&'static str, PlatformLayout>;
|
type WellKnown = HashMap<&'static str, PlatformLayout>;
|
||||||
|
|
||||||
define_pass! {
|
define_pass! {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
mod calc_layout;
|
|
||||||
mod linker;
|
|
||||||
|
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
|
|
||||||
use crate::{rust_ast::AstType, EarlyCtx, Result};
|
use crate::{rust_ast::AstType, EarlyCtx, Result};
|
||||||
|
|
||||||
|
mod calc_layout;
|
||||||
|
mod linker;
|
||||||
pub use calc_layout::CalcLayout;
|
pub use calc_layout::CalcLayout;
|
||||||
pub use linker::Linker;
|
pub use linker::Linker;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use super::{with_either, TypeName};
|
|
||||||
use crate::{
|
use crate::{
|
||||||
markers::{ScopeAttr, ScopeMarkers, VisitMarkers},
|
markers::{ScopeAttr, ScopeMarkers, VisitMarkers},
|
||||||
util::{ToIdent, TypeAnalysis, TypeWrapper},
|
util::{ToIdent, TypeAnalysis, TypeWrapper},
|
||||||
TypeId,
|
TypeId,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use super::{with_either, TypeName};
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
pub enum TypeDef {
|
pub enum TypeDef {
|
||||||
Struct(StructDef),
|
Struct(StructDef),
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
|
use quote::ToTokens;
|
||||||
|
use serde::Serialize;
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
layout::KnownLayout,
|
||||||
|
markers::{get_scope_attr, get_scope_markers, get_visit_markers},
|
||||||
|
rust_ast as rust,
|
||||||
|
util::{unexpanded_macro_err, TypeExt},
|
||||||
|
DefTable, Result,
|
||||||
|
};
|
||||||
|
|
||||||
mod defs;
|
mod defs;
|
||||||
mod get_generics;
|
mod get_generics;
|
||||||
mod get_ident;
|
mod get_ident;
|
||||||
mod to_type;
|
mod to_type;
|
||||||
|
|
||||||
use crate::rust_ast as rust;
|
|
||||||
use crate::{
|
|
||||||
layout::KnownLayout,
|
|
||||||
markers::{get_scope_attr, get_scope_markers, get_visit_markers},
|
|
||||||
util::{unexpanded_macro_err, TypeExt},
|
|
||||||
DefTable, Result,
|
|
||||||
};
|
|
||||||
use quote::ToTokens;
|
|
||||||
use serde::Serialize;
|
|
||||||
|
|
||||||
pub use defs::*;
|
pub use defs::*;
|
||||||
pub use get_generics::GetGenerics;
|
pub use get_generics::GetGenerics;
|
||||||
pub use get_ident::GetIdent;
|
pub use get_ident::GetIdent;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue