mirror of
https://github.com/Zenithsiz/zbuild.git
synced 2026-02-03 14:10:02 +00:00
Replaced several more IndexMaps with HashMaps.
This commit is contained in:
parent
e5a5580832
commit
2ee5f5796a
@ -7,9 +7,8 @@ use {
|
||||
util::ArcStr,
|
||||
AppError,
|
||||
},
|
||||
indexmap::IndexMap,
|
||||
smallvec::SmallVec,
|
||||
std::{mem, path::PathBuf},
|
||||
std::{collections::HashMap, mem, path::PathBuf},
|
||||
zutil_app_error::{app_error, AllErrs, Context},
|
||||
};
|
||||
|
||||
@ -261,10 +260,10 @@ impl TryFromExpr for ArcStr {
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Visitor<'a> {
|
||||
/// All aliases, in order to check
|
||||
aliases: SmallVec<[&'a IndexMap<ArcStr, Expr>; 2]>,
|
||||
aliases: SmallVec<[&'a HashMap<ArcStr, Expr>; 2]>,
|
||||
|
||||
/// All unresolved patterns, in order to check
|
||||
unresolved_pats: SmallVec<[&'a IndexMap<ArcStr, Pattern>; 2]>,
|
||||
unresolved_pats: SmallVec<[&'a HashMap<ArcStr, Pattern>; 2]>,
|
||||
|
||||
/// All resolved patterns
|
||||
resolved_pats: SmallVec<[(ArcStr, ArcStr); 1]>,
|
||||
@ -274,8 +273,8 @@ impl<'a> Visitor<'a> {
|
||||
/// Creates a new visitor with aliases and patterns
|
||||
pub fn new<A, UP, RP>(aliases: A, unresolved_pats: UP, resolved_pats: RP) -> Self
|
||||
where
|
||||
A: IntoIterator<Item = &'a IndexMap<ArcStr, Expr>>,
|
||||
UP: IntoIterator<Item = &'a IndexMap<ArcStr, Pattern>>,
|
||||
A: IntoIterator<Item = &'a HashMap<ArcStr, Expr>>,
|
||||
UP: IntoIterator<Item = &'a HashMap<ArcStr, Pattern>>,
|
||||
RP: IntoIterator<Item = SmallVec<[(ArcStr, ArcStr); 1]>>,
|
||||
{
|
||||
Self {
|
||||
|
||||
@ -19,7 +19,7 @@ pub use {
|
||||
// Imports
|
||||
use {
|
||||
crate::{util::ArcStr, AppError, Ast},
|
||||
indexmap::IndexMap,
|
||||
std::collections::HashMap,
|
||||
};
|
||||
|
||||
/// Rules.
|
||||
@ -32,20 +32,20 @@ pub struct Rules {
|
||||
///
|
||||
/// These are available for the whole program to
|
||||
/// use.
|
||||
pub aliases: IndexMap<ArcStr, Expr>,
|
||||
pub aliases: HashMap<ArcStr, Expr>,
|
||||
|
||||
/// Patterns.
|
||||
///
|
||||
/// These are available for the whole program to
|
||||
/// use.
|
||||
pub pats: IndexMap<ArcStr, Pattern>,
|
||||
pub pats: HashMap<ArcStr, Pattern>,
|
||||
|
||||
/// Default targets to build
|
||||
pub default: Vec<Target<Expr>>,
|
||||
|
||||
/// Rules
|
||||
#[expect(clippy::struct_field_names, reason = "TODO: Rename struct name")]
|
||||
pub rules: IndexMap<ArcStr, Rule<Expr>>,
|
||||
pub rules: HashMap<ArcStr, Rule<Expr>>,
|
||||
}
|
||||
|
||||
impl Rules {
|
||||
|
||||
@ -3,10 +3,9 @@
|
||||
use {
|
||||
super::Expr,
|
||||
crate::{rules::pattern::Pattern, util::ArcStr, AppError},
|
||||
indexmap::IndexMap,
|
||||
itertools::{Itertools, PeekingNext},
|
||||
smallvec::SmallVec,
|
||||
std::collections::BTreeMap,
|
||||
std::collections::{BTreeMap, HashMap},
|
||||
};
|
||||
|
||||
/// An expression tree.
|
||||
@ -35,7 +34,7 @@ impl<K> ExprTree<K> {
|
||||
/// The expression must not contain any aliases.
|
||||
///
|
||||
/// Returns the old key if the expression already existed.
|
||||
pub fn insert(&mut self, expr: &Expr, key: K, pats: &[&IndexMap<ArcStr, Pattern>]) -> Result<Option<K>, AppError> {
|
||||
pub fn insert(&mut self, expr: &Expr, key: K, pats: &[&HashMap<ArcStr, Pattern>]) -> Result<Option<K>, AppError> {
|
||||
let mut cmpts = expr.cmpts.iter();
|
||||
|
||||
// Get all components from the start that are strings
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
use {
|
||||
super::{pattern::Pattern, DepItem, Expr, OutItem},
|
||||
crate::{ast, util::ArcStr, AppError},
|
||||
indexmap::IndexMap,
|
||||
std::collections::HashMap,
|
||||
};
|
||||
|
||||
/// Rule
|
||||
@ -14,10 +14,10 @@ pub struct Rule<T> {
|
||||
pub name: ArcStr,
|
||||
|
||||
/// Aliases
|
||||
pub aliases: IndexMap<ArcStr, T>,
|
||||
pub aliases: HashMap<ArcStr, T>,
|
||||
|
||||
/// Patterns
|
||||
pub pats: IndexMap<ArcStr, Pattern>,
|
||||
pub pats: HashMap<ArcStr, Pattern>,
|
||||
|
||||
/// Output items
|
||||
pub output: Vec<OutItem<T>>,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user