Fix imperative ifnode ast comparison

1. Fix ast comparison
2. Add imperative ast comparison testcase
Merge pull request #3248 from junmendoza/defectfix

Fix imperative ifnode ast comparison