Author: lluis
Date: 2007-10-15 14:37:45 -0400 (Mon, 15 Oct 2007)
New Revision: 87529

Modified:
   trunk/monodevelop/Core/src/MonoDevelop.Projects/ChangeLog
   
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects.Parser/ClassWrapper.cs
Log:
* MonoDevelop.Projects.Parser/ClassWrapper.cs: Make sure the wrapped
  class is lazily loaded.

Modified: trunk/monodevelop/Core/src/MonoDevelop.Projects/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Projects/ChangeLog   2007-10-15 
18:21:27 UTC (rev 87528)
+++ trunk/monodevelop/Core/src/MonoDevelop.Projects/ChangeLog   2007-10-15 
18:37:45 UTC (rev 87529)
@@ -1,3 +1,8 @@
+2007-10-15  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
+
+       * MonoDevelop.Projects.Parser/ClassWrapper.cs: Make sure the wrapped 
class
+         is lazily loaded.
+
 2007-10-12  Mike Krüger <[EMAIL PROTECTED]> 
 
        * MonoDevelop.Projects/ProjectReference.cs,

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects.Parser/ClassWrapper.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects.Parser/ClassWrapper.cs
 2007-10-15 18:21:27 UTC (rev 87528)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Projects/MonoDevelop.Projects.Parser/ClassWrapper.cs
 2007-10-15 18:37:45 UTC (rev 87529)
@@ -73,7 +73,7 @@
                
                public ICompilationUnit CompilationUnit {
                        get {
-                               if (Wrapped != null && (entry.ContentFlags & 
ContentFlags.HasCompilationUnit) != 0)
+                               if (HasContent 
(ContentFlags.HasCompilationUnit))
                                        return Wrapped.CompilationUnit;
                                else
                                        return null;
@@ -91,7 +91,7 @@
                
                public IRegion Region {
                        get {
-                               if (Wrapped != null && (entry.ContentFlags & 
ContentFlags.HasRegion) != 0)
+                               if (HasContent (ContentFlags.HasRegion))
                                        return Wrapped.Region;
                                else
                                        return null;
@@ -100,7 +100,7 @@
                
                public IRegion BodyRegion {
                        get {
-                               if (Wrapped != null && (entry.ContentFlags & 
ContentFlags.HasBodyRegion) != 0)
+                               if (HasContent (ContentFlags.HasBodyRegion))
                                        return Wrapped.BodyRegion;
                                else
                                        return null;
@@ -110,7 +110,7 @@
                // For classes composed by several files, returns all parts of 
the class
                public IClass[] Parts {
                        get {
-                               if (Wrapped != null && (entry.ContentFlags & 
ContentFlags.HasParts) != 0)
+                               if (HasContent (ContentFlags.HasParts))
                                        return Wrapped.Parts;
                                else
                                        return new IClass [0];
@@ -119,7 +119,7 @@
                
                public GenericParameterList GenericParameters {
                        get {
-                               if (Wrapped != null && (entry.ContentFlags & 
ContentFlags.HasGenericParams) != 0)
+                               if (HasContent (ContentFlags.HasGenericParams))
                                        return Wrapped.GenericParameters;
                                else
                                        return null;
@@ -128,7 +128,7 @@
                
                public ReturnTypeList BaseTypes {
                        get {
-                               if (Wrapped != null && (entry.ContentFlags & 
ContentFlags.HasBaseTypes) != 0)
+                               if (HasContent (ContentFlags.HasBaseTypes))
                                        return Wrapped.BaseTypes;
                                else
                                        return new ReturnTypeList ();
@@ -137,7 +137,7 @@
                
                public ClassCollection InnerClasses {
                        get {
-                               if (Wrapped != null && (entry.ContentFlags & 
ContentFlags.HasInnerClasses) != 0)
+                               if (HasContent (ContentFlags.HasInnerClasses))
                                        return Wrapped.InnerClasses;
                                else
                                        return new ClassCollection ();
@@ -146,7 +146,7 @@
 
                public FieldCollection Fields {
                        get {
-                               if (Wrapped != null && (entry.ContentFlags & 
ContentFlags.HasFields) != 0)
+                               if (HasContent (ContentFlags.HasFields))
                                        return Wrapped.Fields;
                                else
                                        return new FieldCollection (this);
@@ -155,7 +155,7 @@
 
                public PropertyCollection Properties {
                        get {
-                               if (Wrapped != null && (entry.ContentFlags & 
ContentFlags.HasProperties) != 0)
+                               if (HasContent (ContentFlags.HasProperties))
                                        return Wrapped.Properties;
                                else
                                        return new PropertyCollection (this);
@@ -164,7 +164,7 @@
 
                public IndexerCollection Indexer {
                        get {
-                               if (Wrapped != null && (entry.ContentFlags & 
ContentFlags.HasIndexers) != 0)
+                               if (HasContent (ContentFlags.HasIndexers))
                                        return Wrapped.Indexer;
                                else
                                        return new IndexerCollection (this);
@@ -173,7 +173,7 @@
 
                public MethodCollection Methods {
                        get {
-                               if (Wrapped != null && (entry.ContentFlags & 
ContentFlags.HasMethods) != 0)
+                               if (HasContent (ContentFlags.HasMethods))
                                        return Wrapped.Methods;
                                else
                                        return new MethodCollection (this);
@@ -182,7 +182,7 @@
 
                public EventCollection Events {
                        get {
-                               if (Wrapped != null && (entry.ContentFlags & 
ContentFlags.HasEvents) != 0)
+                               if (HasContent (ContentFlags.HasEvents))
                                        return Wrapped.Events;
                                else
                                        return new EventCollection (this);
@@ -195,7 +195,7 @@
                
                public AttributeSectionCollection Attributes {
                        get {
-                               if (Wrapped != null && (entry.ContentFlags & 
ContentFlags.HasAttributes) != 0)
+                               if (HasContent (ContentFlags.HasAttributes))
                                        return Wrapped.Attributes;
                                else
                                        return new AttributeSectionCollection 
();
@@ -204,13 +204,18 @@
 
                public string Documentation {
                        get {
-                               if (Wrapped != null && (entry.ContentFlags & 
ContentFlags.HasDocumentation) != 0)
+                               if (HasContent (ContentFlags.HasDocumentation))
                                        return Wrapped.Documentation;
                                else
                                        return string.Empty;
                        }
                }
                
+               bool HasContent (ContentFlags cf)
+               {
+                       return (entry.ContentFlags & cf) != 0 && Wrapped != 
null;
+               }
+               
                public ModifierEnum Modifiers {
                        get { return entry.Modifiers; }
                }

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

Reply via email to