From 597922c1dbdc857f10fdf45c1bc0a22da65e00a4 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Wed, 10 Jun 2015 02:16:38 +0300 Subject: [PATCH] Stopped at an ignored base when getting the root one. Signed-off-by: Dimitar Dobrev --- src/AST/ClassExtensions.cs | 4 ++-- src/Generator/Generators/CSharp/CSharpTextTemplate.cs | 2 +- tests/CSharpTemp/CSharpTemp.h | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/AST/ClassExtensions.cs b/src/AST/ClassExtensions.cs index 2355cc0b..2420ff25 100644 --- a/src/AST/ClassExtensions.cs +++ b/src/AST/ClassExtensions.cs @@ -43,11 +43,11 @@ namespace CppSharp.AST } } - public static Class GetRootBase(this Class @class) + public static Class GetNonIgnoredRootBase(this Class @class) { while (true) { - if (@class.BaseClass == null) + if (!@class.HasNonIgnoredBase || @class.BaseClass == null) return @class; @class = @class.BaseClass; diff --git a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs index e4f5a24d..0600a7d1 100644 --- a/src/Generator/Generators/CSharp/CSharpTextTemplate.cs +++ b/src/Generator/Generators/CSharp/CSharpTextTemplate.cs @@ -1784,7 +1784,7 @@ namespace CppSharp.Generators.CSharp if (@class.IsRefType) { - var @base = @class.GetRootBase(); + var @base = @class.GetNonIgnoredRootBase(); var className = @base.IsAbstractImpl ? @base.BaseClass.Name : @base.Name; // Use interfaces if any - derived types with a this class as a seconary base, must be compatible with the map diff --git a/tests/CSharpTemp/CSharpTemp.h b/tests/CSharpTemp/CSharpTemp.h index 21f438f4..f7944290 100644 --- a/tests/CSharpTemp/CSharpTemp.h +++ b/tests/CSharpTemp/CSharpTemp.h @@ -230,6 +230,10 @@ private: const char* _name; }; +class TestObjectMapWithClassDerivedFromStruct : public QGenericArgument +{ +}; + #define DEFAULT_INT (2 * 1000UL + 500UL) namespace Qt