From 2ff8e5b71b00ed8fe31e82e8da67e04cb8710602 Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Tue, 5 Dec 2023 08:13:55 +0200 Subject: [PATCH] Fix formatting --- src/Visp.Common/PooledDictionary.cs | 21 +++++++++---------- src/Visp.Common/PooledDisposer.cs | 5 +---- src/Visp.Common/PooledList.cs | 13 ++++++------ .../Transforms/SyntaxMacroExpander.fs | 4 ++-- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/Visp.Common/PooledDictionary.cs b/src/Visp.Common/PooledDictionary.cs index 3fb996b..0e6b1cd 100644 --- a/src/Visp.Common/PooledDictionary.cs +++ b/src/Visp.Common/PooledDictionary.cs @@ -8,21 +8,18 @@ namespace Visp.Common; public static class PooledDictionary { - public static void ReturnToPool(this Dictionary it) where K : notnull - => PooledDictionary.Return(it); + public static void ReturnToPool(this Dictionary it) + where K : notnull => PooledDictionary.Return(it); - public static Dictionary Get() where K : notnull - => PooledDictionary.Get(); + public static Dictionary Get() + where K : notnull => PooledDictionary.Get(); - public static PooledDisposer> GetPooled() where K : notnull - => new( - PooledDictionary.Get(), - ReturnToPool - ); + public static PooledDisposer> GetPooled() + where K : notnull => new(PooledDictionary.Get(), ReturnToPool); } public static class PooledDictionary - where K: notnull + where K : notnull { internal class PooledDictionaryPolicy : PooledObjectPolicy> { @@ -44,7 +41,9 @@ public override bool Return(Dictionary obj) } } - private static readonly ObjectPool> s_pool = new DefaultObjectPool>(new PooledDictionaryPolicy()); + private static readonly ObjectPool> s_pool = new DefaultObjectPool< + Dictionary + >(new PooledDictionaryPolicy()); public static Dictionary Get() => s_pool.Get(); diff --git a/src/Visp.Common/PooledDisposer.cs b/src/Visp.Common/PooledDisposer.cs index 6d29482..2b56c32 100644 --- a/src/Visp.Common/PooledDisposer.cs +++ b/src/Visp.Common/PooledDisposer.cs @@ -12,10 +12,7 @@ namespace Visp.Common; /// Type of object contained /// Value /// Function to call when disposed -public readonly struct PooledDisposer( - T value, - Action ret -) : IDisposable +public readonly struct PooledDisposer(T value, Action ret) : IDisposable { /// /// The value diff --git a/src/Visp.Common/PooledList.cs b/src/Visp.Common/PooledList.cs index fb04d06..e1afc48 100644 --- a/src/Visp.Common/PooledList.cs +++ b/src/Visp.Common/PooledList.cs @@ -9,19 +9,16 @@ namespace Visp.Common; public static class PooledList { - public static void ReturnToPool(this List obj) => - PooledList.Return(obj); + public static void ReturnToPool(this List obj) => PooledList.Return(obj); - public static T[] ToArrayAndReturn(this List s) => - PooledList.ToArrayAndReturn(s); + public static T[] ToArrayAndReturn(this List s) => PooledList.ToArrayAndReturn(s); public static ImmutableArray ToImmutableAndReturn(this List s) => PooledList.ToImmutableAndReturn(s); public static List Get() => PooledList.Get(); - public static PooledDisposer> GetPooled() => - new(Get(), ReturnToPool); + public static PooledDisposer> GetPooled() => new(Get(), ReturnToPool); } public static class PooledList @@ -46,7 +43,9 @@ public override bool Return(List obj) } } - private static readonly ObjectPool> s_pool = new DefaultObjectPool>(new PooledListPolicy()); + private static readonly ObjectPool> s_pool = new DefaultObjectPool>( + new PooledListPolicy() + ); public static List Get() => s_pool.Get(); diff --git a/src/Visp.Compiler/Transforms/SyntaxMacroExpander.fs b/src/Visp.Compiler/Transforms/SyntaxMacroExpander.fs index fbed678..86b4119 100644 --- a/src/Visp.Compiler/Transforms/SyntaxMacroExpander.fs +++ b/src/Visp.Compiler/Transforms/SyntaxMacroExpander.fs @@ -139,10 +139,10 @@ let private evaluatePatterns | SynConst.Unit -> res.Add(UNIT) | SynConst.Nil -> res.Add(NIL) | SynConst.String(s, k, _) -> res.Add(STRING(s, k, ParseHelpers.LexCont.Token())) + () - | SynMacroBody.Symbol sym -> - res.Add(LexHelpers.symbolOrKeyword sym.Text) + | SynMacroBody.Symbol sym -> res.Add(LexHelpers.symbolOrKeyword sym.Text) use pooled = PooledList.GetPooled() let res = pooled.Value