More tweaks for nullable binary operation
[mono.git] / mcs / mcs / doc.cs
index 8b8dfeecc8b370a395d21887919c7685440ce554..8d7afc74a6ebcc125a85053aeea26acbca0d8638 100644 (file)
@@ -271,7 +271,7 @@ namespace Mono.CSharp {
                        }
                        TypeSpec t = FindDocumentedTypeNonArray (mc, identifier, ds, cref, r);
                        if (t != null && is_array)
-                               t = Import.ImportType (Array.CreateInstance (t.GetMetaInfo (), 0).GetType ());
+                               t = ArrayContainer.MakeType (t);
                        return t;
                }
 
@@ -321,6 +321,17 @@ namespace Mono.CSharp {
                        int index = identifier.LastIndexOf ('.');
                        if (index < 0)
                                return null;
+
+                       var nsName = identifier.Substring (0, index);
+                       var typeName = identifier.Substring (index + 1);
+                       Namespace ns = ds.NamespaceEntry.NS.GetNamespace (nsName, false);
+                       ns = ns ?? mc.Compiler.GlobalRootNamespace.GetNamespace(nsName, false);
+                       if (ns != null) {
+                               var te = ns.LookupType(mc.Compiler, typeName, 0, true, mc.Location);
+                               if(te != null)
+                                       return te.Type;
+                       }
+
                        int warn;
                        TypeSpec parent = FindDocumentedType (mc, identifier.Substring (0, index), ds, cref, r);
                        if (parent == null)
@@ -361,10 +372,10 @@ namespace Mono.CSharp {
                        string cref, bool warn419, string name_for_error, Report Report)
                {
                        warning_type = 0;
-                       var filter = new MemberFilter (member_name, 0, MemberKind.All, param_list, null);
+//                     var filter = new MemberFilter (member_name, 0, MemberKind.All, param_list, null);
                        IList<MemberSpec> found = null;
                        while (type != null && found == null) {
-                               found = MemberCache.FindMembers (type, filter, BindingRestriction.None);
+                               found = MemberCache.FindMembers (type, member_name, false);
                                type = type.DeclaringType;
                        }
 
@@ -616,7 +627,7 @@ namespace Mono.CSharp {
                                xref.SetAttribute ("cref", "N:" + ns.GetSignatureForError ());
                                return; // a namespace
                        }
-                       if (GlobalRootNamespace.Instance.IsNamespace (name)) {
+                       if (mc.Compiler.GlobalRootNamespace.IsNamespace (name)) {
                                xref.SetAttribute ("cref", "N:" + name);
                                return; // a namespace
                        }
@@ -720,8 +731,16 @@ namespace Mono.CSharp {
                        if (paramSpec.Length > 0)
                                paramSpec += ")";
 
-                       string name = mc is Constructor ? "#ctor" : mc.Name;
-                       if (mc.MemberName.IsGeneric)
+                       string name = mc.Name;
+                       if (mc is Constructor)
+                               name = "#ctor";
+                       else if (mc is InterfaceMemberBase) {
+                               var imb = (InterfaceMemberBase) mc;
+                               name = imb.GetFullName (imb.ShortName);
+                       }
+                       name = name.Replace ('.', '#');
+
+                       if (mc.MemberName.TypeArguments != null && mc.MemberName.TypeArguments.Count > 0)
                                name += "``" + mc.MemberName.CountTypeArguments;
 
                        string suffix = String.Empty;
@@ -741,10 +760,25 @@ namespace Mono.CSharp {
                {
                        var tp = type as TypeParameterSpec;
                        if (tp != null) {
+                               int c = 0;
+                               type = type.DeclaringType;
+                               while (type != null && type.DeclaringType != null) {
+                                       type = type.DeclaringType;
+                                       c += type.MemberDefinition.TypeParametersCount;
+                               }
                                var prefix = tp.IsMethodOwned ? "``" : "`";
-                               return prefix + tp.DeclaredPosition;
+                               return prefix + (c + tp.DeclaredPosition);
                        }
 
+                       var pp = type as PointerContainer;
+                       if (pp != null)
+                               return GetSignatureForDoc (pp.Element) + "*";
+
+                       ArrayContainer ap = type as ArrayContainer;
+                       if (ap != null)
+                               return GetSignatureForDoc (ap.Element) +
+                                       ArrayContainer.GetPostfixSignature (ap.Rank);
+
                        if (TypeManager.IsGenericType (type)) {
                                string g = type.MemberDefinition.Namespace;
                                if (g != null && g.Length > 0)