Created
March 24, 2014 13:48
-
-
Save Skrylar/9740396 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This works | |
macro MakeIntoEvent* (etype: typedesc): stmt = | |
let uid = NextEventTypeUID | |
Inc(NextEventTypeUID) | |
debugEcho "DUMP ID #", uid, ": ", repr(etype) | |
result = quote do: | |
proc GetEventTypeUid* ( | |
self: typedesc[`etype`]): EventTypeUid {.inline.} = | |
let x = `uid` | |
return x | |
proc GetEventTypeUid* ( | |
self: `etype`): EventTypeUid {.inline.} = | |
let x = `uid` | |
return x | |
# ------ | |
# got (int literal(1)) but expected PNimrodNode | |
macro MakeIntoEvent* (etype: typedesc): stmt = | |
let uid = NextEventTypeUID | |
Inc(NextEventTypeUID) | |
debugEcho "DUMP ID #", uid, ": ", repr(etype) | |
result = quote do: | |
proc GetEventTypeUid* ( | |
self: typedesc[`etype`]): EventTypeUid {.inline.} = | |
result = `uid` | |
proc GetEventTypeUid* ( | |
self: `etype`): EventTypeUid {.inline.} = | |
result = `uid` | |
# ------ | |
# This ought to work yet doesn't on typedescs | |
macro MakeIntoEvent* (etype: typedesc): stmt = | |
let uid = NextEventTypeUID | |
Inc(NextEventTypeUID) | |
debugEcho "DUMP ID #", uid, ": ", repr(etype) | |
result = quote do: | |
converter ToEventTypeUid* ( | |
self: typedesc[`etype`]): EventTypeUid {.inline.} = | |
let x = `uid` | |
return x | |
converter ToEventTypeUid* ( | |
self: `etype`): EventTypeUid {.inline.} = | |
let x = `uid` | |
return x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment