public MethodGenerationContext(BaseTypeGenerationContext typeGenerationContext, Action <MethodGenerationContext> closure) : base(typeGenerationContext) { addMethodAction = new AddMethodAction(typeGenerationContext.Builder, () => Name, () => ReturnType, GetParameters, false); typeGenerationContext.TypeGenerationActions.Add(addMethodAction); var method = new GeneratedMethod(() => addMethodAction.MethodBuilder, typeGenerationContext.TypeGenerationActions); SetMethod(method); closure(this); }
public void OverrideMethod(MethodInfo info, Action <OverrideMethodContext> nestedClosure) { var addMethodAction = new AddMethodAction(Builder, () => () => info.Name, () => () => info.ReturnType, () => info.GetParameters().Select(p => p.ParameterType).ToArray(), true); TypeGenerationActions.Add(addMethodAction); var method = new GeneratedMethod(() => addMethodAction.MethodBuilder, TypeGenerationActions); var context = new OverrideMethodContext(info, method, this); nestedClosure(context); if (!context.ReturnDeclared) { method.ReturnFrom(); } }