fix(parser): detect assets in Python named args (#6518)

This commit is contained in:
claude[bot]
2025-09-05 06:28:08 +00:00
committed by GitHub
parent 9b51bb56f5
commit 2027a9c2bd
@@ -39,7 +39,21 @@ impl Visitor for AssetsFinder {
fn visit_expr_call(&mut self, node: rustpython_ast::ExprCall) {
match self.visit_expr_call_inner(&node) {
Ok(_) => {}
Err(_) => self.generic_visit_expr_call(node),
Err(_) => {
// Check keyword arguments for assets before falling back to generic visit
for keyword in &node.keywords {
if let Expr::Constant(ExprConstant { value: Constant::Str(s), .. }) = &keyword.value {
if let Some((kind, path)) = parse_asset_syntax(s) {
self.assets.push(ParseAssetsResult {
kind,
path: path.to_string(),
access_type: None,
});
}
}
}
self.generic_visit_expr_call(node);
}
}
}
}