Author: serras
Date: 2006-06-08 13:22:55 -0400 (Thu, 08 Jun 2006)
New Revision: 61576

Modified:
   trunk/monodevelop/Extras/NemerleBinding/Parser/Parser.cs
   trunk/monodevelop/Extras/NemerleBinding/Parser/SharpDevelopTree/Class.cs
   trunk/monodevelop/Extras/NemerleBinding/Parser/SharpDevelopTree/Method.cs
   trunk/monodevelop/Extras/NemerleBinding/Parser/SharpDevelopTree/Parameter.cs
Log:
Add documentation in Nemerle add-in completion window. Sync with the 
latest Nemerle compiler changes.


Modified: trunk/monodevelop/Extras/NemerleBinding/Parser/Parser.cs
===================================================================
--- trunk/monodevelop/Extras/NemerleBinding/Parser/Parser.cs    2006-06-08 
16:33:28 UTC (rev 61575)
+++ trunk/monodevelop/Extras/NemerleBinding/Parser/Parser.cs    2006-06-08 
17:22:55 UTC (rev 61576)
@@ -268,7 +268,7 @@
                     {   
                         // Recover the text from the start of the method to 
cursor
                         string method_content = Crop (fileContent, line, 
column, caretLineNumber, caretColumn);
-                        NCC.OverloadPossibility[] infox = 
engine.RunCompletionEngine (the_method.Member, method_content);
+                        NCC.CompletionResult infox = 
engine.RunCompletionEngine (the_method.Member, method_content);
                         
                         return GetResults (infox, comp);                       
 
                     }
@@ -286,13 +286,13 @@
             return null;
         }
         
-        ResolveResult GetResults (NCC.OverloadPossibility[] ovs, 
CompilationUnit cu)
+        ResolveResult GetResults (NCC.CompletionResult results, 
CompilationUnit cu)
         {
-            if (ovs.Length == 0)
+            if (results.Overloads.Length == 0)
                 return null;
             
             bool complete_types = false;
-            NCC.OverloadPossibility head = ovs[0];
+            NCC.OverloadPossibility head = results.Overloads.Head;
             if (head.Member.Name == ".ctor" || head.Member.Name == ".cctor" || 
head.Member is NCC.TypeInfo)
                 complete_types = true;
             
@@ -322,10 +322,26 @@
             }
             else
             {
-                Class declaring = new Class (head.Member.DeclaringType, cu, 
false);
+                Class declaring = GetTheRealType (results.ObjectType, cu);
                 
+                if (declaring.FullyQualifiedName == "System.Object")
+                {
+                    // Try with any other member
+                    NCC.TypeInfo found = null;
+                    foreach (NCC.OverloadPossibility ov in results.Overloads)
+                    {
+                        if (ov.Member.DeclaringType.FrameworkTypeName != 
"System.Object")
+                        {
+                            found = ov.Member.DeclaringType;
+                            break;
+                        }
+                    }
+                    if (found != null)
+                        declaring = new Class (found, cu, false);
+                }
+                
                 LanguageItemCollection lang = new LanguageItemCollection ();
-                foreach (NCC.OverloadPossibility ov in ovs)
+                foreach (NCC.OverloadPossibility ov in results.Overloads)
                 {
                     // Do not add property getters and setters, not events 
adders and removers,
                     // nor overloaded operators, nor enum value__, not Nemerle 
internal methods
@@ -367,6 +383,34 @@
             }
         }
         
+        private Class GetTheRealType (NCC.MType objectType, CompilationUnit cu)
+        {
+            if (objectType is NCC.MType.Class)
+            {
+                return new Class (((NCC.MType.Class)objectType).tycon, cu, 
false);
+            }
+            else if (objectType is NCC.MType.Array)
+            {
+                return new Class ("System.Array", cu);
+            }
+            else if (objectType is NCC.MType.Fun)
+            {
+                return GetTheRealType 
((NCC.MType)((NCC.MType.Fun)objectType).to, cu);
+            }
+            else if (objectType is NCC.MType.Ref)
+            {
+                return GetTheRealType 
((NCC.MType)((NCC.MType.Ref)objectType).t, cu);
+            }
+            else if (objectType is NCC.MType.Out)
+            {
+                return GetTheRealType 
((NCC.MType)((NCC.MType.Out)objectType).t, cu);
+            }
+            else
+            {
+                return null;
+            }
+        }
+        
         public ILanguageItem ResolveIdentifier (IParserContext parserContext, 
string id, int caretLineNumber, int caretColumn, string fileName, string 
fileContent)
         {
             return null;

Modified: 
trunk/monodevelop/Extras/NemerleBinding/Parser/SharpDevelopTree/Class.cs
===================================================================
--- trunk/monodevelop/Extras/NemerleBinding/Parser/SharpDevelopTree/Class.cs    
2006-06-08 16:33:28 UTC (rev 61575)
+++ trunk/monodevelop/Extras/NemerleBinding/Parser/SharpDevelopTree/Class.cs    
2006-06-08 17:22:55 UTC (rev 61576)
@@ -22,10 +22,11 @@
         NCC.TypeInfo tinfo;
         internal XmlDocument xmlHelp;
         
-        public Class(string name)
+        public Class(string name, CompilationUnit cu)
         {
             this.FullyQualifiedName = name;
             this.modifiers = (ModifierEnum)0;
+            this.cu = cu;
         }
         
         void LoadXml ()
@@ -52,7 +53,9 @@
         {
             this.cu = cu;
             this.tinfo = null;
-            this.FullyQualifiedName = tinfo.FullName.TrimEnd('*').TrimEnd 
('1', '2', '3', '4').TrimEnd('`');
+            this.FullyQualifiedName = tinfo.FullName.TrimEnd('*');
+            if (this.FullyQualifiedName.Contains("`"))
+                this.FullyQualifiedName = this.FullyQualifiedName.TrimEnd 
('1', '2', '3', '4').TrimEnd('`');
             
             if (tinfo.IsEnum)
                 classType = ClassType.Enum;
@@ -134,7 +137,10 @@
             this.cu = cu;
             this.tinfo = tinfo;
             
-            this.FullyQualifiedName = 
tinfo.FrameworkTypeName.TrimEnd('*').TrimEnd ('1', '2', '3', '4').TrimEnd('`');
+            this.FullyQualifiedName = tinfo.FrameworkTypeName.TrimEnd('*');
+            if (this.FullyQualifiedName.Contains("`"))
+                this.FullyQualifiedName = this.FullyQualifiedName.TrimEnd 
('1', '2', '3', '4').TrimEnd('`');
+
             
             if (tinfo.IsEnum)
                 classType = ClassType.Enum;

Modified: 
trunk/monodevelop/Extras/NemerleBinding/Parser/SharpDevelopTree/Method.cs
===================================================================
--- trunk/monodevelop/Extras/NemerleBinding/Parser/SharpDevelopTree/Method.cs   
2006-06-08 16:33:28 UTC (rev 61575)
+++ trunk/monodevelop/Extras/NemerleBinding/Parser/SharpDevelopTree/Method.cs   
2006-06-08 17:22:55 UTC (rev 61576)
@@ -15,118 +15,144 @@
         NCC.IMethod Member { get; }
     }
     
-       public class Method : AbstractMethod, INemerleMethod
-       {
-               public void AddModifier(ModifierEnum m)
-               {
-                       modifiers = modifiers | m;
-               }
-               
-               NCC.IMethod _member;
-               public NCC.IMethod Member
-               {
-                   get { return _member; }
-               }
-               
-               XmlNode node;
-               void LoadXml (Class declaring, SR.MethodInfo methodBase)
-               {
-                  if (declaring.xmlHelp != null) {
-                               XmlNodeList nodes = 
declaring.xmlHelp.SelectNodes ("/Type/Members/[EMAIL PROTECTED]'" + 
FullyQualifiedName + "']");
-                               if (nodes != null && nodes.Count > 0) {
-                                       if (nodes.Count == 1) {
-                                               node = nodes[0];
-                                       } else {
-                                               node = FindMatch (nodes, 
methodBase);
-                                       }
-                                       if (node != null) {
-                                               XmlNode docNode = 
node.SelectSingleNode ("Docs/summary");
-                                               if (docNode != null) {
-                                                       Documentation = 
docNode.InnerXml;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               
-               XmlNode FindMatch (XmlNodeList nodes, SR.MethodInfo methodBase)
-               {
-                       SR.ParameterInfo[] p = methodBase.GetParameters ();
-                       string s = "";
-                       foreach (XmlNode node in nodes) {
-                               XmlNodeList paramList = node.SelectNodes 
("Parameters/*");
-                               s += paramList.Count + " - " + p.Length + "\n";
-                               if (p.Length == 0 && paramList.Count == 0) 
return node;
-                               if (p.Length != paramList.Count) continue;
-                               bool matched = true;
-                               for (int i = 0; i < p.Length; i++) {
-                                       if (p[i].ParameterType.ToString () != 
paramList[i].Attributes["Type"].Value) {
-                                               matched = false;
-                                       }
-                               }
-                               if (matched)
-                                       return node;
-                       }
-                       return null;
-               }
-               
-               void LoadXml (Class declaring, NCC.IMethod methodBase)
-               {
-                  if (declaring.xmlHelp != null) {
-                               XmlNodeList nodes = 
declaring.xmlHelp.SelectNodes ("/Type/Members/[EMAIL PROTECTED]'" + 
FullyQualifiedName + "']");
-                               if (nodes != null && nodes.Count > 0) {
-                                       if (nodes.Count == 1) {
-                                               node = nodes[0];
-                                       } else {
-                                               node = FindMatch (nodes, 
methodBase);
-                                       }
-                                       if (node != null) {
-                                               XmlNode docNode = 
node.SelectSingleNode ("Docs/summary");
-                                               if (docNode != null) {
-                                                       Documentation = 
docNode.InnerXml;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               
-               XmlNode FindMatch (XmlNodeList nodes, NCC.IMethod methodBase)
-               {
-                   Nemerle.Core.list<Fun_parm> p = methodBase.GetParameters ();
-                       string s = "";
-                       foreach (XmlNode node in nodes) {
-                               XmlNodeList paramList = node.SelectNodes 
("Parameters/*");
-                               s += paramList.Count + " - " + p.Length + "\n";
-                               if (p.Length == 0 && paramList.Count == 0) 
return node;
-                               if (p.Length != paramList.Count) continue;
-                               bool matched = true;
-                               for (int i = 0; i < p.Length; i++) {
-                                   Fun_parm k = p.Nth(i);
-                                   if (k.ty is NCC.MType.Class)
-                                   {
-                                       string pname = 
((NCC.MType.Class)k.ty).tycon.FrameworkTypeName;
-                                       if (pname != 
paramList[i].Attributes["Type"].Value) {
-                                                 matched = false;
-                                                 break;
-                                           }
-                                   }
-                                   else
-                                   {
-                                       matched = false;
-                                       break;
-                                   }
-                               }
-                               if (matched)
-                                       return node;
-                       }
-                       return null;
-               }
-               
-               public Method (Class declaringType, SR.MethodInfo tinfo)
-               {
-                   this.declaringType = declaringType;
-               
-                   ModifierEnum mod = (ModifierEnum)0;
+    public class Method : AbstractMethod, INemerleMethod
+    {
+        public void AddModifier(ModifierEnum m)
+        {
+            modifiers = modifiers | m;
+        }
+        
+        NCC.IMethod _member;
+        public NCC.IMethod Member
+        {
+            get { return _member; }
+        }
+        
+        XmlNode node;
+        void LoadXml (Class declaring, SR.MethodInfo methodBase)
+        {
+           if (declaring.xmlHelp != null) {
+                XmlNodeList nodes = declaring.xmlHelp.SelectNodes 
("/Type/Members/[EMAIL PROTECTED]'" + FullyQualifiedName + "']");
+                if (nodes != null && nodes.Count > 0) {
+                    if (nodes.Count == 1) {
+                        node = nodes[0];
+                    } else {
+                        node = FindMatch (nodes, methodBase);
+                    }
+                    if (node != null) {
+                        XmlNode docNode = node.SelectSingleNode 
("Docs/summary");
+                        if (docNode != null) {
+                            Documentation = docNode.InnerXml;
+                        }
+                    }
+                }
+            }
+        }
+        
+        XmlNode FindMatch (XmlNodeList nodes, SR.MethodInfo methodBase)
+        {
+            SR.ParameterInfo[] p = methodBase.GetParameters ();
+            string s = "";
+            foreach (XmlNode node in nodes) {
+                XmlNodeList paramList = node.SelectNodes ("Parameters/*");
+                s += paramList.Count + " - " + p.Length + "\n";
+                if (p.Length == 0 && paramList.Count == 0) return node;
+                if (p.Length != paramList.Count) continue;
+                bool matched = true;
+                for (int i = 0; i < p.Length; i++) {
+                    if (p[i].ParameterType.ToString () != 
paramList[i].Attributes["Type"].Value) {
+                        matched = false;
+                    }
+                }
+                if (matched)
+                    return node;
+            }
+            return null;
+        }
+        
+        void LoadXml (Class declaring, NCC.IMethod methodBase)
+        {
+            if (declaring.xmlHelp != null) {
+                XmlNodeList nodes = declaring.xmlHelp.SelectNodes 
("/Type/Members/[EMAIL PROTECTED]'" + methodBase.Name.ToString () + "']");
+                if (nodes != null && nodes.Count > 0) {
+                    if (nodes.Count == 1) {
+                        node = nodes[0];
+                    } else {
+                        node = FindMatch (nodes, methodBase);
+                    }
+                    if (node != null) {
+                        XmlNode docNode = node.SelectSingleNode 
("Docs/summary");
+                        if (docNode != null) {
+                            Documentation = docNode.InnerXml;
+                        }
+                    }
+                }
+            }
+        }
+        
+        XmlNode FindMatch (XmlNodeList nodes, NCC.IMethod methodBase)
+        {
+            Nemerle.Core.list<Fun_parm> p = methodBase.GetParameters ();
+            foreach (XmlNode node in nodes) {
+                XmlNodeList paramList = node.SelectNodes ("Parameters/*");
+                if (p.Length == 0 && paramList.Count == 0) return node;
+                if (p.Length != paramList.Count) continue;
+                try
+                {
+                    bool matched = true;
+                    for (int i = 0; i < paramList.Count; i++) {
+                        Fun_parm k = p.Nth(i);
+                        if (k.ty is NCC.MType.Class)
+                        {
+                            string pname = 
((NCC.MType.Class)k.ty).tycon.FrameworkTypeName;
+                            if (pname != 
paramList[i].Attributes["Type"].Value) {
+                                matched = false;
+                                break;
+                            }
+                        }
+                        else if (k.ty is NCC.MType.Array)
+                        {
+                            NCC.MType.Array zas = (NCC.MType.Array)k.ty;
+                            if (zas.t is NCC.MType.Class)
+                            {
+                                string pname = 
((NCC.MType.Class)zas.t).tycon.FrameworkTypeName + "[]";
+                                if (pname != 
paramList[i].Attributes["Type"].Value) {
+                                    matched = false;
+                                    break;
+                                }
+                            }
+                        }
+                        else if (k.ty is NCC.MType.Ref)
+                        {
+                            NCC.MType.Ref zas = (NCC.MType.Ref)k.ty;
+                            if (zas.t is NCC.MType.Class)
+                            {
+                                string pname = 
((NCC.MType.Class)zas.t).tycon.FrameworkTypeName + "&";
+                                if (pname != 
paramList[i].Attributes["Type"].Value) {
+                                    matched = false;
+                                    break;
+                                }
+                            }
+                        }
+                        else
+                        {
+                            matched = false;
+                            break;
+                        }
+                    }
+                    if (matched)
+                        return node;
+                }
+                catch { }
+            }
+            return null;
+        }
+        
+        public Method (Class declaringType, SR.MethodInfo tinfo)
+        {
+            this.declaringType = declaringType;
+        
+            ModifierEnum mod = (ModifierEnum)0;
             if (tinfo.IsPrivate)
                 mod |= ModifierEnum.Private;
             if (tinfo.IsAssembly)
@@ -144,65 +170,65 @@
             if (tinfo.IsVirtual)
                 mod |= ModifierEnum.Virtual;
                 
-                       modifiers = mod;
-                       
-                       this.FullyQualifiedName = tinfo.Name;
-                       
-                       if (tinfo.Name == "op_Addition") 
this.FullyQualifiedName = "@+";
-                       else if (tinfo.Name == "op_Subtraction") 
this.FullyQualifiedName = "@-";
-                       else if (tinfo.Name == "op_Multiply") 
this.FullyQualifiedName = "@*";
-                       else if (tinfo.Name == "op_Division") 
this.FullyQualifiedName = "@/";
-                       else if (tinfo.Name == "op_Modulus") 
this.FullyQualifiedName = "@%";
-                       else if (tinfo.Name == "op_ExclusiveOr") 
this.FullyQualifiedName = "@^";
-                       else if (tinfo.Name == "op_BitwiseAnd") 
this.FullyQualifiedName = "@&";
-                       else if (tinfo.Name == "op_BitwiseOr") 
this.FullyQualifiedName = "@|";
-                       else if (tinfo.Name == "op_LogicalAnd") 
this.FullyQualifiedName = "@&&";
-                       else if (tinfo.Name == "op_LogicalOr") 
this.FullyQualifiedName = "@||";
-                       else if (tinfo.Name == "op_Assign") 
this.FullyQualifiedName = "@=";
-                       else if (tinfo.Name == "op_LeftShift") 
this.FullyQualifiedName = "@<<";
-                       else if (tinfo.Name == "op_RightShift") 
this.FullyQualifiedName = "@>>";
-                       else if (tinfo.Name == "op_Equality") 
this.FullyQualifiedName = "@==";
-                       else if (tinfo.Name == "op_GreaterThan") 
this.FullyQualifiedName = "@>";
-                       else if (tinfo.Name == "op_LessThan") 
this.FullyQualifiedName = "@<";
-                       else if (tinfo.Name == "op_Inequality") 
this.FullyQualifiedName = "@!=";
-                       else if (tinfo.Name == "op_GreaterThanOrEqual") 
this.FullyQualifiedName = "@>=";
-                       else if (tinfo.Name == "op_LessThanOrEqual") 
this.FullyQualifiedName = "@<=";
-                       else if (tinfo.Name == "op_MultiplicationAssignment") 
this.FullyQualifiedName = "@*=";
-                       else if (tinfo.Name == "op_SubtractionAssignment") 
this.FullyQualifiedName = "@-=";
-                       else if (tinfo.Name == "op_ExclusiveOrAssignment") 
this.FullyQualifiedName = "@^=";
-                       else if (tinfo.Name == "op_LeftShiftAssignment") 
this.FullyQualifiedName = "@<<=";
-                       else if (tinfo.Name == "op_ModulusAssignment") 
this.FullyQualifiedName = "@%=";
-                       else if (tinfo.Name == "op_AdditionAssignment") 
this.FullyQualifiedName = "@+=";
-                       else if (tinfo.Name == "op_BitwiseAndAssignment") 
this.FullyQualifiedName = "@&=";
-                       else if (tinfo.Name == "op_BitwiseOrAssignment") 
this.FullyQualifiedName = "@|=";
-                       else if (tinfo.Name == "op_Comma") 
this.FullyQualifiedName = "@,";
-                       else if (tinfo.Name == "op_DivisionAssignment") 
this.FullyQualifiedName = "@/=";
-                       else if (tinfo.Name == "op_Implicit") 
this.FullyQualifiedName = "@:";
-                       else if (tinfo.Name == "op_Explicit") 
this.FullyQualifiedName = "@:>";
-                       else if (tinfo.Name == "op_UnaryPlus") 
this.FullyQualifiedName = "@+";
-                       else if (tinfo.Name == "op_UnaryNegation") 
this.FullyQualifiedName = "@-";
-                       else if (tinfo.Name == "op_Decrement") 
this.FullyQualifiedName = "@--";
-                       else if (tinfo.Name == "op_Increment") 
this.FullyQualifiedName = "@++";
-                       else if (tinfo.Name == "op_OnesComplement") 
this.FullyQualifiedName = "@~";
-                       else if (tinfo.Name == "op_LogicalNot") 
this.FullyQualifiedName = "@!";         
-                       
-                       returnType = new ReturnType(tinfo.ReturnType);
-                       this.region = Class.GetRegion();
-                       this.bodyRegion = Class.GetRegion();
-                       this._member = null;
-                       
-                       LoadXml (declaringType, tinfo);
-                           
-                       // Add parameters
-                       foreach (SR.ParameterInfo pinfo in 
tinfo.GetParameters())
-                           parameters.Add(new Parameter(this, pinfo, node));
-               }
-               
-               public Method (Class declaringType, NCC.IMethod tinfo)
-               {
-                   this.declaringType = declaringType;
-               
-                       ModifierEnum mod = (ModifierEnum)0;
+            modifiers = mod;
+            
+            this.FullyQualifiedName = tinfo.Name;
+            
+            if (tinfo.Name == "op_Addition") this.FullyQualifiedName = "@+";
+            else if (tinfo.Name == "op_Subtraction") this.FullyQualifiedName = 
"@-";
+            else if (tinfo.Name == "op_Multiply") this.FullyQualifiedName = 
"@*";
+            else if (tinfo.Name == "op_Division") this.FullyQualifiedName = 
"@/";
+            else if (tinfo.Name == "op_Modulus") this.FullyQualifiedName = 
"@%";
+            else if (tinfo.Name == "op_ExclusiveOr") this.FullyQualifiedName = 
"@^";
+            else if (tinfo.Name == "op_BitwiseAnd") this.FullyQualifiedName = 
"@&";
+            else if (tinfo.Name == "op_BitwiseOr") this.FullyQualifiedName = 
"@|";
+            else if (tinfo.Name == "op_LogicalAnd") this.FullyQualifiedName = 
"@&&";
+            else if (tinfo.Name == "op_LogicalOr") this.FullyQualifiedName = 
"@||";
+            else if (tinfo.Name == "op_Assign") this.FullyQualifiedName = "@=";
+            else if (tinfo.Name == "op_LeftShift") this.FullyQualifiedName = 
"@<<";
+            else if (tinfo.Name == "op_RightShift") this.FullyQualifiedName = 
"@>>";
+            else if (tinfo.Name == "op_Equality") this.FullyQualifiedName = 
"@==";
+            else if (tinfo.Name == "op_GreaterThan") this.FullyQualifiedName = 
"@>";
+            else if (tinfo.Name == "op_LessThan") this.FullyQualifiedName = 
"@<";
+            else if (tinfo.Name == "op_Inequality") this.FullyQualifiedName = 
"@!=";
+            else if (tinfo.Name == "op_GreaterThanOrEqual") 
this.FullyQualifiedName = "@>=";
+            else if (tinfo.Name == "op_LessThanOrEqual") 
this.FullyQualifiedName = "@<=";
+            else if (tinfo.Name == "op_MultiplicationAssignment") 
this.FullyQualifiedName = "@*=";
+            else if (tinfo.Name == "op_SubtractionAssignment") 
this.FullyQualifiedName = "@-=";
+            else if (tinfo.Name == "op_ExclusiveOrAssignment") 
this.FullyQualifiedName = "@^=";
+            else if (tinfo.Name == "op_LeftShiftAssignment") 
this.FullyQualifiedName = "@<<=";
+            else if (tinfo.Name == "op_ModulusAssignment") 
this.FullyQualifiedName = "@%=";
+            else if (tinfo.Name == "op_AdditionAssignment") 
this.FullyQualifiedName = "@+=";
+            else if (tinfo.Name == "op_BitwiseAndAssignment") 
this.FullyQualifiedName = "@&=";
+            else if (tinfo.Name == "op_BitwiseOrAssignment") 
this.FullyQualifiedName = "@|=";
+            else if (tinfo.Name == "op_Comma") this.FullyQualifiedName = "@,";
+            else if (tinfo.Name == "op_DivisionAssignment") 
this.FullyQualifiedName = "@/=";
+            else if (tinfo.Name == "op_Implicit") this.FullyQualifiedName = 
"@:";
+            else if (tinfo.Name == "op_Explicit") this.FullyQualifiedName = 
"@:>";
+            else if (tinfo.Name == "op_UnaryPlus") this.FullyQualifiedName = 
"@+";
+            else if (tinfo.Name == "op_UnaryNegation") this.FullyQualifiedName 
= "@-";
+            else if (tinfo.Name == "op_Decrement") this.FullyQualifiedName = 
"@--";
+            else if (tinfo.Name == "op_Increment") this.FullyQualifiedName = 
"@++";
+            else if (tinfo.Name == "op_OnesComplement") 
this.FullyQualifiedName = "@~";
+            else if (tinfo.Name == "op_LogicalNot") this.FullyQualifiedName = 
"@!";        
+            
+            returnType = new ReturnType(tinfo.ReturnType);
+            this.region = Class.GetRegion();
+            this.bodyRegion = Class.GetRegion();
+            this._member = null;
+            
+            LoadXml (declaringType, tinfo);
+                
+            // Add parameters
+            foreach (SR.ParameterInfo pinfo in tinfo.GetParameters())
+                parameters.Add(new Parameter(this, pinfo, node));
+        }
+        
+        public Method (Class declaringType, NCC.IMethod tinfo)
+        {
+            this.declaringType = declaringType;
+        
+            ModifierEnum mod = (ModifierEnum)0;
             if ((tinfo.Attributes & NCC.NemerleAttributes.Private) != 0)
                 mod |= ModifierEnum.Private;
             if ((tinfo.Attributes & NCC.NemerleAttributes.Internal) != 0)
@@ -226,60 +252,63 @@
             if ((tinfo.Attributes & NCC.NemerleAttributes.Extern) != 0)
                 mod |= ModifierEnum.Extern;
                 
-                       modifiers = mod;
-                       this.FullyQualifiedName = tinfo.Name;
-                       
-                       if (tinfo.Name == "op_Addition") 
this.FullyQualifiedName = "@+";
-                       else if (tinfo.Name == "op_Subtraction") 
this.FullyQualifiedName = "@-";
-                       else if (tinfo.Name == "op_Multiply") 
this.FullyQualifiedName = "@*";
-                       else if (tinfo.Name == "op_Division") 
this.FullyQualifiedName = "@/";
-                       else if (tinfo.Name == "op_Modulus") 
this.FullyQualifiedName = "@%";
-                       else if (tinfo.Name == "op_ExclusiveOr") 
this.FullyQualifiedName = "@^";
-                       else if (tinfo.Name == "op_BitwiseAnd") 
this.FullyQualifiedName = "@&";
-                       else if (tinfo.Name == "op_BitwiseOr") 
this.FullyQualifiedName = "@|";
-                       else if (tinfo.Name == "op_LogicalAnd") 
this.FullyQualifiedName = "@&&";
-                       else if (tinfo.Name == "op_LogicalOr") 
this.FullyQualifiedName = "@||";
-                       else if (tinfo.Name == "op_Assign") 
this.FullyQualifiedName = "@=";
-                       else if (tinfo.Name == "op_LeftShift") 
this.FullyQualifiedName = "@<<";
-                       else if (tinfo.Name == "op_RightShift") 
this.FullyQualifiedName = "@>>";
-                       else if (tinfo.Name == "op_Equality") 
this.FullyQualifiedName = "@==";
-                       else if (tinfo.Name == "op_GreaterThan") 
this.FullyQualifiedName = "@>";
-                       else if (tinfo.Name == "op_LessThan") 
this.FullyQualifiedName = "@<";
-                       else if (tinfo.Name == "op_Inequality") 
this.FullyQualifiedName = "@!=";
-                       else if (tinfo.Name == "op_GreaterThanOrEqual") 
this.FullyQualifiedName = "@>=";
-                       else if (tinfo.Name == "op_LessThanOrEqual") 
this.FullyQualifiedName = "@<=";
-                       else if (tinfo.Name == "op_MultiplicationAssignment") 
this.FullyQualifiedName = "@*=";
-                       else if (tinfo.Name == "op_SubtractionAssignment") 
this.FullyQualifiedName = "@-=";
-                       else if (tinfo.Name == "op_ExclusiveOrAssignment") 
this.FullyQualifiedName = "@^=";
-                       else if (tinfo.Name == "op_LeftShiftAssignment") 
this.FullyQualifiedName = "@<<=";
-                       else if (tinfo.Name == "op_ModulusAssignment") 
this.FullyQualifiedName = "@%=";
-                       else if (tinfo.Name == "op_AdditionAssignment") 
this.FullyQualifiedName = "@+=";
-                       else if (tinfo.Name == "op_BitwiseAndAssignment") 
this.FullyQualifiedName = "@&=";
-                       else if (tinfo.Name == "op_BitwiseOrAssignment") 
this.FullyQualifiedName = "@|=";
-                       else if (tinfo.Name == "op_Comma") 
this.FullyQualifiedName = "@,";
-                       else if (tinfo.Name == "op_DivisionAssignment") 
this.FullyQualifiedName = "@/=";
-                       else if (tinfo.Name == "op_Implicit") 
this.FullyQualifiedName = "@:";
-                       else if (tinfo.Name == "op_Explicit") 
this.FullyQualifiedName = "@:>";
-                       else if (tinfo.Name == "op_UnaryPlus") 
this.FullyQualifiedName = "@+";
-                       else if (tinfo.Name == "op_UnaryNegation") 
this.FullyQualifiedName = "@-";
-                       else if (tinfo.Name == "op_Decrement") 
this.FullyQualifiedName = "@--";
-                       else if (tinfo.Name == "op_Increment") 
this.FullyQualifiedName = "@++";
-                       else if (tinfo.Name == "op_OnesComplement") 
this.FullyQualifiedName = "@~";
-                       else if (tinfo.Name == "op_LogicalNot") 
this.FullyQualifiedName = "@!"; 
-                       
-                       returnType = new ReturnType 
((NCC.MType)tinfo.ReturnType);
-                       this.region = Class.GetRegion (tinfo.Location);
+            modifiers = mod;
+            this.FullyQualifiedName = tinfo.Name;
+            
+            if (tinfo.Name == "op_Addition") this.FullyQualifiedName = "@+";
+            else if (tinfo.Name == "op_Subtraction") this.FullyQualifiedName = 
"@-";
+            else if (tinfo.Name == "op_Multiply") this.FullyQualifiedName = 
"@*";
+            else if (tinfo.Name == "op_Division") this.FullyQualifiedName = 
"@/";
+            else if (tinfo.Name == "op_Modulus") this.FullyQualifiedName = 
"@%";
+            else if (tinfo.Name == "op_ExclusiveOr") this.FullyQualifiedName = 
"@^";
+            else if (tinfo.Name == "op_BitwiseAnd") this.FullyQualifiedName = 
"@&";
+            else if (tinfo.Name == "op_BitwiseOr") this.FullyQualifiedName = 
"@|";
+            else if (tinfo.Name == "op_LogicalAnd") this.FullyQualifiedName = 
"@&&";
+            else if (tinfo.Name == "op_LogicalOr") this.FullyQualifiedName = 
"@||";
+            else if (tinfo.Name == "op_Assign") this.FullyQualifiedName = "@=";
+            else if (tinfo.Name == "op_LeftShift") this.FullyQualifiedName = 
"@<<";
+            else if (tinfo.Name == "op_RightShift") this.FullyQualifiedName = 
"@>>";
+            else if (tinfo.Name == "op_Equality") this.FullyQualifiedName = 
"@==";
+            else if (tinfo.Name == "op_GreaterThan") this.FullyQualifiedName = 
"@>";
+            else if (tinfo.Name == "op_LessThan") this.FullyQualifiedName = 
"@<";
+            else if (tinfo.Name == "op_Inequality") this.FullyQualifiedName = 
"@!=";
+            else if (tinfo.Name == "op_GreaterThanOrEqual") 
this.FullyQualifiedName = "@>=";
+            else if (tinfo.Name == "op_LessThanOrEqual") 
this.FullyQualifiedName = "@<=";
+            else if (tinfo.Name == "op_MultiplicationAssignment") 
this.FullyQualifiedName = "@*=";
+            else if (tinfo.Name == "op_SubtractionAssignment") 
this.FullyQualifiedName = "@-=";
+            else if (tinfo.Name == "op_ExclusiveOrAssignment") 
this.FullyQualifiedName = "@^=";
+            else if (tinfo.Name == "op_LeftShiftAssignment") 
this.FullyQualifiedName = "@<<=";
+            else if (tinfo.Name == "op_ModulusAssignment") 
this.FullyQualifiedName = "@%=";
+            else if (tinfo.Name == "op_AdditionAssignment") 
this.FullyQualifiedName = "@+=";
+            else if (tinfo.Name == "op_BitwiseAndAssignment") 
this.FullyQualifiedName = "@&=";
+            else if (tinfo.Name == "op_BitwiseOrAssignment") 
this.FullyQualifiedName = "@|=";
+            else if (tinfo.Name == "op_Comma") this.FullyQualifiedName = "@,";
+            else if (tinfo.Name == "op_DivisionAssignment") 
this.FullyQualifiedName = "@/=";
+            else if (tinfo.Name == "op_Implicit") this.FullyQualifiedName = 
"@:";
+            else if (tinfo.Name == "op_Explicit") this.FullyQualifiedName = 
"@:>";
+            else if (tinfo.Name == "op_UnaryPlus") this.FullyQualifiedName = 
"@+";
+            else if (tinfo.Name == "op_UnaryNegation") this.FullyQualifiedName 
= "@-";
+            else if (tinfo.Name == "op_Decrement") this.FullyQualifiedName = 
"@--";
+            else if (tinfo.Name == "op_Increment") this.FullyQualifiedName = 
"@++";
+            else if (tinfo.Name == "op_OnesComplement") 
this.FullyQualifiedName = "@~";
+            else if (tinfo.Name == "op_LogicalNot") this.FullyQualifiedName = 
"@!";    
+            
+            returnType = new ReturnType ((NCC.MType)tinfo.ReturnType);
+            this.region = Class.GetRegion (tinfo.Location);
             if (tinfo is NCC.MemberBuilder)
                 this.bodyRegion = Class.GetRegion 
(((NCC.MemberBuilder)tinfo).BodyLocation);
             else
                 this.bodyRegion = Class.GetRegion (tinfo.Location);
-                       this._member = tinfo;
-                       
-                       LoadXml (declaringType, tinfo);
-                           
-                       // Add parameters
-                       foreach (Fun_parm pinfo in tinfo.GetParameters ())
-                           parameters.Add(new Parameter(this, pinfo, node));
-               }
-       }
+            this._member = tinfo;
+            
+            LoadXml (declaringType, tinfo);
+                
+            // Add parameters
+            foreach (Fun_parm pinfo in tinfo.GetParameters ())
+            {
+                try { parameters.Add(new Parameter(this, pinfo, node)); }
+                catch { }
+            }
+        }
+    }
 }

Modified: 
trunk/monodevelop/Extras/NemerleBinding/Parser/SharpDevelopTree/Parameter.cs
===================================================================
--- 
trunk/monodevelop/Extras/NemerleBinding/Parser/SharpDevelopTree/Parameter.cs    
    2006-06-08 16:33:28 UTC (rev 61575)
+++ 
trunk/monodevelop/Extras/NemerleBinding/Parser/SharpDevelopTree/Parameter.cs    
    2006-06-08 17:22:55 UTC (rev 61576)
@@ -44,7 +44,7 @@
                        }
                        this.declaringMember = declaringMember;
                        
-                       LoadXml (docNode);
+                       try { LoadXml (docNode); } catch { }
                }
                
                public Parameter (IMember declaringMember, SR.ParameterInfo 
pinfo, XmlNode docNode)
@@ -53,7 +53,7 @@
                    returnType = new ReturnType(pinfo.ParameterType);
                    this.declaringMember = declaringMember;
                    
-                   LoadXml (docNode);
+                   try { LoadXml (docNode); } catch { }
                }
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to