(ninja) Deduplicate BatchStatement hasConditions inference logic