Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import macros
- macro examine(x: untyped): untyped =
- debugEcho(x.treeRepr)
- return x
- examine:
- type
- foobar = enum
- somekind
- thingy = object
- case kind: foobar
- of somekind:
- value: int
- macro fail(x: untyped): untyped =
- result = quote:
- type
- foobar = enum
- somekind
- thingy = object
- case kind: foobar
- of somekind:
- value: int
- debugEcho(result.treeRepr)
- const broken = true
- when broken:
- fail(foo)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement