Skip to content

Commit

Permalink
Update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed Aug 28, 2024
1 parent 652d9e5 commit 042a52b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CSharpInteractive.Tests/CSharpInteractive.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
<PackageReference Include="Moq" Version="4.20.70"/>
<PackageReference Include="Pure.DI" Version="2.1.32">
<PackageReference Include="Pure.DI" Version="2.1.34">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion CSharpInteractive/CSharpInteractive.Tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<PackageReference Include="NuGet.Build.Tasks" Version="6.4.0"/>
<PackageReference Include="Microsoft.Build.Framework" Version="16.8.0" IncludeAssets="all"/>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.8.0" IncludeAssets="all"/>
<PackageReference Include="Pure.DI" Version="2.1.32">
<PackageReference Include="Pure.DI" Version="2.1.34">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion CSharpInteractive/CSharpInteractive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<PackageReference Include="NuGet.Build.Tasks" Version="6.4.0"/>
<PackageReference Include="Microsoft.Build.Framework" Version="16.8.0" IncludeAssets="all"/>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.8.0" IncludeAssets="all"/>
<PackageReference Include="Pure.DI" Version="2.1.32">
<PackageReference Include="Pure.DI" Version="2.1.34">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
11 changes: 6 additions & 5 deletions CSharpInteractive/Composition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@ private static void Setup()
return scriptRunner;
}
})
// Default settings
.Bind().To(_ => OptimizationLevel.Release)
.Bind().To(_ => (WarningLevel)ScriptOptions.Default.WarningLevel)
.Bind().To(_ => ScriptOptions.Default.CheckOverflow ? CheckOverflow.On : CheckOverflow.Off)
.Bind().To(_ => ScriptOptions.Default.AllowUnsafe ? AllowUnsafe.On : AllowUnsafe.Off)

.DefaultLifetime(Lifetime.Singleton)
.Bind(Tag.Type).To<ExitManager>()
.Bind(Tag.Type).To<Debugger>()
.Bind(InteractionMode.Interactive).To<InteractiveRunner>()
.Bind(InteractionMode.NonInteractive).To<ScriptRunner>()
.Bind().To<CommandSource>()
.Bind().To<Setting<TTE>>()
#endif
#if APPLICATION
.Bind().As(Lifetime.Transient).To(_ => RunningMode.Application)
Expand Down Expand Up @@ -165,11 +171,6 @@ private static void Setup()
.Bind().To<ProcessInFlowRunner>()
.Bind().To<NuGetReferenceResolver>()
.Bind().To<ScriptContentReplacer>()
.Bind().To(_ => new Setting<LanguageVersion>(LanguageVersion.Default))
.Bind().To(_ => new Setting<OptimizationLevel>(OptimizationLevel.Release))
.Bind().To(_ => new Setting<WarningLevel>((WarningLevel)ScriptOptions.Default.WarningLevel))
.Bind().To(_ => new Setting<CheckOverflow>(ScriptOptions.Default.CheckOverflow ? CheckOverflow.On : CheckOverflow.Off))
.Bind().To(_ => new Setting<AllowUnsafe>(ScriptOptions.Default.AllowUnsafe ? AllowUnsafe.On : AllowUnsafe.Off))
.Bind(Tag.Type).To<AssembliesScriptOptionsProvider>()
.Bind(Tag.Type).Bind<IReferenceRegistry>().To<ReferencesScriptOptionsFactory>()
.Bind(Tag.Type).To<SourceFileScriptOptionsFactory>()
Expand Down
8 changes: 5 additions & 3 deletions CSharpInteractive/Core/Setting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ namespace CSharpInteractive.Core;
internal class Setting<T>(T defaultSettingValue) : ISettingGetter<T>, ISettingSetter<T>
where T: struct, Enum
{
public T GetSetting() => defaultSettingValue;
private T _defaultSettingValue = defaultSettingValue;

public T GetSetting() => _defaultSettingValue;

public T SetSetting(T value)
{
var prevValue = defaultSettingValue;
defaultSettingValue = value;
var prevValue = _defaultSettingValue;
_defaultSettingValue = value;
return prevValue;
}
}

0 comments on commit 042a52b

Please sign in to comment.