11 instantiations of TypePositionInfo
Microsoft.Interop.ComInterfaceGenerator (4)
ComInterfaceGenerator.cs (1)
329new TypePositionInfo(SpecialTypeInfo.Int32, new ManagedHResultExceptionMarshallingInfo())
VirtualMethodPointerStubGenerator.cs (3)
183elements.Add(new TypePositionInfo(new PointerTypeInfo("void*", "void*", false), methodStub.ManagedThisMarshallingInfo) 205elements.Add(new TypePositionInfo(methodStub.TypeKeyOwner, methodStub.ManagedThisMarshallingInfo) 221new TypePositionInfo(
Microsoft.Interop.SourceGeneration (7)
BoundGenerators.cs (1)
23IBoundMarshallingGenerator defaultBoundGenerator = fallbackGenerator.Bind(new TypePositionInfo(SpecialTypeInfo.Void, NoMarshallingInfo.Instance), context);
Marshalling\AttributedMarshallingModelGeneratorResolver.cs (1)
212var elementInfo = new TypePositionInfo(marshallerData.CollectionElementType, marshallerData.CollectionElementMarshallingInfo)
MarshallingInfoParser.cs (2)
316info = new TypePositionInfo(SpecialTypeInfo.Void, NoMarshallingInfo.Instance); 345info = new TypePositionInfo(SpecialTypeInfo.Void, NoMarshallingInfo.Instance);
MethodSignatureElementInfoProvider.cs (1)
33info = new TypePositionInfo(
SignatureContext.cs (1)
122TypePositionInfo retTypeInfo = new(ManagedTypeInfo.CreateTypeInfoForTypeSymbol(method.ReturnType), marshallingInfoParser.ParseMarshallingInfo(method.ReturnType, method.GetReturnTypeAttributes()));
TypePositionInfo.cs (1)
92var typeInfo = new TypePositionInfo(ManagedTypeInfo.CreateTypeInfoForTypeSymbol(paramSymbol.Type), marshallingInfo)
297 references to TypePositionInfo
Microsoft.Interop.ComInterfaceGenerator (66)
Analyzers\ConvertComImportToGeneratedComInterfaceAnalyzer.cs (4)
172private static bool HasUnsupportedMarshalAsInfo(TypePositionInfo info) 188private readonly Func<TypePositionInfo, StubCodeContext, ResolvedGenerator> _func; 190public CallbackGeneratorResolver(Func<TypePositionInfo, StubCodeContext, ResolvedGenerator> func) 195public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) => _func(info, context);
ComInterfaceGenerator.cs (6)
291ImmutableArray<TypePositionInfo> returnSwappedSignatureElements = signatureContext.ElementTypeInformation; 312var managedSignatureAsNativeOut = returnSwappedSignatureElements[i] with 315ManagedIndex = TypePositionInfo.ReturnIndex, 331NativeIndex = TypePositionInfo.ReturnIndex 340TypePositionInfo? managedReturnInfo = signatureContext.ElementTypeInformation.FirstOrDefault(e => e.IsManagedReturnPosition); 356foreach (TypePositionInfo parameter in signatureContext.ManagedParameters)
ComMethodContext.cs (1)
147static ArgumentSyntax GenerateArgument(TypePositionInfo info)
Marshallers\ComInterfaceDispatchMarshallingResolver.cs (7)
19public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) 35public ManagedTypeInfo AsNativeType(TypePositionInfo info) => 40public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 65public SignatureBehavior GetNativeSignatureBehavior(TypePositionInfo info) => SignatureBehavior.NativeType; 66public ValueBoundaryBehavior GetValueBoundaryBehavior(TypePositionInfo info, StubCodeContext context) => ValueBoundaryBehavior.NativeIdentifier; 67public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, out GeneratorDiagnostic? diagnostic) 69public bool UsesNativeIdentifier(TypePositionInfo info, StubCodeContext context) => true;
Marshallers\KeepAliveThisMarshaller.cs (6)
17public ManagedTypeInfo AsNativeType(TypePositionInfo info) => info.ManagedType; 18public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 33public SignatureBehavior GetNativeSignatureBehavior(TypePositionInfo info) => SignatureBehavior.NativeType; 34public ValueBoundaryBehavior GetValueBoundaryBehavior(TypePositionInfo info, StubCodeContext context) => ValueBoundaryBehavior.ManagedIdentifier; 35public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, out GeneratorDiagnostic? diagnostic) 38public bool UsesNativeIdentifier(TypePositionInfo info, StubCodeContext context) => false;
Marshallers\ManagedHResultExceptionGeneratorResolver.cs (13)
18public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) 37public ManagedTypeInfo AsNativeType(TypePositionInfo info) => info.ManagedType; 38public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 56public SignatureBehavior GetNativeSignatureBehavior(TypePositionInfo info) => SignatureBehavior.NativeType; 57public ValueBoundaryBehavior GetValueBoundaryBehavior(TypePositionInfo info, StubCodeContext context) => ValueBoundaryBehavior.ManagedIdentifier; 58public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, out GeneratorDiagnostic? diagnostic) 60public bool UsesNativeIdentifier(TypePositionInfo info, StubCodeContext context) => false; 65public ManagedTypeInfo AsNativeType(TypePositionInfo info) => info.ManagedType; 66public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 93public SignatureBehavior GetNativeSignatureBehavior(TypePositionInfo info) => SignatureBehavior.NativeType; 94public ValueBoundaryBehavior GetValueBoundaryBehavior(TypePositionInfo info, StubCodeContext context) => ValueBoundaryBehavior.ManagedIdentifier; 95public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, out GeneratorDiagnostic? diagnostic) 97public bool UsesNativeIdentifier(TypePositionInfo info, StubCodeContext context) => false;
Marshallers\ObjectUnwrapperResolver.cs (7)
17public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) 33public ManagedTypeInfo AsNativeType(TypePositionInfo info) => new PointerTypeInfo("void*", "void*", false); 34public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 60public SignatureBehavior GetNativeSignatureBehavior(TypePositionInfo info) => SignatureBehavior.NativeType; 61public ValueBoundaryBehavior GetValueBoundaryBehavior(TypePositionInfo info, StubCodeContext context) => ValueBoundaryBehavior.NativeIdentifier; 62public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, out GeneratorDiagnostic? diagnostic) 64public bool UsesNativeIdentifier(TypePositionInfo info, StubCodeContext context) => true;
Marshallers\StructAsHResultMarshallerFactory.cs (7)
17public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) 30public ManagedTypeInfo AsNativeType(TypePositionInfo info) => SpecialTypeInfo.Int32; 32public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 79public SignatureBehavior GetNativeSignatureBehavior(TypePositionInfo info) 84public ValueBoundaryBehavior GetValueBoundaryBehavior(TypePositionInfo info, StubCodeContext context) 94public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, out GeneratorDiagnostic? diagnostic) 97public bool UsesNativeIdentifier(TypePositionInfo info, StubCodeContext context) => true;
UnmanagedToManagedStubGenerator.cs (1)
23ImmutableArray<TypePositionInfo> argTypes,
VirtualMethodPointerStubGenerator.cs (14)
29ImmutableArray<TypePositionInfo> elements = methodStub.SignatureContext.ElementTypeInformation; 136ImmutableArray<TypePositionInfo> elements = AddUnmanagedToManagedImplicitElementInfos(methodStub); 177private static ImmutableArray<TypePositionInfo> AddManagedToUnmanagedImplicitThis(IncrementalMethodStubGenerationContext methodStub) 179ImmutableArray<TypePositionInfo> originalElements = methodStub.SignatureContext.ElementTypeInformation; 181var elements = ImmutableArray.CreateBuilder<TypePositionInfo>(originalElements.Length + 2); 188foreach (TypePositionInfo element in originalElements) 192NativeIndex = TypePositionInfo.IncrementIndex(element.NativeIndex) 199private static ImmutableArray<TypePositionInfo> AddUnmanagedToManagedImplicitElementInfos(IncrementalMethodStubGenerationContext methodStub) 201ImmutableArray<TypePositionInfo> originalElements = methodStub.SignatureContext.ElementTypeInformation; 203var elements = ImmutableArray.CreateBuilder<TypePositionInfo>(originalElements.Length + 2); 210foreach (TypePositionInfo element in originalElements) 214NativeIndex = TypePositionInfo.IncrementIndex(element.NativeIndex) 226ManagedIndex = TypePositionInfo.ExceptionIndex, 227NativeIndex = TypePositionInfo.ReturnIndex
Microsoft.Interop.JavaScript.JSImportGenerator (21)
JSExportCodeGenerator.cs (1)
24ImmutableArray<TypePositionInfo> argTypes,
JSGeneratorFactory.cs (3)
16public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) 36bool isToJs = info.ManagedIndex != TypePositionInfo.ReturnIndex ^ context.Direction == MarshalDirection.UnmanagedToManaged; 96internal static ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context, bool isToJs, KnownManagedType marshaledType, KnownManagedType[] argumentTypes, JSTypeFlags jsType, JSTypeFlags[] jsTypeArguments, Func<string, ResolvedGenerator> failWithReason)
JSImportCodeGenerator.cs (1)
31ImmutableArray<TypePositionInfo> argTypes,
JSSignatureContext.cs (1)
53foreach (var param in sigContext.ElementTypeInformation)
Marshaling\ArrayJSGenerator.cs (1)
16public ArrayJSGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType elementMarshalerType)
Marshaling\ArraySegmentJSGenerator.cs (1)
15public ArraySegmentJSGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType elementMarshalerType)
Marshaling\BaseJSGenerator.cs (1)
24public TypePositionInfo TypeInfo => _inner.TypeInfo;
Marshaling\EmptyJSGenerator.cs (6)
12public ManagedTypeInfo AsNativeType(TypePositionInfo info) => info.ManagedType; 13public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext identifierContext) => Array.Empty<StatementSyntax>(); 14public SignatureBehavior GetNativeSignatureBehavior(TypePositionInfo info) => SignatureBehavior.ManagedTypeAndAttributes; 15public ValueBoundaryBehavior GetValueBoundaryBehavior(TypePositionInfo info, StubCodeContext context) => ValueBoundaryBehavior.ManagedIdentifier; 16public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, out GeneratorDiagnostic? diagnostic) 18public bool UsesNativeIdentifier(TypePositionInfo info, StubCodeContext context) => false;
Marshaling\FuncJSGenerator.cs (1)
19public FuncJSGenerator(TypePositionInfo info, StubCodeContext context, bool isAction, MarshalerType[] argumentMarshalerTypes)
Marshaling\NullableJSGenerator.cs (1)
13public NullableJSGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType resultMarshalerType)
Marshaling\PrimitiveJSGenerator.cs (1)
19public PrimitiveJSGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType marshalerType)
Marshaling\SpanJSGenerator.cs (1)
15public SpanJSGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType elementMarshalerType)
Marshaling\TaskJSGenerator.cs (1)
16public TaskJSGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType resultMarshalerType)
Marshaling\VoidGenerator.cs (1)
8internal sealed class VoidGenerator(TypePositionInfo info, StubCodeContext context, MarshalerType marshalerType) : BaseJSGenerator(marshalerType, new Forwarder().Bind(info, context));
Microsoft.Interop.LibraryImportGenerator (4)
Analyzers\ConvertToLibraryImportAnalyzer.cs (3)
201private static bool HasUnsupportedMarshalAsInfo(TypePositionInfo info) 230private sealed class CallbackGeneratorResolver(Func<TypePositionInfo, StubCodeContext, ResolvedGenerator> func) : IMarshallingGeneratorResolver 232public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) => func(info, context);
ForwarderResolver.cs (1)
14public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) => ResolvedGenerator.Resolved(s_forwarder.Bind(info, context));
Microsoft.Interop.LibraryImportGenerator.Downlevel (1)
ForwarderResolver.cs (1)
14public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) => ResolvedGenerator.Resolved(s_forwarder.Bind(info, context));
Microsoft.Interop.SourceGeneration (205)
BoundGenerators.cs (11)
21public static BoundGenerators Create(ImmutableArray<TypePositionInfo> elementTypeInfo, IMarshallingGeneratorResolver generatorResolver, StubCodeContext context, IUnboundMarshallingGenerator fallbackGenerator, out ImmutableArray<GeneratorDiagnostic> generatorBindingDiagnostics) 33TypePositionInfo? managedExceptionInfo = null; 35foreach (TypePositionInfo argType in elementTypeInfo) 59if (!TypePositionInfo.IsSpecialIndex(argType.ManagedIndex)) 63if (!TypePositionInfo.IsSpecialIndex(argType.NativeIndex)) 130static IEnumerable<(bool IsManagedIndex, int Index)> GetInfoDependencies(TypePositionInfo info) 133if (info.ManagedIndex == TypePositionInfo.UnsetIndex) 141static (bool IsManagedIndex, int Index) GetInfoIndex(TypePositionInfo info) 147if (info.ManagedIndex != TypePositionInfo.UnsetIndex) 154IBoundMarshallingGenerator CreateGenerator(TypePositionInfo p, IMarshallingGeneratorResolver factory) 204public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context)
DefaultIdentifierContext.cs (1)
26public override (string managed, string native) GetIdentifiers(TypePositionInfo info)
GeneratorDiagnosticsBag.cs (1)
29/// <param name="locations">A provider of locations for diagnostics on <see cref="TypePositionInfo"/>s.</param>
LinearCollectionElementIdentifierContext.cs (4)
12private readonly TypePositionInfo _elementInfo; 29TypePositionInfo elementInfo, 46public override (string managed, string native) GetIdentifiers(TypePositionInfo info) 63public override string GetAdditionalIdentifier(TypePositionInfo info, string name)
ManagedToNativeStubGenerator.cs (2)
51ImmutableArray<TypePositionInfo> argTypes, 96public string GetNativeIdentifier(TypePositionInfo info)
MarshalAsParser.cs (1)
143if (!elementInfoProvider.TryGetInfoForParamIndex(attributeData, (short)sizeParamIndexArg.Value!, marshallingInfoCallback, out TypePositionInfo paramIndexInfo))
Marshalling\AttributedMarshallingModelGeneratorResolver.cs (11)
43public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) 65private GeneratorDiagnostic.NotSupported? ValidateCountInfo(TypePositionInfo info, CountInfo count, StubCodeContext context, out bool countInfoRequiresCast) 72SizeAndParamIndexInfo(_, TypePositionInfo param) => ValidateNumElementsExpression(param, out countInfoRequiresCast), 73CountElementCountInfo(TypePositionInfo elementInfo) => ValidateNumElementsExpression(elementInfo, out countInfoRequiresCast), 80GeneratorDiagnostic.NotSupported? ValidateNumElementsExpression(TypePositionInfo paramInfo, out bool requiresCast) 131private CustomTypeMarshallerData GetMarshallerDataForTypePositionInfo(CustomTypeMarshallers marshallers, TypePositionInfo info, StubCodeContext context) 144private ResolvedGenerator CreateCustomNativeTypeMarshaller(TypePositionInfo info, StubCodeContext context, NativeMarshallingAttributeInfo marshalInfo) 207TypePositionInfo info, 212var elementInfo = new TypePositionInfo(marshallerData.CollectionElementType, marshallerData.CollectionElementMarshallingInfo) 366private static FreeStrategy GetFreeStrategy(TypePositionInfo info, StubCodeContext context) 417private GeneratorDiagnostic.NotSupported? ValidateCustomNativeTypeMarshallingSupported(TypePositionInfo info, StubCodeContext context, NativeMarshallingAttributeInfo marshalInfo)
Marshalling\BlittableMarshaller.cs (6)
14public ManagedTypeInfo AsNativeType(TypePositionInfo info) 19public SignatureBehavior GetNativeSignatureBehavior(TypePositionInfo info) 24public ValueBoundaryBehavior GetValueBoundaryBehavior(TypePositionInfo info, StubCodeContext context) 37public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 97public bool UsesNativeIdentifier(TypePositionInfo info, StubCodeContext context) 102public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, out GeneratorDiagnostic? diagnostic)
Marshalling\BlittableMarshallerResolver.cs (2)
12/// Resolves a <see cref="TypePositionInfo"/> with <see cref="UnmanagedBlittableMarshallingInfo"/> based on the target compilation's 23public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context)
Marshalling\BoolMarshaller.cs (6)
29public ManagedTypeInfo AsNativeType(TypePositionInfo info) 35public SignatureBehavior GetNativeSignatureBehavior(TypePositionInfo info) 40public ValueBoundaryBehavior GetValueBoundaryBehavior(TypePositionInfo info, StubCodeContext context) 50public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 98public bool UsesNativeIdentifier(TypePositionInfo info, StubCodeContext context) => true; 100public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, out GeneratorDiagnostic? diagnostic)
Marshalling\BreakingChangeDetector.cs (1)
17public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context)
Marshalling\ByValueContentsMarshalKindValidator.cs (3)
9/// An <see cref="IMarshallingGeneratorResolver"/> implementation that wraps an inner <see cref="IMarshallingGeneratorResolver"/> instance and validates that the <see cref="TypePositionInfo.ByValueContentsMarshalKind"/> on the provided <see cref="TypePositionInfo"/> is valid in the current marshalling scenario. 22public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context)
Marshalling\ByValueMarshalKindSupportDescriptor.cs (4)
12public ByValueMarshalKindSupport GetSupport(TypePositionInfo info, out GeneratorDiagnostic? diagnostic) 42/// Provides an implementation of <see cref="IUnboundMarshallingGenerator.SupportsByValueMarshalKind(ByValueContentsMarshalKind, TypePositionInfo, out GeneratorDiagnostic?)"/> through <see cref="GetSupport(ByValueContentsMarshalKind, TypePositionInfo, out GeneratorDiagnostic?)"/> 71public ByValueMarshalKindSupport GetSupport(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, out GeneratorDiagnostic? diagnostic)
Marshalling\CharMarshaller.cs (7)
18public ValueBoundaryBehavior GetValueBoundaryBehavior(TypePositionInfo info, StubCodeContext context) 36public ManagedTypeInfo AsNativeType(TypePositionInfo info) 42public SignatureBehavior GetNativeSignatureBehavior(TypePositionInfo info) 47public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 123public bool UsesNativeIdentifier(TypePositionInfo info, StubCodeContext context) 129private static bool IsPinningPathSupported(TypePositionInfo info, StubCodeContext context) 137public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, out GeneratorDiagnostic? diagnostic)
Marshalling\CharMarshallingGeneratorResolver.cs (2)
24public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) 34private ResolvedGenerator CreateCharMarshaller(TypePositionInfo info, StubCodeContext context)
Marshalling\CompositeMarshallingGeneratorResolver.cs (1)
26public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context)
Marshalling\CustomTypeMarshallingGenerator.cs (1)
22public TypePositionInfo TypeInfo => nativeTypeMarshaller.TypeInfo;
Marshalling\DelegateMarshaller.cs (6)
15public ManagedTypeInfo AsNativeType(TypePositionInfo info) 20public SignatureBehavior GetNativeSignatureBehavior(TypePositionInfo info) 25public ValueBoundaryBehavior GetValueBoundaryBehavior(TypePositionInfo info, StubCodeContext context) 30public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 93public bool UsesNativeIdentifier(TypePositionInfo info, StubCodeContext context) => true; 95public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, out GeneratorDiagnostic? diagnostic)
Marshalling\ElementsMarshalling.cs (7)
18TypePositionInfo TypeInfo { get; } 68SizeAndParamIndexInfo(SizeAndParamIndexInfo.UnspecifiedConstSize, TypePositionInfo param) => GetExpressionForParam(param), 69SizeAndParamIndexInfo(int size, TypePositionInfo param) => CheckedExpression(SyntaxKind.CheckedExpression, 73CountElementCountInfo(TypePositionInfo elementInfo) => GetExpressionForParam(elementInfo), 96ExpressionSyntax GetExpressionForParam(TypePositionInfo paramInfo) 113public static StatementSyntax GetNumElementsAssignmentFromManagedValuesSource(this IElementsMarshallingCollectionSource source, TypePositionInfo info, StubIdentifierContext context) 127public static StatementSyntax GetNumElementsAssignmentFromManagedValuesDestination(this IElementsMarshallingCollectionSource source, TypePositionInfo info, StubIdentifierContext context)
Marshalling\Forwarder.cs (6)
12public ManagedTypeInfo AsNativeType(TypePositionInfo info) 17public SignatureBehavior GetNativeSignatureBehavior(TypePositionInfo info) 22public ValueBoundaryBehavior GetValueBoundaryBehavior(TypePositionInfo info, StubCodeContext context) 27public IEnumerable<StatementSyntax> Generate(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 32public bool UsesNativeIdentifier(TypePositionInfo info, StubCodeContext context) => false; 34public ByValueMarshalKindSupport SupportsByValueMarshalKind(ByValueContentsMarshalKind marshalKind, TypePositionInfo info, out GeneratorDiagnostic? diagnostic)
Marshalling\GeneratorDiagnostic.cs (5)
13private GeneratorDiagnostic(TypePositionInfo typePositionInfo, bool isFatal) 23public TypePositionInfo TypePositionInfo { get; } 28public sealed record NotSupported(TypePositionInfo TypePositionInfo) : GeneratorDiagnostic(TypePositionInfo, isFatal: true) 45public sealed record UnnecessaryData(TypePositionInfo TypePositionInfo, ImmutableArray<Location> UnnecessaryDataLocations) : GeneratorDiagnostic(TypePositionInfo, isFatal: false) 64public sealed record NotRecommended(TypePositionInfo TypePositionInfo) : GeneratorDiagnostic(TypePositionInfo, isFatal: false)
Marshalling\GenericFriendlyPointerIdentifierContext.cs (4)
14private readonly TypePositionInfo _adaptedInfo; 17public GenericFriendlyPointerIdentifierContext(StubIdentifierContext inner, TypePositionInfo adaptedInfo, string baseIdentifier) 25public override (string managed, string native) GetIdentifiers(TypePositionInfo info) 36public override string GetAdditionalIdentifier(TypePositionInfo info, string name) => _innerContext.GetAdditionalIdentifier(info, name);
Marshalling\ICustomTypeMarshallingStrategy.cs (1)
14TypePositionInfo TypeInfo { get; }
Marshalling\IMarshallingGeneratorResolver.cs (1)
17TypePositionInfo info,
Marshalling\MarshalAsMarshallingGeneratorResolver.cs (1)
35TypePositionInfo info,
Marshalling\MarshallerHelpers.cs (28)
64public static string GetMarshallerIdentifier(TypePositionInfo info, StubIdentifierContext context) 69public static string GetManagedSpanIdentifier(TypePositionInfo info, StubIdentifierContext context) 74public static string GetNativeSpanIdentifier(TypePositionInfo info, StubIdentifierContext context) 79public static string GetNumElementsIdentifier(TypePositionInfo info, StubIdentifierContext context) 84public static string GetLastIndexMarshalledIdentifier(TypePositionInfo info, StubIdentifierContext context) 94public static ExpressionSyntax GetIndexedManagedElementExpression(TypePositionInfo info, StubCodeContext codeContext, StubIdentifierContext context) 105internal static bool CanUseCallerAllocatedBuffer(TypePositionInfo info, StubCodeContext context) 232public static IEnumerable<TypePositionInfo> GetDependentElementsOfMarshallingInfo( 237if (nestedCollection.ElementCountInfo is CountElementCountInfo { ElementInfo: TypePositionInfo nestedCountElement }) 241if (nestedCountElement.ManagedIndex != TypePositionInfo.UnsetIndex || nestedCountElement.NativeIndex != TypePositionInfo.UnsetIndex) 248foreach (TypePositionInfo nestedElement in GetDependentElementsOfMarshallingInfo(mode.Value.CollectionElementMarshallingInfo)) 250if (nestedElement.ManagedIndex != TypePositionInfo.UnsetIndex || nestedElement.NativeIndex != TypePositionInfo.UnsetIndex) 260public static StatementSyntax SkipInitOrDefaultInit(TypePositionInfo info, StubIdentifierContext context) 282public static StatementSyntax DefaultInit(TypePositionInfo info, StubIdentifierContext context) 291/// Get the marshalling direction for a given <see cref="TypePositionInfo"/> in a given <see cref="StubCodeContext"/>. 298public static MarshalDirection GetMarshalDirection(TypePositionInfo info, StubCodeContext context) 353public static StubIdentifierContext.Stage GetCleanupStage(TypePositionInfo info, StubCodeContext context) 375public static void ValidateCountInfoAvailableAtCall(MarshalDirection stubDirection, TypePositionInfo info, GeneratorDiagnosticsBag generatorDiagnostics, IMethodSymbol symbol, DiagnosticDescriptor outParamDescriptor, DiagnosticDescriptor returnValueDescriptor) 383|| info.ManagedIndex is TypePositionInfo.ReturnIndex) 389Location location = TypePositionInfo.GetLocation(info, symbol); 397else if (countInfo.ElementInfo.ManagedIndex is TypePositionInfo.ReturnIndex) 399Location location = TypePositionInfo.GetLocation(info, symbol); 410public static SyntaxTokenList GetManagedParameterModifiers(TypePositionInfo typeInfo) 453public static SyntaxToken GetManagedArgumentRefKindKeyword(TypePositionInfo typeInfo) 471public static bool IsInStubReturnPosition(TypePositionInfo info, MarshalDirection direction) 486public static bool IsInInvocationReturnPosition(TypePositionInfo info, MarshalDirection direction)
Marshalling\MarshallingGenerator.cs (11)
11/// An enumeration describing how a <see cref="TypePositionInfo"/> should be represented in its corresponding native signature element (parameter, field, or return value). 21/// The native signature should be the type returned by <see cref="IUnboundMarshallingGenerator.AsNativeType(TypePositionInfo)"/> passed by value. 26/// The native signature should be a pointer to the type returned by <see cref="IUnboundMarshallingGenerator.AsNativeType(TypePositionInfo)"/> passed by value. 32/// An enumeration describing how a <see cref="TypePositionInfo"/> should be represented in its corresponding native signature element (parameter, field, or return value). 42/// The native identifier provided by <see cref="StubIdentifierContext.GetIdentifiers(TypePositionInfo)"/> should be passed by value. 47/// The address of the native identifier provided by <see cref="StubIdentifierContext.GetIdentifiers(TypePositionInfo)"/> should be passed by value. 52/// The native identifier provided by <see cref="StubIdentifierContext.GetIdentifiers(TypePositionInfo)"/> should be cast to the native type. 88TypePositionInfo TypeInfo { get; } 152/// A bound generator that binds an <see cref="IUnboundMarshallingGenerator"/> to a specific <see cref="TypePositionInfo"/>. 156internal sealed class BoundMarshallingGenerator(TypePositionInfo info, StubCodeContext context, IUnboundMarshallingGenerator unbound) : IBoundMarshallingGenerator 162public TypePositionInfo TypeInfo => info;
Marshalling\MarshallingGeneratorExtensions.cs (4)
104private static ParameterSyntax GenerateForwardingParameter(TypePositionInfo info, string identifier) 141TypePositionInfo info = generator.TypeInfo; 156TypePositionInfo info = generator.TypeInfo; 167TypePositionInfo info = generator.TypeInfo;
Marshalling\NoMarshallingInfoErrorResolver.cs (1)
15TypePositionInfo info,
Marshalling\NotSupportedResolver.cs (1)
8public ResolvedGenerator Create(TypePositionInfo info, StubCodeContext context) =>
Marshalling\ResolvedGenerator.cs (1)
25public static ResolvedGenerator NotSupported(TypePositionInfo info, StubCodeContext context, GeneratorDiagnostic.NotSupported notSupportedDiagnostic)
Marshalling\StatefulMarshallingStrategy.cs (3)
13internal sealed class StatefulValueMarshalling(TypePositionInfo info, StubCodeContext stubContext, ManagedTypeInfo marshallerType, ManagedTypeInfo unmanagedType, MarshallerShape shape) : ICustomTypeMarshallingStrategy 21public TypePositionInfo TypeInfo => info; 175public static string GetMarshallerIdentifier(TypePositionInfo info, StubIdentifierContext context)
Marshalling\StatelessMarshallingStrategy.cs (2)
17internal sealed class StatelessValueMarshalling(TypePositionInfo info, StubCodeContext codeContext, TypeSyntax marshallerTypeSyntax, ManagedTypeInfo unmanagedType, MarshallerShape shape) : ICustomTypeMarshallingStrategy 23public TypePositionInfo TypeInfo => info;
Marshalling\StaticPinnableManagedValueMarshaller.cs (1)
15public TypePositionInfo TypeInfo => innerMarshallingGenerator.TypeInfo;
Marshalling\UnmanagedToManagedOwnershipTrackingStrategy.cs (2)
14/// Marshalling strategy that introduces a variable to hold the initial value of the provided <see cref="TypePositionInfo"/> and a variable to track if the original value has been replaced. 23public TypePositionInfo TypeInfo => innerMarshaller.TypeInfo;
MarshallingAttributeInfo.cs (3)
90public sealed record CountElementCountInfo(TypePositionInfo ElementInfo) : CountInfo 95public sealed record SizeAndParamIndexInfo(int ConstSize, TypePositionInfo? ParamAtIndex) : CountInfo 99public const TypePositionInfo UnspecifiedParam = null;
MarshallingInfoParser.cs (22)
109/// Get a <see cref="TypePositionInfo"/> instance for the given element name. 112/// <param name="elementName">The element name to retrieve a <see cref="TypePositionInfo"/> instance for.</param> 113/// <param name="marshallingInfoCallback">A callback to retrieve marshalling info to put into the <see cref="TypePositionInfo"/>.</param> 116/// <returns><c>true</c> if a <see cref="TypePositionInfo"/> instance could be created for the type; otherwise <c>false</c></returns> 117bool TryGetInfoForElementName(AttributeData attrData, string elementName, GetMarshallingInfoCallback marshallingInfoCallback, IElementInfoProvider rootProvider, out TypePositionInfo info); 119/// Get a <see cref="TypePositionInfo"/> instance for the given element index. 122/// <param name="paramIndex">The element index to retrieve a <see cref="TypePositionInfo"/> instance for.</param> 123/// <param name="marshallingInfoCallback">A callback to retrieve marshalling info to put into the <see cref="TypePositionInfo"/>.</param> 126/// <returns><c>true</c> if a <see cref="TypePositionInfo"/> instance could be created for the type; otherwise <c>false</c></returns> 127bool TryGetInfoForParamIndex(AttributeData attrData, int paramIndex, GetMarshallingInfoCallback marshallingInfoCallback, IElementInfoProvider rootProvider, out TypePositionInfo info); 136/// Get a <see cref="TypePositionInfo"/> instance for the given element name. 139/// <param name="elementName">The element name to retrieve a <see cref="TypePositionInfo"/> instance for.</param> 140/// <param name="marshallingInfoCallback">A callback to retrieve marshalling info to put into the <see cref="TypePositionInfo"/>.</param> 142/// <returns><c>true</c> if a <see cref="TypePositionInfo"/> instance could be created for the type; otherwise <c>false</c></returns> 143public static bool TryGetInfoForElementName(this IElementInfoProvider provider, AttributeData attrData, string elementName, GetMarshallingInfoCallback marshallingInfoCallback, out TypePositionInfo info) 149/// Get a <see cref="TypePositionInfo"/> instance for the given element index. 152/// <param name="paramIndex">The element index to retrieve a <see cref="TypePositionInfo"/> instance for.</param> 153/// <param name="marshallingInfoCallback">A callback to retrieve marshalling info to put into the <see cref="TypePositionInfo"/>.</param> 155/// <returns><c>true</c> if a <see cref="TypePositionInfo"/> instance could be created for the type; otherwise <c>false</c></returns> 156public static bool TryGetInfoForParamIndex(this IElementInfoProvider provider, AttributeData attrData, int paramIndex, GetMarshallingInfoCallback marshallingInfoCallback, out TypePositionInfo info) 298public bool TryGetInfoForElementName(AttributeData attrData, string elementName, GetMarshallingInfoCallback marshallingInfoCallback, IElementInfoProvider rootProvider, [NotNullWhen(true)] out TypePositionInfo? info) 325public bool TryGetInfoForParamIndex(AttributeData attrData, int paramIndex, GetMarshallingInfoCallback marshallingInfoCallback, IElementInfoProvider rootProvider, [NotNullWhen(true)] out TypePositionInfo? info)
MarshalUsingAttributeParser.cs (1)
103if (!elementInfoProvider.TryGetInfoForElementName(attributeData, elementName, marshallingInfoCallback, out TypePositionInfo elementInfo))
MethodSignatureElementInfoProvider.cs (5)
29public bool TryGetInfoForElementName(AttributeData attrData, string elementName, GetMarshallingInfoCallback marshallingInfoCallback, IElementInfoProvider rootProvider, out TypePositionInfo info) 37ManagedIndex = TypePositionInfo.ReturnIndex 47info = TypePositionInfo.CreateForParameter( 60public bool TryGetInfoForParamIndex(AttributeData attrData, int paramIndex, GetMarshallingInfoCallback marshallingInfoCallback, IElementInfoProvider rootProvider, out TypePositionInfo info) 69info = TypePositionInfo.CreateForParameter(
SignatureContext.cs (15)
30public ImmutableArray<TypePositionInfo> ElementTypeInformation { get; init; } 32public IEnumerable<TypePositionInfo> ManagedParameters => ElementTypeInformation.Where(tpi => !TypePositionInfo.IsSpecialIndex(tpi.ManagedIndex)); 40foreach (TypePositionInfo typeInfo in ElementTypeInformation) 42if (typeInfo.ManagedIndex != TypePositionInfo.UnsetIndex 43&& typeInfo.ManagedIndex != TypePositionInfo.ReturnIndex) 62ImmutableArray<TypePositionInfo> typeInfos = GenerateTypeInformation(method, marshallingInfoParser, env); 101private static ImmutableArray<TypePositionInfo> GenerateTypeInformation( 108ImmutableArray<TypePositionInfo>.Builder typeInfos = ImmutableArray.CreateBuilder<TypePositionInfo>(); 113var typeInfo = TypePositionInfo.CreateForParameter(param, marshallingInfo, env.Compilation); 122TypePositionInfo retTypeInfo = new(ManagedTypeInfo.CreateTypeInfoForTypeSymbol(method.ReturnType), marshallingInfoParser.ParseMarshallingInfo(method.ReturnType, method.GetReturnTypeAttributes())); 125ManagedIndex = TypePositionInfo.ReturnIndex, 126NativeIndex = TypePositionInfo.ReturnIndex,
StubCodeContext.cs (1)
59public bool IsInStubReturnPosition(TypePositionInfo info)
StubIdentifierContext.cs (3)
45/// <see cref="IUnboundMarshallingGenerator.AsArgument(TypePositionInfo)"/> should provide the 103public virtual (string managed, string native) GetIdentifiers(TypePositionInfo info) 114public virtual string GetAdditionalIdentifier(TypePositionInfo info, string name)
TypePositionInfo.cs (4)
83public bool PositionsEqual(TypePositionInfo other) 88public static TypePositionInfo CreateForParameter(IParameterSymbol paramSymbol, MarshallingInfo marshallingInfo, Compilation compilation) 92var typeInfo = new TypePositionInfo(ManagedTypeInfo.CreateTypeInfoForTypeSymbol(paramSymbol.Type), marshallingInfo) 105public static Location GetLocation(TypePositionInfo info, IMethodSymbol methodSymbol)
VariableDeclarations.cs (2)
23TypePositionInfo info = marshaller.TypeInfo; 86TypePositionInfo info = marshaller.TypeInfo;