summaryrefslogtreecommitdiff
path: root/tests/src/Loader/classloader/nesting/Tests/nesting4.il
blob: a5ee7e9bf2d0bd15433bdc7c41487d24cf8c7de7 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// 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 extern System.Console { }
// model revision #2
// To compile: ilasm nesting4.il

.assembly extern mscorlib {}
.assembly nesting4{}

// Nesting module: PureManaged
// Nesting location: MainModule

// enclosing type 
// kind: Class
// flag: None
// visibility: private
// generics: Nongeneric
// depends on nested: InstanceField

.class private EnclType
{
  // nested type 
  // kind: Interface
  // flag: abstract
  // visibility: public
  // generics: Nongeneric
  // depends on enclosing: StaticField

  .class interface abstract nested public NestedType
  {
    // nested depends on enclosing: StaticField
    // nested member visibility: public
    .field public static class EnclType sEnclType
  }

  // enclosing depends on nested: InstanceField
  // enclosing member visibility: famorassem
  .field famorassem class EnclType/NestedType sNestClass

  // entry point location: EnclosingType

  .method public static int32 Main()
  {
    .entrypoint
    .locals init (class [mscorlib]System.Exception V_0,
                  int32 V_1)

    .try
    {
      newobj instance void class Client::.ctor()
      call instance void  Client::method1()
      ldstr      "PASS"
      call       void [System.Console]System.Console::WriteLine(string)
      ldc.i4.s   100
      stloc.1
      leave.s    end
    }
    catch [mscorlib]System.Exception 
    {
      stloc.0
      ldstr      "{0}Caught unexpected exception."
      ldloc.0
      call void [System.Console]System.Console::WriteLine(string,object)
      ldstr      "FAIL"
      call       void [System.Console]System.Console::WriteLine(string)
      ldc.i4.s   101
      stloc.1
      leave.s    end
    }
    end: ldloc.1
    ret
  }

  .method public specialname instance void .ctor() cil managed
  {
    .maxstack 8
    ldarg.0
    call instance void [mscorlib]System.Object::.ctor()
    ret
  }
}


// Client module: PureManaged
// Client location: MainModule
// Client interaction: None

.class public Client
{

  .method public specialname instance void .ctor() cil managed
  {
    .maxstack 8
    ldarg.0
    call instance void [mscorlib]System.Object::.ctor()
    ret
  }
  .method public instance void method1()
  {
 
      // load enclosing and nested types

      newobj instance void class EnclType::.ctor()
      stsfld class EnclType class EnclType/NestedType::sEnclType
      ldsfld class EnclType class EnclType/NestedType::sEnclType

      // Helper1 implements EnclType/NestedType

      newobj instance void class Helper1::.ctor()
      stfld class EnclType/NestedType class EnclType::sNestClass
      ret
  }
}

.class public Helper1 implements EnclType/NestedType
{
  .method public specialname instance void .ctor() cil managed
  {
    ldarg.0
    call instance void [mscorlib]System.Object::.ctor()
    ret
  }

}