Skip to content

Instantly share code, notes, and snippets.

@acple
Last active September 19, 2018 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acple/adf6cbb3e47c45d3b06a4ae29120338f to your computer and use it in GitHub Desktop.
Save acple/adf6cbb3e47c45d3b06a4ae29120338f to your computer and use it in GitHub Desktop.
コンパイル結果がやべーやつ
using System;
namespace Sandbox
{
class Program
{
static void Main(string[] args)
{
var x = 1;
{
var y = 2;
{
var z = 3;
var func = (Action)(() => Console.WriteLine(x + y + z));
func.Invoke();
}
}
}
}
}
// Token: 0x02000002 RID: 2
.class private auto ansi beforefieldinit Sandbox.Program
extends [System.Runtime]System.Object
{
// Nested Types
// Token: 0x02000003 RID: 3
.class nested private auto ansi sealed beforefieldinit '<>c__DisplayClass0_0'
extends [System.Runtime]System.Object
{
.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
01 00 00 00
)
// Fields
// Token: 0x04000001 RID: 1
.field public int32 x
// Methods
// Token: 0x06000003 RID: 3 RVA: 0x000020A9 File Offset: 0x000002A9
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
// Header Size: 1 byte
// Code Size: 7 (0x7) bytes
.maxstack 8
/* 0x000002AA 02 */ IL_0000: ldarg.0
/* 0x000002AB 280E00000A */ IL_0001: call instance void [System.Runtime]System.Object::.ctor()
/* 0x000002B0 2A */ IL_0006: ret
} // end of method '<>c__DisplayClass0_0'::.ctor
} // end of class <>c__DisplayClass0_0
// Token: 0x02000004 RID: 4
.class nested private auto ansi sealed beforefieldinit '<>c__DisplayClass0_1'
extends [System.Runtime]System.Object
{
.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
01 00 00 00
)
// Fields
// Token: 0x04000002 RID: 2
.field public int32 y
// Token: 0x04000003 RID: 3
.field public class Sandbox.Program/'<>c__DisplayClass0_0' 'CS$<>8__locals1'
// Methods
// Token: 0x06000004 RID: 4 RVA: 0x000020B1 File Offset: 0x000002B1
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
// Header Size: 1 byte
// Code Size: 7 (0x7) bytes
.maxstack 8
/* 0x000002B2 02 */ IL_0000: ldarg.0
/* 0x000002B3 280E00000A */ IL_0001: call instance void [System.Runtime]System.Object::.ctor()
/* 0x000002B8 2A */ IL_0006: ret
} // end of method '<>c__DisplayClass0_1'::.ctor
} // end of class <>c__DisplayClass0_1
// Token: 0x02000005 RID: 5
.class nested private auto ansi sealed beforefieldinit '<>c__DisplayClass0_2'
extends [System.Runtime]System.Object
{
.custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
01 00 00 00
)
// Fields
// Token: 0x04000004 RID: 4
.field public int32 z
// Token: 0x04000005 RID: 5
.field public class Sandbox.Program/'<>c__DisplayClass0_1' 'CS$<>8__locals2'
// Methods
// Token: 0x06000005 RID: 5 RVA: 0x000020B9 File Offset: 0x000002B9
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
// Header Size: 1 byte
// Code Size: 7 (0x7) bytes
.maxstack 8
/* 0x000002BA 02 */ IL_0000: ldarg.0
/* 0x000002BB 280E00000A */ IL_0001: call instance void [System.Runtime]System.Object::.ctor()
/* 0x000002C0 2A */ IL_0006: ret
} // end of method '<>c__DisplayClass0_2'::.ctor
// Token: 0x06000006 RID: 6 RVA: 0x000020C1 File Offset: 0x000002C1
.method assembly hidebysig
instance void '<Main>b__0' () cil managed
{
// Header Size: 1 byte
// Code Size: 41 (0x29) bytes
.maxstack 8
/* 0x000002C2 02 */ IL_0000: ldarg.0
/* 0x000002C3 7B05000004 */ IL_0001: ldfld class Sandbox.Program/'<>c__DisplayClass0_1' Sandbox.Program/'<>c__DisplayClass0_2'::'CS$<>8__locals2'
/* 0x000002C8 7B03000004 */ IL_0006: ldfld class Sandbox.Program/'<>c__DisplayClass0_0' Sandbox.Program/'<>c__DisplayClass0_1'::'CS$<>8__locals1'
/* 0x000002CD 7B01000004 */ IL_000B: ldfld int32 Sandbox.Program/'<>c__DisplayClass0_0'::x
/* 0x000002D2 02 */ IL_0010: ldarg.0
/* 0x000002D3 7B05000004 */ IL_0011: ldfld class Sandbox.Program/'<>c__DisplayClass0_1' Sandbox.Program/'<>c__DisplayClass0_2'::'CS$<>8__locals2'
/* 0x000002D8 7B02000004 */ IL_0016: ldfld int32 Sandbox.Program/'<>c__DisplayClass0_1'::y
/* 0x000002DD 58 */ IL_001B: add
/* 0x000002DE 02 */ IL_001C: ldarg.0
/* 0x000002DF 7B04000004 */ IL_001D: ldfld int32 Sandbox.Program/'<>c__DisplayClass0_2'::z
/* 0x000002E4 58 */ IL_0022: add
/* 0x000002E5 280F00000A */ IL_0023: call void [System.Console]System.Console::WriteLine(int32)
/* 0x000002EA 2A */ IL_0028: ret
} // end of method '<>c__DisplayClass0_2'::'<Main>b__0'
} // end of class <>c__DisplayClass0_2
// Methods
// Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
.method private hidebysig static
void Main (
string[] args
) cil managed
{
// Header Size: 12 bytes
// Code Size: 69 (0x45) bytes
// LocalVarSig Token: 0x11000001 RID: 1
.maxstack 3
.entrypoint
.locals init (
[0] class Sandbox.Program/'<>c__DisplayClass0_0' 'CS$<>8__locals0',
[1] class Sandbox.Program/'<>c__DisplayClass0_1' 'CS$<>8__locals1'
)
/* 0x0000025C 7303000006 */ IL_0000: newobj instance void Sandbox.Program/'<>c__DisplayClass0_0'::.ctor()
/* 0x00000261 0A */ IL_0005: stloc.0
/* 0x00000262 06 */ IL_0006: ldloc.0
/* 0x00000263 17 */ IL_0007: ldc.i4.1
/* 0x00000264 7D01000004 */ IL_0008: stfld int32 Sandbox.Program/'<>c__DisplayClass0_0'::x
/* 0x00000269 7304000006 */ IL_000D: newobj instance void Sandbox.Program/'<>c__DisplayClass0_1'::.ctor()
/* 0x0000026E 0B */ IL_0012: stloc.1
/* 0x0000026F 07 */ IL_0013: ldloc.1
/* 0x00000270 06 */ IL_0014: ldloc.0
/* 0x00000271 7D03000004 */ IL_0015: stfld class Sandbox.Program/'<>c__DisplayClass0_0' Sandbox.Program/'<>c__DisplayClass0_1'::'CS$<>8__locals1'
/* 0x00000276 07 */ IL_001A: ldloc.1
/* 0x00000277 18 */ IL_001B: ldc.i4.2
/* 0x00000278 7D02000004 */ IL_001C: stfld int32 Sandbox.Program/'<>c__DisplayClass0_1'::y
/* 0x0000027D 7305000006 */ IL_0021: newobj instance void Sandbox.Program/'<>c__DisplayClass0_2'::.ctor()
/* 0x00000282 25 */ IL_0026: dup
/* 0x00000283 07 */ IL_0027: ldloc.1
/* 0x00000284 7D05000004 */ IL_0028: stfld class Sandbox.Program/'<>c__DisplayClass0_1' Sandbox.Program/'<>c__DisplayClass0_2'::'CS$<>8__locals2'
/* 0x00000289 25 */ IL_002D: dup
/* 0x0000028A 19 */ IL_002E: ldc.i4.3
/* 0x0000028B 7D04000004 */ IL_002F: stfld int32 Sandbox.Program/'<>c__DisplayClass0_2'::z
/* 0x00000290 FE0606000006 */ IL_0034: ldftn instance void Sandbox.Program/'<>c__DisplayClass0_2'::'<Main>b__0'()
/* 0x00000296 730C00000A */ IL_003A: newobj instance void [System.Runtime]System.Action::.ctor(object, native int)
/* 0x0000029B 6F0D00000A */ IL_003F: callvirt instance void [System.Runtime]System.Action::Invoke()
/* 0x000002A0 2A */ IL_0044: ret
} // end of method Program::Main
// Token: 0x06000002 RID: 2 RVA: 0x000020A1 File Offset: 0x000002A1
.method public hidebysig specialname rtspecialname
instance void .ctor () cil managed
{
// Header Size: 1 byte
// Code Size: 7 (0x7) bytes
.maxstack 8
/* 0x000002A2 02 */ IL_0000: ldarg.0
/* 0x000002A3 280E00000A */ IL_0001: call instance void [System.Runtime]System.Object::.ctor()
/* 0x000002A8 2A */ IL_0006: ret
} // end of method Program::.ctor
} // end of class Sandbox.Program
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment