Beispiel #1
0
		public MethodNode(IMethod method, TypeNode declaringType, TypeNode returnType)
		{
			Method = method;
			DeclaringType = declaringType;
			ReturnType = returnType;
			instructions = new List<Instruction>();
			parameters = new List<Parameter>();
			typeUses = new List<TypeNode>();
			methodUses = new List<MethodNode>();
			fieldUses = new List<FieldNode>();
		}
Beispiel #2
0
		TypeNode ReadType(ITypeDefinition type)
		{
			if (type == null)
				return null;
			TypeNode t;
			if (typeMappings.TryGetValue(type, out t))
				return t;
			cecilMappings.Add(loader.GetCecilObject(type.Parts[0]), type);
			NamespaceNode ns = ReadNamespace(type.Namespace);
			typeMappings.Add(type, t = new TypeNode(type, ns));
			ns.types.Add(t);
			if (type.DeclaringTypeDefinition != null) {
				ReadType(type.DeclaringTypeDefinition).nestedTypes.Add(t);
			}
			return t;
		}
Beispiel #3
0
		public FieldNode(IField field, TypeNode declaringType, TypeNode returnType)
		{
			this.Field = field;
			this.DeclaringType = declaringType;
			this.ReturnType = returnType;
		}
Beispiel #4
0
		public static BitmapSource GetIcon(TypeNode type)
		{
			switch (type.TypeDefinition.Kind) {
				case TypeKind.Enum:
					if (type.TypeDefinition.IsPublic)
						return Enum;
					if (type.TypeDefinition.IsProtected)
						return ProtectedEnum;
					if (type.TypeDefinition.IsInternal)
						return InternalEnum;
					return PrivateEnum;
				case TypeKind.Struct:
					if (type.TypeDefinition.IsPublic)
						return Struct;
					if (type.TypeDefinition.IsProtected)
						return ProtectedStruct;
					if (type.TypeDefinition.IsInternal)
						return InternalStruct;
					return PrivateStruct;
				case TypeKind.Interface:
					if (type.TypeDefinition.IsPublic)
						return Interface;
					if (type.TypeDefinition.IsProtected)
						return ProtectedInterface;
					if (type.TypeDefinition.IsInternal)
						return InternalInterface;
					return PrivateInterface;
				case TypeKind.Delegate:
					if (type.TypeDefinition.IsPublic)
						return Delegate;
					if (type.TypeDefinition.IsProtected)
						return ProtectedDelegate;
					if (type.TypeDefinition.IsInternal)
						return InternalDelegate;
					return PrivateDelegate;
				default:
					if (type.TypeDefinition.IsPublic)
						return Class;
					if (type.TypeDefinition.IsProtected)
						return ProtectedClass;
					if (type.TypeDefinition.IsInternal)
						return InternalClass;
					return PrivateClass;
			}
		}