summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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]