Unify code for ending compiler.
There's now a single code path for the end of a chunk of bytecode, so we can eventually put code there for capturing closures.
This commit is contained in:
+2
-3
@@ -554,7 +554,7 @@ Value interpret(WrenVM* vm, ObjFn* fn)
|
||||
{
|
||||
int type = instruction;
|
||||
int symbol = READ_ARG();
|
||||
int constant = READ_ARG();
|
||||
Value method = POP();
|
||||
ObjClass* classObj = AS_CLASS(PEEK());
|
||||
|
||||
switch (type)
|
||||
@@ -576,8 +576,7 @@ Value interpret(WrenVM* vm, ObjFn* fn)
|
||||
break;
|
||||
}
|
||||
|
||||
ObjFn* body = AS_FN(frame->fn->constants[constant]);
|
||||
classObj->methods[symbol].fn = body;
|
||||
classObj->methods[symbol].fn = AS_FN(method);
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user