mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 19:52:36 +00:00
18 lines
455 B
Nim
18 lines
455 B
Nim
# issue #23249
|
|
|
|
type Control* = object
|
|
proc onAction*(c: Control, handler: proc(e: int) {.gcsafe.}) = discard
|
|
proc onAction*(c: Control, handler: proc() {.gcsafe.}) = discard
|
|
|
|
template setControlHandlerBlock(c: Control, p: untyped, a: untyped) =
|
|
when compiles(c.p(nil)):
|
|
c.p() do() {.gcsafe.}: a
|
|
else:
|
|
c.p = proc() {.gcsafe.} =
|
|
a
|
|
|
|
proc mkLayout() =
|
|
var b: Control
|
|
setControlHandlerBlock(b, onAction):
|
|
echo "hi"
|