anchor.diff:      } else if (selector.isIndex || selector.isIndexSet) {
         // For an index operation, this code generates:
         //
  -      //    if (receiver.constructor == Array || typeof receiver == "string") {
  -      //      if (a0 >>> 0 === a0 && a0 < receiver.length) {
  -      //        return receiver[a0];
  +      //    if (typeof a0 === "number") {
  +      //      if (receiver.constructor == Array ||
  +      //          typeof receiver == "string") {
  +      //        if (a0 >>> 0 === a0 && a0 < receiver.length) {
  +      //          return receiver[a0];
  +      //        }
         //      }
         //    }
         //
         // For an index set operation, this code generates:
         //
  -      //    if (receiver.constructor == Array && !receiver.immutable$list) {
  -      //      if (a0 >>> 0 === a0 && a0 < receiver.length) {
  -      //        return receiver[a0] = a1;
  +      //    if (typeof a0 === "number") {
  +      //      if (receiver.constructor == Array && !receiver.immutable$list) {
  +      //        if (a0 >>> 0 === a0 && a0 < receiver.length) {
  +      //          return receiver[a0] = a1;
  +      //        }
         //      }
         //    }
         bool containsArray = classes.contains(helpers.jsArrayClass);
  
positive.code:         }
  
          return js.statement('''
            if (#)
              if ((a0 >>> 0) === a0 && a0 < receiver.length)
                return receiver[a0];
            ''', typeCheck);
        } else {
          jsAst.Expression typeCheck;
  
negative.code:         }
  
          return js.statement(r'''
            if (typeof a0 === "number")
              if (# && !receiver.immutable$list &&
                  (a0 >>> 0) === a0 && a0 < receiver.length)
                return receiver[a0] = a1;
            ''', typeCheck);
        }
      }
  