Ejemplo n.º 1
0
 public TypeInfo(TypeInfo other, GenericInstanceType git)
 {
     this.typeReference = TypeReferenceInstance.make(other.typeReference, git);
     this.typeDef = other.typeDef;
 }
Ejemplo n.º 2
0
 public InterfaceMethodInfo(TypeInfo iface, InterfaceMethodInfo other)
 {
     this.iface = iface;
     foreach (var key in other.ifaceMethodToClassMethod.Keys)
         ifaceMethodToClassMethod[key] = other.ifaceMethodToClassMethod[key];
 }
Ejemplo n.º 3
0
 void initializeInterfaces(TypeInfo typeInfo)
 {
     var git = typeInfo.typeReference as GenericInstanceType;
     interfaceMethodInfos.initializeFrom(typeInfo.typeDef.interfaceMethodInfos, git);
     foreach (var info in typeInfo.typeDef.allImplementedInterfaces.Keys) {
         var newTypeInfo = new TypeInfo(info, git);
         allImplementedInterfaces[newTypeInfo] = true;
     }
 }
Ejemplo n.º 4
0
 public void addBaseType(TypeDef baseDef, TypeReference baseRef)
 {
     if (baseDef == null || baseRef == null)
         return;
     baseType = new TypeInfo(baseRef, baseDef);
 }
Ejemplo n.º 5
0
 public InterfaceMethodInfo(TypeInfo iface)
 {
     this.iface = iface;
     foreach (var methodDef in iface.typeDef.AllMethods)
         ifaceMethodToClassMethod[methodDef] = null;
 }
Ejemplo n.º 6
0
 public void addMethodIfEmpty(TypeInfo iface, MethodDef ifaceMethod, MethodDef classMethod)
 {
     InterfaceMethodInfo info;
     var key = new TypeReferenceKey(iface.typeReference);
     if (!interfaceMethods.TryGetValue(key, out info))
         throw new ApplicationException("Could not find interface");
     info.addMethodIfEmpty(ifaceMethod, classMethod);
 }
Ejemplo n.º 7
0
        public void initializeFrom(InterfaceMethodInfos other, GenericInstanceType git)
        {
            foreach (var pair in other.interfaceMethods) {
                var oldTypeInfo = pair.Value.IFace;
                var newTypeInfo = new TypeInfo(oldTypeInfo, git);
                var oldKey = new TypeReferenceKey(oldTypeInfo.typeReference);
                var newKey = new TypeReferenceKey(newTypeInfo.typeReference);

                InterfaceMethodInfo newMethodsInfo = new InterfaceMethodInfo(newTypeInfo, other.interfaceMethods[oldKey]);
                if (interfaceMethods.ContainsKey(newKey))
                    newMethodsInfo.merge(interfaceMethods[newKey]);
                interfaceMethods[newKey] = newMethodsInfo;
            }
        }
Ejemplo n.º 8
0
 public void addInterface(TypeInfo iface)
 {
     var key = new TypeReferenceKey(iface.typeReference);
     if (!interfaceMethods.ContainsKey(key))
         interfaceMethods[key] = new InterfaceMethodInfo(iface);
 }
Ejemplo n.º 9
0
 // Returns the previous classMethod, or null if none
 public MethodDef addMethod(TypeInfo iface, MethodDef ifaceMethod, MethodDef classMethod)
 {
     return addMethod(iface.typeReference, ifaceMethod, classMethod);
 }
Ejemplo n.º 10
0
		void InitializeInterfaces(TypeInfo typeInfo) {
			var git = typeInfo.typeRef.TryGetGenericInstSig();
			interfaceMethodInfos.InitializeFrom(typeInfo.typeDef.interfaceMethodInfos, git);
			foreach (var info in typeInfo.typeDef.allImplementedInterfaces.Keys) {
				var newTypeInfo = new TypeInfo(info, git);
				allImplementedInterfaces[newTypeInfo] = true;
			}
		}
Ejemplo n.º 11
0
		public TypeInfo(TypeInfo other, GenericInstSig git) {
			this.typeRef = GenericArgsSubstitutor.Create(other.typeRef, git);
			this.typeDef = other.typeDef;
		}
Ejemplo n.º 12
0
		public void AddBaseType(MTypeDef baseDef, ITypeDefOrRef baseRef) {
			if (baseDef == null || baseRef == null)
				return;
			baseType = new TypeInfo(baseRef, baseDef);
		}
Ejemplo n.º 13
0
		public void AddMethodIfEmpty(TypeInfo iface, MMethodDef ifaceMethod, MMethodDef classMethod) {
			InterfaceMethodInfo info;
			if (!interfaceMethods.TryGetValue(iface.typeRef, out info))
				throw new ApplicationException("Could not find interface");
			info.AddMethodIfEmpty(ifaceMethod, classMethod);
		}
Ejemplo n.º 14
0
		// Returns the previous classMethod, or null if none
		public MMethodDef AddMethod(TypeInfo iface, MMethodDef ifaceMethod, MMethodDef classMethod) {
			return AddMethod(iface.typeRef, ifaceMethod, classMethod);
		}