Merge pull request #65946 from antonWetzel/csharp-nd-array

Don't marshal multidimensional arrays
This commit is contained in:
Rémi Verschelde 2022-09-18 00:42:50 +02:00
commit ee39c68d4f

View file

@ -156,6 +156,10 @@ namespace Godot.SourceGenerators
else if (typeKind == TypeKind.Array) else if (typeKind == TypeKind.Array)
{ {
var arrayType = (IArrayTypeSymbol)type; var arrayType = (IArrayTypeSymbol)type;
if (arrayType.Rank != 1)
return null;
var elementType = arrayType.ElementType; var elementType = arrayType.ElementType;
switch (elementType.SpecialType) switch (elementType.SpecialType)
@ -177,8 +181,8 @@ namespace Godot.SourceGenerators
if (elementType.SimpleDerivesFrom(typeCache.GodotObjectType)) if (elementType.SimpleDerivesFrom(typeCache.GodotObjectType))
return MarshalType.GodotObjectOrDerivedArray; return MarshalType.GodotObjectOrDerivedArray;
if (elementType.ContainingAssembly.Name == "GodotSharp" && if (elementType.ContainingAssembly?.Name == "GodotSharp" &&
elementType.ContainingNamespace.Name == "Godot") elementType.ContainingNamespace?.Name == "Godot")
{ {
switch (elementType) switch (elementType)
{ {