Skip to content

Commit 6a1d4b3

Browse files
committed
Support -unsafe command for Roslyn Compiler
1 parent 95b20e5 commit 6a1d4b3

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

core/IncrementalCompiler/CompileOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class CompileOptions
3030
[DataMember] public List<string> References = new List<string>();
3131
[DataMember] public List<string> Files = new List<string>();
3232
[DataMember] public List<string> NoWarnings = new List<string>();
33+
[DataMember] public List<string> Options = new List<string>();
3334
[DataMember] public DebugSymbolFileType DebugSymbolFile;
3435
[DataMember] public PrebuiltOutputReuseType PrebuiltOutputReuse;
3536

@@ -80,6 +81,10 @@ public void ParseArgument(string[] args)
8081
: id);
8182
}
8283
break;
84+
85+
default:
86+
Options.Add(arg);
87+
break;
8388
}
8489
}
8590
else if (arg.StartsWith("@"))

core/IncrementalCompiler/Compiler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ private CompileResult BuildFull(CompileOptions options)
6969
_sourceMap.Values,
7070
_referenceMap.Values,
7171
new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)
72-
.WithSpecificDiagnosticOptions(specificDiagnosticOptions));
72+
.WithSpecificDiagnosticOptions(specificDiagnosticOptions)
73+
.WithAllowUnsafe(options.Options.Contains("-unsafe")));
7374

7475
Emit(result);
7576

0 commit comments

Comments
 (0)