Browse Source

Generate valid C++ for parameters by value

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1636/head
Dimitar Dobrev 4 years ago
parent
commit
4397cae7b2
  1. 2
      src/Generator/Generators/C/CppTypePrinter.cs
  2. 2
      src/Generator/Generators/TypePrinter.cs
  3. 3
      tests/Common/Common.h

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

@ -442,7 +442,7 @@ namespace CppSharp.Generators.C @@ -442,7 +442,7 @@ namespace CppSharp.Generators.C
}
}
return $"{result}";
return result;
}
public override TypePrinterResult VisitDelegate(FunctionType function)

2
src/Generator/Generators/TypePrinter.cs

@ -43,7 +43,7 @@ namespace CppSharp.Generators @@ -43,7 +43,7 @@ namespace CppSharp.Generators
if (hasPlaceholder)
return string.Format(Type, $"{NamePrefix}{Name}{NameSuffix}");
var namePrefix = (Name.Length > 0 && NamePrefix.Length > 0) ?
var namePrefix = Name.Length > 0 && (NamePrefix.Length > 0 || Type.Length > 0) ?
$"{NamePrefix} " : NamePrefix.ToString();
return $"{Type}{namePrefix}{Name}{NameSuffix}";
}

3
tests/Common/Common.h

@ -486,9 +486,10 @@ namespace SomeNamespace @@ -486,9 +486,10 @@ namespace SomeNamespace
virtual void AbstractMethod();
};
class DLL_API Inlines
class Inlines
{
public:
Inlines(int param) {}
inline operator NamespacedAbstractImpl () const { return NamespacedAbstractImpl(); }
};
}

Loading…
Cancel
Save