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
} }
} }
return $"{result}"; return result;
} }
public override TypePrinterResult VisitDelegate(FunctionType function) public override TypePrinterResult VisitDelegate(FunctionType function)

2
src/Generator/Generators/TypePrinter.cs

@ -43,7 +43,7 @@ namespace CppSharp.Generators
if (hasPlaceholder) if (hasPlaceholder)
return string.Format(Type, $"{NamePrefix}{Name}{NameSuffix}"); 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(); $"{NamePrefix} " : NamePrefix.ToString();
return $"{Type}{namePrefix}{Name}{NameSuffix}"; return $"{Type}{namePrefix}{Name}{NameSuffix}";
} }

3
tests/Common/Common.h

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

Loading…
Cancel
Save