From 28247d71ff27d5a25b68ee272e57b83132768914 Mon Sep 17 00:00:00 2001 From: Nikolay Pianikov Date: Wed, 28 Aug 2024 14:51:06 +0300 Subject: [PATCH] Minor formatting --- readme/async-disposable-scope.md | 2 +- readme/async-root.md | 2 +- readme/auto-scoped.md | 2 +- readme/func-with-tag.md | 2 +- readme/func.md | 2 +- readme/generic-async-composition-roots-with-constraints.md | 4 ++-- readme/lazy.md | 2 +- readme/manually-started-tasks.md | 2 +- readme/scope.md | 2 +- readme/task.md | 2 +- readme/tracking-async-disposable-instances-in-delegates.md | 2 +- readme/tracking-disposable-instances-in-delegates.md | 2 +- src/Pure.DI.Core/Core/Code/BuildTools.cs | 4 ++-- src/Pure.DI.Core/Core/Code/FactoryCodeBuilder.cs | 2 +- src/Pure.DI.Core/Core/Code/IBuildTools.cs | 2 +- 15 files changed, 17 insertions(+), 17 deletions(-) diff --git a/readme/async-disposable-scope.md b/readme/async-disposable-scope.md index d683fb6ab..b45666ef2 100644 --- a/readme/async-disposable-scope.md +++ b/readme/async-disposable-scope.md @@ -136,7 +136,7 @@ partial class Composition: IDisposable, IAsyncDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perBlockFunc1 = default(Func ); + var perBlockFunc1 = default(Func); perBlockFunc1 = new Func([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { Composition transientComposition3 = this; diff --git a/readme/async-root.md b/readme/async-root.md index e99f1d161..dac1d8419 100644 --- a/readme/async-root.md +++ b/readme/async-root.md @@ -59,7 +59,7 @@ partial class Composition TaskContinuationOptions localTaskContinuationOptions19 = transientTaskContinuationOptions4; TaskScheduler localTaskScheduler20 = transientTaskScheduler5; perBlockTaskFactory2 = new TaskFactory(localCancellationToken17, localTaskCreationOptions18, localTaskContinuationOptions19, localTaskScheduler20); - var perBlockFunc1 = default(Func ); + var perBlockFunc1 = default(Func); perBlockFunc1 = new Func([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { IService localValue21 = new Service(new Dependency()); diff --git a/readme/auto-scoped.md b/readme/auto-scoped.md index ca1f15b31..e59087942 100644 --- a/readme/auto-scoped.md +++ b/readme/auto-scoped.md @@ -95,7 +95,7 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perBlockFunc1 = default(Func ); + var perBlockFunc1 = default(Func); perBlockFunc1 = new Func([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { Composition transientComposition3 = this; diff --git a/readme/func-with-tag.md b/readme/func-with-tag.md index d2e0a4cfa..03bdecc0f 100644 --- a/readme/func-with-tag.md +++ b/readme/func-with-tag.md @@ -59,7 +59,7 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perBlockFunc1 = default(Func ); + var perBlockFunc1 = default(Func); perBlockFunc1 = new Func([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { IDependency localValue32 = new Dependency(); diff --git a/readme/func.md b/readme/func.md index 26997d007..840e20c66 100644 --- a/readme/func.md +++ b/readme/func.md @@ -62,7 +62,7 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perBlockFunc1 = default(Func ); + var perBlockFunc1 = default(Func); perBlockFunc1 = new Func([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { IDependency localValue30 = new Dependency(); diff --git a/readme/generic-async-composition-roots-with-constraints.md b/readme/generic-async-composition-roots-with-constraints.md index ffe5c48a3..3ead1ebbe 100644 --- a/readme/generic-async-composition-roots-with-constraints.md +++ b/readme/generic-async-composition-roots-with-constraints.md @@ -93,7 +93,7 @@ partial class Composition TaskContinuationOptions localTaskContinuationOptions48 = transientTaskContinuationOptions4; TaskScheduler localTaskScheduler49 = transientTaskScheduler5; perBlockTaskFactory2 = new TaskFactory>(localCancellationToken46, localTaskCreationOptions47, localTaskContinuationOptions48, localTaskScheduler49); - var perBlockFunc1 = default(Func> ); + var perBlockFunc1 = default(Func>); perBlockFunc1 = new Func>([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { OtherService transientOtherService6; @@ -123,7 +123,7 @@ partial class Composition TaskContinuationOptions localTaskContinuationOptions56 = transientTaskContinuationOptions4; TaskScheduler localTaskScheduler57 = transientTaskScheduler5; perBlockTaskFactory2 = new TaskFactory>(localCancellationToken54, localTaskCreationOptions55, localTaskContinuationOptions56, localTaskScheduler57); - var perBlockFunc1 = default(Func> ); + var perBlockFunc1 = default(Func>); perBlockFunc1 = new Func>([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { IService localValue58 = new Service(new Dependency()); diff --git a/readme/lazy.md b/readme/lazy.md index a153daa0b..92138e418 100644 --- a/readme/lazy.md +++ b/readme/lazy.md @@ -53,7 +53,7 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perBlockFunc2 = default(Func ); + var perBlockFunc2 = default(Func); perBlockFunc2 = new Func([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { IDependency localValue33 = new Dependency(); diff --git a/readme/manually-started-tasks.md b/readme/manually-started-tasks.md index ddf032551..8f68281fc 100644 --- a/readme/manually-started-tasks.md +++ b/readme/manually-started-tasks.md @@ -91,7 +91,7 @@ partial class Composition [MethodImpl(MethodImplOptions.AggressiveInlining)] public IService GetRoot(CancellationToken cancellationToken) { - var perBlockFunc2 = default(Func ); + var perBlockFunc2 = default(Func); perBlockFunc2 = new Func([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { IDependency localValue35 = new Dependency(); diff --git a/readme/scope.md b/readme/scope.md index 718b31cca..fa0e81665 100644 --- a/readme/scope.md +++ b/readme/scope.md @@ -134,7 +134,7 @@ partial class Composition: IDisposable [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - var perBlockFunc1 = default(Func ); + var perBlockFunc1 = default(Func); perBlockFunc1 = new Func([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { Composition transientComposition3 = this; diff --git a/readme/task.md b/readme/task.md index cb7185871..b17c28ac6 100644 --- a/readme/task.md +++ b/readme/task.md @@ -88,7 +88,7 @@ partial class Composition TaskContinuationOptions localTaskContinuationOptions40 = transientTaskContinuationOptions5; TaskScheduler localTaskScheduler41 = transientTaskScheduler6; perBlockTaskFactory3 = new TaskFactory(localCancellationToken38, localTaskCreationOptions39, localTaskContinuationOptions40, localTaskScheduler41); - var perBlockFunc2 = default(Func ); + var perBlockFunc2 = default(Func); perBlockFunc2 = new Func([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { IDependency localValue42 = new Dependency(); diff --git a/readme/tracking-async-disposable-instances-in-delegates.md b/readme/tracking-async-disposable-instances-in-delegates.md index 6a702e0e8..157dbe9e2 100644 --- a/readme/tracking-async-disposable-instances-in-delegates.md +++ b/readme/tracking-async-disposable-instances-in-delegates.md @@ -97,7 +97,7 @@ partial class Composition get { var accumulator41 = new Owned(); - var perBlockFunc1 = default(Func> ); + var perBlockFunc1 = default(Func>); perBlockFunc1 = new Func>([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { var accumulator41 = new Owned(); diff --git a/readme/tracking-disposable-instances-in-delegates.md b/readme/tracking-disposable-instances-in-delegates.md index 5614fa970..df2b585cb 100644 --- a/readme/tracking-disposable-instances-in-delegates.md +++ b/readme/tracking-disposable-instances-in-delegates.md @@ -90,7 +90,7 @@ partial class Composition get { var accumulator41 = new Owned(); - var perBlockFunc1 = default(Func> ); + var perBlockFunc1 = default(Func>); perBlockFunc1 = new Func>([MethodImpl(MethodImplOptions.AggressiveInlining)] () => { var accumulator41 = new Owned(); diff --git a/src/Pure.DI.Core/Core/Code/BuildTools.cs b/src/Pure.DI.Core/Core/Code/BuildTools.cs index 47bfed2c5..28c554224 100644 --- a/src/Pure.DI.Core/Core/Code/BuildTools.cs +++ b/src/Pure.DI.Core/Core/Code/BuildTools.cs @@ -15,8 +15,8 @@ public void AddPureHeader(LinesBuilder code) code.AppendLine("#endif"); } - public string GetDeclaration(Variable variable) => - variable.IsDeclared ? "" : $"{typeResolver.Resolve(variable.Setup, variable.InstanceType)} "; + public string GetDeclaration(Variable variable, string separator = " ") => + variable.IsDeclared ? "" : $"{typeResolver.Resolve(variable.Setup, variable.InstanceType)}{separator}"; public string OnInjected(BuildContext ctx, Variable variable) { diff --git a/src/Pure.DI.Core/Core/Code/FactoryCodeBuilder.cs b/src/Pure.DI.Core/Core/Code/FactoryCodeBuilder.cs index f68c94a3a..a8233d453 100644 --- a/src/Pure.DI.Core/Core/Code/FactoryCodeBuilder.cs +++ b/src/Pure.DI.Core/Core/Code/FactoryCodeBuilder.cs @@ -163,7 +163,7 @@ public void Build(BuildContext ctx, in DpFactory factory) var lines = new List(); if (!variable.IsDeclared && variable.IsLazy) { - ctx.Code.AppendLine($"var {variable.VariableName} = default({ctx.BuildTools.GetDeclaration(variable)});"); + ctx.Code.AppendLine($"var {variable.VariableName} = default({ctx.BuildTools.GetDeclaration(variable, "")});"); variable.IsDeclared = true; } diff --git a/src/Pure.DI.Core/Core/Code/IBuildTools.cs b/src/Pure.DI.Core/Core/Code/IBuildTools.cs index 238ad8c7f..24cfe95e8 100644 --- a/src/Pure.DI.Core/Core/Code/IBuildTools.cs +++ b/src/Pure.DI.Core/Core/Code/IBuildTools.cs @@ -4,7 +4,7 @@ internal interface IBuildTools { void AddPureHeader(LinesBuilder code); - string GetDeclaration(Variable variable); + string GetDeclaration(Variable variable, string separator = " "); string OnInjected(BuildContext ctx, Variable variable);