bench/lang: add bench_base
[nit.git] / src / program.nit
index 5e6903e..728b7ce 100644 (file)
@@ -19,7 +19,7 @@ package program
 
 import metamodel
 import icode
-import primitive_info
+private import primitive_info
 import mmloader
 
 redef class ToolContext
@@ -81,6 +81,7 @@ class Program
        fun generate_allocation_iroutines
        do
                for c in main_module.local_classes do
+                       if c.global.is_abstract or c.global.is_interface then continue
                        var pi = c.primitive_info
                        if pi == null then
                                do
@@ -90,16 +91,19 @@ class Program
                                        var iroutine = new IRoutine(iselfa, null)
                                        var icb = new ICodeBuilder(main_module, iroutine)
 
-                                       for g in c.global_properties do
-                                               if not g.intro isa MMAttribute then continue
-                                               var p = c[g]
-                                               var t = p.signature.return_type
-                                               if p isa MMAttribute and t != null then
-                                                       var ir = p.iroutine
-                                                       if ir == null then continue
-                                                       # FIXME: Not compatible with sep compilation
-                                                       var e = icb.inline_routine(ir, iselfa, null).as(not null)
-                                                       icb.stmt(new IAttrWrite(p, iself, e))
+                                       for sc in c.che.linear_extension.reversed do
+                                               for g in sc.global_properties do
+                                                       if g.local_class != sc then continue
+                                                       if not g.intro isa MMAttribute then continue
+                                                       var p = c[g]
+                                                       var t = p.signature.return_type
+                                                       if p isa MMAttribute and t != null then
+                                                               var ir = p.iroutine
+                                                               if ir == null then continue
+                                                               # FIXME: Not compatible with sep compilation
+                                                               var e = icb.inline_routine(ir, iselfa, null).as(not null)
+                                                               icb.stmt(new IAttrWrite(p, iself, e))
+                                                       end
                                                end
                                        end
 
@@ -181,7 +185,7 @@ class Program
                                if iroutine != null then
                                        action(iroutine, m)
                                end
-                               for i in c.new_instance_iroutine do
+                               for i in c.new_instance_iroutine.values do
                                        action(i, m)
                                end
                        end