summary refs log tree commit diff stats
path: root/lib/core
diff options
context:
space:
mode:
authorDominik Picheta <dominikpicheta@googlemail.com>2015-05-17 18:22:55 +0100
committerDominik Picheta <dominikpicheta@googlemail.com>2015-05-17 18:22:55 +0100
commitbaee41499e99df988330404e14b3814e4290ac48 (patch)
tree0ae6e677f7a402032f8eb2737e6691d6952f3fab /lib/core
parent60af6a265352d75559a98f1977084e9e5ab081fd (diff)
parent1d47617d1b72c642fac5543f38aa24330b0f9a19 (diff)
downloadNim-baee41499e99df988330404e14b3814e4290ac48.tar.gz
Merge pull request #2712 from nanoant/patch/macros-introduce-typenode-for-typedesc
Macros: Introduce typeNode(t: typedesc): NimNode
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/macros.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index 35f0f61c1..7e6e4ccc9 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim
@@ -177,6 +177,12 @@ proc getType*(n: NimNode): NimNode {.magic: "NGetType", noSideEffect.}
   ## resolve recursive types, you have to call 'getType' again. To see what
   ## kind of type it is, call `typeKind` on getType's result.
 
+proc getType*(n: typedesc): NimNode {.magic: "NGetType", noSideEffect.}
+  ## Returns the Nim type node for given type. This can be used to turn macro
+  ## typedesc parameter into proper NimNode representing type, since typedesc
+  ## are an exception in macro calls - they are not mapped implicitly to
+  ## NimNode like any other arguments.
+
 proc typeKind*(n: NimNode): NimTypeKind {.magic: "NGetType", noSideEffect.}
   ## Returns the type kind of the node 'n' that should represent a type, that
   ## means the node should have been obtained via `getType`.