Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed Jan 20, 2025
1 parent 0d9cd5a commit d466c88
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 18 deletions.
2 changes: 0 additions & 2 deletions build/Tools/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

namespace Build.Tools;

using System.Text;

[SuppressMessage("Reliability", "CA2012:Use ValueTasks correctly")]
internal class Commands(RootCommand rootCommand)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Pure.DI.Core/Core/Code/Compilations.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ReSharper disable ClassNeverInstantiated.Global
namespace Pure.DI.Core.Code;

public class Compilations : ICompilations
internal class Compilations : ICompilations
{
public LanguageVersion GetLanguageVersion(Compilation compilation) =>
compilation is CSharpCompilation sharpCompilation
Expand Down
2 changes: 1 addition & 1 deletion src/Pure.DI.Core/Core/Code/ICompilations.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Pure.DI.Core.Code;

public interface ICompilations
internal interface ICompilations
{
LanguageVersion GetLanguageVersion(Compilation compilation);
}
2 changes: 1 addition & 1 deletion src/Pure.DI.Core/Core/Code/TypeDescription.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Pure.DI.Core.Code;

public readonly record struct TypeDescription(
internal readonly record struct TypeDescription(
string Name,
IReadOnlyCollection<TypeDescription> TypeArgs,
ITypeParameterSymbol? TypeParam)
Expand Down
2 changes: 1 addition & 1 deletion src/Pure.DI.Core/Core/Const.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Pure.DI.Core;

public static class Const
internal static class Const
{
public const int MaxIterationsCount = 0x8FFFF;
}
3 changes: 0 additions & 3 deletions src/Pure.DI.Core/Core/Generation.cs

This file was deleted.

6 changes: 3 additions & 3 deletions src/Pure.DI.Core/Core/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ internal sealed class Generator(
ISmartTags smartTags,
IGeneratorSources sources,
CancellationToken cancellationToken)
: IBuilder<IEnumerable<SyntaxUpdate>, Generation>
: IBuilder<IEnumerable<SyntaxUpdate>, Unit>
{
public Generation Build(IEnumerable<SyntaxUpdate> updates)
public Unit Build(IEnumerable<SyntaxUpdate> updates)
{
profiler.Profile();
using var logObserverToken = observersRegistry.Register(logObserver);
Expand All @@ -28,7 +28,7 @@ public Generation Build(IEnumerable<SyntaxUpdate> updates)
logObserver.OnCompleted();
}

return new Generation();
return Unit.Shared;
}

private Unit ProcessUpdates(IEnumerable<SyntaxUpdate> updates)
Expand Down
1 change: 1 addition & 0 deletions src/Pure.DI.Core/Core/IGenericTypeArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
internal interface IGenericTypeArguments
{
bool IsGenericTypeArgument(MdSetup setup, ITypeSymbol typeSymbol);

bool IsGenericTypeArgumentAttribute(MdSetup setup, ITypeSymbol typeSymbol);
}
1 change: 1 addition & 0 deletions src/Pure.DI.Core/Core/LinesBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public IEnumerator<string> GetEnumerator()

public IDisposable SaveToArray(Encoding encoding, out byte[] buffer, out int size)
{
FlushLines();
var charCount = 0;
var newLine = Environment.NewLine;
foreach (var line in _lines)
Expand Down
2 changes: 1 addition & 1 deletion src/Pure.DI.Core/Core/Models/ArgKind.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Pure.DI.Core.Models;

public enum ArgKind
internal enum ArgKind
{
Class,
Root
Expand Down
2 changes: 1 addition & 1 deletion src/Pure.DI.Core/Core/Models/CompositionName.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Pure.DI.Core.Models;

public readonly record struct CompositionName(string ClassName, string Namespace, SyntaxNode? Source) : IComparable<CompositionName>
internal readonly record struct CompositionName(string ClassName, string Namespace, SyntaxNode? Source) : IComparable<CompositionName>
{
public bool Equals(CompositionName other) => ClassName == other.ClassName && Namespace == other.Namespace;

Expand Down
2 changes: 1 addition & 1 deletion src/Pure.DI.Core/Core/Models/LogEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// ReSharper disable NotAccessedPositionalProperty.Global
namespace Pure.DI.Core.Models;

public readonly record struct LogEntry(
internal readonly record struct LogEntry(
DiagnosticSeverity Severity,
string Message,
Location? Location = null,
Expand Down
2 changes: 1 addition & 1 deletion src/Pure.DI.Core/Core/Models/Resource.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Pure.DI.Core.Models;

public readonly record struct Resource(string Name, Stream Content) : IDisposable
internal readonly record struct Resource(string Name, Stream Content) : IDisposable
{
public void Dispose() => Content.Dispose();
}
4 changes: 2 additions & 2 deletions src/Pure.DI.Core/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ private void Setup() => DI.Setup()
// Roots
.Root<IEnumerable<Source>>(nameof(Api))
.Root<IObserversRegistry>(nameof(Observers))
.RootBind<Generation>(nameof(Generate), kind: Internal)
.To((IBuilder<IEnumerable<SyntaxUpdate>, Generation> generator, IEnumerable<SyntaxUpdate> updates) => generator.Build(updates))
.RootBind<Unit>(nameof(Generate), kind: Internal)
.To((IBuilder<IEnumerable<SyntaxUpdate>, Unit> generator, IEnumerable<SyntaxUpdate> updates) => generator.Build(updates))

.RootArg<IGeneratorOptions>("options")
.RootArg<IGeneratorSources>("sources")
Expand Down

0 comments on commit d466c88

Please sign in to comment.