nitc :: AClassdef :: compile_to_c
private fun compile_to_c(v: AbstractCompilerVisitor, mpropdef: MMethodDef, arguments: Array[RuntimeVariable])
do
if mpropdef.mproperty.is_root_init then
assert arguments.length == 1
if not mpropdef.is_intro then
v.supercall(mpropdef, arguments.first.mtype.as(MClassType), arguments)
end
return
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
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
else
abort
end
end
src/compiler/abstract_compiler.nit:3683,2--3719,4