private static IMethodSymbol Resolve( SymbolKeyReader reader, bool isPartialMethodImplementationPart, IMethodSymbol method) { var originalParameterTypeResolutions = reader.ReadSymbolKeyArray(); var returnType = GetFirstSymbol <ITypeSymbol>(reader.ReadSymbolKey()); var originalParameterTypes = originalParameterTypeResolutions.Select( r => GetFirstSymbol <ITypeSymbol>(r)).ToArray(); if (!originalParameterTypes.Any(s_typeIsNull)) { if (reader.ParameterTypesMatch(method.OriginalDefinition.Parameters, originalParameterTypes)) { if (returnType == null || reader.Comparer.Equals(returnType, method.ReturnType)) { if (isPartialMethodImplementationPart) { method = method.PartialImplementationPart ?? method; } Debug.Assert(method != null); return(method); } } } return(null); }
public static SymbolKeyResolution Resolve(SymbolKeyReader reader) { var metadataName = reader.ReadString(); var containingSymbolResolution = reader.ReadSymbolKey(); var isIndexer = reader.ReadBoolean(); var refKinds = reader.ReadRefKindArray(); var originalParameterTypes = reader.ReadSymbolKeyArray().Select( r => GetFirstSymbol <ITypeSymbol>(r)).ToArray(); if (originalParameterTypes.Any(s_typeIsNull)) { return(default(SymbolKeyResolution)); } var properties = containingSymbolResolution.GetAllSymbols().OfType <INamedTypeSymbol>() .SelectMany(t => t.GetMembers()) .OfType <IPropertySymbol>() .Where(p => p.Parameters.Length == refKinds.Length && p.MetadataName == metadataName && p.IsIndexer == isIndexer); var matchingProperties = properties.Where(p => ParameterRefKindsMatch(p.OriginalDefinition.Parameters, refKinds) && reader.ParameterTypesMatch(p.OriginalDefinition.Parameters, originalParameterTypes)); return(CreateSymbolInfo(matchingProperties)); }