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(semantic, transformer): simplify FxIndexMap type aliases #7524

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
6 changes: 3 additions & 3 deletions crates/oxc_semantic/src/scope.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{hash::BuildHasherDefault, mem};
use std::mem;

use indexmap::IndexMap;
use rustc_hash::{FxHashMap, FxHasher};
use rustc_hash::{FxBuildHasher, FxHashMap};

use oxc_index::IndexVec;
use oxc_span::CompactStr;
Expand All @@ -10,7 +10,7 @@ pub use oxc_syntax::scope::{ScopeFlags, ScopeId};

use crate::{symbol::SymbolId, NodeId};

type FxIndexMap<K, V> = IndexMap<K, V, BuildHasherDefault<FxHasher>>;
type FxIndexMap<K, V> = IndexMap<K, V, FxBuildHasher>;

pub(crate) type Bindings = FxIndexMap<CompactStr, SymbolId>;
pub type UnresolvedReferences = FxHashMap<CompactStr, Vec<ReferenceId>>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,9 @@
//! The Implementation based on
//! <https://github.com/babel/babel/blob/d20b314c14533ab86351ecf6ca6b7296b66a57b3/packages/babel-traverse/src/path/conversion.ts#L170-L247>

use std::hash::BuildHasherDefault;

use compact_str::CompactString;
use indexmap::IndexMap;
use rustc_hash::{FxHashSet, FxHasher};
use rustc_hash::{FxBuildHasher, FxHashSet};

use oxc_allocator::{Box as ArenaBox, Vec as ArenaVec};
use oxc_ast::{ast::*, NONE};
Expand All @@ -106,7 +104,7 @@ use oxc_traverse::{Ancestor, BoundIdentifier, Traverse, TraverseCtx};

use crate::EnvOptions;

type FxIndexMap<K, V> = IndexMap<K, V, BuildHasherDefault<FxHasher>>;
type FxIndexMap<K, V> = IndexMap<K, V, FxBuildHasher>;

/// Mode for arrow function conversion
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
Expand Down
6 changes: 2 additions & 4 deletions crates/oxc_transformer/src/es2022/class_properties/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,8 @@
//! * <https://github.com/babel/babel/blob/v7.26.2/packages/babel-helper-create-class-features-plugin/src/fields.ts>
//! * Class properties TC39 proposal: <https://github.com/tc39/proposal-class-fields>

use std::hash::BuildHasherDefault;

use indexmap::IndexMap;
use rustc_hash::FxHasher;
use rustc_hash::FxBuildHasher;
use serde::Deserialize;

use oxc_allocator::{Address, GetAddress};
Expand All @@ -158,7 +156,7 @@ mod private;
mod static_prop;
mod utils;

type FxIndexMap<K, V> = IndexMap<K, V, BuildHasherDefault<FxHasher>>;
type FxIndexMap<K, V> = IndexMap<K, V, FxBuildHasher>;

#[derive(Debug, Default, Clone, Copy, Deserialize)]
#[serde(default, rename_all = "camelCase")]
Expand Down
6 changes: 3 additions & 3 deletions tasks/transform_checker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@
use std::{
cell::Cell,
fmt::{Debug, Display},
hash::{BuildHasherDefault, Hash},
hash::Hash,
};

use indexmap::IndexMap;
use rustc_hash::FxHasher;
use rustc_hash::FxBuildHasher;

use oxc_allocator::{Allocator, CloneIn};
use oxc_ast::{ast::*, visit::walk, Visit};
Expand All @@ -105,7 +105,7 @@ use oxc_syntax::{
symbol::SymbolId,
};

type FxIndexMap<K, V> = IndexMap<K, V, BuildHasherDefault<FxHasher>>;
type FxIndexMap<K, V> = IndexMap<K, V, FxBuildHasher>;

/// Check `ScopeTree` and `SymbolTable` are correct after transform
pub fn check_semantic_after_transform(
Expand Down
Loading