@@ -193,7 +193,7 @@ private static MethodDeclarationSyntax PrintGeneratedSource(
193
193
. WithBody ( stubCode ) ;
194
194
}
195
195
196
- private static VirtualMethodIndexData ? ProcessVirtualMethodIndexAttribute ( AttributeData attrData )
196
+ private static VirtualMethodIndexCompilationData ? ProcessVirtualMethodIndexAttribute ( AttributeData attrData )
197
197
{
198
198
// Found the attribute, but it has an error so report the error.
199
199
// This is most likely an issue with targeting an incorrect TFM.
@@ -214,7 +214,7 @@ private static MethodDeclarationSyntax PrintGeneratedSource(
214
214
bool exceptionMarshallingDefined = false ;
215
215
ExceptionMarshalling exceptionMarshalling = ExceptionMarshalling . Custom ;
216
216
INamedTypeSymbol ? exceptionMarshallingCustomType = null ;
217
- if ( namedArguments . TryGetValue ( nameof ( VirtualMethodIndexData . Direction ) , out TypedConstant directionValue ) )
217
+ if ( namedArguments . TryGetValue ( nameof ( VirtualMethodIndexCompilationData . Direction ) , out TypedConstant directionValue ) )
218
218
{
219
219
// TypedConstant's Value property only contains primitive values.
220
220
if ( directionValue . Value is not int )
@@ -224,15 +224,15 @@ private static MethodDeclarationSyntax PrintGeneratedSource(
224
224
// A boxed primitive can be unboxed to an enum with the same underlying type.
225
225
direction = ( MarshalDirection ) directionValue . Value ! ;
226
226
}
227
- if ( namedArguments . TryGetValue ( nameof ( VirtualMethodIndexData . ImplicitThisParameter ) , out TypedConstant implicitThisValue ) )
227
+ if ( namedArguments . TryGetValue ( nameof ( VirtualMethodIndexCompilationData . ImplicitThisParameter ) , out TypedConstant implicitThisValue ) )
228
228
{
229
229
if ( implicitThisValue . Value is not bool )
230
230
{
231
231
return null ;
232
232
}
233
233
implicitThis = ( bool ) implicitThisValue . Value ! ;
234
234
}
235
- if ( namedArguments . TryGetValue ( nameof ( VirtualMethodIndexData . ExceptionMarshalling ) , out TypedConstant exceptionMarshallingValue ) )
235
+ if ( namedArguments . TryGetValue ( nameof ( VirtualMethodIndexCompilationData . ExceptionMarshalling ) , out TypedConstant exceptionMarshallingValue ) )
236
236
{
237
237
exceptionMarshallingDefined = true ;
238
238
// TypedConstant's Value property only contains primitive values.
@@ -243,7 +243,7 @@ private static MethodDeclarationSyntax PrintGeneratedSource(
243
243
// A boxed primitive can be unboxed to an enum with the same underlying type.
244
244
exceptionMarshalling = ( ExceptionMarshalling ) exceptionMarshallingValue . Value ! ;
245
245
}
246
- if ( namedArguments . TryGetValue ( nameof ( VirtualMethodIndexData . ExceptionMarshallingCustomType ) , out TypedConstant exceptionMarshallingCustomTypeValue ) )
246
+ if ( namedArguments . TryGetValue ( nameof ( VirtualMethodIndexCompilationData . ExceptionMarshallingCustomType ) , out TypedConstant exceptionMarshallingCustomTypeValue ) )
247
247
{
248
248
if ( exceptionMarshallingCustomTypeValue . Value is not INamedTypeSymbol )
249
249
{
@@ -252,7 +252,7 @@ private static MethodDeclarationSyntax PrintGeneratedSource(
252
252
exceptionMarshallingCustomType = ( INamedTypeSymbol ) exceptionMarshallingCustomTypeValue . Value ;
253
253
}
254
254
255
- return new VirtualMethodIndexData ( ( int ) attrData . ConstructorArguments [ 0 ] . Value ) . WithValuesFromNamedArguments ( namedArguments ) with
255
+ return new VirtualMethodIndexCompilationData ( ( int ) attrData . ConstructorArguments [ 0 ] . Value ) . WithValuesFromNamedArguments ( namedArguments ) with
256
256
{
257
257
Direction = direction ,
258
258
ImplicitThisParameter = implicitThis ,
@@ -300,11 +300,11 @@ private static IncrementalStubGenerationContext CalculateStubInformation(MethodD
300
300
var generatorDiagnostics = new GeneratorDiagnostics ( ) ;
301
301
302
302
// Process the LibraryImport attribute
303
- VirtualMethodIndexData ? virtualMethodIndexData = ProcessVirtualMethodIndexAttribute ( virtualMethodIndexAttr ! ) ;
303
+ VirtualMethodIndexCompilationData ? virtualMethodIndexData = ProcessVirtualMethodIndexAttribute ( virtualMethodIndexAttr ! ) ;
304
304
305
305
if ( virtualMethodIndexData is null )
306
306
{
307
- virtualMethodIndexData = new VirtualMethodIndexData ( - 1 ) ;
307
+ virtualMethodIndexData = new VirtualMethodIndexCompilationData ( - 1 ) ;
308
308
}
309
309
else if ( virtualMethodIndexData . Index < 0 )
310
310
{
@@ -371,7 +371,7 @@ private static IncrementalStubGenerationContext CalculateStubInformation(MethodD
371
371
methodSyntaxTemplate ,
372
372
new MethodSignatureDiagnosticLocations ( syntax ) ,
373
373
new SequenceEqualImmutableArray < FunctionPointerUnmanagedCallingConventionSyntax > ( callConv , SyntaxEquivalentComparer . Instance ) ,
374
- virtualMethodIndexData ,
374
+ VirtualMethodIndexData . From ( virtualMethodIndexData ) ,
375
375
exceptionMarshallingInfo ,
376
376
ComInterfaceGeneratorHelpers . CreateGeneratorFactory ( environment , MarshalDirection . ManagedToUnmanaged ) ,
377
377
ComInterfaceGeneratorHelpers . CreateGeneratorFactory ( environment , MarshalDirection . UnmanagedToManaged ) ,
@@ -380,7 +380,7 @@ private static IncrementalStubGenerationContext CalculateStubInformation(MethodD
380
380
new SequenceEqualImmutableArray < Diagnostic > ( generatorDiagnostics . Diagnostics . ToImmutableArray ( ) ) ) ;
381
381
}
382
382
383
- private static MarshallingInfo CreateExceptionMarshallingInfo ( AttributeData virtualMethodIndexAttr , ISymbol symbol , Compilation compilation , GeneratorDiagnostics diagnostics , VirtualMethodIndexData virtualMethodIndexData )
383
+ private static MarshallingInfo CreateExceptionMarshallingInfo ( AttributeData virtualMethodIndexAttr , ISymbol symbol , Compilation compilation , GeneratorDiagnostics diagnostics , VirtualMethodIndexCompilationData virtualMethodIndexData )
384
384
{
385
385
if ( virtualMethodIndexData . ExceptionMarshallingDefined )
386
386
{
0 commit comments