diff --git a/stew/shims/macros.nim b/stew/shims/macros.nim index 7844cf3..f1bd75c 100644 --- a/stew/shims/macros.nim +++ b/stew/shims/macros.nim @@ -1,5 +1,5 @@ import - std/[macros, tables, hashes] + std/[hashes, macros, tables, typetraits] export macros @@ -395,6 +395,11 @@ proc newLitFixed*(arg: tuple): NimNode {.compileTime.} = for a,b in arg.fieldPairs: result.add nnkExprColonExpr.newTree(newIdentNode(a), newLitFixed(b)) +proc newLitFixed*(arg: distinct): NimNode {.compileTime.} = + result = newLitFixed distinctBase(arg) + var typ = getTypeInst(typeof(arg))[1] + result = newCall(typ,result) + iterator typedParams*(n: NimNode, skip = 0): (NimNode, NimNode) = let params = n[3] for i in (1 + skip) ..< params.len: