[gh-88] Reapplied unsafe to decompilation (but not execution).
This commit is contained in:
Родитель
440901b32d
Коммит
595cbc2744
|
@ -1,5 +1,8 @@
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Microsoft.CodeAnalysis.CSharp;
|
||||||
using MirrorSharp.Advanced;
|
using MirrorSharp.Advanced;
|
||||||
|
using MirrorSharp.FSharp.Advanced;
|
||||||
|
using SharpLab.Server.MirrorSharp.Internal;
|
||||||
|
|
||||||
namespace SharpLab.Server.MirrorSharp {
|
namespace SharpLab.Server.MirrorSharp {
|
||||||
[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)]
|
[UsedImplicitly(ImplicitUseKindFlags.InstantiatedNoFixedConstructorSignature)]
|
||||||
|
@ -11,11 +14,18 @@ namespace SharpLab.Server.MirrorSharp {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
session.SetTargetName(value);
|
session.SetTargetName(value);
|
||||||
//if (value == TargetNames.Run) {
|
SetAllowUnsafe(session, value != TargetNames.Run);
|
||||||
// session.Roslyn.Project.
|
|
||||||
//}
|
|
||||||
|
|
||||||
return true;
|
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.IO.RecyclableMemoryStream" Version="1.2.1" />
|
||||||
<PackageReference Include="Microsoft.Owin.Cors" Version="3.0.1" />
|
<PackageReference Include="Microsoft.Owin.Cors" Version="3.0.1" />
|
||||||
<PackageReference Include="Microsoft.Owin.Host.SystemWeb" 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.FSharp" Version="0.9.0-pre-20170620" />
|
||||||
<PackageReference Include="MirrorSharp.Owin" Version="0.9.0-pre-20170523" />
|
<PackageReference Include="MirrorSharp.Owin" Version="0.9.0-pre-20170523" />
|
||||||
<PackageReference Include="MirrorSharp.VisualBasic" Version="0.9.0-pre-20170523" />
|
<PackageReference Include="MirrorSharp.VisualBasic" Version="0.9.0-pre-20170523" />
|
||||||
|
|
Загрузка…
Ссылка в новой задаче