recv
.recv.mtype
is used to know what must be filled.
# Fill the initial values of the newly created instance `recv`.
# `recv.mtype` is used to know what must be filled.
fun init_instance(recv: Instance)
do
for npropdef in collect_attr_propdef(recv.mtype) do
npropdef.init_expr(self, recv)
end
end
src/interpreter/naive_interpreter.nit:679,2--686,4
# Redef init_instance to simulate the loading of a class
redef fun init_instance(recv: Instance)
do
if not recv.mtype.as(MClassType).mclass.loaded then load_class(recv.mtype.as(MClassType).mclass)
recv.vtable = recv.mtype.as(MClassType).mclass.vtable
assert recv isa MutableInstance
recv.internal_attributes = init_internal_attributes(initialization_value, recv.mtype.as(MClassType).mclass.mattributes.length)
super
end
src/vm/virtual_machine.nit:161,2--172,4