switch対応
switch文に対応してみた
まだswitchは式にできてないので戻り値は返せないけども
とりあえず[x, xs]のxs部分にcdr相当を渡したいんだけど
めっちゃめんどくさいので単純に配列をGetRangeしてコピーすることにした
GetRangeはご丁寧にもMSDNにO(n)っすよって書いてあるけど、もうほんとめんどくさいしいいや
コンパイルした結果がこれ
わらっちゃうくらいザツい(^-^;
.method public static void switch.show(class [mscorlib]System.Collections.Generic.List`1<int32> A_0) cil managed { // コード サイズ 96 (0x60) .maxstack 7 .locals init (int32 V_0, bool V_1, int32 V_2, int32 V_3, class [mscorlib]System.Collections.Generic.List`1<int32> V_4) IL_0000: ldarg.0 IL_0001: call instance int32 class [mscorlib]System.Collections.Generic.List`1<int32>::get_Count() IL_0006: stloc.0 IL_0007: ldloc.0 IL_0008: ldc.i4.0 IL_0009: ceq IL_000b: stloc.1 IL_000c: ldloc.1 IL_000d: brtrue IL_0017 IL_0012: br IL_001c IL_0017: br IL_005f IL_001c: ldloc.0 IL_001d: ldc.i4.1 IL_001e: clt IL_0020: ldc.i4.0 IL_0021: ceq IL_0023: stloc.1 IL_0024: ldloc.1 IL_0025: brtrue IL_002f IL_002a: br IL_005f IL_002f: ldarg.0 IL_0030: ldc.i4.0 IL_0031: call instance !0 class [mscorlib]System.Collections.Generic.List`1<int32>::get_Item(int32) IL_0036: stloc.2 IL_0037: ldloc.0 IL_0038: ldc.i4.1 IL_0039: sub IL_003a: stloc.3 IL_003b: ldarg.0 IL_003c: ldc.i4.1 IL_003d: ldloc.3 IL_003e: call instance class [mscorlib]System.Collections.Generic.List`1<!0> class [mscorlib]System.Collections.Generic.List`1<int32>::GetRange(int32, int32) IL_0043: stloc V_4 IL_0047: nop IL_0048: nop IL_0049: ldloc.2 IL_004a: call void [mscorlib]System.Console::WriteLine(int32) IL_004f: ldloc V_4 IL_0053: nop IL_0054: nop IL_0055: call void switch.show(class [mscorlib]System.Collections.Generic.List`1<int32>) IL_005a: br IL_005f IL_005f: ret } // end of global method switch.show