diff options
author | Araq <rumpf_a@web.de> | 2016-10-24 20:20:20 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2016-10-24 20:20:20 +0200 |
commit | 0eb70e64c4dfbe48f6fb5d4873d4c02dca65bc4a (patch) | |
tree | 1b7ffe69eabd3ec37db7c1f011394cd921e7d855 /lib/pure/future.nim | |
parent | 1d191831c0c41536efc1a57be48f38b0746bd40f (diff) | |
parent | 6fd27a8a0849e2c1150b5f15b7b61d43b63642b2 (diff) | |
download | Nim-0eb70e64c4dfbe48f6fb5d4873d4c02dca65bc4a.tar.gz |
Merge branch 'devel' of github.com:nim-lang/Nim into devel
Diffstat (limited to 'lib/pure/future.nim')
-rw-r--r-- | lib/pure/future.nim | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/pure/future.nim b/lib/pure/future.nim index 67975cfcb..2a6d29933 100644 --- a/lib/pure/future.nim +++ b/lib/pure/future.nim @@ -177,3 +177,24 @@ macro `[]`*(lc: ListComprehension, comp, typ: untyped): untyped = newIdentNode("@"), newNimNode(nnkBracket))), result)))) + + +macro dump*(x: typed): untyped = + ## Dumps the content of an expression, useful for debugging. + ## It accepts any expression and prints a textual representation + ## of the tree representing the expression - as it would appear in + ## source code - together with the value of the expression. + ## + ## As an example, + ## + ## .. code-block:: nim + ## let + ## x = 10 + ## y = 20 + ## dump(x + y) + ## + ## will print ``x + y = 30``. + let s = x.toStrLit + let r = quote do: + debugEcho `s`, " = ", `x` + return r \ No newline at end of file |