nitg-s: removed compile_type_fts_table and compile_type_vts_table since they were...
authorAlexandre Terrasa <alexandre@moz-code.org>
Thu, 7 Feb 2013 22:20:42 +0000 (17:20 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Mon, 4 Mar 2013 18:20:01 +0000 (13:20 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/separate_compiler.nit

index 42169d8..e5eba10 100644 (file)
@@ -534,121 +534,6 @@ class SeparateCompiler
                v.add_decl("\};")
        end
 
-       protected fun compile_type_fts_table(mtype: MType): Bool do
-
-               var mclass_type: MClassType
-               if mtype isa MNullableType then
-                       mclass_type = mtype.mtype.as(MClassType)
-               else
-                       mclass_type = mtype.as(MClassType)
-               end
-               if self.ft_tables[mclass_type.mclass].is_empty then return false
-
-               # extern const struct fst_table_X fst_table_X
-               self.header.add_decl("extern const struct fts_table_{mtype.c_name} fts_table_{mtype.c_name};")
-               self.header.add_decl("struct fts_table_{mtype.c_name} \{")
-               if modelbuilder.toolcontext.opt_phmod_typing.value or modelbuilder.toolcontext.opt_phand_typing.value then
-                       self.header.add_decl("int mask;")
-               end
-               self.header.add_decl("struct type *types[{self.ft_tables[mclass_type.mclass].length}];")
-               self.header.add_decl("\};")
-
-               # const struct fts_table_X fts_table_X
-               var v = new_visitor
-               v.add_decl("const struct fts_table_{mtype.c_name} fts_table_{mtype.c_name} = \{")
-               if modelbuilder.toolcontext.opt_phmod_typing.value or modelbuilder.toolcontext.opt_phand_typing.value then
-                       v.add_decl("{self.ft_masks[mclass_type.mclass]},")
-               end
-               v.add_decl("\{")
-               for ft in self.ft_tables[mclass_type.mclass] do
-                       if ft == null then
-                               v.add_decl("NULL, /* empty */")
-                       else
-                               var ntype: MType
-                               if ft.mclass == mclass_type.mclass then
-                                       ntype = mclass_type.arguments[ft.rank]
-                               else
-                                       ntype = ft.anchor_to(self.mainmodule, mclass_type)
-                               end
-                               if self.type_layout.ids.has_key(ntype) then
-                                       v.add_decl("(struct type*)&type_{ntype.c_name}, /* {ft} ({ntype}) */")
-                               else
-                                       v.add_decl("NULL, /* empty ({ft} not a live type) */")
-                               end
-                       end
-               end
-               v.add_decl("\},")
-               v.add_decl("\};")
-               return true
-       end
-
-       protected fun compile_type_vts_table(mtype: MType): Bool do
-
-               var mclass_type: MClassType
-               if mtype isa MNullableType then
-                       mclass_type = mtype.mtype.as(MClassType)
-               else
-                       mclass_type = mtype.as(MClassType)
-               end
-               if self.vt_tables[mclass_type.mclass].is_empty then return false
-
-               # extern const struct vts_table_X vts_table_X
-               self.header.add_decl("extern const struct vts_table_{mtype.c_name} vts_table_{mtype.c_name};")
-               self.header.add_decl("struct vts_table_{mtype.c_name} \{")
-               if modelbuilder.toolcontext.opt_phmod_typing.value or modelbuilder.toolcontext.opt_phand_typing.value then
-                       self.header.add_decl("int mask;")
-               end
-               self.header.add_decl("struct type *types[{self.vt_tables[mclass_type.mclass].length}];")
-               self.header.add_decl("\};")
-
-               # const struct vts_table_X vts_table_X
-               var v = new_visitor
-               v.add_decl("const struct vts_table_{mtype.c_name} vts_table_{mtype.c_name} = \{")
-               if modelbuilder.toolcontext.opt_phmod_typing.value or modelbuilder.toolcontext.opt_phand_typing.value then
-                       v.add_decl("{vt_masks[mclass_type.mclass]},")
-               end
-               v.add_decl("\{")
-
-               for vt in self.vt_tables[mclass_type.mclass] do
-                       if vt == null then
-                               v.add_decl("NULL, /* empty */")
-                       else
-                               var bound = vt.as(MVirtualTypeDef).bound
-                               if bound == null then
-                                       #FIXME how can a bound be null here ?
-                                       print "No bound found for virtual type {vt} ?"
-                                       abort
-                               else
-                                       var is_nullable = ""
-                                       if bound isa MNullableType then
-                                               bound = bound.mtype
-                                               is_nullable = "nullable_"
-                                       end
-                                       if bound isa MVirtualType then
-                                               bound = bound.anchor_to(self.mainmodule, mclass_type)
-                                       else if bound isa MParameterType then
-                                               bound = bound.anchor_to(self.mainmodule, mclass_type)
-                                       else if bound isa MGenericType and bound.need_anchor then
-                                               bound = bound.anchor_to(self.mainmodule, mclass_type)
-                                       else if bound isa MClassType then
-                                       else
-                                               print "NOT YET IMPLEMENTED: mtype_to_livetype with type: {bound}"
-                                               abort
-                                       end
-
-                                       if self.type_layout.ids.has_key(bound) then
-                                               v.add_decl("(struct type*)&type_{is_nullable}{bound.c_name}, /* {bound} */")
-                                       else
-                                               v.add_decl("NULL, /* dead type {bound} */")
-                                       end
-                               end
-                       end
-               end
-               v.add_decl("\},")
-               v.add_decl("\};")
-               return true
-       end
-
        fun compile_type_unanchored_table(mtype: MType): Bool do
 
                var mclass_type: MClassType