if works properly now
This commit is contained in:
parent
5f0f511066
commit
baabdd2655
@ -615,9 +615,17 @@ static Result<Value> builtin_if(Interpreter &i, std::span<Ast> args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Try(i.eval((Ast)args.front())).truthy()) {
|
if (Try(i.eval((Ast)args.front())).truthy()) {
|
||||||
return i.eval((Ast)args[1]);
|
if (args[1].type == Ast::Type::Block) {
|
||||||
|
return Try(i.eval((Ast)args[1].arguments.front()));
|
||||||
|
} else {
|
||||||
|
return Try(i.eval((Ast)args[1]));
|
||||||
|
}
|
||||||
} else if (args.size() == 3) {
|
} else if (args.size() == 3) {
|
||||||
return i.eval((Ast)args[2]);
|
if (args[2].type == Ast::Type::Block) {
|
||||||
|
return Try(i.eval((Ast)args[2].arguments.front()));
|
||||||
|
} else {
|
||||||
|
return Try(i.eval((Ast)args[2]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Value{};
|
return Value{};
|
||||||
|
@ -11,8 +11,9 @@
|
|||||||
static inline void register_note_length_constants()
|
static inline void register_note_length_constants()
|
||||||
{
|
{
|
||||||
auto &global = *Env::global;
|
auto &global = *Env::global;
|
||||||
|
global.force_define("wn", Number(1, 1));
|
||||||
global.force_define("fn", Number(1, 1));
|
global.force_define("fn", Number(1, 1));
|
||||||
global.force_define("dfn", Number(3, 2));
|
global.force_define("dwn", Number(3, 2));
|
||||||
global.force_define("hn", Number(1, 2));
|
global.force_define("hn", Number(1, 2));
|
||||||
global.force_define("dhn", Number(3, 4));
|
global.force_define("dhn", Number(3, 4));
|
||||||
global.force_define("ddhn", Number(7, 8));
|
global.force_define("ddhn", Number(7, 8));
|
||||||
|
Loading…
Reference in New Issue
Block a user