pub struct StmtBlock { /* private fields */ }Implementations§
Source§impl StmtBlock
impl StmtBlock
Sourcepub fn items(&self) -> impl Iterator<Item = SyntaxNode>
pub fn items(&self) -> impl Iterator<Item = SyntaxNode>
Every direct-child statement (LET_STMT/ASSIGN_STMT/EXPR_STMT)
AND the tail expression if present, in source order — the untyped
escape hatch, same shape as Block::items.
Sourcepub fn tail(&self) -> Option<SyntaxNode>
pub fn tail(&self) -> Option<SyntaxNode>
The block’s unterminated trailing expression (blocks-as-values), if
one is present — the last child, when its kind is none of the
statement-wrapper kinds this grammar can produce as a genuine
statement (parser/stmt.rs::stmt_block never emits any node after
the tail, so the last child is always the tail when it isn’t one
of those). B0.8 Wave B’s four control-flow kinds
(IF_STMT/WHILE_STMT/FOR_STMT/UNTIL_STMT) never produce a
value and are always fully delimited by their own body/; — same
non-tail treatment as the three Wave A kinds, not new behavior.
B0.8 Wave B tail (issue #1322) adds RETURN_STMT/BREAK_STMT/
CONTINUE_STMT to this same non-tail set — all three are always
;-terminated in code-ground position (parser/stmt.rs’s
return_stmt/break_stmt/continue_stmt), never a bare tail
value. The > text prose-line escape (issue #1992) adds
PROSE_LINE to the set for the same reason: it never produces a
value (parser/stmt.rs::statement’s doc), so a STMT_BLOCK ending
in one has no tail expression, not a prose line masquerading as one
(review finding F2 — lower_native/lambda.rs’s block.tail() call
would otherwise lower it as a lambda’s return value instead of
reaching lower_block_item’s loud E129 arm).
Trait Implementations§
Source§impl AstNode for StmtBlock
impl AstNode for StmtBlock
Source§fn can_cast(kind: SyntaxKind) -> bool
fn can_cast(kind: SyntaxKind) -> bool
true for a node with a SyntaxKind this type can wrap.Source§fn cast(node: SyntaxNode) -> Option<Self>
fn cast(node: SyntaxNode) -> Option<Self>
SyntaxNode into this typed wrapper.Source§fn syntax(&self) -> &SyntaxNode
fn syntax(&self) -> &SyntaxNode
SyntaxNode.