# Path: src/som/interpreter/ast/nodes/expression_node.py
# class ExpressionNode(Node):
# 
#     def __init__(self, source_section):
#         Node.__init__(self, source_section)
# 
#     def is_super_node(self):
#         return False
# 
# Path: src/som/vmobjects/abstract_object.py
# class AbstractObject(object):
# 
#     def __init__(self):
#         pass
# 
#     def get_class(self, universe):
#         raise NotImplementedError("Subclasses need to implement get_class(universe).")
# 
#     def quick_add(self, from_method, frame, interpreter, bytecode_index):
#         interpreter._send(from_method, frame, interpreter._add_symbol,
#                           self.get_class(interpreter.get_universe()),
#                           bytecode_index)
# 
#     def quick_multiply(self, from_method, frame, interpreter, bytecode_index):
#         interpreter._send(from_method, frame, interpreter._multiply_symbol,
#                           self.get_class(interpreter.get_universe()),
#                           bytecode_index)
# 
#     def quick_subtract(self, from_method, frame, interpreter, bytecode_index):
#         interpreter._send(from_method, frame, interpreter._subtract_symbol,
#                           self.get_class(interpreter.get_universe()),
#                           bytecode_index)
# 
#     @staticmethod
#     def is_invokable():
#         return False
# 
#     def __str__(self):
#         from som.vm.universe import get_current
#         return "a " + self.get_class(get_current()).get_name().get_embedded_string()


from rlib.debug import make_sure_not_resized
from rlib.jit   import unroll_safe
from ..expression_node import ExpressionNode
from .....vmobjects.abstract_object import AbstractObject




class AbstractMessageNode(ExpressionNode):

    _immutable_fields_ = ['_selector', '_universe',
                          '_rcvr_expr?', '_arg_exprs?[*]']
    _child_nodes_      = ['_rcvr_expr',  '_arg_exprs[*]']

    def __init__(self, selector, universe, rcvr_expr, arg_exprs,
                 source_section = None):
        ExpressionNode.__init__(self, source_section)
        self._selector = selector
        self._universe = universe
        assert arg_exprs is not None
        make_sure_not_resized(arg_exprs)
        self._rcvr_expr = self.adopt_child(rcvr_expr)
        self._arg_exprs = self.adopt_children(arg_exprs)

    @unroll_safe
    def _evaluate_rcvr_and_args(self, frame):
        rcvr = self._rcvr_expr.execute(frame)

# Path: src/som/interpreter/ast/nodes/expression_node.py
# class ExpressionNode(Node):
# 
#     def __init__(self, source_section):
#         Node.__init__(self, source_section)
# 
#     def is_super_node(self):
#         return False
# 
# Path: src/som/vmobjects/abstract_object.py
# class AbstractObject(object):
# 
#     def __init__(self):
#         pass
# 
#     def get_class(self, universe):
#         raise NotImplementedError("Subclasses need to implement get_class(universe).")
# 
#     def quick_add(self, from_method, frame, interpreter, bytecode_index):
#         interpreter._send(from_method, frame, interpreter._add_symbol,
#                           self.get_class(interpreter.get_universe()),
#                           bytecode_index)
# 
#     def quick_multiply(self, from_method, frame, interpreter, bytecode_index):
#         interpreter._send(from_method, frame, interpreter._multiply_symbol,
#                           self.get_class(interpreter.get_universe()),
#                           bytecode_index)
# 
#     def quick_subtract(self, from_method, frame, interpreter, bytecode_index):
#         interpreter._send(from_method, frame, interpreter._subtract_symbol,
#                           self.get_class(interpreter.get_universe()),
#                           bytecode_index)
# 
#     @staticmethod
#     def is_invokable():
#         return False
# 
#     def __str__(self):
#         from som.vm.universe import get_current
#         return "a " + self.get_class(get_current()).get_name().get_embedded_string()


# Path: src/som/interpreter/ast/nodes/message/abstract_node.py
from rlib.debug import make_sure_not_resized
from rlib.jit   import unroll_safe
from ..expression_node import ExpressionNode
from .....vmobjects.abstract_object import AbstractObject





class AbstractMessageNode(ExpressionNode):

    _immutable_fields_ = ['_selector', '_universe',
                          '_rcvr_expr?', '_arg_exprs?[*]']
    _child_nodes_      = ['_rcvr_expr',  '_arg_exprs[*]']

    def __init__(self, selector, universe, rcvr_expr, arg_exprs,
                 source_section = None):
        ExpressionNode.__init__(self, source_section)
        self._selector = selector
        self._universe = universe
        assert arg_exprs is not None
        make_sure_not_resized(arg_exprs)
        self._rcvr_expr = self.adopt_child(rcvr_expr)
        self._arg_exprs = self.adopt_children(arg_exprs)

    @unroll_safe
    def _evaluate_rcvr_and_args(self, frame):
        rcvr = self._rcvr_expr.execute(frame)

        assert isinstance(rcvr, AbstractObject)