Example #1
0
 /// <summary>
 /// Make sure that the visibility of the given type definition is high enough to be used in the signature of the given member.
 /// </summary>
 /// <returns>True if type has changed</returns>
 public static bool EnsureVisibility(this NetTypeReference type, INetMemberVisibility member)
 {
     if (type == null)
     {
         return(false);
     }
     return(type.Accept(EnsureVisibilityTypeVisitor.Instance, member));
 }
Example #2
0
 /// <summary>
 /// Make sure that the visibility of the given member is limited by the visibility of the given type is that is in another scope.
 /// </summary>
 /// <returns>True if member has changed</returns>
 public static bool LimitVisibility(this INetMemberVisibility member, NetTypeReference type)
 {
     if (type == null)
     {
         return(false);
     }
     return(type.Accept(LimitVisibilityTypeVisitor.Instance, member));
 }
Example #3
0
 /// <summary>
 /// Resolve all generic parameters in the given type in the given context.
 /// </summary>
 internal static bool TryResolve(NetTypeReference type, INetGenericParameterProvider context, TypeNameMap typeNameMap, out NetTypeReference result)
 {
     result = null;
     if (type == null)
     {
         return(false);
     }
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     result = type.Accept(new Resolver(context, typeNameMap), 0);
     return(result != null);
 }
Example #4
0
        /// <summary>
        /// Create a type reference
        /// </summary>
        private static string CreateRef(NetTypeReference typeRef, bool allowVoid, bool useShortTypeNames, bool useShortNestedTypeNames, bool useGlobalPrefix, NetTypeDefinition context, TargetFramework target)
        {
            if (typeRef == null)
            {
                if (allowVoid)
                {
                    return("void");
                }
                throw new ArgumentNullException("typeRef");
            }
            var result = typeRef.Accept(new CodeTypeReferenceBuilder(context, useShortTypeNames, useShortNestedTypeNames, allowVoid, target.TypeNameMap), true);

            if (context != null)
            {
                switch (result)
                {
                case "global::Android.Widget.AdapterView<object>.IOnItemClickListener":
                    switch (context.FullName)
                    {
                    case "Android.Widget.Spinner":
                        return(result.Replace("<object>", "<global::Android.Widget.ISpinnerAdapter>"));

                    case "Android.Widget.ExpandableListView":
                        return(result.Replace("<object>", "<global::Android.Widget.IListAdapter>"));
                    }
                    break;
                }
            }
            if (useGlobalPrefix)
            {
                if (!result.StartsWith("global::"))
                {
                    result = "global::" + result;
                }
            }
            return(result);
        }