public abstract bool PropogateExtraUsedFromMember(AssemblyDef assemblyDef, TypeDef typeDef, MemberDef memberDef);
public abstract void ImplementableMemberDef(AssemblyDef assemblyDef, TypeDef typeDef, MemberDef memberDef);
public bool PrimTryResolve(Global global, out AssemblyDef assemblyDef, out TypeDef typeDef, out MemberDef memberDef) { if (!DefiningType.PrimTryResolve(global, out assemblyDef, out typeDef)) { memberDef = null; return(false); } memberDef = typeDef.ResolveMember(Signature); return(memberDef != null); }
public abstract void ImplementableMemberDef(AssemblyDef assemblyDef, TypeDef typeDef, MemberDef memberDef);
public abstract bool PropogateExtraUsedFromMember(AssemblyDef assemblyDef, TypeDef typeDef, MemberDef memberDef);
public override void ImplementableMemberDef(CST.AssemblyDef assemblyDef, CST.TypeDef typeDef, CST.MemberDef memberDef) { var ctxt = CST.MessageContextBuilders.Member(env.Global, assemblyDef, typeDef, memberDef); var s = typeDef.Style; var methodDef = memberDef as CST.MethodDef; if (methodDef == null) { return; } if (s is CST.DelegateTypeStyle || s is CST.MultiDimArrayTypeStyle) { // SPECIAL CASE: Magic delegate and multi-dimensional array methods are // implemented by runtime return; } if (env.AttributeHelper.MethodHasAttribute (assemblyDef, typeDef, methodDef, env.AttributeHelper.IgnoreAttributeRef, true, true)) { Log(new CST.InvalidMemberDef(ctxt, "Method is marked as '[Ignore]'")); methodDef.Invalid = new CST.InvalidInfo("Ignored"); } try { if (!(s is CST.InterfaceTypeStyle) && methodDef.MethodStyle != CST.MethodStyle.Abstract && !env.InteropManager.IsImported(assemblyDef, typeDef, methodDef)) { switch (methodDef.CodeFlavor) { case CST.MethodCodeFlavor.Managed: { var instructions = methodDef.Instructions(Global); if (instructions == null || instructions.Body.Count == 0) { Log(new CST.InvalidMemberDef(ctxt, "Method has no body")); methodDef.Invalid = new CST.InvalidInfo("Unimplementable"); } break; } case CST.MethodCodeFlavor.ManagedExtern: Log(new CST.InvalidMemberDef(ctxt, "Method is marked as extern but has no import")); methodDef.Invalid = new CST.InvalidInfo("Unimplementable"); break; case CST.MethodCodeFlavor.Native: Log(new CST.InvalidMemberDef(ctxt, "Method invokes native code")); methodDef.Invalid = new CST.InvalidInfo("Unimplementable"); break; case CST.MethodCodeFlavor.Runtime: Log(new CST.InvalidMemberDef(ctxt, "Method is part of the CLR runtime")); methodDef.Invalid = new CST.InvalidInfo("Unimplementable"); break; case CST.MethodCodeFlavor.ForwardRef: Log(new CST.InvalidMemberDef(ctxt, "Method is a forward reference")); methodDef.Invalid = new CST.InvalidInfo("Unimplementable"); break; default: throw new ArgumentOutOfRangeException(); } } // else: no body to check } catch (DefinitionException) { Log(new CST.InvalidMemberDef(ctxt, "Method contains an interop error")); methodDef.Invalid = new CST.InvalidInfo("Unimplementable"); } }
public override bool PropogateExtraUsedFromMember(CST.AssemblyDef assemblyDef, CST.TypeDef typeDef, CST.MemberDef memberDef) { var newUsed = false; var methodDef = memberDef as CST.MethodDef; if (methodDef != null) { if (!methodDef.IsStatic && methodDef.IsConstructor && env.InteropManager.IsImported(assemblyDef, typeDef, methodDef) && !env.InteropManager.IsFactory(assemblyDef, typeDef, methodDef)) { // Imported instance constructor may invoke an 'importing' constructor var polyMethEnv = Global.Environment().AddAssembly(assemblyDef).AddType(typeDef).AddSelfTypeBoundArguments(). AddMethod(methodDef); var methodRef = env.InteropManager.BestImportingConstructor(polyMethEnv); if (methodRef != null) { if (ExtraUsedMethod(methodRef.QualifiedMemberName)) { newUsed = true; } } } } return(newUsed); }