Flatten statements and expressions in the AST.