Preserve yield position during pretty printing

This commit is contained in:
Eric Holk
2025-03-12 16:27:52 -07:00
parent edf65e735c
commit 1c0916a2b3
12 changed files with 55 additions and 18 deletions

View File

@@ -1657,7 +1657,7 @@ pub enum ExprKind {
Try(P<Expr>),
/// A `yield`, with an optional value to be yielded.
Yield(Option<P<Expr>>),
Yield(Option<P<Expr>>, YieldKind),
/// A `do yeet` (aka `throw`/`fail`/`bail`/`raise`/whatever),
/// with an optional value to be returned.
@@ -1903,6 +1903,15 @@ pub enum MatchKind {
Postfix,
}
/// The kind of yield expression
#[derive(Clone, Copy, Encodable, Decodable, Debug, PartialEq)]
pub enum YieldKind {
/// yield expr { ... }
Prefix,
/// expr.yield { ... }
Postfix,
}
/// A literal in a meta item.
#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
pub struct MetaItemLit {