summaryrefslogtreecommitdiff
path: root/tests/src/readytorun/tests/genericsload/genericslib.il
blob: fdc2f408a3e93f8f83780e03027c6ed8ad91c9f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//

.assembly genericslib { }
.module genericslib.dll

.assembly extern mscorlib { }

// A module constructor that sets GenClass`1<string>::StaticField to true.
.method assembly specialname rtspecialname static 
          void  .cctor() cil managed
{
    ldc.i4.1
    stsfld     bool class GenClass`1<string>::StaticField
    ret
}

.class public auto ansi beforefieldinit GenClass`1<T>
       extends [mscorlib]System.Object
{
    .field static public bool StaticField

    /*
    public GenClass()
    {
        if (!StaticField)
            throw new System.Exception();
    }
    */
    .method public hidebysig specialname rtspecialname 
            instance void  .ctor() cil managed
    {
        ldarg.0
        call       instance void [mscorlib]System.Object::.ctor()

        ldsfld     bool class GenClass`1<!T>::StaticField
        brtrue.s   OK

        newobj     instance void [mscorlib]System.Exception::.ctor()
        throw

    OK: ret
    }

    /*
    public static bool StaticMethod()
    {
        return StaticField;
    }
    */
    .method public hidebysig static bool StaticMethod() cil managed
    {
        ldsfld     bool class GenClass`1<!T>::StaticField
        ret
    }
}