Raise edition one more level

This commit is contained in:
Johann Hemmann 2024-01-30 16:57:40 +01:00 committed by Lukas Wirth
parent 454e481422
commit 2cf5d8811a
13 changed files with 61 additions and 35 deletions

View file

@ -172,7 +172,7 @@ pub use crate::ast::SourceFile;
impl SourceFile {
pub fn parse(text: &str) -> Parse<SourceFile> {
let _p = tracing::span!(tracing::Level::INFO, "SourceFile::parse").entered();
let (green, errors) = parsing::parse_text(text);
let (green, errors) = parsing::parse_text(text, parser::Edition::Edition2021);
let root = SyntaxNode::new_root(green.clone());
assert_eq!(root.kind(), SyntaxKind::SOURCE_FILE);
@ -185,7 +185,10 @@ impl SourceFile {
}
impl ast::TokenTree {
pub fn reparse_as_comma_separated_expr(self) -> Parse<ast::MacroEagerInput> {
pub fn reparse_as_comma_separated_expr(
self,
edition: parser::Edition,
) -> Parse<ast::MacroEagerInput> {
let tokens = self.syntax().descendants_with_tokens().filter_map(NodeOrToken::into_token);
let mut parser_input = parser::Input::default();
@ -219,8 +222,7 @@ impl ast::TokenTree {
}
}
let parser_output = parser::TopEntryPoint::MacroEagerInput
.parse(&parser_input, parser::Edition::Edition2021);
let parser_output = parser::TopEntryPoint::MacroEagerInput.parse(&parser_input, edition);
let mut tokens =
self.syntax().descendants_with_tokens().filter_map(NodeOrToken::into_token);