Skip to content
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
9 changes: 2 additions & 7 deletions tasks/ast_tools/src/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@
//! [`Derive`]: crate::Derive
//! [`Generator`]: crate::Generator

use indexmap::{IndexMap, IndexSet};
use oxc_index::IndexVec;
use rustc_hash::FxBuildHasher;
use syn::Ident;

use crate::{
Codegen, log, log_success,
schema::Derives,
schema::{File, FileId, Schema},
schema::{Derives, File, FileId, Schema},
utils::FxIndexMap,
};

pub mod attr;
Expand All @@ -67,9 +65,6 @@ use load::load_file;
use parse::parse;
use skeleton::Skeleton;

type FxIndexMap<K, V> = IndexMap<K, V, FxBuildHasher>;
type FxIndexSet<K> = IndexSet<K, FxBuildHasher>;

/// Analyse the files with provided paths, and generate a [`Schema`].
pub fn parse_files(file_paths: &[&str], codegen: &Codegen) -> Schema {
// Load files and populate `skeletons` and `meta_skeletons` + mapping from type name to `TypeId`.
Expand Down
3 changes: 2 additions & 1 deletion tasks/ast_tools/src/parse/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ use crate::{
BoxDef, CellDef, Def, EnumDef, FieldDef, File, FileId, MetaId, MetaType, OptionDef,
PrimitiveDef, Schema, StructDef, TypeDef, TypeId, VariantDef, VecDef, Visibility,
},
utils::{FxIndexMap, FxIndexSet},
};

use super::{
Derives, FxIndexMap, FxIndexSet,
Derives,
attr::{AttrLocation, AttrPart, AttrPartListElement, AttrPositions, AttrProcessor},
ident_name,
skeleton::{EnumSkeleton, Skeleton, StructSkeleton},
Expand Down
5 changes: 5 additions & 0 deletions tasks/ast_tools/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
use indexmap::{IndexMap, IndexSet};
use phf::{Set as PhfSet, phf_set};
use proc_macro2::{Span, TokenStream};
use quote::{format_ident, quote};
use rustc_hash::FxBuildHasher;
use syn::{Ident, LitInt};

pub type FxIndexMap<K, V> = IndexMap<K, V, FxBuildHasher>;
pub type FxIndexSet<K> = IndexSet<K, FxBuildHasher>;

/// Reserved word in Rust.
/// From <https://doc.rust-lang.org/reference/keywords.html>.
static RESERVED_NAMES: PhfSet<&'static str> = phf_set! {
Expand Down
Loading