Array.indexOf/lastIndexOf implementation (refs HaxeFoundation/haxe#1242)