Add Method type for objects
* Methods are wrappers created with an owner and a function, which passes the owner as the first argument when the function is called. * Fix a small bug in the VM where the pc was being set at the wrong time Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -149,9 +149,11 @@ impl<'c> Vm<'c> {
|
||||
let frame = callee_obj.as_fun()
|
||||
.expect("callable function")
|
||||
.create_frame(callee.clone(), self, args);
|
||||
// Jump to the first address of the new function call if it's a user function
|
||||
if let Frame::User(_) = &frame {
|
||||
self.set_pc(0);
|
||||
}
|
||||
self.frames_mut().push(frame);
|
||||
// Jump to the first address of the new function call
|
||||
self.set_pc(0);
|
||||
}
|
||||
Signal::Return => {
|
||||
// 1. pop return value
|
||||
|
||||
Reference in New Issue
Block a user