-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from dansiegel/pragma-warnings
allow Pragma warning disable
- Loading branch information
Showing
4 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,28 @@ | ||
namespace CodeGenHelpers | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace CodeGenHelpers | ||
{ | ||
public abstract class BuilderBase : IBuilder | ||
{ | ||
protected readonly List<string> _pragmaWarnings = new List<string>(); | ||
|
||
internal abstract void Write(ref CodeWriter writer); | ||
|
||
void IBuilder.Write(ref CodeWriter writer) => | ||
void IBuilder.Write(ref CodeWriter writer) | ||
{ | ||
var warnings = string.Join(", ", _pragmaWarnings.Distinct()); | ||
if(_pragmaWarnings.Any()) | ||
{ | ||
writer.AppendUnindentedLine($"#pragma warning disable {warnings}"); | ||
} | ||
|
||
Write(ref writer); | ||
|
||
if (_pragmaWarnings.Any()) | ||
{ | ||
writer.AppendUnindentedLine($"#pragma warning restore {warnings}"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace CodeGenHelpers | ||
{ | ||
public class CompilerWarnings | ||
{ | ||
/// <summary> | ||
/// The field is never used | ||
/// </summary> | ||
public const string CS0169 = nameof(CS0169); | ||
|
||
/// <summary> | ||
/// The member is marked obsolete | ||
/// </summary> | ||
public const string CS0612 = nameof(CS0612); | ||
|
||
/// <summary> | ||
/// The member is marked obsolete with a message | ||
/// </summary> | ||
public const string CS0618 = nameof(CS0618); | ||
} | ||
} |