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