Generate valid C# for fields with types system template specializations

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
This commit is contained in:
Dimitar Dobrev 2021-11-11 23:20:56 +02:00
Родитель ad6557792f
Коммит 0b8f252d1b
3 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -57,6 +57,11 @@ namespace CppSharp.Passes
MarkUsedFieldTypes(decl, visitedDeclarationContexts);
}
foreach (var @base in @class.Bases.Where(
b => b.IsClass && b.Class.Ignore && b.Class.Fields.Count > 0))
{
@base.Class.GenerationKind = GenerationKind.Internal;
}
}
}
}

Просмотреть файл

@ -40,7 +40,8 @@ namespace CppSharp.Passes
private bool TryMarkType(Type desugared)
{
var tagType = desugared as TagType;
var templateType = desugared as TemplateSpecializationType;
var tagType = desugared as TagType ?? templateType?.Desugared.Type as TagType;
if (tagType != null)
{
var specialization = tagType.Declaration as ClassTemplateSpecialization;
@ -56,7 +57,6 @@ namespace CppSharp.Passes
return true;
}
var templateType = desugared as TemplateSpecializationType;
if (templateType != null)
{
var template = templateType.Template;

Просмотреть файл

@ -5,6 +5,7 @@
#include <vector>
#include <limits>
#include <string>
#include <mutex>
#include "AnotherUnit.h"
#include "ExcludedUnit.hpp"
#include "CSharpTemplates.h"
@ -201,6 +202,7 @@ protected:
AbstractProprietor(int i);
int m_value;
long m_property;
std::mutex m_mutex;
};
class DLL_API Proprietor : public AbstractProprietor