mirror of
https://github.com/zekexiao/pocketlang.git
synced 2025-02-05 20:26:53 +08:00
Some tiny bugs bug fix
When parsing class and if there is an EOF it's not being marked as an error which is a regression after the syntax error refactor which is fixed. Constructor of boolean class return C boolean instead of VAR_BOOL() bug fixed
This commit is contained in:
parent
95c318b6f7
commit
cb209eb4d4
@ -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 ||
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user