Modify hacks::parse_expr_from_str() to take an edition too

This will be needed as we parse unknown identifiers and want to insert them into source code.
This commit is contained in:
Chayim Refael Friedman 2024-08-22 14:39:59 +03:00
parent e6d59e65ec
commit ddbb28daa0
4 changed files with 14 additions and 10 deletions

View file

@ -477,10 +477,12 @@ pub fn parse_tt_as_comma_sep_paths(
.into_iter()
.filter_map(|(is_sep, group)| (!is_sep).then_some(group))
.filter_map(|mut tokens| {
syntax::hacks::parse_expr_from_str(&tokens.join("")).and_then(|expr| match expr {
ast::Expr::PathExpr(it) => it.path(),
_ => None,
})
syntax::hacks::parse_expr_from_str(&tokens.join(""), Edition::CURRENT).and_then(
|expr| match expr {
ast::Expr::PathExpr(it) => it.path(),
_ => None,
},
)
})
.collect();
Some(paths)