diff --git a/src/compiler/compile.c b/src/compiler/compile.c index 6151cb2..83f2d80 100644 --- a/src/compiler/compile.c +++ b/src/compiler/compile.c @@ -679,6 +679,13 @@ static _Bool emit_instr_for_node(ExeBuilder *exeb, Node *node, Promise *break_de if(!emit_instr_for_node(exeb, func->body, NULL, error)) return 0; + if(func->body->kind == NODE_EXPR) + { + Operand op = (Operand) { .type = OPTP_INT, .as_int = 1 }; + if(!ExeBuilder_Append(exeb, error, OPCODE_POP, &op, 1, func->body->offset + func->body->length, 0)) + return 0; + } + // Write a return instruction, just // in case it didn't already return. Operand op = (Operand) { .type = OPTP_INT, .as_int = 0 }; diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c index f4c4aab..bf4e6be 100644 --- a/src/runtime/runtime.c +++ b/src/runtime/runtime.c @@ -1185,7 +1185,7 @@ static _Bool step(Runtime *runtime, Error *error) if(!Object_IsBool(top)) { - Error_Report(error, 1, "JUMPIFNOTANDPOP expected a boolean on the stack"); + Error_Report(error, 0, "Not a boolean"); return 0; } @@ -1217,7 +1217,7 @@ static _Bool step(Runtime *runtime, Error *error) if(!Object_IsBool(top)) { - Error_Report(error, 1, "JUMPIFNOTANDPOP expected a boolean on the stack"); + Error_Report(error, 0, "Not a boolean"); return 0; }