Skip to content

Commit 79b23f8

Browse files
committed
fix(compiler): resolve MSVC warnings for shadowing, unreferenced labels, and nonstandard extensions
1 parent beef5e1 commit 79b23f8

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/runtime/vm.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,6 @@ static bool resolveContextualMethod(VM* pvm, ObjString* name, Value* result) {
11961196
DISPATCH();
11971197
}
11981198

1199-
trap:
12001199
{
12011200
runtimeError(pvm, "Unknown opcode %d.", frame->ip[-1]);
12021201
return INTERPRET_RUNTIME_ERROR;
@@ -1285,12 +1284,12 @@ InterpretResult interpret(VM* pvm, const char* source) {
12851284
return result;
12861285
}
12871286

1288-
void defineNative(VM* vm, const char* name, NativeFn function) {
1289-
push(vm, OBJ_VAL(copyString(name, (int)strlen(name))));
1290-
push(vm, OBJ_VAL(newNative(function)));
1291-
tableSet(&vm->globals, AS_STRING(vm->stackTop[-2]), vm->stackTop[-1]);
1292-
pop(vm);
1293-
pop(vm);
1287+
void defineNative(VM* pvm, const char* name, NativeFn function) {
1288+
push(pvm, OBJ_VAL(copyString(name, (int)strlen(name))));
1289+
push(pvm, OBJ_VAL(newNative(function)));
1290+
tableSet(&pvm->globals, AS_STRING(pvm->stackTop[-2]), pvm->stackTop[-1]);
1291+
pop(pvm);
1292+
pop(pvm);
12941293
}
12951294

12961295
InterpretResult interpretChunk(VM* pvm, Chunk* chunk) {

src/stdlib/stdlib_core.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ extern void register_io_globals(VM* vm);
4242

4343
// Exposed natives
4444
extern Value native_clock(int argCount, Value* args);
45+
extern Value nativeLoadConfig(int argCount, Value *args);
46+
4547

4648
static Value native_len(int argCount, Value* args) {
4749
if (argCount < 1) return NUMBER_VAL(0);
@@ -53,11 +55,11 @@ static Value native_len(int argCount, Value* args) {
5355
return NUMBER_VAL(0);
5456
}
5557

56-
static ObjModule* create_empty_module(VM* vm, const char* name) {
58+
static ObjModule* create_empty_module(VM* pVM, const char* name) {
5759
ObjString* nameStr = copyString(name, (int)strlen(name));
58-
push(vm, OBJ_VAL(nameStr));
60+
push(pVM, OBJ_VAL(nameStr));
5961
ObjModule* module = newModule(nameStr);
60-
pop(vm);
62+
pop(pVM);
6163
return module;
6264
}
6365

@@ -265,7 +267,6 @@ void registerStdLib(VM* pVM) {
265267
defineNative(pVM, "pop", native_pop);
266268
defineNative(pVM, "substr", native_substr);
267269

268-
extern Value nativeLoadConfig(int argCount, Value *args);
269270
defineNative(pVM, "loadConfig", nativeLoadConfig);
270271

271272
register_math_globals(pVM);

0 commit comments

Comments
 (0)