forked from scriptcs/scriptcs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoslynModule.cs
More file actions
21 lines (19 loc) · 734 Bytes
/
RoslynModule.cs
File metadata and controls
21 lines (19 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using ScriptCs.Contracts;
namespace ScriptCs.Engine.Roslyn
{
[Module("roslyn")]
public class RoslynModule : IModule
{
public void Initialize(IModuleConfiguration config)
{
Guard.AgainstNullArgument("config", config);
if (!config.Overrides.ContainsKey(typeof(IScriptEngine)))
{
var engineType = config.Cache ? typeof(CSharpPersistentEngine) : typeof(CSharpScriptEngine);
engineType = config.Debug ? typeof(CSharpScriptInMemoryEngine) : engineType;
engineType = config.IsRepl ? typeof(CSharpReplEngine) : engineType;
config.Overrides[typeof(IScriptEngine)] = engineType;
}
}
}
}