diff --git a/Makefile b/Makefile index 90b9034..00eae31 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # make clean && make && ./bin/cosmo CC=clang -CFLAGS=-fPIE -O3 +CFLAGS=-fPIE -O3 -Wall LDFLAGS=#-fsanitize=address OUT=bin/cosmo diff --git a/examples/fortest.lua b/examples/fortest.lua index 5fdb5df..afcf7d1 100644 --- a/examples/fortest.lua +++ b/examples/fortest.lua @@ -8,6 +8,6 @@ end for (var x = 0; x < 1000; x=x+1) do for (var z = 0; z < 100; z=z+1) do - print("The factorial of " .. z .. " is " .. fact(z)) + print("The factorial of " .. x .. "." .. z .. " is " .. fact(z)) end end \ No newline at end of file diff --git a/src/clex.c b/src/clex.c index f7bbb16..987e805 100644 --- a/src/clex.c +++ b/src/clex.c @@ -179,7 +179,6 @@ void cosmoL_freeLexState(CState *state, CLexState *lstate) { } CToken cosmoL_scanToken(CLexState *state) { -_scanTokenEnter: skipWhitespace(state); state->startChar = state->currentChar; diff --git a/src/cvm.c b/src/cvm.c index 9e19bfc..221b3dc 100644 --- a/src/cvm.c +++ b/src/cvm.c @@ -304,11 +304,13 @@ bool cosmoV_execute(CState *state) { break; } case OP_SETLOCAL: { - frame->base[READBYTE()] = *cosmoV_pop(state); + uint8_t indx = READBYTE(); + frame->base[indx] = *cosmoV_pop(state); break; } case OP_GETLOCAL: { - cosmoV_pushValue(state, frame->base[READBYTE()]); + uint8_t indx = READBYTE(); + cosmoV_pushValue(state, frame->base[indx]); break; } case OP_GETUPVAL: { @@ -491,7 +493,6 @@ bool cosmoV_execute(CState *state) { uint8_t vals = READBYTE(); StkPtr start = state->top - vals; StkPtr end = cosmoV_getTop(state, 0); - StkPtr current; CObjString *result = cosmoV_toString(state, *start); for (StkPtr current = start + 1; current <= end; current++) {