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) · 740 Bytes
/
RoslynModule.cs
File metadata and controls
21 lines (19 loc) · 740 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(RoslynScriptPersistentEngine) : typeof(RoslynScriptEngine);
engineType = config.Debug ? typeof(RoslynScriptInMemoryEngine) : engineType;
engineType = config.IsRepl ? typeof(RoslynReplEngine) : engineType;
config.Overrides[typeof(IScriptEngine)] = engineType;
}
}
}
}