mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
internal: Properly check the edition for edition dependent syntax kinds
This commit is contained in:
parent
2b86639018
commit
f90bdfc13d
23 changed files with 348 additions and 130 deletions
|
@ -178,19 +178,8 @@ impl<'a> Converter<'a> {
|
|||
rustc_lexer::TokenKind::Whitespace => WHITESPACE,
|
||||
|
||||
rustc_lexer::TokenKind::Ident if token_text == "_" => UNDERSCORE,
|
||||
rustc_lexer::TokenKind::Ident
|
||||
if ["async", "await", "dyn", "try"].contains(&token_text)
|
||||
&& !self.edition.at_least_2018() =>
|
||||
{
|
||||
IDENT
|
||||
}
|
||||
rustc_lexer::TokenKind::Ident
|
||||
if token_text == "gen" && !self.edition.at_least_2024() =>
|
||||
{
|
||||
IDENT
|
||||
}
|
||||
rustc_lexer::TokenKind::Ident => {
|
||||
SyntaxKind::from_keyword(token_text).unwrap_or(IDENT)
|
||||
SyntaxKind::from_keyword(token_text, self.edition).unwrap_or(IDENT)
|
||||
}
|
||||
rustc_lexer::TokenKind::InvalidPrefix | rustc_lexer::TokenKind::InvalidIdent => {
|
||||
err = "Ident contains invalid characters";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue