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:
Dhruv Manilawala 2024-06-05 12:59:43 +05:30 committed by GitHub
parent 8338db6c12
commit eed6d784df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 37 additions and 25 deletions

View file

@ -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