Fix function recursion
This commit is contained in:
parent
bbab728ce9
commit
41a268389c
@ -3,8 +3,8 @@ use serde::{Deserialize, Serialize};
|
||||
use crate::{
|
||||
context::Context,
|
||||
error::{RuntimeError, SyntaxError, ValidationError},
|
||||
AbstractTree, AssignmentOperator, Format, Identifier, SourcePosition, Statement, SyntaxNode,
|
||||
Type, TypeSpecification, Value,
|
||||
AbstractTree, AssignmentOperator, Format, Function, Identifier, SourcePosition, Statement,
|
||||
SyntaxNode, Type, TypeSpecification, Value,
|
||||
};
|
||||
|
||||
/// Variable assignment, including add-assign and subtract-assign operations.
|
||||
|
@ -137,6 +137,8 @@ impl AbstractTree for FunctionCall {
|
||||
let key = identifier.inner();
|
||||
|
||||
if let Some(value) = context.get_value(key)? {
|
||||
self.context
|
||||
.set_value(identifier.inner().clone(), value.clone())?;
|
||||
value.clone()
|
||||
} else {
|
||||
return Err(RuntimeError::VariableIdentifierNotFound(
|
||||
@ -163,7 +165,7 @@ impl AbstractTree for FunctionCall {
|
||||
self.context.set_value(identifier.inner().clone(), value)?;
|
||||
}
|
||||
|
||||
value.as_function()?.call(&[], source, context)
|
||||
function.call(&[], source, &self.context)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user