Fixed panic for parenthesis-less function calls

This commit is contained in:
PaddiM8 2022-01-14 16:04:16 +01:00
parent 7b0435d3ec
commit 1273206d6a

View File

@ -387,17 +387,21 @@ fn build_fn_call(
new_arguments new_arguments
} }
Expr::Group(argument) => { _ => {
let argument = if let Expr::Group(argument) = adjacent_expr {
*argument
} else {
adjacent_expr
};
if let Some(log_base) = log_base { if let Some(log_base) = log_base {
return Ok(Expr::FnCall( return Ok(Expr::FnCall(
Identifier::from_full_name("log"), Identifier::from_full_name("log"),
vec![analyse_expr(context, *argument)?, log_base], vec![analyse_expr(context, argument)?, log_base],
)); ));
} else { } else {
vec![analyse_expr(context, *argument)?] vec![analyse_expr(context, argument)?]
} }
} }
_ => unreachable!(),
}; };
if is_integral { if is_integral {