Browse Source

Fix test compiler error

Don't skip function bodies to force template instantiations
pull/1919/head
duckdoom5 4 months ago
parent
commit
16fa166716
  1. 13
      tests/dotnet/CSharp/CSharp.Gen.cs

13
tests/dotnet/CSharp/CSharp.Gen.cs

@ -25,6 +25,7 @@ namespace CppSharp.Tests @@ -25,6 +25,7 @@ namespace CppSharp.Tests
base.Setup(driver);
driver.ParserOptions.UnityBuild = true;
driver.ParserOptions.SkipFunctionBodies = false;
driver.ParserOptions.AddSupportedFunctionTemplates("FunctionTemplate");
driver.Options.GenerateFreeStandingFunctionsClassName = t => t.FileNameWithoutExtension + "Cool";
@ -237,16 +238,12 @@ namespace CppSharp.Tests @@ -237,16 +238,12 @@ namespace CppSharp.Tests
var specialization = type.GetClassTemplateSpecialization();
var typePrinter = new CSharpTypePrinter(null);
typePrinter.PushContext(TypePrinterContextKind.Native);
return new CustomType(string.Format($@"{
specialization.Visit(typePrinter)}{
(Type.IsAddress() ? "*" : string.Empty)}", specialization.Visit(typePrinter),
return new CustomType(string.Format($@"{specialization.Visit(typePrinter)}{(Type.IsAddress() ? "*" : string.Empty)}", specialization.Visit(typePrinter),
Type.IsAddress() ? "*" : string.Empty));
}
return new CustomType(
$@"global::System.Collections.Generic.{
(ctx.MarshalKind == MarshalKind.DefaultExpression ? "List" : "IList")}<{
ctx.GetTemplateParameterList()}>");
$@"global::System.Collections.Generic.{(ctx.MarshalKind == MarshalKind.DefaultExpression ? "List" : "IList")}<{ctx.GetTemplateParameterList()}>");
}
public override void MarshalToNative(MarshalContext ctx)
@ -292,9 +289,7 @@ namespace CppSharp.Tests @@ -292,9 +289,7 @@ namespace CppSharp.Tests
{
if (ctx.Kind == TypePrinterContextKind.Native)
{
return new CustomType($@"global::CSharp.QString.{
Helpers.InternalStruct}{
(ctx.Type.IsAddress() ? "*" : string.Empty)}");
return new CustomType($@"global::CSharp.QString.{Helpers.InternalStruct}{(ctx.Type.IsAddress() ? "*" : string.Empty)}");
}
return new CILType(typeof(string));
}

Loading…
Cancel
Save