-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathCompilationOptions.cs
50 lines (45 loc) · 1.56 KB
/
CompilationOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (C) 2015-2023 The Neo Project.
//
// The Neo.Compiler.CSharp is free software distributed under the MIT
// software license, see the accompanying file LICENSE in the main directory
// of the project or http://www.opensource.org/licenses/mit-license.php
// for more details.
//
// Redistribution and use in source and binary forms with or without
// modifications are permitted.
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using System;
using System.Collections.Generic;
namespace Neo.Compiler
{
public class CompilationOptions
{
[Flags]
public enum OptimizationType : byte
{
None = 0,
Basic = 1,
Experimental = 2,
All = Basic | Experimental
}
public NullableContextOptions Nullable { get; set; }
public bool Debug { get; set; }
public OptimizationType Optimize { get; set; } = OptimizationType.Basic;
public bool Checked { get; set; }
public bool NoInline { get; set; }
public byte AddressVersion { get; set; } = 0x35;
public string? BaseName { get; set; }
private CSharpParseOptions? parseOptions = null;
public CSharpParseOptions GetParseOptions()
{
if (parseOptions is null)
{
List<string> preprocessorSymbols = new();
if (Debug) preprocessorSymbols.Add("DEBUG");
parseOptions = new CSharpParseOptions(preprocessorSymbols: preprocessorSymbols);
}
return parseOptions;
}
}
}