[gh-88] Reapplied unsafe to decompilation (but not execution).

This commit is contained in:
Andrey Shchekin 2017-07-23 11:45:48 +12:00
Родитель 440901b32d
Коммит 595cbc2744
2 изменённых файлов: 15 добавлений и 5 удалений

Просмотреть файл

@ -1,5 +1,8 @@
using JetBrains.Annotations;
using Microsoft.CodeAnalysis.CSharp;
using MirrorSharp.Advanced;
using MirrorSharp.FSharp.Advanced;
using SharpLab.Server.MirrorSharp.Internal;
namespace SharpLab.Server.MirrorSharp {
[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)]
@ -11,11 +14,18 @@ namespace SharpLab.Server.MirrorSharp {
return false;
session.SetTargetName(value);
//if (value == TargetNames.Run) {
// session.Roslyn.Project.
//}
SetAllowUnsafe(session, value != TargetNames.Run);
return true;
}
private void SetAllowUnsafe(IWorkSession session, bool enabled) {
if (!session.IsRoslyn)
return;
var project = session.Roslyn.Project;
if (!(project.CompilationOptions is CSharpCompilationOptions csharpOptions))
return;
project = project.WithCompilationOptions(csharpOptions.WithAllowUnsafe(enabled));
session.Roslyn.Project = project;
}
}
}

Просмотреть файл

@ -20,7 +20,7 @@
<PackageReference Include="Microsoft.IO.RecyclableMemoryStream" Version="1.2.1" />
<PackageReference Include="Microsoft.Owin.Cors" Version="3.0.1" />
<PackageReference Include="Microsoft.Owin.Host.SystemWeb" Version="3.0.1" />
<PackageReference Include="MirrorSharp.Common" Version="0.9.0-pre-20170722-local-1" />
<PackageReference Include="MirrorSharp.Common" Version="0.9.0-pre-20170723-local-2" />
<PackageReference Include="MirrorSharp.FSharp" Version="0.9.0-pre-20170620" />
<PackageReference Include="MirrorSharp.Owin" Version="0.9.0-pre-20170523" />
<PackageReference Include="MirrorSharp.VisualBasic" Version="0.9.0-pre-20170523" />