Handle keywords in field names for custom types
このコミットが含まれているのは:
1 親
9e07f66d0b
コミット
94b40e5d61
2ファイル変更
+20
-8
検索条件に一致するファイルはありません
+10
-4
@@ -337,15 +337,21 @@ partial class ID2D1ShaderGenerator
|
||||
INamedTypeSymbol fieldType = (INamedTypeSymbol)field.Type;
|
||||
|
||||
// Convert the name to the fully qualified HLSL version
|
||||
if (!HlslKnownTypes.TryGetMappedName(fieldType.GetFullMetadataName(), out string? mapped))
|
||||
if (!HlslKnownTypes.TryGetMappedName(fieldType.GetFullMetadataName(), out string? mappedType))
|
||||
{
|
||||
mapped = fieldType.GetFullMetadataName().ToHlslIdentifierName();
|
||||
mappedType = fieldType.GetFullMetadataName().ToHlslIdentifierName();
|
||||
}
|
||||
|
||||
// Get the field name as a valid HLSL identifier
|
||||
if (!HlslKnownKeywords.TryGetMappedName(field.Name, out string? mappedName))
|
||||
{
|
||||
mappedName = field.Name;
|
||||
}
|
||||
|
||||
structDeclaration = structDeclaration.AddMembers(
|
||||
FieldDeclaration(VariableDeclaration(
|
||||
IdentifierName(mapped!)).AddVariables(
|
||||
VariableDeclarator(Identifier(field.Name)))));
|
||||
IdentifierName(mappedType!)).AddVariables(
|
||||
VariableDeclarator(Identifier(mappedName!)))));
|
||||
}
|
||||
|
||||
// Insert the trailing ; right after the closing bracket (after normalization)
|
||||
|
||||
@@ -465,15 +465,21 @@ partial class IShaderGenerator
|
||||
INamedTypeSymbol fieldType = (INamedTypeSymbol)field.Type;
|
||||
|
||||
// Convert the name to the fully qualified HLSL version
|
||||
if (!HlslKnownTypes.TryGetMappedName(fieldType.GetFullMetadataName(), out string? mapped))
|
||||
if (!HlslKnownTypes.TryGetMappedName(fieldType.GetFullMetadataName(), out string? mappedType))
|
||||
{
|
||||
mapped = fieldType.GetFullMetadataName().ToHlslIdentifierName();
|
||||
mappedType = fieldType.GetFullMetadataName().ToHlslIdentifierName();
|
||||
}
|
||||
|
||||
// Get the field name as a valid HLSL identifier
|
||||
if (!HlslKnownKeywords.TryGetMappedName(field.Name, out string? mappedName))
|
||||
{
|
||||
mappedName = field.Name;
|
||||
}
|
||||
|
||||
structDeclaration = structDeclaration.AddMembers(
|
||||
FieldDeclaration(VariableDeclaration(
|
||||
IdentifierName(mapped!)).AddVariables(
|
||||
VariableDeclarator(Identifier(field.Name)))));
|
||||
IdentifierName(mappedType!)).AddVariables(
|
||||
VariableDeclarator(Identifier(mappedName!)))));
|
||||
}
|
||||
|
||||
// Insert the trailing ; right after the closing bracket (after normalization)
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする