Handle inherited fields correctly.

This commit is contained in:
Bob Nystrom
2013-12-10 16:13:25 -08:00
parent 1e2449893e
commit c1cfe1b9f6
10 changed files with 174 additions and 22 deletions
+4 -1
View File
@@ -710,6 +710,9 @@ Value interpret(WrenVM* vm, Value function)
break;
}
ObjFn* methodFn = IS_FN(method) ? AS_FN(method) : AS_CLOSURE(method)->fn;
wrenBindMethod(classObj, methodFn);
classObj->methods[symbol].fn = method;
DISPATCH();
}
@@ -1057,11 +1060,11 @@ Value interpret(WrenVM* vm, Value function)
void wrenCallFunction(Fiber* fiber, Value function, int numArgs)
{
// TODO(bob): Check for stack overflow.
fiber->frames[fiber->numFrames].fn = function;
fiber->frames[fiber->numFrames].ip = 0;
fiber->frames[fiber->numFrames].stackStart = fiber->stackSize - numArgs;
// TODO(bob): Check for stack overflow.
fiber->numFrames++;
}