icode: if inlining is impossible, at least use a static call
authorJean Privat <jean@pryen.org>
Wed, 19 Aug 2009 15:46:29 +0000 (11:46 -0400)
committerJean Privat <jean@pryen.org>
Wed, 19 Aug 2009 15:46:29 +0000 (11:46 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/analysis/inline_methods.nit
tests/sav/base_inline_nested2.sav

index 1b06b0d..02519d0 100644 (file)
@@ -34,7 +34,13 @@ special ICodeVisitor
                        if ir != null and ic.is_inlinable then
                                if _current_inlining.has(ir) then
                                        # We cannot inline ir
-                                       # FIXME: what we want is a static call
+                                       # So, at least transform the call to a static one
+                                       current_icode.delete
+                                       var icall = new IStaticCall(ic.property, ic.exprs)
+                                       icall.closure_defs = ic.closure_defs
+                                       icall.result = ic.result
+                                       current_icode.insert_before(icall)
+                                       current_icode.delete
                                else
                                        var icb = _icb
                                        _current_inlining.push(ir)
index c749215..dfb4247 100644 (file)
@@ -6,7 +6,7 @@ F6
 B5
 F4
 B3
-A2
+F2
 B1
 F0
 B10
@@ -14,7 +14,7 @@ F9
 B8
 F7
 B6
-A5
+F5
 B4
 F3
 B2