nitc: remove the redundant property `mfree_init`
authorJean Privat <jean@pryen.org>
Fri, 12 Feb 2016 02:50:33 +0000 (21:50 -0500)
committerJean Privat <jean@pryen.org>
Fri, 12 Feb 2016 02:50:33 +0000 (21:50 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

src/compiler/abstract_compiler.nit
src/compiler/java_compiler.nit
src/modelize/modelize_property.nit
src/rapid_type_analysis.nit

index 07d6826..02e489d 100644 (file)
@@ -3167,8 +3167,7 @@ end
 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)
index 7468d28..ec759a2 100644 (file)
@@ -1482,8 +1482,7 @@ end
 
 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
index b782f25..03d9951 100644 (file)
@@ -153,7 +153,6 @@ redef class ModelBuilder
                        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
@@ -356,7 +355,6 @@ redef class ModelBuilder
                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
@@ -488,9 +486,6 @@ 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
index 9a6b117..749dd00 100644 (file)
@@ -258,9 +258,6 @@ class RapidTypeAnalysis
                        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