mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-26 03:28:02 +02:00
Deferred evaluation support for binary operators
This commit is contained in:
parent
7093476126
commit
0ebd306d93
5 changed files with 108 additions and 18 deletions
|
@ -2,6 +2,17 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace System
|
||||
{
|
||||
extension Event<T>
|
||||
{
|
||||
public implicit void operator+=(T dlg) mut
|
||||
{
|
||||
Add(dlg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Tests
|
||||
{
|
||||
class Delegates
|
||||
|
@ -146,6 +157,9 @@ namespace Tests
|
|||
|
||||
ClassB<int8>.DelegateB dlg2 = scope (val) => val + 123;
|
||||
Test.Assert(dlg2(3) == 126);
|
||||
|
||||
Event<EventHandler> e = .();
|
||||
e += scope (sender, e) => {};
|
||||
}
|
||||
|
||||
public static void Modify(ref int a, ref Splattable b)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue