Skip to content

Commit 980f367

Browse files
committed
Fixed the generated C# when a ref parameter is named after a keyword.
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 5df67cd commit 980f367

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/Generator/Generator.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,8 @@ private GeneratorOutput GenerateModuleTemplate(Module module)
143143

144144
protected abstract string TypePrinterDelegate(CppSharp.AST.Type type);
145145

146-
public static string GeneratedIdentifier(string id)
147-
{
148-
return "__" + id;
149-
}
146+
public static string GeneratedIdentifier(string id) =>
147+
$"__{(id.StartsWith("@") ? id.Substring(1) : id)}";
150148

151149
public void Dispose()
152150
{

tests/Common/Common.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ HasOverloadsWithDifferentPointerKindsToSameType::~HasOverloadsWithDifferentPoint
848848
{
849849
}
850850

851-
void HasOverloadsWithDifferentPointerKindsToSameType::overload(int& i)
851+
void HasOverloadsWithDifferentPointerKindsToSameType::overload(int& in)
852852
{
853853
}
854854

tests/Common/Common.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ class DLL_API HasOverloadsWithDifferentPointerKindsToSameType
13101310
public:
13111311
HasOverloadsWithDifferentPointerKindsToSameType();
13121312
~HasOverloadsWithDifferentPointerKindsToSameType();
1313-
void overload(int& i);
1313+
void overload(int& in);
13141314
void overload(int&& i);
13151315
void overload(const int& i);
13161316
void overload(const Foo& rx, int from = -1);

0 commit comments

Comments
 (0)