示例#1
0
        TypeResolver GetTypeResolver(ITypeDefOrRef typeRef)
        {
            if (typeRef == null)
            {
                return(null);
            }
            var scopeType = typeRef.ScopeType;
            var key       = scopeType.Namespace + "." + scopeType.TypeName;

            if (!types.TryGetValue(key, out var list))
            {
                return(null);
            }

            if (scopeType is TypeDef)
            {
                foreach (var resolver in list)
                {
                    if (resolver.type.MetadataToken == scopeType.MDToken.Raw)
                    {
                        return(resolver);
                    }
                }
            }

            foreach (var resolver in list)
            {
                if (ResolverUtils.CompareTypes(resolver.type, scopeType))
                {
                    return(resolver);
                }
            }

            return(null);
        }