From: Jean Privat Date: Wed, 19 Aug 2009 15:46:29 +0000 (-0400) Subject: icode: if inlining is impossible, at least use a static call X-Git-Tag: v0.3~38 X-Git-Url: http://nitlanguage.org icode: if inlining is impossible, at least use a static call Signed-off-by: Jean Privat --- diff --git a/src/analysis/inline_methods.nit b/src/analysis/inline_methods.nit index 1b06b0d..02519d0 100644 --- a/src/analysis/inline_methods.nit +++ b/src/analysis/inline_methods.nit @@ -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) diff --git a/tests/sav/base_inline_nested2.sav b/tests/sav/base_inline_nested2.sav index c749215..dfb4247 100644 --- a/tests/sav/base_inline_nested2.sav +++ b/tests/sav/base_inline_nested2.sav @@ -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