Mercurial > projects > dynamin
diff dynamin/core/event.d @ 106:acdbb30fee7e
Port to D2.
Most of the effort was dealing with immutable and const.
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Mon, 17 Dec 2012 23:41:50 -0600 |
parents | 73060bc3f004 |
children |
line wrap: on
line diff
--- a/dynamin/core/event.d Sat Nov 24 10:21:50 2012 -0600 +++ b/dynamin/core/event.d Mon Dec 17 23:41:50 2012 -0600 @@ -94,7 +94,7 @@ void opAddAssign(Handler handler) { if(!handler.funcptr) throw new Exception("handler cannot be null"); handlers.length = handlers.length + 1; - handlers[length-1] = handler; + handlers[$-1] = handler; // TODO: use a list? //handlers.add(handler); } @@ -106,7 +106,7 @@ } Foo* f = new Foo; f.handler = handler; - *this += &f.wrapper; + this += &f.wrapper; // I really wish D could do this: //this += (ArgsType e) { handler(); }; }