Browse Source

Merge pull request #361 from ddobrev/master

Fixed a regression causing ignored types with bases without empty ctors to fail
pull/363/head
João Matos 11 years ago
parent
commit
aa05b1059b
  1. 2
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs
  2. 6
      src/Generator/Passes/CleanInvalidDeclNamesPass.cs
  3. 2
      tests/CSharpTemp/CSharpTemp.cs
  4. 7
      tests/CSharpTemp/CSharpTemp.h

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

@ -744,7 +744,7 @@ namespace CppSharp.Generators.CSharp
var bases = new List<string>(); var bases = new List<string>();
var needsBase = @class.HasGeneratedBase; var needsBase = @class.HasGeneratedBase && @class.IsGenerated;
if (needsBase) if (needsBase)
{ {

6
src/Generator/Passes/CleanInvalidDeclNamesPass.cs

@ -123,6 +123,12 @@ namespace CppSharp.Passes
return base.VisitTypedefDecl(typedef); return base.VisitTypedefDecl(typedef);
} }
public override bool VisitVariableDecl(Variable variable)
{
variable.Name = CheckName(variable.Name);
return base.VisitVariableDecl(variable);
}
private static void CheckEnumName(Enumeration @enum) private static void CheckEnumName(Enumeration @enum)
{ {
// If we still do not have a valid name, then try to guess one // If we still do not have a valid name, then try to guess one

2
tests/CSharpTemp/CSharpTemp.cs

@ -82,6 +82,8 @@ namespace CppSharp.Tests
{ {
ctx.SetClassAsValueType("TestCopyConstructorVal"); ctx.SetClassAsValueType("TestCopyConstructorVal");
ctx.SetClassAsValueType("QGenericArgument"); ctx.SetClassAsValueType("QGenericArgument");
ctx.IgnoreClassWithName("IgnoredTypeInheritingNonIgnoredWithNoEmptyCtor");
} }
public override void Postprocess(Driver driver, ASTContext ctx) public override void Postprocess(Driver driver, ASTContext ctx)

7
tests/CSharpTemp/CSharpTemp.h

@ -10,6 +10,8 @@ public:
int& operator[](int i); int& operator[](int i);
int A; int A;
static int null;
protected: protected:
int P; int P;
}; };
@ -20,6 +22,7 @@ public:
Qux(); Qux();
Qux(Foo foo); Qux(Foo foo);
int farAwayFunc() const; int farAwayFunc() const;
int array[3];
void obsolete(); void obsolete();
}; };
@ -253,6 +256,10 @@ class DLL_API IgnoredType
{ {
}; };
class DLL_API IgnoredTypeInheritingNonIgnoredWithNoEmptyCtor : public P
{
};
class DLL_API PropertyWithIgnoredType class DLL_API PropertyWithIgnoredType
{ {
public: public:

Loading…
Cancel
Save