mirror of https://github.com/icsharpcode/ILSpy.git
Browse Source
F# emits tail calls pervasively, but the 'tail.' prefix was dropped entirely at the C# output stage, so the information never reached the decompiled text. Render it inline as '/*tail.*/' before the call, mirroring the existing 'constrained.' prefix comment in CallBuilder. Fix #3817 Assisted-by: Claude:claude-opus-4-8:Claude Codepull/3816/head
4 changed files with 63 additions and 1 deletions
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
internal class TailCall |
||||
{ |
||||
public static int Callee(int x) |
||||
{ |
||||
return x; |
||||
} |
||||
public static int Caller(int x) |
||||
{ |
||||
return /*tail.*/Callee(x); |
||||
} |
||||
} |
||||
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
#define CORE_ASSEMBLY "System.Runtime" |
||||
|
||||
.assembly extern CORE_ASSEMBLY |
||||
{ |
||||
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: |
||||
.ver 4:0:0:0 |
||||
} |
||||
|
||||
.assembly TailCall { } |
||||
|
||||
.class private auto ansi beforefieldinit TailCall |
||||
extends [CORE_ASSEMBLY]System.Object |
||||
{ |
||||
.method public hidebysig static int32 Callee (int32 x) cil managed |
||||
{ |
||||
.maxstack 8 |
||||
ldarg.0 |
||||
ret |
||||
} |
||||
|
||||
.method public hidebysig static int32 Caller (int32 x) cil managed |
||||
{ |
||||
.maxstack 8 |
||||
ldarg.0 |
||||
tail. |
||||
call int32 TailCall::Callee(int32) |
||||
ret |
||||
} |
||||
|
||||
.method public hidebysig specialname rtspecialname |
||||
instance void .ctor () cil managed |
||||
{ |
||||
.maxstack 8 |
||||
ldarg.0 |
||||
call instance void [CORE_ASSEMBLY]System.Object::.ctor() |
||||
ret |
||||
} |
||||
} |
||||
Loading…
Reference in new issue