コード例 #1
0
        public IType MergeTypeWithTemporary(IType type)
        {
            if (type == null || type.CompilationUnit == null || string.IsNullOrEmpty(type.CompilationUnit.FileName))
            {
                return(type);
            }

            if (temporaryCompilationUnits.ContainsKey(type.CompilationUnit.FileName))
            {
                var   unit    =  temporaryCompilationUnits[type.CompilationUnit.FileName];
                IType tmpType = unit.Types.FirstOrDefault(t => t.Location ==  type.Location || t.DecoratedFullName == type.DecoratedFullName);

                if (tmpType != null)
                {
                    CompoundType result = new CompoundType();
                    result.AddPart(type);
                    result.AddPart(tmpType);
                    return(result);
                }
            }
            return(type);
        }
コード例 #2
0
ファイル: ProjectDom.cs プロジェクト: kmarecki/monodevelop
		public IType MergeTypeWithTemporary (IType type)
		{
			if (type == null || type.CompilationUnit == null || string.IsNullOrEmpty (type.CompilationUnit.FileName))
				return type;
			
			if (temporaryCompilationUnits.ContainsKey (type.CompilationUnit.FileName)) {
				var unit = temporaryCompilationUnits[type.CompilationUnit.FileName];
				IType tmpType = unit.Types.FirstOrDefault (t => t.Location == type.Location || t.DecoratedFullName == type.DecoratedFullName);
				
				if (tmpType != null) {
					CompoundType result = new CompoundType ();
					result.AddPart (type);
					result.AddPart (tmpType);
					return result;
				}
			}
			return type;
		}
コード例 #3
0
        static DomType ReadTypeInternal(BinaryReader reader, INameDecoder nameTable)
        {
            uint typeCount = ReadUInt(reader, 1000);

            if (typeCount > 1)
            {
                CompoundType compoundResult = new CompoundType();
                while (typeCount-- > 0)
                {
                    compoundResult.AddPart(ReadTypeInternal(reader, nameTable));
                }

                return(compoundResult);
            }

            DomType result = new DomType();

            ReadMemberInformation(reader, nameTable, result);
//			bool verbose = result.Name == "CopyDelegate";
//			if (verbose) System.Console.WriteLine("read type:" + result.Name);
            result.TypeModifier = (TypeModifier)reader.ReadUInt32();
            result.BodyRegion   = ReadRegion(reader, nameTable);
            string compilationUnitFileName = ReadString(reader, nameTable);

            result.CompilationUnit = new CompilationUnit(compilationUnitFileName);

            result.Namespace = ReadString(reader, nameTable);
            result.ClassType = (ClassType)reader.ReadUInt32();
            result.BaseType  = ReadReturnType(reader, nameTable);

            // implemented interfaces
            long count = ReadUInt(reader, 5000);

//			if (verbose) System.Console.WriteLine("impl. interfaces:" + count);
            while (count-- > 0)
            {
                result.AddInterfaceImplementation(ReadReturnType(reader, nameTable));
            }

            // innerTypes
//			if (verbose) System.Console.WriteLine("pos:" + reader.BaseStream.Position);
            count = ReadUInt(reader, 10000);
//			if (verbose) System.Console.WriteLine("inner types:" + count);
            while (count-- > 0)
            {
                DomType innerType = ReadTypeInternal(reader, nameTable);
                innerType.DeclaringType = result;
                result.Add(innerType);
            }

            // fields
//			if (verbose) System.Console.WriteLine("pos:" + reader.BaseStream.Position);
            count = ReadUInt(reader, 10000);
//			if (verbose) System.Console.WriteLine("fields:" + count);
            while (count-- > 0)
            {
                DomField field = ReadField(reader, nameTable);
                field.DeclaringType = result;
                result.Add(field);
            }

            // methods
//			if (verbose) System.Console.WriteLine("pos:" + reader.BaseStream.Position);
            count = ReadUInt(reader, 10000);
//			if (verbose) System.Console.WriteLine("methods:" + count);
            while (count-- > 0)
            {
                DomMethod method = ReadMethod(reader, nameTable);
                method.DeclaringType = result;
                result.Add(method);
            }

            // properties
//			if (verbose) System.Console.WriteLine("pos:" + reader.BaseStream.Position);
            count = ReadUInt(reader, 10000);
//			if (verbose) System.Console.WriteLine("properties:" + count);
            while (count-- > 0)
            {
                DomProperty property = ReadProperty(reader, nameTable);
                property.DeclaringType = result;
                result.Add(property);
            }

            // events
//			if (verbose) System.Console.WriteLine("pos:" + reader.BaseStream.Position);
            count = ReadUInt(reader, 10000);
//			if (verbose) System.Console.WriteLine("events:" + count);
            while (count-- > 0)
            {
                DomEvent evt = ReadEvent(reader, nameTable);
                evt.DeclaringType = result;
                result.Add(evt);
            }

            // type parameters
            count = ReadUInt(reader, 500);
            while (count-- > 0)
            {
                TypeParameter tp = ReadTypeParameter(reader, nameTable);
                result.AddTypeParameter(tp);
            }
            return(result);
        }
コード例 #4
0
		static DomType ReadTypeInternal (BinaryReader reader, INameDecoder nameTable, IDomObjectTable objectTable)
		{
			uint typeCount = ReadUInt (reader, 1000);
			if (typeCount > 1) {
				CompoundType compoundResult = new CompoundType ();
				while (typeCount-- > 0) {
					compoundResult.AddPart (ReadTypeInternal (reader, nameTable, objectTable));
				}
				
				return compoundResult;
			}
			
			DomType result = new DomType ();
			ReadMemberInformation (reader, nameTable, objectTable, result);
			//			bool verbose = result.Name == "CopyDelegate";
			//			if (verbose) System.Console.WriteLine("read type:" + result.Name);
			result.TypeModifier = (TypeModifier)reader.ReadUInt32 ();
			result.BodyRegion = ReadRegion (reader, nameTable);
			string compilationUnitFileName = ReadString (reader, nameTable);
			result.CompilationUnit = new CompilationUnit (compilationUnitFileName);
			
			result.Namespace = ReadString (reader, nameTable);
			result.ClassType = (ClassType)reader.ReadUInt32 ();
			result.BaseType = ReadReturnType (reader, nameTable, objectTable);
			
			// implemented interfaces
			long count = ReadUInt (reader, 5000);
			//			if (verbose) System.Console.WriteLine("impl. interfaces:" + count);
			while (count-- > 0) {
				result.AddInterfaceImplementation (ReadReturnType (reader, nameTable, objectTable));
			}
			
			// innerTypes
			//			if (verbose) System.Console.WriteLine("pos:" + reader.BaseStream.Position);
			count = ReadUInt (reader, 10000);
			//			if (verbose) System.Console.WriteLine("inner types:" + count);
			while (count-- > 0) {
				DomType innerType = ReadTypeInternal (reader, nameTable, objectTable);
				innerType.DeclaringType = result;
				result.Add (innerType);
			}
			
			// fields
			//			if (verbose) System.Console.WriteLine("pos:" + reader.BaseStream.Position);
			count = ReadUInt (reader, 10000);
			//			if (verbose) System.Console.WriteLine("fields:" + count);
			while (count-- > 0) {
				DomField field = ReadField (reader, nameTable, objectTable);
				field.DeclaringType = result;
				result.Add (field);
			}
			
			// methods
			//			if (verbose) System.Console.WriteLine("pos:" + reader.BaseStream.Position);
			count = ReadUInt (reader, 10000);
			//			if (verbose) System.Console.WriteLine("methods:" + count);
			while (count-- > 0) {
				DomMethod method = ReadMethod (reader, nameTable, objectTable);
				method.DeclaringType = result;
				result.Add (method);
			}
			
			// properties
			//			if (verbose) System.Console.WriteLine("pos:" + reader.BaseStream.Position);
			count = ReadUInt (reader, 10000);
			//			if (verbose) System.Console.WriteLine("properties:" + count);
			while (count-- > 0) {
				DomProperty property = ReadProperty (reader, nameTable, objectTable);
				property.DeclaringType = result;
				result.Add (property);
			}
			
			// events
			//			if (verbose) System.Console.WriteLine("pos:" + reader.BaseStream.Position);
			count = ReadUInt (reader, 10000);
			//			if (verbose) System.Console.WriteLine("events:" + count);
			while (count-- > 0) {
				DomEvent evt = ReadEvent (reader, nameTable, objectTable);
				evt.DeclaringType = result;
				result.Add (evt);
			}
			
			// type parameters
			count = ReadUInt (reader, 500);
			while (count-- > 0) {
				TypeParameter tp = ReadTypeParameter (reader, nameTable, objectTable);
				result.AddTypeParameter (tp);
			}
			return result;
		}