summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2017-11-30 15:24:30 +0100
committerAraq <rumpf_a@web.de>2017-11-30 15:24:30 +0100
commit255902f9a5a9f92ce2d65996a43626eff4c3b52c (patch)
tree95f5ec714ccf2b235f1a12a04161dfefb7729915
parent34ac04f70509e9f9c3d28b1bb12e3d6e6ed3a947 (diff)
downloadNim-255902f9a5a9f92ce2d65996a43626eff4c3b52c.tar.gz
added macros.unpackVarargs
-rw-r--r--changelog.md1
-rw-r--r--lib/core/macros.nim5
2 files changed, 6 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md
index a37089ef2..f061805b1 100644
--- a/changelog.md
+++ b/changelog.md
@@ -117,3 +117,4 @@ This now needs to be written as:
   your code work with both old and new Nim versions.
   See [special-operators](https://nim-lang.org/docs/manual.html#special-operators)
   for more information.
+- Added ``macros.unpackVarargs``.
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index ebc9f7714..ee6c1a09f 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim
@@ -1226,3 +1226,8 @@ when not defined(booting):
     macro payload: untyped {.gensym.} =
       result = parseStmt(e)
     payload()
+
+macro unpackVarargs*(callee: untyped; args: varargs[untyped]): untyped =
+  result = newCall(callee)
+  for i in 0 ..< args.len:
+    result.add args[i]