mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-18 00:00:03 +00:00
Enable parsing of attributes inside a match block
We allow invalid inner attributes to be parsed, e.g. inner attributes that are not directly after the opening brace of the match block. Instead we run validation on `MatchArmList` to allow better reporting of errors.
This commit is contained in:
parent
982f72c022
commit
1c97c1ac11
16 changed files with 589 additions and 1 deletions
|
@ -153,6 +153,20 @@ impl FnDef {
|
|||
}
|
||||
|
||||
impl Attr {
|
||||
pub fn is_inner(&self) -> bool {
|
||||
let tt = match self.value() {
|
||||
None => return false,
|
||||
Some(tt) => tt,
|
||||
};
|
||||
|
||||
let prev = match tt.syntax().prev_sibling() {
|
||||
None => return false,
|
||||
Some(prev) => prev,
|
||||
};
|
||||
|
||||
prev.kind() == EXCL
|
||||
}
|
||||
|
||||
pub fn as_atom(&self) -> Option<SmolStr> {
|
||||
let tt = self.value()?;
|
||||
let (_bra, attr, _ket) = tt.syntax().children().collect_tuple()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue