From f4f291a7f2b225ff43683bed750a6c398835732b Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Fri, 19 May 2017 09:47:55 -0700 Subject: [PATCH] PR feedback --- .../{ClassName.cs => CSharpIdentifier.cs} | 2 +- .../MvcViewDocumentClassifierPass.cs | 2 +- .../NamespaceDirective.cs | 8 ++++---- .../RazorPageDocumentClassifierPass.cs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) rename src/Microsoft.AspNetCore.Mvc.Razor.Extensions/{ClassName.cs => CSharpIdentifier.cs} (97%) diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ClassName.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/CSharpIdentifier.cs similarity index 97% rename from src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ClassName.cs rename to src/Microsoft.AspNetCore.Mvc.Razor.Extensions/CSharpIdentifier.cs index 6f8033b8e3..cd2661a70c 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/ClassName.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/CSharpIdentifier.cs @@ -6,7 +6,7 @@ using System.Text; namespace Microsoft.AspNetCore.Mvc.Razor.Extensions { - internal static class ClassName + internal static class CSharpIdentifier { public static string GetClassNameFromPath(string path) { diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/MvcViewDocumentClassifierPass.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/MvcViewDocumentClassifierPass.cs index da2b2865e6..a6ee8005c3 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/MvcViewDocumentClassifierPass.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/MvcViewDocumentClassifierPass.cs @@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions var filePath = codeDocument.GetRelativePath() ?? codeDocument.Source.FileName; base.OnDocumentStructureCreated(codeDocument, @namespace, @class, method); - @class.Name = ClassName.GetClassNameFromPath(filePath); + @class.Name = CSharpIdentifier.GetClassNameFromPath(filePath); @class.BaseType = "global::Microsoft.AspNetCore.Mvc.Razor.RazorPage"; @class.AccessModifier = "public"; @namespace.Content = "AspNetCore"; diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/NamespaceDirective.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/NamespaceDirective.cs index 7d61804390..7df5e9272c 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/NamespaceDirective.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/NamespaceDirective.cs @@ -63,14 +63,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions { // Beautify the class name since we're using a hierarchy for namespaces. var @class = visitor.FirstClass; - var prefix = Path.GetFileNameWithoutExtension(codeDocument.Source.FileName); + var prefix = CSharpIdentifier.SanitizeClassName(Path.GetFileNameWithoutExtension(codeDocument.Source.FileName)); if (@class != null && irDocument.DocumentKind == RazorPageDocumentClassifierPass.RazorPageDocumentKind) { - @class.Name = ClassName.SanitizeClassName(prefix + "_Page"); + @class.Name = prefix + "_Page"; } else if (@class != null && irDocument.DocumentKind == MvcViewDocumentClassifierPass.MvcViewDocumentKind) { - @class.Name = ClassName.SanitizeClassName(prefix + "_View"); + @class.Name = prefix + "_View"; } } @@ -126,7 +126,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions for (var i = 0; i < segments.Length - 1; i++) { builder.Append('.'); - builder.Append(ClassName.SanitizeClassName(segments[i])); + builder.Append(CSharpIdentifier.SanitizeClassName(segments[i])); } @namespace = builder.ToString(); diff --git a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/RazorPageDocumentClassifierPass.cs b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/RazorPageDocumentClassifierPass.cs index 321bc172de..4a225dd060 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/RazorPageDocumentClassifierPass.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor.Extensions/RazorPageDocumentClassifierPass.cs @@ -27,7 +27,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions base.OnDocumentStructureCreated(codeDocument, @namespace, @class, method); @class.BaseType = "global::Microsoft.AspNetCore.Mvc.RazorPages.Page"; - @class.Name = ClassName.GetClassNameFromPath(filePath); + @class.Name = CSharpIdentifier.GetClassNameFromPath(filePath); @class.AccessModifier = "public"; @namespace.Content = "AspNetCore"; method.Name = "ExecuteAsync";