Browse Source

Fix bug in `std::optional` mapping

pull/1904/head
duckdoom5 5 months ago
parent
commit
3ef0c0fa95
  1. 6
      src/Generator/Types/Std/Stdlib.CLI.cs

6
src/Generator/Types/Std/Stdlib.CLI.cs

@ -201,10 +201,10 @@ namespace CppSharp.Types.Std.CLI
? new CILType(typeof(nint)) ? new CILType(typeof(nint))
: type.Type; : type.Type;
ctx.Before.WriteLineIndent("if (!{0}.has_value())", ctx.ArgName); ctx.Before.WriteLine("if (!{0}.has_value())", ctx.ReturnVarName);
{ {
ctx.Before.WriteLine("return {};"); ctx.Before.WriteLineIndent("return {};");
ctx.Before.Unindent(); ctx.Before.NewLine();
} }
var elementCtx = new MarshalContext(ctx.Context, ctx.Indentation) var elementCtx = new MarshalContext(ctx.Context, ctx.Indentation)

Loading…
Cancel
Save