(
&mut self,
is_lambda: bool,
)
| 3237 | } |
| 3238 | |
| 3239 | fn parse_parameter( |
| 3240 | &mut self, |
| 3241 | is_lambda: bool, |
| 3242 | ) -> Result<(Arg, Option<Expression>), ParsingError> { |
| 3243 | let node = self.start_node(); |
| 3244 | let arg = self.cur_token().to_string(self.source); |
| 3245 | self.bump(Kind::Identifier); |
| 3246 | // Lambda parameters cannot have annotations |
| 3247 | let annotation = if self.at(Kind::Colon) && !is_lambda { |
| 3248 | self.bump(Kind::Colon); |
| 3249 | Some(self.parse_expression()?) |
| 3250 | } else { |
| 3251 | None |
| 3252 | }; |
| 3253 | let arg_node = self.finish_node(node); |
| 3254 | let default = if self.eat(Kind::Assign) { |
| 3255 | Some(self.parse_expression()?) |
| 3256 | } else { |
| 3257 | None |
| 3258 | }; |
| 3259 | Ok(( |
| 3260 | Arg { |
| 3261 | node: arg_node, |
| 3262 | arg, |
| 3263 | annotation, |
| 3264 | }, |
| 3265 | default, |
| 3266 | )) |
| 3267 | } |
| 3268 | |
| 3269 | // the FStringStart token is consumed by the caller |
| 3270 | fn parse_fstring(&mut self, node: Node) -> Result<Vec<Expression>, ParsingError> { |
no test coverage detected