private ImportedMember ImportMember(MemberReference mref) { if (mref == null) { return(null); } if (mref is GenericInstanceMethod) { GenericInstanceMethod gm = (GenericInstanceMethod)mref; for (int i = 0; i < gm.GenericArguments.Count; i++) { ImportType(gm.GenericArguments[i]); } mref = gm.ElementMethod; } if (mref is MethodDefinition) { return(null); } if (memberCache.ContainsKey(mref)) { return(memberCache[mref]); } ImportedType it = ImportType(mref.DeclaringType); if (it == null) { return(null); } ImportedMember mb = new ImportedMember(); it.members.Add(mb); mb.name = mref.Name; if (mref is FieldReference) { mb.signature = ((FieldReference)mref).Resolve().FullName; mb.kind = ElementType.field; } else { mb.signature = ((MethodReference)mref).Resolve().FullName; mb.kind = ElementType.method; } mb.kindSpecified = true; memberCache.Add(mref, mb); return(mb); }
private ImportedMember ImportMember(MemberReference mref) { if (mref == null) return null; if (mref is GenericInstanceMethod) { GenericInstanceMethod gm = (GenericInstanceMethod)mref; for (int i = 0; i < gm.GenericArguments.Count; i++) ImportType(gm.GenericArguments[i]); mref = gm.ElementMethod; } if (mref is MethodDefinition) return null; if (memberCache.ContainsKey(mref)) return memberCache[mref]; ImportedType it = ImportType(mref.DeclaringType); if (it == null) return null; ImportedMember mb = new ImportedMember(); it.members.Add(mb); mb.name = mref.Name; if (mref is FieldReference) { mb.signature = ((FieldReference)mref).Resolve().FullName; mb.kind = ElementType.field; } else { mb.signature = ((MethodReference)mref).Resolve().FullName; mb.kind = ElementType.method; } mb.kindSpecified = true; memberCache.Add(mref, mb); return mb; }