Switch back to newLitFixed
This commit is contained in:
parent
aa5ccdd57f
commit
adc63e8aff
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue