While this is NFC - NumStmtFields is currently 0, the assert is faulty.
It's not checking that VisitStmt() is called when getIdx() returns NumStmtFields.
It is checking that VisitStmt() is called *first*, when getIdx() returns 0.
I have stumbled into this while changing NumStmtFields to 1.