nitg-s/u: Renamed retieve_live_partial_types in retrieve_partial_types
[nit.git] / src / separate_compiler.nit
index b3a29e2..dfc4ceb 100644 (file)
@@ -210,16 +210,31 @@ class SeparateCompiler
        fun do_property_coloring do
                var mclasses = new HashSet[MClass].from(modelbuilder.model.mclasses)
 
+               # Layouts
+               var method_layout_builder: PropertyLayoutBuilder[MMethod]
+               var attribute_layout_builder: PropertyLayoutBuilder[MAttribute]
+               if modelbuilder.toolcontext.opt_bm_typing.value then
+                       method_layout_builder = new MMethodBMizer(self.mainmodule)
+                       attribute_layout_builder = new MAttributeBMizer(self.mainmodule)
+               else if modelbuilder.toolcontext.opt_phmod_typing.value then
+                       method_layout_builder = new MMethodHasher(new PHModOperator, self.mainmodule)
+                       attribute_layout_builder = new MAttributeHasher(new PHModOperator, self.mainmodule)
+               else if modelbuilder.toolcontext.opt_phand_typing.value then
+                       method_layout_builder = new MMethodHasher(new PHAndOperator, self.mainmodule)
+                       attribute_layout_builder = new MAttributeHasher(new PHAndOperator, self.mainmodule)
+               else
+                       method_layout_builder = new MMethodColorer(self.mainmodule)
+                       attribute_layout_builder = new MAttributeColorer(self.mainmodule)
+               end
+
                # methods coloration
-               var method_coloring = new MMethodColorer(mainmodule)
-               var method_layout = method_coloring.build_layout(mclasses)
+               var method_layout = method_layout_builder.build_layout(mclasses)
                self.method_tables = build_method_tables(mclasses, method_layout)
                self.compile_color_consts(method_layout.pos)
                self.method_layout = method_layout
 
                # attributes coloration
-               var attribute_coloring = new MAttributeColorer(mainmodule)
-               var attr_layout = attribute_coloring.build_layout(mclasses)
+               var attr_layout = attribute_layout_builder.build_layout(mclasses)
                self.attr_tables = build_attr_tables(mclasses, attr_layout)
                self.compile_color_consts(attr_layout.pos)
                self.attr_layout = attr_layout
@@ -324,7 +339,7 @@ class SeparateCompiler
                end
 
                for mtype in mtypes do
-                       retieve_live_partial_types(mtype)
+                       retrieve_partial_types(mtype)
                end
                mtypes.add_all(self.partial_types)
 
@@ -458,7 +473,7 @@ class SeparateCompiler
                return tables
        end
 
-       fun retieve_live_partial_types(mtype: MType) do
+       fun retrieve_partial_types(mtype: MType) do
                # add formal types arguments to mtypes
                if mtype isa MGenericType then
                        for ft in mtype.arguments do
@@ -467,7 +482,7 @@ class SeparateCompiler
                                        abort
                                end
                                self.partial_types.add(ft)
-                               retieve_live_partial_types(ft)
+                               retrieve_partial_types(ft)
                        end
                end
                var mclass_type: MClassType
@@ -997,6 +1012,13 @@ class SeparateCompilerVisitor
                return res
        end
 
+       redef fun supercall(m: MMethodDef, recvtype: MClassType, args: Array[RuntimeVariable]): nullable RuntimeVariable
+       do
+               # FIXME implements a polymorphic access in tables
+               m = m.lookup_next_definition(m.mclassdef.mmodule, m.mclassdef.bound_mtype)
+               return self.call(m, recvtype, args)
+       end
+
        redef fun vararg_instance(mpropdef, recv, varargs, elttype)
        do
                # A vararg must be stored into an new array