internal sealed override bool GetUnificationUseSiteDiagnosticRecursive( ref DiagnosticInfo result, Symbol owner, ref HashSet <TypeSymbol> checkedTypes ) { if ( ConstructedFrom.GetUnificationUseSiteDiagnosticRecursive( ref result, owner, ref checkedTypes ) || GetUnificationUseSiteDiagnosticRecursive( ref result, _typeArgumentsWithAnnotations, owner, ref checkedTypes ) ) { return(true); } var typeArguments = this.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics; foreach (var typeArg in typeArguments) { if ( GetUnificationUseSiteDiagnosticRecursive( ref result, typeArg.CustomModifiers, owner, ref checkedTypes ) ) { return(true); } } return(false); }
internal sealed override bool GetUnificationUseSiteDiagnosticRecursive(ref DiagnosticInfo result, Symbol owner, ref HashSet <TypeSymbol> checkedTypes) { if (ConstructedFrom.GetUnificationUseSiteDiagnosticRecursive(ref result, owner, ref checkedTypes) || GetUnificationUseSiteDiagnosticRecursive(ref result, _typeArguments, owner, ref checkedTypes)) { return(true); } if (_hasTypeArgumentsCustomModifiers) { foreach (var modifiers in this.TypeArgumentsCustomModifiers) { if (GetUnificationUseSiteDiagnosticRecursive(ref result, modifiers, owner, ref checkedTypes)) { return(true); } } } return(false); }
public static (AttributeData?attribute, INamedTypeSymbol?marshallerType) GetDefaultMarshallerInfo(ITypeSymbol managedType) { AttributeData?attr = managedType.GetAttributes().FirstOrDefault(attr => attr.AttributeClass.ToDisplayString() == TypeNames.NativeMarshallingAttribute); if (attr is null) { return(attr, null); } INamedTypeSymbol?marshallerType = null; if (attr.ConstructorArguments.Length == 0) { return(attr, null); } marshallerType = attr.ConstructorArguments[0].Value as INamedTypeSymbol; if (managedType is not INamedTypeSymbol namedType || marshallerType is null) { return(attr, null); } if (namedType.TypeArguments.Length == 0) { return(attr, marshallerType); } else if (marshallerType.TypeArguments.Length != namedType.TypeArguments.Length) { return(attr, null); } else if (marshallerType.IsGenericType) { // Construct the marshaler type around the same type arguments as the managed type. return(attr, marshallerType.ConstructedFrom.Construct(namedType.TypeArguments, namedType.TypeArgumentNullableAnnotations)); } return(attr, marshallerType); }
internal sealed override bool GetUnificationUseSiteDiagnosticRecursive(ref DiagnosticInfo result, Symbol owner, ref HashSet <TypeSymbol> checkedTypes) { return(ConstructedFrom.GetUnificationUseSiteDiagnosticRecursive(ref result, owner, ref checkedTypes) || GetUnificationUseSiteDiagnosticRecursive(ref result, typeArguments, owner, ref checkedTypes)); }