lift parameter-less do block to lambdas
This commit is contained in:
parent
f7b10e213b
commit
a3f19c87fb
10 changed files with 46 additions and 26 deletions
|
|
@ -7,7 +7,7 @@ discard """
|
|||
import macros
|
||||
|
||||
macro mixer(n: typed): untyped =
|
||||
expectKind(n, nnkCharLit)
|
||||
|
||||
expectKind(n[0], nnkCharLit)
|
||||
|
||||
mixer:
|
||||
echo "owh"
|
||||
echo "owh"
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ b.onFocusLost:
|
|||
b.onFocusLost do:
|
||||
echo "lost focus 2"
|
||||
|
||||
b.onUserEvent("UserEvent 1") do:
|
||||
b.onUserEvent "UserEvent 1" do:
|
||||
discard
|
||||
|
||||
b.onUserEvent("UserEvent 2"):
|
||||
b.onUserEvent "UserEvent 2":
|
||||
discard
|
||||
|
||||
b.onUserEvent("UserEvent 3", () => echo "event 2")
|
||||
b.onUserEvent("UserEvent 3", () => echo "event 3")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
discard """
|
||||
output: '''true
|
||||
output: '''
|
||||
true
|
||||
true
|
||||
true
|
||||
true
|
||||
|
|
@ -19,7 +20,8 @@ true
|
|||
2
|
||||
12
|
||||
Event { name: 'click: test' }
|
||||
Event { name: 'reloaded: test' }'''
|
||||
Event { name: 'reloaded: test' }
|
||||
'''
|
||||
"""
|
||||
|
||||
import macros, jsffi, jsconsole
|
||||
|
|
@ -306,6 +308,6 @@ block:
|
|||
on("click") do (e: Event):
|
||||
console.log e
|
||||
|
||||
jslib.on("reloaded") do:
|
||||
jslib.on "reloaded" do:
|
||||
console.log jsarguments[0]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue