mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-08 12:48:07 +00:00
Update type annotation parsing API to return Parsed
(#11739)
## Summary This PR updates the return type of `parse_type_annotation` from `Expr` to `Parsed<ModExpression>`. This is to allow accessing the tokens for the parsed sub-expression in the follow-up PR. ## Test Plan `cargo insta test`
This commit is contained in:
parent
8338db6c12
commit
eed6d784df
6 changed files with 37 additions and 25 deletions
|
@ -357,6 +357,11 @@ impl Parsed<ModExpression> {
|
|||
&self.syntax.body
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the expression contained in this parsed output.
|
||||
pub fn expr_mut(&mut self) -> &mut Expr {
|
||||
&mut self.syntax.body
|
||||
}
|
||||
|
||||
/// Consumes the [`Parsed`] output and returns the contained [`Expr`].
|
||||
pub fn into_expr(self) -> Expr {
|
||||
*self.syntax.body
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue