Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/mbe/src/expander/matcher.rs')
-rw-r--r--crates/mbe/src/expander/matcher.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/mbe/src/expander/matcher.rs b/crates/mbe/src/expander/matcher.rs
index 189efcd15c..4da8b309f0 100644
--- a/crates/mbe/src/expander/matcher.rs
+++ b/crates/mbe/src/expander/matcher.rs
@@ -63,7 +63,7 @@ use std::{rc::Rc, sync::Arc};
use intern::{Symbol, sym};
use smallvec::{SmallVec, smallvec};
-use span::{Edition, Span};
+use span::Span;
use tt::{
DelimSpan,
iter::{TtElement, TtIter},
@@ -112,11 +112,11 @@ impl Match<'_> {
/// Matching errors are added to the `Match`.
pub(super) fn match_<'t>(
+ db: &dyn salsa::Database,
pattern: &'t MetaTemplate,
input: &'t tt::TopSubtree<Span>,
- edition: Edition,
) -> Match<'t> {
- let mut res = match_loop(pattern, input, edition);
+ let mut res = match_loop(db, pattern, input);
res.bound_count = count(res.bindings.bindings());
return res;
@@ -365,6 +365,7 @@ struct MatchState<'t> {
/// - `error_items`: the set of items in errors, used for error-resilient parsing
#[inline]
fn match_loop_inner<'t>(
+ db: &dyn salsa::Database,
src: TtIter<'t, Span>,
stack: &[TtIter<'t, Span>],
res: &mut Match<'t>,
@@ -375,7 +376,6 @@ fn match_loop_inner<'t>(
eof_items: &mut SmallVec<[MatchState<'t>; 1]>,
error_items: &mut SmallVec<[MatchState<'t>; 1]>,
delim_span: tt::DelimSpan<Span>,
- edition: Edition,
) {
macro_rules! try_push {
($items: expr, $it:expr) => {
@@ -486,7 +486,7 @@ fn match_loop_inner<'t>(
OpDelimited::Op(Op::Var { kind, name, .. }) => {
if let &Some(kind) = kind {
let mut fork = src.clone();
- let match_res = match_meta_var(kind, &mut fork, delim_span, edition);
+ let match_res = match_meta_var(db, kind, &mut fork, delim_span);
match match_res.err {
None => {
// Some meta variables are optional (e.g. vis)
@@ -621,9 +621,9 @@ fn match_loop_inner<'t>(
}
fn match_loop<'t>(
+ db: &dyn salsa::Database,
pattern: &'t MetaTemplate,
src: &'t tt::TopSubtree<Span>,
- edition: Edition,
) -> Match<'t> {
let span = src.top_subtree().delimiter.delim_span();
let mut src = src.iter();
@@ -655,6 +655,7 @@ fn match_loop<'t>(
stdx::always!(next_items.is_empty());
match_loop_inner(
+ db,
src.clone(),
&stack,
&mut res,
@@ -665,7 +666,6 @@ fn match_loop<'t>(
&mut eof_items,
&mut error_items,
span,
- edition,
);
stdx::always!(cur_items.is_empty());
@@ -772,14 +772,14 @@ fn match_loop<'t>(
}
fn match_meta_var<'t>(
+ db: &dyn salsa::Database,
kind: MetaVarKind,
input: &mut TtIter<'t, Span>,
delim_span: DelimSpan<Span>,
- edition: Edition,
) -> ExpandResult<Fragment<'t>> {
let fragment = match kind {
MetaVarKind::Path => {
- return expect_fragment(input, parser::PrefixEntryPoint::Path, edition, delim_span)
+ return expect_fragment(db, input, parser::PrefixEntryPoint::Path, delim_span)
.map(Fragment::Path);
}
MetaVarKind::Expr(expr) => {
@@ -807,7 +807,7 @@ fn match_meta_var<'t>(
}
_ => {}
};
- return expect_fragment(input, parser::PrefixEntryPoint::Expr, edition, delim_span)
+ return expect_fragment(db, input, parser::PrefixEntryPoint::Expr, delim_span)
.map(Fragment::Expr);
}
MetaVarKind::Ident | MetaVarKind::Tt | MetaVarKind::Lifetime | MetaVarKind::Literal => {
@@ -853,7 +853,7 @@ fn match_meta_var<'t>(
MetaVarKind::Item => parser::PrefixEntryPoint::Item,
MetaVarKind::Vis => parser::PrefixEntryPoint::Vis,
};
- expect_fragment(input, fragment, edition, delim_span).map(Fragment::Tokens)
+ expect_fragment(db, input, fragment, delim_span).map(Fragment::Tokens)
}
fn collect_vars(collector_fun: &mut impl FnMut(Symbol), pattern: &MetaTemplate) {