Browse Source

Fix generation of operators in NAPI generator.

instantiate-types-nested-templates
Joao Matos 5 years ago committed by João Matos
parent
commit
77972c78fa
  1. 2
      src/Generator/Generators/C/CppSources.cs
  2. 10
      src/Generator/Generators/NAPI/NAPIHelpers.cs

2
src/Generator/Generators/C/CppSources.cs

@ -181,7 +181,7 @@ namespace CppSharp.Generators.Cpp @@ -181,7 +181,7 @@ namespace CppSharp.Generators.Cpp
public virtual void GenerateClassMethods(Class @class)
{
foreach (var method in @class.Methods.Where(m => !m.IsOperator))
foreach (var method in @class.Methods)
{
if (ASTUtils.CheckIgnoreMethod(method) || CppHeaders.FunctionIgnored(method))
continue;

10
src/Generator/Generators/NAPI/NAPIHelpers.cs

@ -22,6 +22,9 @@ namespace CppSharp.Generators.Cpp @@ -22,6 +22,9 @@ namespace CppSharp.Generators.Cpp
public override void VisitDeclContextFunctions(DeclarationContext context)
{
if (!VisitOptions.VisitNamespaceFunctions)
return;
var functions = context.Functions.Where(f => !ASTUtils.CheckIgnoreFunction(f)).ToList();
var unique = functions.GroupBy(m => m.Name);
foreach (var group in unique)
@ -46,6 +49,7 @@ namespace CppSharp.Generators.Cpp @@ -46,6 +49,7 @@ namespace CppSharp.Generators.Cpp
{
var constructors = @class.Constructors.Where(c => c.IsGenerated && !c.IsCopyConstructor)
.ToList();
if (!constructors.Any())
return;
@ -57,12 +61,14 @@ namespace CppSharp.Generators.Cpp @@ -57,12 +61,14 @@ namespace CppSharp.Generators.Cpp
if (!function.IsGenerated)
return false;
if (function is Method method)
{
if (!(function is Method method))
return true;
if (method.IsConstructor || method.IsDestructor)
return false;
if (method.IsOperator)
{
if (method.OperatorKind == CXXOperatorKind.Conversion ||
method.OperatorKind == CXXOperatorKind.Equal)
return false;

Loading…
Cancel
Save