diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/core/macros.nim | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index a146117d0..3011eaa67 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -696,6 +696,16 @@ proc newLit*[T](arg: seq[T]): NimNode {.compileTime.} = ), bracket ) +proc newLit*(arg: enum): NimNode {.compileTime.} = + result = newCall( + arg.type.getTypeInst[1], + newLit(int(arg)) + ) + +proc newLit*[T](s: set[T]): NimNode {.compileTime.} = + result = nnkCurly.newTree + for x in s: + result.add newLit(x) proc newLit*(arg: tuple): NimNode {.compileTime.} = result = nnkPar.newTree |