json.nim: tiny refactoring

This commit is contained in:
Araq 2019-04-01 16:24:04 +02:00
commit fda1352ccf

View file

@ -1023,10 +1023,7 @@ proc toIdentNode(typeNode: NimNode): NimNode =
proc createGetEnumCall(jsonNode, kindType: NimNode): NimNode = proc createGetEnumCall(jsonNode, kindType: NimNode): NimNode =
# -> getEnum(`jsonNode`, `kindType`) # -> getEnum(`jsonNode`, `kindType`)
let getEnumSym = bindSym("getEnum") result = newCall(bindSym("getEnum"), jsonNode, toStrLit(jsonNode), kindType)
let astStrLit = toStrLit(jsonNode)
let getEnumCall = newCall(getEnumSym, jsonNode, astStrLit, kindType)
return getEnumCall
proc createOfBranchCond(ofBranch, getEnumCall: NimNode): NimNode = proc createOfBranchCond(ofBranch, getEnumCall: NimNode): NimNode =
## Creates an expression that acts as the condition for an ``of`` branch. ## Creates an expression that acts as the condition for an ``of`` branch.