Switch back to newLitFixed

This commit is contained in:
Zahary Karadjov 2019-10-28 14:47:57 +02:00
parent aa5ccdd57f
commit adc63e8aff
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 1 additions and 6 deletions

View File

@ -52,11 +52,6 @@ type
FieldSetter[Configuration] = proc (cfg: var Configuration, val: TaintedString) {.nimcall, gcsafe.} FieldSetter[Configuration] = proc (cfg: var Configuration, val: TaintedString) {.nimcall, gcsafe.}
FieldCompleter = proc (val: TaintedString): seq[string] {.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 = proc getFieldName(caseField: NimNode): NimNode =
result = caseField result = caseField
if result.kind == nnkIdentDefs: result = result[0] if result.kind == nnkIdentDefs: result = result[0]
@ -645,7 +640,7 @@ macro buildCommandTree(RecordType: type): untyped =
else: else:
res.opts.add opt res.opts.add opt
result = newLit(res) result = newLitFixed(res)
debugMacroResult "Command Tree" debugMacroResult "Command Tree"
proc load*(Configuration: type, proc load*(Configuration: type,