internal override void AccumUsedTypeAndMemberDefs(ValidityContext vctxt, AssemblyDef assemblyDef, TypeDef typeDef) { base.AccumUsedTypeAndMemberDefs(vctxt, assemblyDef, typeDef); var ctxt = MessageContextBuilders.Member(vctxt.Global, assemblyDef, typeDef, this); for (var i = 0; i < TypeParameters.Count; i++) { var p = TypeParameters[i]; p.AccumUsedTypeDefs(vctxt, assemblyDef, false); if (p.Invalid != null) { Invalid = new InvalidInfo(MessageContextBuilders.TypeArg(ParameterFlavor.Method, i), p.Invalid); return; } } foreach (var p in ValueParameters) { Invalid = p.Type.AccumUsedTypeDefs(vctxt, ctxt, usedTypes); if (Invalid != null) { return; } } if (Result != null) { Invalid = Result.Type.AccumUsedTypeDefs(vctxt, ctxt, usedTypes); if (Invalid != null) { return; } } if (vctxt.IgnoreMethodDefBody(assemblyDef, typeDef, this)) { return; } foreach (var l in Locals) { Invalid = l.Type.AccumUsedTypeDefs(vctxt, ctxt, usedTypes); if (Invalid != null) { return; } } var instructions = Instructions(vctxt.Global); if (instructions != null) { foreach (var i in instructions.Body) { Invalid = i.AccumUsedTypeAndMemberDefs(vctxt, ctxt, usedTypes, usedMembers); if (Invalid != null) { return; } } } }
internal override void CheckValid(ValidityContext vctxt, TypeEnvironment typeEnv) { if (Invalid != null || typeEnv.Type.Invalid != null) return; var methEnv = typeEnv.AddMethod(this).AddSelfMethodBoundArguments(); for (var i = 0; i < TypeParameters.Count; i++) { TypeParameters[i].CheckValid(vctxt, methEnv); if (TypeParameters[i].Invalid != null) { Invalid = new InvalidInfo (MessageContextBuilders.TypeArg(ParameterFlavor.Method, i), TypeParameters[i].Invalid); return; } } var ctxt = MessageContextBuilders.Member(vctxt.Global, typeEnv.Assembly, typeEnv.Type, this); foreach (var p in ValueParameters) { Invalid = p.Type.CheckValid(vctxt, ctxt, methEnv); if (Invalid != null) return; } if (Result != null) { Invalid = Result.Type.CheckValid(vctxt, ctxt, methEnv); if (Invalid != null) return; } if (vctxt.IgnoreMethodDefBody(typeEnv.Assembly, typeEnv.Type, this)) return; foreach (var l in Locals) { Invalid = l.Type.CheckValid(vctxt, ctxt, methEnv); if (Invalid != null) return; } var instructions = Instructions(vctxt.Global); if (instructions != null) { foreach (var i in instructions.Body) { Invalid = i.CheckValid(vctxt, ctxt, methEnv); if (Invalid != null) return; Invalid = vctxt.ImplementableInstruction(ctxt, methEnv.Assembly, methEnv.Type, this, i); if (Invalid != null) return; } } vctxt.ImplementableMemberDef(typeEnv.Assembly, typeEnv.Type, this); }
internal override void AccumUsedTypeAndMemberDefs(ValidityContext vctxt, AssemblyDef assemblyDef, TypeDef typeDef) { base.AccumUsedTypeAndMemberDefs(vctxt, assemblyDef, typeDef); var ctxt = MessageContextBuilders.Member(vctxt.Global, assemblyDef, typeDef, this); for (var i = 0; i < TypeParameters.Count; i++) { var p = TypeParameters[i]; p.AccumUsedTypeDefs(vctxt, assemblyDef, false); if (p.Invalid != null) { Invalid = new InvalidInfo(MessageContextBuilders.TypeArg(ParameterFlavor.Method, i), p.Invalid); return; } } foreach (var p in ValueParameters) { Invalid = p.Type.AccumUsedTypeDefs(vctxt, ctxt, usedTypes); if (Invalid != null) return; } if (Result != null) { Invalid = Result.Type.AccumUsedTypeDefs(vctxt, ctxt, usedTypes); if (Invalid != null) return; } if (vctxt.IgnoreMethodDefBody(assemblyDef, typeDef, this)) return; foreach (var l in Locals) { Invalid = l.Type.AccumUsedTypeDefs(vctxt, ctxt, usedTypes); if (Invalid != null) return; } var instructions = Instructions(vctxt.Global); if (instructions != null) { foreach (var i in instructions.Body) { Invalid = i.AccumUsedTypeAndMemberDefs(vctxt, ctxt, usedTypes, usedMembers); if (Invalid != null) return; } } }
internal override void CheckValid(ValidityContext vctxt, TypeEnvironment typeEnv) { if (Invalid != null || typeEnv.Type.Invalid != null) { return; } var methEnv = typeEnv.AddMethod(this).AddSelfMethodBoundArguments(); for (var i = 0; i < TypeParameters.Count; i++) { TypeParameters[i].CheckValid(vctxt, methEnv); if (TypeParameters[i].Invalid != null) { Invalid = new InvalidInfo (MessageContextBuilders.TypeArg(ParameterFlavor.Method, i), TypeParameters[i].Invalid); return; } } var ctxt = MessageContextBuilders.Member(vctxt.Global, typeEnv.Assembly, typeEnv.Type, this); foreach (var p in ValueParameters) { Invalid = p.Type.CheckValid(vctxt, ctxt, methEnv); if (Invalid != null) { return; } } if (Result != null) { Invalid = Result.Type.CheckValid(vctxt, ctxt, methEnv); if (Invalid != null) { return; } } if (vctxt.IgnoreMethodDefBody(typeEnv.Assembly, typeEnv.Type, this)) { return; } foreach (var l in Locals) { Invalid = l.Type.CheckValid(vctxt, ctxt, methEnv); if (Invalid != null) { return; } } var instructions = Instructions(vctxt.Global); if (instructions != null) { foreach (var i in instructions.Body) { Invalid = i.CheckValid(vctxt, ctxt, methEnv); if (Invalid != null) { return; } Invalid = vctxt.ImplementableInstruction(ctxt, methEnv.Assembly, methEnv.Type, this, i); if (Invalid != null) { return; } } } vctxt.ImplementableMemberDef(typeEnv.Assembly, typeEnv.Type, this); }