public IILLocal?GenMain(IGenerationContext context) { var il = context.IL; var needsForProps = context.NeedsForProperties(_implementationType, _arePropertiesAutowired).ToList(); if (needsForProps.Count > 0) { var result = il.DeclareLocal(_implementationType); context.PushToILStack(context.NeedsForConstructor(_constructorInfo)); il.Newobj(_constructorInfo).Stloc(result); foreach (var need in needsForProps) { if (!context.IsResolvableNeed(need)) { continue; } var resolvedNeed = context.ResolveNeed(need); if (resolvedNeed.IsCorruptingILStack(context)) { var local = resolvedNeed.GenMain(context); if (local == null) { local = il.DeclareLocal(need.ClrType); il.Stloc(local); } il.Ldloc(result); il.Ldloc(local); } else { il.Ldloc(result); var local = resolvedNeed.GenMain(context); if (local != null) { il.Ldloc(local); } } il.Call(need.PropertyInfo !.GetSetMethod(true) !); } return(result); } context.PushToILStack(context.NeedsForConstructor(_constructorInfo)); context.IL.Newobj(_constructorInfo); return(null); }
public IEnumerable <INeed> GetNeeds(IGenerationContext context) { return(context.NeedsForConstructor(_constructorInfo).Concat(context.NeedsForProperties(_implementationType, _arePropertiesAutowired))); }
public IILLocal GenMain(IGenerationContext context) { context.PushToILStack(context.NeedsForConstructor(_constructorInfo)); context.IL.Newobj(_constructorInfo); return null; }
public IEnumerable<INeed> GetNeeds(IGenerationContext context) { return context.NeedsForConstructor(_constructorInfo); }
public bool IsCorruptingILStack(IGenerationContext context) { return context.AnyCorruptingStack(context.NeedsForConstructor(_constructorInfo)); }