@@ -25,16 +25,16 @@ internal sealed class DefinitionMethod : Method
25
25
26
26
public DefinitionMethod ( IGenericContext gc , MethodDefinitionHandle handle ) : base ( gc )
27
27
{
28
- md = Cx . MdReader . GetMethodDefinition ( handle ) ;
28
+ md = Context . MdReader . GetMethodDefinition ( handle ) ;
29
29
this . gc = gc ;
30
30
this . handle = handle ;
31
- name = Cx . GetString ( md . Name ) ;
31
+ name = Context . GetString ( md . Name ) ;
32
32
33
- declaringType = ( Type ) Cx . CreateGeneric ( this , md . GetDeclaringType ( ) ) ;
33
+ declaringType = ( Type ) Context . CreateGeneric ( this , md . GetDeclaringType ( ) ) ;
34
34
35
35
signature = md . DecodeSignature ( new SignatureDecoder ( ) , this ) ;
36
36
37
- methodDebugInformation = Cx . GetMethodDebugInformation ( handle ) ;
37
+ methodDebugInformation = Context . GetMethodDebugInformation ( handle ) ;
38
38
}
39
39
40
40
public override bool Equals ( object ? obj )
@@ -48,7 +48,7 @@ public override bool Equals(object? obj)
48
48
49
49
public override Type DeclaringType => declaringType ;
50
50
51
- public override string Name => Cx . ShortName ( md . Name ) ;
51
+ public override string Name => Context . ShortName ( md . Name ) ;
52
52
53
53
public override string NameLabel => name ;
54
54
@@ -67,14 +67,14 @@ public override IEnumerable<IExtractionProduct> Contents
67
67
// depend on other type parameters (as a constraint).
68
68
genericParams = new MethodTypeParameter [ md . GetGenericParameters ( ) . Count ] ;
69
69
for ( var i = 0 ; i < genericParams . Length ; ++ i )
70
- genericParams [ i ] = Cx . Populate ( new MethodTypeParameter ( this , this , i ) ) ;
70
+ genericParams [ i ] = Context . Populate ( new MethodTypeParameter ( this , this , i ) ) ;
71
71
for ( var i = 0 ; i < genericParams . Length ; ++ i )
72
72
genericParams [ i ] . PopulateHandle ( md . GetGenericParameters ( ) [ i ] ) ;
73
73
foreach ( var p in genericParams )
74
74
yield return p ;
75
75
}
76
76
77
- var typeSignature = md . DecodeSignature ( Cx . TypeSignatureDecoder , this ) ;
77
+ var typeSignature = md . DecodeSignature ( Context . TypeSignatureDecoder , this ) ;
78
78
79
79
var parameters = GetParameterExtractionProducts ( typeSignature . ParameterTypes ) . ToArray ( ) ;
80
80
Parameters = parameters . OfType < Parameter > ( ) . ToArray ( ) ;
@@ -85,37 +85,37 @@ public override IEnumerable<IExtractionProduct> Contents
85
85
foreach ( var c in PopulateFlags )
86
86
yield return c ;
87
87
88
- foreach ( var p in md . GetParameters ( ) . Select ( h => Cx . MdReader . GetParameter ( h ) ) . Where ( p => p . SequenceNumber > 0 ) )
88
+ foreach ( var p in md . GetParameters ( ) . Select ( h => Context . MdReader . GetParameter ( h ) ) . Where ( p => p . SequenceNumber > 0 ) )
89
89
{
90
90
var pe = Parameters [ IsStatic ? p . SequenceNumber - 1 : p . SequenceNumber ] ;
91
91
if ( p . Attributes . HasFlag ( ParameterAttributes . Out ) )
92
92
yield return Tuples . cil_parameter_out ( pe ) ;
93
93
if ( p . Attributes . HasFlag ( ParameterAttributes . In ) )
94
94
yield return Tuples . cil_parameter_in ( pe ) ;
95
- Attribute . Populate ( Cx , pe , p . GetCustomAttributes ( ) ) ;
95
+ Attribute . Populate ( Context , pe , p . GetCustomAttributes ( ) ) ;
96
96
}
97
97
98
- yield return Tuples . metadata_handle ( this , Cx . Assembly , MetadataTokens . GetToken ( handle ) ) ;
98
+ yield return Tuples . metadata_handle ( this , Context . Assembly , MetadataTokens . GetToken ( handle ) ) ;
99
99
100
100
foreach ( var m in GetMethodExtractionProducts ( Name , declaringType , typeSignature . ReturnType ) )
101
101
{
102
102
yield return m ;
103
103
}
104
104
105
105
yield return Tuples . cil_method_source_declaration ( this , this ) ;
106
- yield return Tuples . cil_method_location ( this , Cx . Assembly ) ;
106
+ yield return Tuples . cil_method_location ( this , Context . Assembly ) ;
107
107
108
108
if ( HasBytecode )
109
109
{
110
110
Implementation = new MethodImplementation ( this ) ;
111
111
yield return Implementation ;
112
112
113
- var body = Cx . PeReader . GetMethodBody ( md . RelativeVirtualAddress ) ;
113
+ var body = Context . PeReader . GetMethodBody ( md . RelativeVirtualAddress ) ;
114
114
115
115
if ( ! body . LocalSignature . IsNil )
116
116
{
117
- var locals = Cx . MdReader . GetStandaloneSignature ( body . LocalSignature ) ;
118
- var localVariableTypes = locals . DecodeLocalSignature ( Cx . TypeSignatureDecoder , this ) ;
117
+ var locals = Context . MdReader . GetStandaloneSignature ( body . LocalSignature ) ;
118
+ var localVariableTypes = locals . DecodeLocalSignature ( Context . TypeSignatureDecoder , this ) ;
119
119
120
120
this . locals = new LocalVariable [ localVariableTypes . Length ] ;
121
121
@@ -125,13 +125,13 @@ public override IEnumerable<IExtractionProduct> Contents
125
125
if ( t is ByRefType brt )
126
126
{
127
127
t = brt . ElementType ;
128
- this . locals [ l ] = Cx . Populate ( new LocalVariable ( Cx , Implementation , l , t ) ) ;
128
+ this . locals [ l ] = Context . Populate ( new LocalVariable ( Context , Implementation , l , t ) ) ;
129
129
yield return this . locals [ l ] ;
130
130
yield return Tuples . cil_type_annotation ( this . locals [ l ] , TypeAnnotation . Ref ) ;
131
131
}
132
132
else
133
133
{
134
- this . locals [ l ] = Cx . Populate ( new LocalVariable ( Cx , Implementation , l , t ) ) ;
134
+ this . locals [ l ] = Context . Populate ( new LocalVariable ( Context , Implementation , l , t ) ) ;
135
135
yield return this . locals [ l ] ;
136
136
}
137
137
}
@@ -152,7 +152,7 @@ public override IEnumerable<IExtractionProduct> Contents
152
152
153
153
if ( methodDebugInformation != null )
154
154
{
155
- var sourceLocation = Cx . CreateSourceLocation ( methodDebugInformation . Location ) ;
155
+ var sourceLocation = Context . CreateSourceLocation ( methodDebugInformation . Location ) ;
156
156
yield return sourceLocation ;
157
157
yield return Tuples . cil_method_location ( this , sourceLocation ) ;
158
158
}
@@ -191,7 +191,7 @@ public override IEnumerable<IExtractionProduct> Contents
191
191
yield return Tuples . cil_newslot ( this ) ;
192
192
193
193
// Populate attributes
194
- Attribute . Populate ( Cx , this , md . GetCustomAttributes ( ) ) ;
194
+ Attribute . Populate ( Context , this , md . GetCustomAttributes ( ) ) ;
195
195
}
196
196
}
197
197
@@ -210,7 +210,7 @@ private IEnumerable<IExtractionProduct> Decode(byte[]? ilbytes, Dictionary<int,
210
210
nextSequencePoint = methodDebugInformation . SequencePoints . GetEnumerator ( ) ;
211
211
if ( nextSequencePoint . MoveNext ( ) )
212
212
{
213
- instructionLocation = Cx . CreateSourceLocation ( nextSequencePoint . Current . Location ) ;
213
+ instructionLocation = Context . CreateSourceLocation ( nextSequencePoint . Current . Location ) ;
214
214
yield return instructionLocation ;
215
215
}
216
216
else
@@ -222,12 +222,12 @@ private IEnumerable<IExtractionProduct> Decode(byte[]? ilbytes, Dictionary<int,
222
222
var child = 0 ;
223
223
for ( var offset = 0 ; offset < ( ilbytes ? . Length ?? 0 ) ; )
224
224
{
225
- var instruction = new Instruction ( Cx , this , ilbytes ! , offset , child ++ ) ;
225
+ var instruction = new Instruction ( Context , this , ilbytes ! , offset , child ++ ) ;
226
226
yield return instruction ;
227
227
228
228
if ( nextSequencePoint != null && offset >= nextSequencePoint . Current . Offset )
229
229
{
230
- instructionLocation = Cx . CreateSourceLocation ( nextSequencePoint . Current . Location ) ;
230
+ instructionLocation = Context . CreateSourceLocation ( nextSequencePoint . Current . Location ) ;
231
231
yield return instructionLocation ;
232
232
if ( ! nextSequencePoint . MoveNext ( ) )
233
233
nextSequencePoint = null ;
@@ -257,7 +257,7 @@ public IEnumerable<Instruction> DebugInstructions
257
257
{
258
258
if ( md . ImplAttributes == MethodImplAttributes . IL && md . RelativeVirtualAddress != 0 )
259
259
{
260
- var body = Cx . PeReader . GetMethodBody ( md . RelativeVirtualAddress ) ;
260
+ var body = Context . PeReader . GetMethodBody ( md . RelativeVirtualAddress ) ;
261
261
262
262
var ilbytes = body . GetILBytes ( ) ;
263
263
@@ -267,7 +267,7 @@ public IEnumerable<Instruction> DebugInstructions
267
267
Instruction decoded ;
268
268
try
269
269
{
270
- decoded = new Instruction ( Cx , this , ilbytes ! , offset , child ++ ) ;
270
+ decoded = new Instruction ( Context , this , ilbytes ! , offset , child ++ ) ;
271
271
offset += decoded . Width ;
272
272
}
273
273
catch // lgtm[cs/catch-of-all-exceptions]
0 commit comments