From dd1d8d91d8253f3f7a74beb091046bef2020dd37 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Thu, 7 Nov 2019 03:27:49 +0100 Subject: [PATCH] Tests: Add References test --- Il2CppTests/Il2CppTests.csproj | 2 ++ Il2CppTests/TestSources/References.cs | 29 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Il2CppTests/TestSources/References.cs diff --git a/Il2CppTests/Il2CppTests.csproj b/Il2CppTests/Il2CppTests.csproj index 8414f65..9182cd8 100644 --- a/Il2CppTests/Il2CppTests.csproj +++ b/Il2CppTests/Il2CppTests.csproj @@ -32,6 +32,7 @@ + @@ -55,6 +56,7 @@ + diff --git a/Il2CppTests/TestSources/References.cs b/Il2CppTests/TestSources/References.cs new file mode 100644 index 0000000..cc5a540 --- /dev/null +++ b/Il2CppTests/TestSources/References.cs @@ -0,0 +1,29 @@ +/* + Copyright 2017-2019 Katy Coe - http://www.hearthcode.org - http://www.djkaty.com + + All rights reserved. +*/ + +namespace Il2CppTests.TestSources +{ +#pragma warning disable CS0169 + internal class Test + { + private float floatField; + + public void MethodWithRefParameters(int a, ref int b, int c, ref int d) {} + + // In parameters were introduced in C# 7.2 + public void MethodWithInRefOut(in int a, ref int b, out int c) => c = 1; + + public ref float MethodWithRefReturnType() => ref floatField; + } + + // Ref structs were introduced in C# 7.2 - creates IsByRefLike attribute on type in assembly + // Attribute doesn't seem to be retained by IL2CPP? + public ref struct RefStruct + { + private int structField1; + } +#pragma warning restore CS0169 +} \ No newline at end of file