Browse Source

Do not write the fixed keyword multiple times for nested array types.

pull/219/merge
Elias Holzer 12 years ago committed by triton
parent
commit
ba03f64f65
  1. 4
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs
  2. 2
      tests/Basic/Basic.h

4
src/Generator/Generators/CSharp/CSharpTypePrinter.cs

@ -127,9 +127,11 @@ namespace CppSharp.Generators.CSharp
Type = string.Format("{0}*", array.Type.Visit(this, quals)) Type = string.Format("{0}*", array.Type.Visit(this, quals))
}; };
} }
// Do not write the fixed keyword multiple times for nested array types
var fixedKeyword = array.Type is ArrayType ? string.Empty : "fixed ";
return new CSharpTypePrinterResult() return new CSharpTypePrinterResult()
{ {
Type = string.Format("fixed {0}", array.Type.Visit(this, quals)), Type = string.Format("{0}{1}", fixedKeyword, array.Type.Visit(this, quals)),
NameSuffix = string.Format("[{0}]", array.Size) NameSuffix = string.Format("[{0}]", array.Size)
}; };
} }

2
tests/Basic/Basic.h

@ -17,6 +17,8 @@ public:
const char* GetANSI(); const char* GetANSI();
// TODO: VC++ does not support char16 // TODO: VC++ does not support char16
// char16 chr16; // char16 chr16;
float nested_array[2][2];
}; };
struct DLL_API Bar struct DLL_API Bar

Loading…
Cancel
Save