Invert quote-style when generating code within f-strings (#4487)

This commit is contained in:
Charlie Marsh 2023-05-18 10:33:33 -04:00 committed by GitHub
parent 2fb312bb2b
commit 73efbeb581
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 271 additions and 162 deletions

View file

@ -336,6 +336,11 @@ impl<'a> Context<'a> {
Some(self.stmts[parent_id])
}
/// Return the current `Expr`.
pub fn expr(&self) -> Option<&'a Expr> {
self.exprs.iter().last().copied()
}
/// Return the parent `Expr` of the current `Expr`.
pub fn expr_parent(&self) -> Option<&'a Expr> {
self.exprs.iter().rev().nth(1).copied()