Merge pull request #5428 from kumpera/wasm-support-p2
[mono.git] / mono / tests / ldfld_missing_field.il
1
2 //  CIL which breaks the ECMA-335 rules. 
3 // this CIL should fail verification by a conforming CLI verifier.
4
5 .assembly 'ldfld_missing_field_generated'
6 {
7   .hash algorithm 0x00008004
8   .ver  0:0:0:0
9 }
10
11 .class public auto ansi beforefieldinit MissingMember extends [mscorlib]System.Object
12 {
13         .method public hidebysig  specialname  rtspecialname instance default void .ctor ()  cil managed 
14         {
15                 .maxstack 8
16                 ldarg.0 
17                 call instance void object::.ctor()
18                 ret 
19         }
20
21         .method static private hidebysig void PrivateMethod ()  cil managed 
22         {
23                 .maxstack 8
24                 ret 
25         }
26
27
28         .field private int32 privateField
29 }
30
31 .class public auto ansi beforefieldinit Driver extends [mscorlib]System.Object
32 {
33         .method public hidebysig  specialname  rtspecialname instance default void .ctor ()  cil managed 
34         {
35                 .maxstack 8
36                 ldarg.0 
37                 call instance void object::.ctor()
38                 ret 
39         }
40
41         .method public static void NoInline() cil managed
42         {
43                 .maxstack 8
44                 ret
45         }
46
47         .method public static void TestMethod() cil managed
48         {
49                 .maxstack 8
50                 call void Driver::NoInline()
51                 ldnull
52                 ldfld int32 MissingMember::fld
53
54                 leave END
55 END:
56                 ret
57         }
58
59         .method public static int32 Main() cil managed
60         {
61                 .entrypoint
62                 .maxstack 8
63                 .locals init ( class [mscorlib]System.Exception V_0, int32 V_1)
64
65                 ldc.i4.0
66                 stloc.1
67
68                 .try {
69                         call void Driver::TestMethod()
70                         ldstr ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>ldfld_missing_field did not throw an exception"
71                         call void class [mscorlib]System.Console::WriteLine(string)
72                         ldc.i4.1 
73                         stloc.1
74                         leave END
75                 }
76                 catch [mscorlib]System.Exception {
77                         stloc.0
78
79                         ldloc.0
80                         callvirt instance class [mscorlib]System.Type class [mscorlib]System.Exception::GetType()
81                         ldtoken [mscorlib]System.MissingFieldException
82                         call class [mscorlib]System.Type class [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
83                         beq ARE_EQUAL
84                         ldstr ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>ldfld_missing_field thrown {0} instead of System.MissingFieldException"
85                         ldloc.0 
86                         callvirt instance class [mscorlib]System.Type class [mscorlib]System.Exception::GetType()
87                         call void class [mscorlib]System.Console::WriteLine(string, object)
88                         ldc.i4.1 
89                         stloc.1
90 ARE_EQUAL:
91                         leave END
92                 }
93
94
95 END:
96                 ldloc.1
97                 ret
98         }
99 }