Skip to content

Commit 4397cae

Browse files
committed
Generate valid C++ for parameters by value
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent 722a1d7 commit 4397cae

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/Generator/Generators/C/CppTypePrinter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ public override TypePrinterResult VisitParameter(Parameter param, bool hasName =
442442
}
443443
}
444444

445-
return $"{result}";
445+
return result;
446446
}
447447

448448
public override TypePrinterResult VisitDelegate(FunctionType function)

src/Generator/Generators/TypePrinter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public override string ToString()
4343
if (hasPlaceholder)
4444
return string.Format(Type, $"{NamePrefix}{Name}{NameSuffix}");
4545

46-
var namePrefix = (Name.Length > 0 && NamePrefix.Length > 0) ?
46+
var namePrefix = Name.Length > 0 && (NamePrefix.Length > 0 || Type.Length > 0) ?
4747
$"{NamePrefix} " : NamePrefix.ToString();
4848
return $"{Type}{namePrefix}{Name}{NameSuffix}";
4949
}

tests/Common/Common.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,10 @@ namespace SomeNamespace
486486
virtual void AbstractMethod();
487487
};
488488

489-
class DLL_API Inlines
489+
class Inlines
490490
{
491491
public:
492+
Inlines(int param) {}
492493
inline operator NamespacedAbstractImpl () const { return NamespacedAbstractImpl(); }
493494
};
494495
}

0 commit comments

Comments
 (0)