feat: replace module import string operand with direct ObjModule reference in IMPORT_VARIABLE

Add CODE_END_MODULE opcode to store the current ObjModule in vm->lastModule after module body execution. Modify IMPORT_VARIABLE to load variables from vm->lastModule instead of using a constant string operand for the module name. Update opcode definitions, debug dump, compiler import logic, and interpreter dispatch accordingly. Refactor variable lookup into getModuleVariable helper. Adjust formatting in wren_primitive.c and wren_opt_meta.c.
This commit is contained in:
Bob Nystrom
2018-03-20 13:54:51 +00:00
parent cf05cd7c8c
commit 88ad0fc138
8 changed files with 84 additions and 50 deletions
+2 -1
View File
@@ -29,7 +29,8 @@ void metaCompile(WrenVM* vm)
}
}
void metaGetModuleVariables(WrenVM* vm) {
void metaGetModuleVariables(WrenVM* vm)
{
wrenEnsureSlots(vm, 3);
Value moduleValue = wrenMapGet(vm->modules, vm->apiStack[1]);