Skip to content

Commit

Permalink
fix: returning strings, numbers, arrays, booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
artegoser committed Aug 16, 2022
1 parent 8fef9f6 commit bd9aa89
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,17 @@ impl Interpreter {
Value::Object(name) => {
let check = name.get("return");
match check {
Some(check) => {
let result = json!({"return": self.eval_node(check)});
self.exit_from_scope();
return result;
}
Some(check) => match check {
Value::Object(_) => {
let result = json!({"return": self.eval_node(check)});
self.exit_from_scope();
return result;
}
_ => {
self.exit_from_scope();
return json!({"return": check.clone()});
}
},
None => {}
}
}
Expand Down

0 comments on commit bd9aa89

Please sign in to comment.