From adc63e8aff3fc4fb9154de448f46031a1ab18ac6 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Mon, 28 Oct 2019 14:47:57 +0200 Subject: [PATCH] Switch back to newLitFixed --- confutils.nim | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/confutils.nim b/confutils.nim index 4ed32ba..55a3b08 100644 --- a/confutils.nim +++ b/confutils.nim @@ -52,11 +52,6 @@ type FieldSetter[Configuration] = proc (cfg: var Configuration, val: TaintedString) {.nimcall, gcsafe.} FieldCompleter = proc (val: TaintedString): seq[string] {.nimcall, gcsafe.} -proc newLit*(arg: ref): NimNode {.compileTime.} = - result = nnkObjConstr.newTree(arg.type.getTypeInst[1]) - for a, b in fieldPairs(arg[]): - result.add nnkExprColonExpr.newTree(newIdentNode(a), newLit(b)) - proc getFieldName(caseField: NimNode): NimNode = result = caseField if result.kind == nnkIdentDefs: result = result[0] @@ -645,7 +640,7 @@ macro buildCommandTree(RecordType: type): untyped = else: res.opts.add opt - result = newLit(res) + result = newLitFixed(res) debugMacroResult "Command Tree" proc load*(Configuration: type,