Commit cac30b5e authored by Stefan Marr's avatar Stefan Marr

Block _invoke doesn't handle control flow exceptions

- it relies on interpreter returning result values and puts it on the stack
- non-local returns are handled by method call of the context
Signed-off-by: default avatarStefan Marr <>
parent 36cfed21
from rpython.rlib import jit
from som.interpreter.control_flow import RestartLoopException
from som.vmobjects.abstract_object import AbstractObject
from som.vmobjects.primitive import Primitive
......@@ -44,14 +45,13 @@ def block_evaluation_primitive(num_args, universe):
return Block.Evaluation(num_args, universe, _invoke)
def _invoke(ivkbl, frame, interpreter):
# Get the block (the receiver) from the stack
assert isinstance(ivkbl, Block.Evaluation)
rcvr = frame.get_stack_element(ivkbl._number_of_arguments - 1)
# Get the context of the block...
context = rcvr.get_context()
# Push a new frame and set its context to be the one specified in
# the block
new_frame = interpreter.push_new_frame(rcvr.get_method(), context)
new_frame = interpreter.new_frame(frame, rcvr.get_method(), context)
result = interpreter.interpret(rcvr.get_method(), new_frame)
frame.pop_old_arguments_and_push_result(rcvr.get_method(), result)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment