Skip to content

Commit 16fa166

Browse files
committed
Fix test compiler error
Don't skip function bodies to force template instantiations
1 parent 4c1cddb commit 16fa166

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

tests/dotnet/CSharp/CSharp.Gen.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public override void Setup(Driver driver)
2525
base.Setup(driver);
2626

2727
driver.ParserOptions.UnityBuild = true;
28+
driver.ParserOptions.SkipFunctionBodies = false;
2829
driver.ParserOptions.AddSupportedFunctionTemplates("FunctionTemplate");
2930

3031
driver.Options.GenerateFreeStandingFunctionsClassName = t => t.FileNameWithoutExtension + "Cool";
@@ -42,7 +43,7 @@ public override void SetupPasses(Driver driver)
4243
driver.Options.GenerateClassTemplates = true;
4344

4445
var disableNativeToManaged = new ClassGenerationOptions { GenerateNativeToManaged = false };
45-
driver.Options.GetClassGenerationOptions = e =>
46+
driver.Options.GetClassGenerationOptions = e =>
4647
{
4748
return e.Name == "ClassWithoutNativeToManaged" ? disableNativeToManaged : null;
4849
};
@@ -237,16 +238,12 @@ public override Type SignatureType(TypePrinterContext ctx)
237238
var specialization = type.GetClassTemplateSpecialization();
238239
var typePrinter = new CSharpTypePrinter(null);
239240
typePrinter.PushContext(TypePrinterContextKind.Native);
240-
return new CustomType(string.Format($@"{
241-
specialization.Visit(typePrinter)}{
242-
(Type.IsAddress() ? "*" : string.Empty)}", specialization.Visit(typePrinter),
241+
return new CustomType(string.Format($@"{specialization.Visit(typePrinter)}{(Type.IsAddress() ? "*" : string.Empty)}", specialization.Visit(typePrinter),
243242
Type.IsAddress() ? "*" : string.Empty));
244243
}
245244

246245
return new CustomType(
247-
$@"global::System.Collections.Generic.{
248-
(ctx.MarshalKind == MarshalKind.DefaultExpression ? "List" : "IList")}<{
249-
ctx.GetTemplateParameterList()}>");
246+
$@"global::System.Collections.Generic.{(ctx.MarshalKind == MarshalKind.DefaultExpression ? "List" : "IList")}<{ctx.GetTemplateParameterList()}>");
250247
}
251248

252249
public override void MarshalToNative(MarshalContext ctx)
@@ -292,9 +289,7 @@ public override Type SignatureType(TypePrinterContext ctx)
292289
{
293290
if (ctx.Kind == TypePrinterContextKind.Native)
294291
{
295-
return new CustomType($@"global::CSharp.QString.{
296-
Helpers.InternalStruct}{
297-
(ctx.Type.IsAddress() ? "*" : string.Empty)}");
292+
return new CustomType($@"global::CSharp.QString.{Helpers.InternalStruct}{(ctx.Type.IsAddress() ? "*" : string.Empty)}");
298293
}
299294
return new CILType(typeof(string));
300295
}

0 commit comments

Comments
 (0)