Skip to content

Commit

Permalink
Update src/PublicApiGenerator/CodeNormalizer.cs
Browse files Browse the repository at this point in the history
Co-Authored-By: Joseph Musser <me@jnm2.com>
  • Loading branch information
danielmarbach and jnm2 committed Nov 5, 2019
1 parent d164983 commit adc325f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/PublicApiGenerator/CodeNormalizer.cs
Expand Up @@ -34,7 +34,8 @@ public static string NormalizeGeneratedCode(StringWriter writer)
gennedClass = Regex.Replace(gennedClass, Set, " { set; }", RegexOptions.IgnorePatternWhitespace);
gennedClass = Regex.Replace(gennedClass, @"\s+{\s+}", " { }", RegexOptions.IgnorePatternWhitespace);
gennedClass = Regex.Replace(gennedClass, @"\)\s+;", ");", RegexOptions.IgnorePatternWhitespace);
gennedClass = Regex.Replace(gennedClass, $@"(?s)(?<=\[[^\]]*)(Attribute)?({AttributeMarker}(\(\))?(?=\])|{AttributeMarker}(?=\(.+\)\])|{AttributeMarker}(?=new.+\}}\)\]))", string.Empty, RegexOptions.IgnorePatternWhitespace);
var attributeMarkerEscaped = Regex.Escape(AttributeMarker);
gennedClass = Regex.Replace(gennedClass, $@"(Attribute)?({attributeMarkerEscaped}(\(\))?(?=\])|{attributeMarkerEscaped}(?=\(.+\)\])|{attributeMarkerEscaped}(?=new.+\}}\)\]))", string.Empty, RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);

gennedClass = gennedClass.Replace("class " + StaticMarker, "static class ");
gennedClass = gennedClass.Replace("struct " + ReadonlyMarker, "readonly struct ");
Expand Down

0 comments on commit adc325f

Please sign in to comment.