Loop over statement tree