mirror of
https://github.com/PaddiM8/kalker.git
synced 2025-01-05 21:18:59 +01:00
Also decrement
This commit is contained in:
parent
3e14a747fd
commit
3619008188
@ -89,7 +89,6 @@ struct SumVar {
|
||||
}
|
||||
|
||||
fn eval_stmt(context: &mut Context, stmt: &Stmt) -> Result<KalkValue, KalkError> {
|
||||
context.recursion_depth += 1;
|
||||
match stmt {
|
||||
Stmt::VarDecl(_, _) => eval_var_decl_stmt(context, stmt),
|
||||
Stmt::FnDecl(_, _, _) => eval_fn_decl_stmt(),
|
||||
@ -136,7 +135,10 @@ pub(crate) fn eval_expr(
|
||||
Expr::Boolean(value) => Ok(KalkValue::Boolean(*value)),
|
||||
Expr::Group(expr) => eval_group_expr(context, expr, unit),
|
||||
Expr::FnCall(identifier, expressions) => {
|
||||
eval_fn_call_expr(context, identifier, expressions, unit)
|
||||
context.recursion_depth += 1;
|
||||
let res = eval_fn_call_expr(context, identifier, expressions, unit);
|
||||
context.recursion_depth -= 1;
|
||||
res
|
||||
}
|
||||
Expr::Piecewise(pieces) => eval_piecewise(context, pieces, unit),
|
||||
Expr::Vector(values) => eval_vector(context, values),
|
||||
@ -517,6 +519,7 @@ pub(crate) fn eval_fn_call_expr(
|
||||
return Err(KalkError::StackOverflow);
|
||||
}
|
||||
|
||||
|
||||
if arguments.len() != expressions.len() {
|
||||
return Err(KalkError::IncorrectAmountOfArguments(
|
||||
arguments.len(),
|
||||
|
Loading…
Reference in New Issue
Block a user