[linker] Find linked away interfaces when resolving removed interfaces. Fixes #3513. (#3515)

The linker might remove interfaces that have already been linked away. Make
sure to look for the TypeDefinition for such interfaces among the types that
have already been linked away.

Fixes https://github.com/xamarin/xamarin-macios/issues/3513.
This commit is contained in:
Rolf Bjarne Kvinge 2018-02-19 11:36:38 +01:00 коммит произвёл GitHub
Родитель 96085adb66
Коммит 6d88e01b5e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -31,7 +31,12 @@ namespace Xamarin.Linker {
// The static registrar needs access to the interfaces for protocols, so keep them around. // The static registrar needs access to the interfaces for protocols, so keep them around.
if (!LinkContext.ProtocolImplementations.TryGetValue (type, out var list)) if (!LinkContext.ProtocolImplementations.TryGetValue (type, out var list))
LinkContext.ProtocolImplementations [type] = list = new List<TypeDefinition> (); LinkContext.ProtocolImplementations [type] = list = new List<TypeDefinition> ();
list.Add (iface.InterfaceType.Resolve ()); var it = iface.InterfaceType.Resolve ();
if (it == null) {
// The interface type might already have been linked away, so go look for it among those types as well
it = LinkContext.GetLinkedAwayType (iface.InterfaceType, out _);
}
list.Add (it);
} }
protected override void ElementRemoved (IMetadataTokenProvider element) protected override void ElementRemoved (IMetadataTokenProvider element)