mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-25 09:27:43 +00:00
Add always disabled gen parse support
This commit is contained in:
parent
983c9c122e
commit
7011094685
32 changed files with 376 additions and 55 deletions
|
|
@ -352,13 +352,22 @@ pub enum BlockModifier {
|
|||
Unsafe(SyntaxToken),
|
||||
Try(SyntaxToken),
|
||||
Const(SyntaxToken),
|
||||
AsyncGen(SyntaxToken),
|
||||
Gen(SyntaxToken),
|
||||
Label(ast::Label),
|
||||
}
|
||||
|
||||
impl ast::BlockExpr {
|
||||
pub fn modifier(&self) -> Option<BlockModifier> {
|
||||
self.async_token()
|
||||
.map(BlockModifier::Async)
|
||||
self.gen_token()
|
||||
.map(|v| {
|
||||
if self.async_token().is_some() {
|
||||
BlockModifier::AsyncGen(v)
|
||||
} else {
|
||||
BlockModifier::Gen(v)
|
||||
}
|
||||
})
|
||||
.or_else(|| self.async_token().map(BlockModifier::Async))
|
||||
.or_else(|| self.unsafe_token().map(BlockModifier::Unsafe))
|
||||
.or_else(|| self.try_token().map(BlockModifier::Try))
|
||||
.or_else(|| self.const_token().map(BlockModifier::Const))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue