mirror of
https://github.com/godotengine/godot.git
synced 2025-10-26 03:04:31 +00:00
Fully qualify C# default values in exported fields.
This avoids issues when the default values rely on using namespaces.
This commit is contained in:
parent
c17f17eb98
commit
6ab93bd919
4 changed files with 83 additions and 2 deletions
|
|
@ -170,7 +170,13 @@ namespace Godot.SourceGenerators
|
|||
.Select(s => s?.Initializer ?? null)
|
||||
.FirstOrDefault();
|
||||
|
||||
string? value = initializer?.Value.ToString();
|
||||
// Fully qualify the value to avoid issues with namespaces.
|
||||
string? value = null;
|
||||
if (initializer != null)
|
||||
{
|
||||
var sm = context.Compilation.GetSemanticModel(initializer.SyntaxTree);
|
||||
value = initializer.Value.FullQualifiedSyntax(sm);
|
||||
}
|
||||
|
||||
exportedMembers.Add(new ExportedPropertyMetadata(
|
||||
property.Name, marshalType.Value, propertyType, value));
|
||||
|
|
@ -207,7 +213,13 @@ namespace Godot.SourceGenerators
|
|||
.Select(s => s.Initializer)
|
||||
.FirstOrDefault(i => i != null);
|
||||
|
||||
string? value = initializer?.Value.ToString();
|
||||
// This needs to be fully qualified to avoid issues with namespaces.
|
||||
string? value = null;
|
||||
if (initializer != null)
|
||||
{
|
||||
var sm = context.Compilation.GetSemanticModel(initializer.SyntaxTree);
|
||||
value = initializer.Value.FullQualifiedSyntax(sm);
|
||||
}
|
||||
|
||||
exportedMembers.Add(new ExportedPropertyMetadata(
|
||||
field.Name, marshalType.Value, fieldType, value));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue