In `newDotExpr` you need the 2nd argument to be an identifier. That is, all
other dots should be in the 1st argument. That is, you need a nested
`newDotExpr`. Like:
result.add(newAssignment(
newDotExpr(
newDotExpr(obj, newIdentNode"aProperty4"),
newIdentNode"astr"),
i[1]))
Run
Of coarse, you need to get those identifiers programmatically from input, and
you probably want not fixed nesting level, so you have more work. It may be
easier with a helper recursive compile-time procedure, called from your macro;
or you'll need more cycles.