diff options
author | Araq <rumpf_a@web.de> | 2011-08-01 00:21:16 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-08-01 00:21:16 +0200 |
commit | dd99fe61c02c79a42965cb0c24f2e8e24eec3886 (patch) | |
tree | 6e6573c36d216c3a557440f1e1103bded48c590e /tests/accept | |
parent | 3e806a374a1b42246e947965677c4a1520f3db57 (diff) | |
download | Nim-dd99fe61c02c79a42965cb0c24f2e8e24eec3886.tar.gz |
documentation for 'var T' as return type
Diffstat (limited to 'tests/accept')
-rw-r--r-- | tests/accept/run/teventemitter.nim | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/accept/run/teventemitter.nim b/tests/accept/run/teventemitter.nim index 763f41943..68970b967 100644 --- a/tests/accept/run/teventemitter.nim +++ b/tests/accept/run/teventemitter.nim @@ -5,16 +5,18 @@ type type TEventEmitter = object of TObject events*: TTable[string, TDoublyLinkedList[proc(e: TEventArgs)]] + +proc emit*(emitter: TEventEmitter, event: string, args: TEventArgs) = + for func in nodes(emitter.events[event]): + func.value(args) #call function with args. + proc on*(emitter: var TEventEmitter, event: string, func: proc(e: TEventArgs)) = if not hasKey(emitter.events, event): var list: TDoublyLinkedList[proc(e: TEventArgs)] add(emitter.events,event,list) #if not, add it. #append(emitter.events[event], func) #adds the function to the event's list. I get a error here too. - -proc emit*(emitter: TEventEmitter, event: string, args: TEventArgs) = - for func in nodes(emitter.events[event]): - func.value(args) #call function with args. + proc initEmitter(emitter: TEventEmitter) = emitter.events = initTable[string, TDoublyLinkedList[proc(e: TEventArgs)]]() |