mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +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
|
@ -1,4 +1,5 @@
|
|||
//! Utilities for formatting macro expanded nodes until we get a proper formatter.
|
||||
use span::Edition;
|
||||
use syntax::{
|
||||
ast::make,
|
||||
ted::{self, Position},
|
||||
|
@ -131,5 +132,6 @@ pub fn insert_ws_into(syn: SyntaxNode) -> SyntaxNode {
|
|||
}
|
||||
|
||||
fn is_text(k: SyntaxKind) -> bool {
|
||||
k.is_keyword() || k.is_literal() || k == IDENT || k == UNDERSCORE
|
||||
// FIXME: Edition
|
||||
k.is_keyword(Edition::CURRENT) || k.is_literal() || k == IDENT || k == UNDERSCORE
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! Various helper functions to work with SyntaxNodes.
|
||||
use itertools::Itertools;
|
||||
use parser::T;
|
||||
use span::Edition;
|
||||
use syntax::{
|
||||
ast::{self, HasLoopBody, MacroCall, PathSegmentKind, VisibilityKind},
|
||||
AstNode, AstToken, Preorder, RustLanguage, WalkEvent,
|
||||
|
@ -461,7 +462,8 @@ pub fn parse_tt_as_comma_sep_paths(input: ast::TokenTree) -> Option<Vec<ast::Pat
|
|||
let tokens =
|
||||
input.syntax().children_with_tokens().skip(1).map_while(|it| match it.into_token() {
|
||||
// seeing a keyword means the attribute is unclosed so stop parsing here
|
||||
Some(tok) if tok.kind().is_keyword() => None,
|
||||
// FIXME: Edition
|
||||
Some(tok) if tok.kind().is_keyword(Edition::CURRENT) => None,
|
||||
// don't include the right token tree parenthesis if it exists
|
||||
tok @ Some(_) if tok == r_paren => None,
|
||||
// only nodes that we can find are other TokenTrees, those are unexpected in this parse though
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue