Refactor tuple argument handling in inliner
Remove redundant tuple flattening logic in `map_params_to_args`. The existing logic for iterating through tuple elements already correctly handles nested tuples and records by recursively calling `map_params_to_args`.
This commit is contained in:
@@ -136,32 +136,6 @@ impl<'a> Inliner<'a> {
|
||||
*offset += 1;
|
||||
}
|
||||
BoundKind::Tuple { elements } => {
|
||||
if let Some(arg) = args.get(*offset) {
|
||||
let mut sub_args = Vec::new();
|
||||
let is_compound = match &arg.kind {
|
||||
BoundKind::Tuple { .. } | BoundKind::Record { .. } => {
|
||||
flatten_tuple(arg.clone(), &mut sub_args);
|
||||
true
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
|
||||
if is_compound {
|
||||
let mut sub_offset = 0;
|
||||
for el in elements {
|
||||
self.map_params_to_args(
|
||||
el,
|
||||
&sub_args,
|
||||
&mut sub_offset,
|
||||
sub,
|
||||
body_usage,
|
||||
);
|
||||
}
|
||||
*offset += 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for el in elements {
|
||||
self.map_params_to_args(el, args, offset, sub, body_usage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user