fix case3 (for) by depending on types of inner shapes and order of them and number of them.
Authored by: nadeem-gamal 2012-08-17
Parent: [r929]
Child: [r931]