redef class AClassdef
private fun compile_to_c(v: AbstractCompilerVisitor, mpropdef: MMethodDef, arguments: Array[RuntimeVariable])
do
- if mpropdef == self.mfree_init then
- assert mpropdef.mproperty.is_root_init
+ 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)
redef class AClassdef
private fun compile_to_java(v: JavaCompilerVisitor, mpropdef: MMethodDef, arguments: Array[RuntimeVariable]) do
- if mpropdef == self.mfree_init then
- assert mpropdef.mproperty.is_root_init
+ if mpropdef.mproperty.is_root_init then
if not mpropdef.is_intro then
v.supercall(mpropdef, arguments.first.mtype.as(MClassType), arguments)
end
mpropdef.msignature = msignature
mpropdef.new_msignature = msignature
mprop.is_init = true
- nclassdef.mfree_init = mpropdef
self.toolcontext.info("{mclassdef} gets a free empty constructor {mpropdef}{msignature}", 3)
the_root_init_mmethod = mprop
return
var msignature = new MSignature(mparameters, null)
mpropdef.new_msignature = msignature
mpropdef.msignature = new MSignature(new Array[MParameter], null) # always an empty real signature
- nclassdef.mfree_init = mpropdef
self.toolcontext.info("{mclassdef} gets a free constructor for attributes {mpropdef}{msignature}", 3)
mclassdef.mclass.root_init = mpropdef
end
redef class AClassdef
# Marker used in `ModelBuilder::build_properties`
private var build_properties_is_done = false
-
- # The free init (implicitely constructed by the class if required)
- var mfree_init: nullable MMethodDef = null
end
redef class MClass
var npropdef = modelbuilder.mpropdef2node(mmethoddef)
if npropdef isa AClassdef then
- # It is an init for a class
- assert mmethoddef == npropdef.mfree_init
-
if mmethoddef.mproperty.is_root_init and not mmethoddef.is_intro then
self.add_super_send(v.receiver, mmethoddef)
end