pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:1359:    break;       case T_ARRAY:    if(TYPEOF(Pike_sp[-1]) == T_INT)    t = (0 <= Pike_sp[-1].u.integer && Pike_sp[-1].u.integer < Pike_sp[-2].u.array->size);       pop_n_elems(args);    push_int(t);    break;    -  case T_MULTISET: +     case T_MAPPING: -  f_index(2); -  f_zero_type(1); +  t=!!low_mapping_lookup( Pike_sp[-2].u.mapping, Pike_sp-1 ); +  pop_n_elems(2); +  push_int(t); +  break;    - #ifdef PIKE_DEBUG -  if(TYPEOF(Pike_sp[-1]) != T_INT) -  PIKE_ERROR("has_index", -  "Function `zero_type' gave incorrect result.\n", Pike_sp, args); - #endif -  Pike_sp[-1].u.integer = !Pike_sp[-1].u.integer; +  case T_MULTISET: +  t = multiset_member( Pike_sp[-2].u.multiset, Pike_sp-1 ); +  pop_n_elems(2); +  push_int(t);    break;       case T_OBJECT:    case T_PROGRAM:    /* FIXME: If the object behaves like an array, it will throw an    error for non-valid indices. Therefore it's not a good idea    to use the index operator.       Maybe we should use object->_has_index(index) provided that    the object implements it.