internal: Thread edition through to parsing/tt-to-syntax-tree routines for macros

This commit is contained in:
Lukas Wirth 2024-04-14 16:02:38 +02:00
parent 83370fe5d7
commit a483d3bc37
39 changed files with 187 additions and 145 deletions

View file

@ -3,7 +3,7 @@
use std::fmt;
use rustc_hash::{FxHashMap, FxHashSet};
use span::{SpanAnchor, SpanData, SpanMap};
use span::{Edition, SpanAnchor, SpanData, SpanMap};
use stdx::{never, non_empty_vec::NonEmptyVec};
use syntax::{
ast::{self, make::tokens::doc_comment},
@ -183,7 +183,12 @@ where
}
/// Split token tree with separate expr: $($e:expr)SEP*
pub fn parse_exprs_with_sep<S>(tt: &tt::Subtree<S>, sep: char, span: S) -> Vec<tt::Subtree<S>>
pub fn parse_exprs_with_sep<S>(
tt: &tt::Subtree<S>,
sep: char,
span: S,
edition: Edition,
) -> Vec<tt::Subtree<S>>
where
S: Copy + fmt::Debug,
{
@ -195,8 +200,7 @@ where
let mut res = Vec::new();
while iter.peek_n(0).is_some() {
let expanded =
iter.expect_fragment(parser::PrefixEntryPoint::Expr, parser::Edition::CURRENT);
let expanded = iter.expect_fragment(parser::PrefixEntryPoint::Expr, edition);
res.push(match expanded.value {
None => break,