Пример #1
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;
     }
 }
Пример #2
0
 public TypeInfo(TypeInfo other, GenericInstanceType git)
 {
     this.typeReference = TypeReferenceInstance.make(other.typeReference, git);
     this.typeDef = other.typeDef;
 }
Пример #3
0
 public InterfaceMethodInfo(TypeInfo iface)
 {
     this.iface = iface;
     foreach (var methodDef in iface.typeDef.AllMethods)
         ifaceMethodToClassMethod[methodDef] = null;
 }
Пример #4
0
 public InterfaceMethodInfo(TypeInfo iface, InterfaceMethodInfo other)
 {
     this.iface = iface;
     foreach (var key in other.ifaceMethodToClassMethod.Keys)
         ifaceMethodToClassMethod[key] = other.ifaceMethodToClassMethod[key];
 }
Пример #5
0
 public void addBaseType(TypeDef baseDef, TypeReference baseRef)
 {
     if (baseDef == null || baseRef == null)
         return;
     baseType = new TypeInfo(baseRef, baseDef);
 }
Пример #6
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;
            }
        }
Пример #7
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);
 }
Пример #8
0
 // Returns the previous classMethod, or null if none
 public MethodDef addMethod(TypeInfo iface, MethodDef ifaceMethod, MethodDef classMethod)
 {
     return addMethod(iface.typeReference, ifaceMethod, classMethod);
 }
Пример #9
0
 public void addInterface(TypeInfo iface)
 {
     var key = new TypeReferenceKey(iface.typeReference);
     if (!interfaceMethods.ContainsKey(key))
         interfaceMethods[key] = new InterfaceMethodInfo(iface);
 }