(
&self,
func: &ast::Expr,
args: &ast::Arguments,
)
| 8303 | } |
| 8304 | |
| 8305 | fn detect_builtin_generator_call( |
| 8306 | &self, |
| 8307 | func: &ast::Expr, |
| 8308 | args: &ast::Arguments, |
| 8309 | ) -> Option<BuiltinGeneratorCallKind> { |
| 8310 | let ast::Expr::Name(ast::ExprName { id, .. }) = func else { |
| 8311 | return None; |
| 8312 | }; |
| 8313 | if args.args.len() != 1 |
| 8314 | || !args.keywords.is_empty() |
| 8315 | || !matches!(args.args[0], ast::Expr::Generator(_)) |
| 8316 | { |
| 8317 | return None; |
| 8318 | } |
| 8319 | match id.as_str() { |
| 8320 | "tuple" => Some(BuiltinGeneratorCallKind::Tuple), |
| 8321 | "list" => Some(BuiltinGeneratorCallKind::List), |
| 8322 | "set" => Some(BuiltinGeneratorCallKind::Set), |
| 8323 | "all" => Some(BuiltinGeneratorCallKind::All), |
| 8324 | "any" => Some(BuiltinGeneratorCallKind::Any), |
| 8325 | _ => None, |
| 8326 | } |
| 8327 | } |
| 8328 | |
| 8329 | /// Emit the optimized inline loop for builtin(genexpr) calls. |
| 8330 | /// |
no test coverage detected