mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Item is a Stmt
This commit is contained in:
parent
a7ca6583fb
commit
d4d986c7f8
6 changed files with 36 additions and 15 deletions
|
@ -348,7 +348,6 @@ pub struct BlockExpr {
|
|||
pub(crate) syntax: SyntaxNode,
|
||||
}
|
||||
impl ast::AttrsOwner for BlockExpr {}
|
||||
impl ast::ModuleItemOwner for BlockExpr {}
|
||||
impl BlockExpr {
|
||||
pub fn label(&self) -> Option<Label> { support::child(&self.syntax) }
|
||||
pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
|
||||
|
@ -1395,8 +1394,8 @@ impl ast::AttrsOwner for GenericParam {}
|
|||
pub enum Stmt {
|
||||
LetStmt(LetStmt),
|
||||
ExprStmt(ExprStmt),
|
||||
Item(Item),
|
||||
}
|
||||
impl ast::AttrsOwner for Stmt {}
|
||||
impl AstNode for SourceFile {
|
||||
fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE }
|
||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||
|
@ -3380,6 +3379,9 @@ impl From<LetStmt> for Stmt {
|
|||
impl From<ExprStmt> for Stmt {
|
||||
fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) }
|
||||
}
|
||||
impl From<Item> for Stmt {
|
||||
fn from(node: Item) -> Stmt { Stmt::Item(node) }
|
||||
}
|
||||
impl std::fmt::Display for Item {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
std::fmt::Display::fmt(self.syntax(), f)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue