fix: returning strings, numbers, arrays, booleans

This commit is contained in:
Artemy 2022-08-16 14:30:00 +03:00
parent 8fef9f68e2
commit bd9aa89e07

View file

@ -451,11 +451,17 @@ impl Interpreter {
Value::Object(name) => { Value::Object(name) => {
let check = name.get("return"); let check = name.get("return");
match check { match check {
Some(check) => { Some(check) => match check {
let result = json!({"return": self.eval_node(check)}); Value::Object(_) => {
self.exit_from_scope(); let result = json!({"return": self.eval_node(check)});
return result; self.exit_from_scope();
} return result;
}
_ => {
self.exit_from_scope();
return json!({"return": check.clone()});
}
},
None => {} None => {}
} }
} }