diff --git a/src/pk_compiler.c b/src/pk_compiler.c index 11c830d..e6dff49 100644 --- a/src/pk_compiler.c +++ b/src/pk_compiler.c @@ -2443,7 +2443,14 @@ static int compileClass(Compiler* compiler) { checkMaxConstantsReached(compiler, cls_index); skipNewLines(compiler); - while (!match(compiler, TK_END) && !match(compiler, TK_EOF)) { + while (!match(compiler, TK_END)) { + + if (match(compiler, TK_EOF)) { + syntaxError(compiler, compiler->parser.previous, + "Unexpected EOF while parsing class."); + break; + } + // At the top level the stack size should be 0, before and after compiling // a top level statement, since there aren't any locals at the top level. ASSERT(compiler->parser.has_errors || diff --git a/src/pk_core.c b/src/pk_core.c index 5f2f6bb..f3c2b80 100644 --- a/src/pk_core.c +++ b/src/pk_core.c @@ -664,7 +664,7 @@ static void _ctorNull(PKVM* vm) { } static void _ctorBool(PKVM* vm) { - RET(toBool(ARG(1))); + RET(VAR_BOOL(toBool(ARG(1)))); } static void _ctorNumber(PKVM* vm) {