minor refactor, fixed many warnings

This commit is contained in:
2021-01-01 23:06:24 -06:00
parent bccabdebd7
commit 7e9b61e018
26 changed files with 53 additions and 49 deletions

View File

@@ -287,8 +287,10 @@ static uint16_t identifierConstant(CParseState *pstate, CToken *name) {
}
static void addLocal(CParseState *pstate, CToken name) {
if (pstate->compiler->localCount > UINT8_MAX)
return error(pstate, "UInt overflow! Too many locals in scope!");
if (pstate->compiler->localCount > UINT8_MAX) {
error(pstate, "UInt overflow! Too many locals in scope!");
return;
}
Local *local = &pstate->compiler->locals[pstate->compiler->localCount++];
local->name = name;
@@ -1494,4 +1496,4 @@ CObjFunction* cosmoP_compileString(CState *state, const char *source, const char
freeParseState(&parser);
cosmoM_unfreezeGC(state);
return resFunc;
}
}