pike.git / src / builtin_functions.c

version» Context lines:

pike.git/src/builtin_functions.c:1466:    SIMPLE_WRONG_NUM_ARGS_ERROR("has_value", 2);       switch(TYPEOF(Pike_sp[-2]))    {    case T_MAPPING:    f_search(2);    f_zero_type(1);       if(TYPEOF(Pike_sp[-1]) == T_INT)    Pike_sp[-1].u.integer = !Pike_sp[-1].u.integer; -  else -  PIKE_ERROR("has_value", -  "Function `zero_type' gave incorrect result.\n", Pike_sp, args); +     break;       case T_PROGRAM:    case T_OBJECT:    /* FIXME: It's very sad that we always have to do linear search    with `values' in case of objects. The problem is that we cannot    use `search' directly since it's undefined whether it returns    -1 (array) or 0 (mapping) during e.g. some data type emulation.       Maybe we should use object->_has_value(value) provided that
pike.git/src/builtin_functions.c:1500:    stack_swap();       /* FALL_THROUGH */       case T_STRING: /* Strings are odd. /Noring */    case T_ARRAY:    f_search(2);       if(TYPEOF(Pike_sp[-1]) == T_INT)    Pike_sp[-1].u.integer = (Pike_sp[-1].u.integer != -1); -  else -  PIKE_ERROR("has_value", "Search gave incorrect result.\n", Pike_sp, args); +     break;       default:    SIMPLE_ARG_TYPE_ERROR ("has_value", 1, "string|array|mapping|object|program");    }   }      /*! @decl void add_constant(string name, mixed value)    *! @decl void add_constant(string name)    *!