mpropdef
associated with the current node.
# Execute an implicit `mpropdef` associated with the current node.
private fun call(v: NaiveInterpreter, mpropdef: MMethodDef, arguments: Array[Instance]): nullable Instance
do
if mpropdef.mproperty.is_root_init then
assert arguments.length == 1
if not mpropdef.is_intro then
# standard call-next-method
var superpd = mpropdef.lookup_next_definition(v.mainmodule, arguments.first.mtype)
v.call(superpd, arguments)
end
return null
else if mclassdef.default_init == mpropdef then
var recv = arguments.first
var initializers = mpropdef.initializers
var no_init = false
if not initializers.is_empty and not mpropdef.is_old_style_init then
var i = 1
for p in initializers do
if p isa MMethod then
var args = [recv]
for x in p.intro.msignature.mparameters do
args.add arguments[i]
i += 1
end
v.send(p, args)
if p.intro.is_calling_init then no_init = true
else if p isa MAttribute then
assert recv isa MutableInstance
v.write_attribute(p, recv, arguments[i])
i += 1
else abort
end
assert i == arguments.length
end
if not no_init then v.send(mclass.the_root_init_mmethod.as(not null), [recv])
return null
else
abort
end
end
src/interpreter/naive_interpreter.nit:1627,2--1666,4