implemented more nodes

This commit is contained in:
Snorre 2025-02-20 23:03:35 +01:00
parent b7834b5244
commit a5cc6813d1

View file

@ -24,7 +24,11 @@ impl Node for Call {
}; };
let arguments = if let NodeEnum::Set(set) = self.arguments.as_ref() { let arguments = if let NodeEnum::Set(set) = self.arguments.as_ref() {
set.get_values() let mut arguments = vec![];
for value in set.get_values().iter() {
arguments.push(value.evaluate(env)?);
}
arguments
} else { } else {
panic!( panic!(
"This shoulnd not be possible, but call constructed with arguments of type that is not set" "This shoulnd not be possible, but call constructed with arguments of type that is not set"
@ -44,7 +48,7 @@ impl Node for Call {
// Call function body with arguments // Call function body with arguments
match func.get_body() { match func.get_body() {
// Pass arguments to native function // Pass arguments to native function
FunctionType::Native(_name, native_function) => native_function(arguments), FunctionType::Native(_name, native_function) => native_function(&arguments),
FunctionType::UserFunction(node_enum) => { FunctionType::UserFunction(node_enum) => {
// TODO: Push scope // TODO: Push scope
// Define variables // Define variables