~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Core/MonoDevelop.Projects.Dom/CompilationUnit.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
                        }
72
72
                }
73
73
                
74
 
                
75
 
                public object Tag {
76
 
                        get;
77
 
                        set;
78
 
                }
79
 
                
80
74
                S INode.AcceptVisitor<T, S> (IDomVisitor<T, S> visitor, T data)
81
75
                {
82
76
                        return visitor.Visit (this, data);
210
204
                        
211
205
                        public override INode Visit (IReturnType type, object data)
212
206
                        {
213
 
                                IReturnType returnType = (IReturnType)base.Visit (type, data);
214
 
                                if (BuiltInTypes.Contains (returnType.FullName))
215
 
                                        return returnType;
 
207
                                IReturnType rt = (IReturnType)base.Visit (type, data);
 
208
                                if (BuiltInTypes.Contains (rt.FullName))
 
209
                                        return rt;
216
210
                                
 
211
                                DomReturnType returnType = new DomReturnType (rt);
217
212
                                string longest = "";
218
213
                                string lastAlias = null;
219
214
                                if (callingType != null && returnType.DecoratedFullName.StartsWith (callingType.FullName)) {
224
219
                                }
225
220
                                        
226
221
                                foreach (IUsing u in unit.Usings.Where (u => u.ValidRegion.Contains (location))) {
227
 
                                        foreach (string ns in u.Namespaces.Where (ns => returnType.Namespace == ns || returnType.Namespace.StartsWith (ns + "."))) {
 
222
                                        foreach (string ns in u.Namespaces.Where (ns => returnType.Namespace == ns || returnType.Namespace != null && returnType.Namespace.StartsWith (ns + "."))) {
228
223
                                                if (longest.Length < ns.Length)
229
224
                                                        longest = ns;
230
225
                                        }
236
231
                                }
237
232
                                if (lastAlias != null)
238
233
                                        return new DomReturnType (lastAlias);
239
 
                                if (longest.Length > 0) 
240
 
                                        returnType.Namespace = returnType.Namespace == longest ? "" : returnType.Namespace.Substring (longest.Length + 1);
 
234
                                if (longest.Length > 0 && returnType.Namespace == longest) 
 
235
                                        returnType.Namespace = "";
241
236
                                return returnType;
242
237
                        }
243
238
                }