Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMorgan Brown <morganbr@users.noreply.github.com>2018-01-13 15:48:48 +0300
committerGitHub <noreply@github.com>2018-01-13 15:48:48 +0300
commite32aeceee788a18bb4ced99e629ce8acfcec53b2 (patch)
treea476d154b9c197169c749104a29562d69974299a /tests
parentc91a527a15ee429b776e57d1930c5841c66e1dcf (diff)
Implement WebAssembly delegates (#5143)
* Implement WebAssembly delegates and fix other minor codegen issues.
Diffstat (limited to 'tests')
-rw-r--r--tests/src/Simple/HelloWasm/Program.cs48
1 files changed, 47 insertions, 1 deletions
diff --git a/tests/src/Simple/HelloWasm/Program.cs b/tests/src/Simple/HelloWasm/Program.cs
index 25886330c..ff8eb1295 100644
--- a/tests/src/Simple/HelloWasm/Program.cs
+++ b/tests/src/Simple/HelloWasm/Program.cs
@@ -117,6 +117,29 @@ internal static class Program
{
PrintLine("CpObj test: Ok.");
}
+
+ Func<int> staticDelegate = StaticDelegateTarget;
+ if(staticDelegate() == 7)
+ {
+ PrintLine("Static delegate test: Ok.");
+ }
+
+ tempObj.TestInt = 8;
+ Func<int> instanceDelegate = tempObj.InstanceDelegateTarget;
+ if(instanceDelegate() == 8)
+ {
+ PrintLine("Instance delegate test: Ok.");
+ }
+
+ Action virtualDelegate = tempObj.VirtualDelegateTarget;
+ virtualDelegate();
+
+ PrintLine("Done");
+ }
+
+ private static int StaticDelegateTarget()
+ {
+ return 7;
}
private static unsafe void PrintString(string s)
@@ -203,11 +226,19 @@ public struct BoxStubTest
{
return Value;
}
+
+ public string GetValue()
+ {
+ Program.PrintLine("BoxStubTest.GetValue called");
+ Program.PrintLine(Value);
+ return Value;
+ }
}
public class TestClass
{
- public string TestString {get; set;}
+ public string TestString { get; set; }
+ public int TestInt { get; set; }
public TestClass(int number)
{
@@ -230,6 +261,16 @@ public class TestClass
{
Program.PrintLine("Virtual Slot Test 2: Ok");
}
+
+ public int InstanceDelegateTarget()
+ {
+ return TestInt;
+ }
+
+ public virtual void VirtualDelegateTarget()
+ {
+ Program.PrintLine("Virtual delegate incorrectly dispatched to base.");
+ }
}
public class TestDerivedClass : TestClass
@@ -248,5 +289,10 @@ public class TestDerivedClass : TestClass
{
throw new Exception();
}
+
+ public override void VirtualDelegateTarget()
+ {
+ Program.PrintLine("Virtual Delegate Test: Ok");
+ }
}