Add parentheses in genericPrint according to path.needsParens().