private void FuzzilyForwardReferencesFromSource2Target(AssemblyNode targetAssembly, AssemblyNode sourceAssembly) { Contract.Requires(targetAssembly != null); Contract.Requires(sourceAssembly != null); for (int i = 1, n = sourceAssembly.Types.Count; i < n; i++) { TypeNode currentType = sourceAssembly.Types[i]; if (currentType == null) { continue; } TypeNode targetType = targetAssembly.GetType(currentType.Namespace, currentType.Name); if (targetType == null) { if (Duplicator.TypesToBeDuplicated[currentType.UniqueKey] == null) { Duplicator.FindTypesToBeDuplicated(new TypeNodeList(currentType)); } Trace("COPYOOB: type to be duplicated {0}", currentType.FullName); } else { if (HelperMethods.IsContractTypeForSomeOtherType(currentType as Class)) { // dummy contract target type. Ignore it. targetType.Members = new MemberList(); targetType.ClearMemberTable(); } Contract.Assume(TemplateParameterCount(currentType) == TemplateParameterCount(targetType), "Name mangling should ensure this"); Duplicator.DuplicateFor[currentType.UniqueKey] = targetType; Trace("COPYOOB: forwarding {1} to {0}", currentType.FullName, targetType.FullName); FuzzilyForwardType(currentType, targetType); } } }
public virtual TypeNode VisitTypeNode(TypeNode typeNode){ if (typeNode == null) return null; typeNode.Attributes = this.VisitAttributeList(typeNode.Attributes); typeNode.SecurityAttributes = this.VisitSecurityAttributeList(typeNode.SecurityAttributes); Class c = typeNode as Class; if (c != null) c.BaseClass = (Class)this.VisitTypeReference(c.BaseClass); typeNode.Interfaces = this.VisitInterfaceReferenceList(typeNode.Interfaces); typeNode.TemplateArguments = this.VisitTypeReferenceList(typeNode.TemplateArguments); typeNode.TemplateParameters = this.VisitTypeParameterList(typeNode.TemplateParameters); this.VisitMemberList(typeNode.Members); if (this.memberListNamesChanged) { typeNode.ClearMemberTable(); } #if ExtendedRuntime // have to visit this *after* visiting the members since in Normalizer // it creates normalized method bodies for the invariant methods and // those shouldn't be visited again!! // REVIEW!! I don't think the method bodies created in Normalizer are necessarily normalized anymore!! typeNode.Contract = this.VisitTypeContract(typeNode.Contract); #endif return typeNode; }