code for visitArrayIndex()