Fixed generic components with fully qualified names (dotnet/aspnetcore-tooling#356)
\n\nCommit migrated from b7392f1f84
This commit is contained in:
parent
92d931c229
commit
1d53925b8e
|
|
@ -53,6 +53,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X
|
|||
|
||||
public static string SanitizeClassName(string inputName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(inputName))
|
||||
{
|
||||
return inputName;
|
||||
}
|
||||
|
||||
if (!IsIdentifierStart(inputName[0]) && IsIdentifierPart(inputName[0]))
|
||||
{
|
||||
inputName = "_" + inputName;
|
||||
|
|
|
|||
|
|
@ -53,6 +53,11 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X
|
|||
|
||||
public static string SanitizeClassName(string inputName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(inputName))
|
||||
{
|
||||
return inputName;
|
||||
}
|
||||
|
||||
if (!IsIdentifierStart(inputName[0]) && IsIdentifierPart(inputName[0]))
|
||||
{
|
||||
inputName = "_" + inputName;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
public static string SanitizeIdentifier(string inputName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(inputName))
|
||||
{
|
||||
return inputName;
|
||||
}
|
||||
|
||||
if (!IsIdentifierStart(inputName[0]) && IsIdentifierPart(inputName[0]))
|
||||
{
|
||||
inputName = "_" + inputName;
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
|
|||
|
||||
// Method name is generated and guaranteed not to collide, since it's unique for each
|
||||
// component call site.
|
||||
MethodName = $"Create{node.TagName}_{_id++}",
|
||||
MethodName = $"Create{CSharpIdentifier.SanitizeIdentifier(node.TagName)}_{_id++}",
|
||||
FullTypeName = @namespace + ".TypeInference",
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue