|
1 | 1 | // Licensed to the .NET Foundation under one or more agreements.
|
2 | 2 | // The .NET Foundation licenses this file to you under the MIT license.
|
3 | 3 |
|
4 |
| -using System; |
5 | 4 | using System.Collections.Immutable;
|
6 | 5 | using System.Linq;
|
7 | 6 |
|
@@ -195,12 +194,12 @@ public override void Initialize(AnalysisContext context)
|
195 | 194 |
|
196 | 195 | private void PrepareForAnalysis(CompilationStartAnalysisContext context)
|
197 | 196 | {
|
198 |
| - var generatedMarshallingAttribute = context.Compilation.GetTypeByMetadataName(TypeNames.GeneratedMarshallingAttribute); |
199 |
| - var blittableTypeAttribute = context.Compilation.GetTypeByMetadataName(TypeNames.BlittableTypeAttribute); |
200 |
| - var nativeMarshallingAttribute = context.Compilation.GetTypeByMetadataName(TypeNames.NativeMarshallingAttribute); |
201 |
| - var marshalUsingAttribute = context.Compilation.GetTypeByMetadataName(TypeNames.MarshalUsingAttribute); |
202 |
| - var genericContiguousCollectionMarshallerAttribute = context.Compilation.GetTypeByMetadataName(TypeNames.GenericContiguousCollectionMarshallerAttribute); |
203 |
| - var spanOfByte = context.Compilation.GetTypeByMetadataName(TypeNames.System_Span_Metadata)!.Construct(context.Compilation.GetSpecialType(SpecialType.System_Byte)); |
| 197 | + INamedTypeSymbol? generatedMarshallingAttribute = context.Compilation.GetTypeByMetadataName(TypeNames.GeneratedMarshallingAttribute); |
| 198 | + INamedTypeSymbol? blittableTypeAttribute = context.Compilation.GetTypeByMetadataName(TypeNames.BlittableTypeAttribute); |
| 199 | + INamedTypeSymbol? nativeMarshallingAttribute = context.Compilation.GetTypeByMetadataName(TypeNames.NativeMarshallingAttribute); |
| 200 | + INamedTypeSymbol? marshalUsingAttribute = context.Compilation.GetTypeByMetadataName(TypeNames.MarshalUsingAttribute); |
| 201 | + INamedTypeSymbol? genericContiguousCollectionMarshallerAttribute = context.Compilation.GetTypeByMetadataName(TypeNames.GenericContiguousCollectionMarshallerAttribute); |
| 202 | + INamedTypeSymbol? spanOfByte = context.Compilation.GetTypeByMetadataName(TypeNames.System_Span_Metadata)!.Construct(context.Compilation.GetSpecialType(SpecialType.System_Byte)); |
204 | 203 |
|
205 | 204 | if (generatedMarshallingAttribute is not null
|
206 | 205 | && blittableTypeAttribute is not null
|
@@ -256,7 +255,7 @@ public void AnalyzeTypeDefinition(SymbolAnalysisContext context)
|
256 | 255 |
|
257 | 256 | AttributeData? blittableTypeAttributeData = null;
|
258 | 257 | AttributeData? nativeMarshallingAttributeData = null;
|
259 |
| - foreach (var attr in type.GetAttributes()) |
| 258 | + foreach (AttributeData attr in type.GetAttributes()) |
260 | 259 | {
|
261 | 260 | if (SymbolEqualityComparer.Default.Equals(attr.AttributeClass, _generatedMarshallingAttribute))
|
262 | 261 | {
|
@@ -416,7 +415,7 @@ private void AnalyzeNativeMarshalerType(SymbolAnalysisContext context, ITypeSymb
|
416 | 415 |
|
417 | 416 | bool hasConstructor = false;
|
418 | 417 | bool hasStackallocConstructor = false;
|
419 |
| - foreach (var ctor in marshalerType.Constructors) |
| 418 | + foreach (IMethodSymbol ctor in marshalerType.Constructors) |
420 | 419 | {
|
421 | 420 | if (ctor.IsStatic)
|
422 | 421 | {
|
|
0 commit comments