Add bindings builder for speed up matching

This commit is contained in:
Edwin Cheng 2021-03-13 20:17:54 +08:00
parent f1350dd93c
commit 9117148f42
3 changed files with 221 additions and 67 deletions

View file

@ -5,7 +5,7 @@
mod matcher;
mod transcriber;
use smallvec::SmallVec;
use rustc_hash::FxHashMap;
use syntax::SmolStr;
use crate::{ExpandError, ExpandResult};
@ -96,7 +96,7 @@ pub(crate) fn expand_rules(
/// many is not a plain `usize`, but an `&[usize]`.
#[derive(Debug, Default, Clone, PartialEq, Eq)]
struct Bindings {
inner: SmallVec<[(SmolStr, Binding); 4]>,
inner: FxHashMap<SmolStr, Binding>,
}
#[derive(Debug, Clone, PartialEq, Eq)]