IReturnType ResolveType(ICompilationUnit unit, IReturnType type)
        {
            if (type == null)
            {
                return(DomReturnType.Void);
            }
            if (type.Type != null)             // type known (possible anonymous type), no resolving needed
            {
                return(type);
            }
            TypeResolverVisitor typeResolverVisitor = new TypeResolverVisitor(dom, unit);

            typeResolverVisitor.SetCurrentMember(this.CallingMember);
            return((IReturnType)typeResolverVisitor.Visit(type, this.CallingType));
        }
		internal static int ResolveTypes (ProjectDom db, ICompilationUnit unit, IEnumerable<IType> types, IEnumerable<IAttribute> attributes, out List<IType> result, out List<IAttribute> resultAtrtibutes)
		{
			TypeResolverVisitor tr = new TypeResolverVisitor (db, unit);
			
			int unresolvedCount = 0;
			
			result = new List<IType> ();
			foreach (IType c in types) {
				tr.UnresolvedCount = 0;
				DomType rc = (DomType)c.AcceptVisitor (tr, null);
				if (rc.CompilationUnit != null)
					rc.CompilationUnit = new CompilationUnit (rc.CompilationUnit.FileName);
				rc.Resolved = true;
				// no need to set the base type here - the completion db handles that
				// (setting to system.object is wrong for enums & structs - and interfaces may never have a base)
/*				
				if (tr.UnresolvedCount == 0 && c.FullName != "System.Object") {
					// If the class has no base classes, make sure it subclasses System.Object
					if (rc.BaseType == null)
						rc.BaseType = new DomReturnType ("System.Object");
				}*/
				
				result.Add (rc);
				unresolvedCount += tr.UnresolvedCount;
			}
				
			resultAtrtibutes = new List<IAttribute> ();
			foreach (IAttribute a in attributes) {
				tr.UnresolvedCount = 0;
				DomAttribute ra = (DomAttribute)a.AcceptVisitor (tr, null);
				resultAtrtibutes.Add (ra);
				unresolvedCount += tr.UnresolvedCount;
			}
			
			return unresolvedCount;
		}
		internal static int ResolveTypes (ProjectDom db, ICompilationUnit unit, IList<IType> types, out List<IType> result)
		{
			TypeResolverVisitor tr = new TypeResolverVisitor (db, unit);
			
			int unresolvedCount = 0;
			result = new List<IType> ();
			foreach (IType c in types) {
				tr.UnresolvedCount = 0;
				DomType rc = (DomType)c.AcceptVisitor (tr, null);
				rc.Resolved = true;
				
				if (tr.UnresolvedCount == 0 && c.FullName != "System.Object") {
					// If the class has no base classes, make sure it subclasses System.Object
					if (rc.BaseType == null)
						rc.BaseType = new DomReturnType ("System.Object");
				}
				
				result.Add (rc);
				unresolvedCount += tr.UnresolvedCount;
			}
				
			return unresolvedCount;
		}