Browse Source

Fixed the generated code when the C++ parameters are named "arg1", "arg2", etc.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/658/head
Dimitar Dobrev 9 years ago
parent
commit
0a7b396842
  1. 2
      src/Generator/Generators/CLI/CLISourcesTemplate.cs
  2. 2
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs
  3. 4
      tests/Common/Common.cpp
  4. 2
      tests/Common/Common.h

2
src/Generator/Generators/CLI/CLISourcesTemplate.cs

@ -1160,7 +1160,7 @@ namespace CppSharp.Generators.CLI @@ -1160,7 +1160,7 @@ namespace CppSharp.Generators.CLI
if (param.Type is BuiltinType)
return paramMarshal;
var argName = "arg" + paramIndex.ToString(CultureInfo.InvariantCulture);
var argName = Generator.GeneratedIdentifier("arg") + paramIndex.ToString(CultureInfo.InvariantCulture);
var isRef = param.IsOut || param.IsInOut;
// Since both pointers and references to types are wrapped as CLI

2
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -2911,7 +2911,7 @@ namespace CppSharp.Generators.CSharp @@ -2911,7 +2911,7 @@ namespace CppSharp.Generators.CSharp
return new ParamMarshal { Name = name, Param = param };
}
var argName = "arg" + paramIndex.ToString(CultureInfo.InvariantCulture);
var argName = Generator.GeneratedIdentifier("arg") + paramIndex.ToString(CultureInfo.InvariantCulture);
var paramMarshal = new ParamMarshal { Name = argName, Param = param };
if (param.IsOut || param.IsInOut)

4
tests/Common/Common.cpp

@ -80,9 +80,9 @@ Bar* Bar::returnPointerToValueType() @@ -80,9 +80,9 @@ Bar* Bar::returnPointerToValueType()
return this;
}
bool Bar::operator ==(const Bar& other) const
bool Bar::operator ==(const Bar& arg1) const
{
return A == other.A && B == other.B;
return A == arg1.A && B == arg1.B;
}
bool operator ==(Bar::Item item, const Bar& bar)

2
tests/Common/Common.h

@ -85,7 +85,7 @@ struct DLL_API Bar @@ -85,7 +85,7 @@ struct DLL_API Bar
Bar* returnPointerToValueType();
bool operator ==(const Bar& other) const;
bool operator ==(const Bar& arg1) const;
};
DLL_API bool operator ==(Bar::Item item, const Bar& bar);

Loading…
Cancel
Save