Only generate ast if something actually changed.