Skip to content

Commit 0b78b20

Browse files
Code cleanup
1 parent 751a48a commit 0b78b20

File tree

11 files changed

+27
-17
lines changed

11 files changed

+27
-17
lines changed

CSharpInteractive/Composition.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ private static void Setup()
149149
.Bind().To<Settings>()
150150
.Bind().To<Info>()
151151
.Bind().To<ConsoleSource>()
152-
.Bind(typeof(LoadFileCodeSource)).To(ctx => new Func<string, ICodeSource>(name =>
152+
.Bind(LoadFileCode).To(ctx => new Func<string, ICodeSource>(name =>
153153
{
154154
ctx.Inject<LoadFileCodeSource>(out var loadFileCodeSource);
155155
loadFileCodeSource.Name = name;
156156
return loadFileCodeSource;
157157
}))
158-
.Bind(typeof(LineCodeSource)).To(ctx => new Func<string, ICodeSource>(line =>
158+
.Bind(LineCode).To(ctx => new Func<string, ICodeSource>(line =>
159159
{
160160
ctx.Inject<LineCodeSource>(out var lineCodeSource);
161161
lineCodeSource.Line = line;

CSharpInteractive/Core/BuildMessageLogWriter.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ namespace CSharpInteractive.Core;
44

55
using HostApi;
66
using Pure.DI;
7+
using static Pure.DI.Tag;
78

89
internal class BuildMessageLogWriter(
910
ILog<BuildMessageLogWriter> log,
10-
[Tag(Tag.Base)] IStdOut stdOut,
11-
[Tag(Tag.Base)] IStdErr stdErr)
11+
[Tag(Base)] IStdOut stdOut,
12+
[Tag(Base)] IStdErr stdErr)
1213
: IBuildMessageLogWriter
1314
{
1415
public void Write(ProcessInfo processInfo, BuildMessage message)

CSharpInteractive/Core/BuildRunner.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace CSharpInteractive.Core;
99

1010
using HostApi;
1111
using Pure.DI;
12+
using static Pure.DI.Tag;
1213

1314
internal class BuildRunner(
1415
IProcessRunner processRunner,
@@ -17,8 +18,8 @@ internal class BuildRunner(
1718
Func<IBuildContext> buildContextFactory,
1819
IBuildOutputProcessor buildOutputProcessor,
1920
Func<IProcessMonitor> monitorFactory,
20-
[Tag(Tag.Base)] IBuildMessagesProcessor defaultBuildMessagesProcessor,
21-
[Tag(Tag.Custom)] IBuildMessagesProcessor customBuildMessagesProcessor,
21+
[Tag(Base)] IBuildMessagesProcessor defaultBuildMessagesProcessor,
22+
[Tag(Custom)] IBuildMessagesProcessor customBuildMessagesProcessor,
2223
IProcessResultHandler processResultHandler,
2324
IStartInfoDescription startInfoDescription,
2425
ICommandLineStatisticsRegistry statisticsRegistry)

CSharpInteractive/Core/CISpecific.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
namespace CSharpInteractive.Core;
55

66
using Pure.DI;
7+
using static Pure.DI.Tag;
78

89
internal class CISpecific<T>(
910
ICISettings settings,
10-
[Tag(Tag.Base)] Func<T> defaultFactory,
11-
[Tag(Tag.TeamCity)] Func<T> teamcityFactory,
12-
[Tag(Tag.Ansi)] Func<T> ansiFactory)
11+
[Tag(Base)] Func<T> defaultFactory,
12+
[Tag(TeamCity)] Func<T> teamcityFactory,
13+
[Tag(Ansi)] Func<T> ansiFactory)
1314
: ICISpecific<T>
1415
{
1516
public T Instance => settings.CIType switch

CSharpInteractive/Core/DotnetEnvironment.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ namespace CSharpInteractive.Core;
55

66
using System.Runtime.InteropServices;
77
using Pure.DI;
8+
using static Pure.DI.Tag;
89

910
internal class DotNetEnvironment(
10-
[Tag(Tag.TargetFrameworkMoniker)] string targetFrameworkMoniker,
11-
[Tag(Tag.ModuleFile)] string moduleFile,
11+
[Tag(TargetFrameworkMoniker)] string targetFrameworkMoniker,
12+
[Tag(ModuleFile)] string moduleFile,
1213
IEnvironment environment,
1314
IFileExplorer fileExplorer)
1415
: IDotNetEnvironment, ITraceSource

CSharpInteractive/Core/ProcessInFlowRunner.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ namespace CSharpInteractive.Core;
66
using HostApi;
77
using JetBrains.TeamCity.ServiceMessages.Write.Special;
88
using Pure.DI;
9+
using static Pure.DI.Tag;
910

1011
internal class ProcessInFlowRunner(
11-
[Tag(Tag.Base)] IProcessRunner baseProcessRunner,
12+
[Tag(Base)] IProcessRunner baseProcessRunner,
1213
ICISettings ciSettings,
1314
ITeamCityWriter teamCityWriter,
1415
IFlowContext flowContext)

CSharpInteractive/Core/ReliableBuildContext.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ namespace CSharpInteractive.Core;
66
using HostApi;
77
using JetBrains.TeamCity.ServiceMessages;
88
using Pure.DI;
9+
using static Pure.DI.Tag;
910

1011
internal class ReliableBuildContext(
1112
ICISettings ciSettings,
1213
IFileSystem fileSystem,
1314
IMessagesReader messagesReader,
14-
[Tag(Tag.Base)] IBuildContext baseBuildContext)
15+
[Tag(Base)] IBuildContext baseBuildContext)
1516
: IBuildContext
1617
{
1718
private readonly Dictionary<string, Output> _sources = new();

CSharpInteractive/Core/RuntimeExplorer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
namespace CSharpInteractive.Core;
44

55
using Pure.DI;
6+
using static Pure.DI.Tag;
67

78
internal class RuntimeExplorer(
8-
[Tag(Tag.RuntimePath)] string runtimePath,
9+
[Tag(RuntimePath)] string runtimePath,
910
IFileSystem fileSystem) : IRuntimeExplorer
1011
{
1112
public bool TryFindRuntimeAssembly(string assemblyPath, [MaybeNullWhen(false)] out string runtimeAssemblyPath)

CSharpInteractive/Core/ScriptContentReplacer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ namespace CSharpInteractive.Core;
44

55
using NuGet.Packaging;
66
using Pure.DI;
7+
using static Pure.DI.Tag;
78

89
internal class ScriptContentReplacer(
910
INuGetReferenceResolver nuGetReferenceResolver,
@@ -13,7 +14,7 @@ internal class ScriptContentReplacer(
1314
IFileSystem fileSystem,
1415
IUniqueNameGenerator uniqueNameGenerator,
1516
IEnvironment environment,
16-
[Tag(typeof(LineCodeSource))] Func<string, ICodeSource> codeSourceFactory)
17+
[Tag(LineCode)] Func<string, ICodeSource> codeSourceFactory)
1718
: IScriptContentReplacer
1819
{
1920
[SuppressMessage("Performance", "CA1806:Do not ignore method results")]

CSharpInteractive/Core/Settings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ namespace CSharpInteractive.Core;
44

55
using System.Collections.Immutable;
66
using Pure.DI;
7+
using static Pure.DI.Tag;
78

89
internal class Settings(
910
RunningMode runningMode,
1011
IEnvironment environment,
1112
ICommandLineParser commandLineParser,
1213
ICodeSource consoleCodeSource,
13-
[Tag(typeof(LoadFileCodeSource))] Func<string, ICodeSource> fileCodeSourceFactory)
14+
[Tag(LoadFileCode)] Func<string, ICodeSource> fileCodeSourceFactory)
1415
: ISettings, ISettingSetter<VerbosityLevel>
1516
{
1617
private readonly object _lockObject = new();

0 commit comments

Comments
 (0)