macros: distinct literals (#235)
This commit is contained in:
parent
9501d3d60c
commit
b7b5969557
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue