how to use newColonExpr in macro for initializer proc generation
Simply create the `nnkObjConstr` first, then add your `ColonExpr` nodes to that. Something like this: var myObj = nnkObjConstr.newTree(newIdentNode(strVal(name))) for field in fields: myObj.add newColonExpr(newIdentNode($field[0]), nodeMap(field[1])) Run
how to use newColonExpr in macro for initializer proc generation
I am trying to use macro for automatic initializer proc generation, here is the code func typeMap(k: JsonNodeKind): string = case k: of JBool: "bool" of JInt: "int" of JFloat: "float" of JString: "string" else: error("Unsupported json kind: