pike.git / src / pike_types.c

version» Context lines:

pike.git/src/pike_types.c:6911:    } else if (c->lex.pragmas & ID_STRICT_TYPES) {    yywarning("In argument %d to %S: The @-operator argument has a max length of %d.",    argno, fun_name, 256-cnt);    }    }       return res;   }      /* NOTE: fun_type loses a reference. */ - struct pike_type *new_check_call(struct pike_string *fun_name, + static struct pike_type *new_check_call_arg(struct pike_string *fun_name,    struct pike_type *fun_type, -  node *args, INT32 *argno, INT32 flags) +  node *args, INT32 *argno, +  INT32 flags)   {    struct compilation *c = THIS_COMPILATION;    struct pike_type *tmp = NULL;    struct pike_type *res = NULL;    struct svalue *sval = NULL;       CHECK_COMPILER();       debug_malloc_touch(fun_type);    -  while (args && -  ((args->token == F_ARG_LIST) || (args->token == F_LVALUE_LIST)) && -  fun_type) { -  if (args->token == F_LVALUE_LIST) flags |= CALL_ARG_LVALUE; -  fun_type = new_check_call(fun_name, fun_type, CAR(args), argno, flags); -  debug_malloc_touch(fun_type); -  args = CDR(args); -  } -  +     if (!args || !fun_type) {    debug_malloc_touch(fun_type);    return fun_type;    }       (*argno)++;       if (args->token == F_CONSTANT) {    sval = &args->u.sval;    }
pike.git/src/pike_types.c:7059:   #endif /* PIKE_DEBUG */    yytype_report(REPORT_ERROR, NULL, 0, NULL,    NULL, 0, args->type,    0, "Too many arguments to %S (expected %d arguments).",    fun_name, *argno - 1);    }    free_type(fun_type);    return NULL;   }    + /* NOTE: fun_type loses a reference. */ + struct pike_type *new_check_call(struct pike_string *fun_name, +  struct pike_type *fun_type, +  node *args, INT32 *argno, INT32 flags) + { +  node *orig_arg_parent = NULL; +  INT32 orig_flags = flags; +  int num_lvalue = 0; +  +  if (!args || !fun_type) { +  debug_malloc_touch(fun_type); +  return fun_type; +  } +  +  orig_arg_parent = args->parent; +  args->parent = NULL; /* End marker. */ +  +  debug_malloc_touch(fun_type); +  +  while (args && fun_type) { +  if ((args->token == F_ARG_LIST) || (args->token == F_LVALUE_LIST)) { +  if (args->token == F_LVALUE_LIST) { +  num_lvalue++; +  flags |= CALL_ARG_LVALUE; +  } +  if (CAR(args)) { +  CAR(args)->parent = args; +  args = CAR(args); +  continue; +  } else if (CDR(args)) { +  CDR(args)->parent = args; +  args = CDR(args); +  continue; +  } +  } else { +  fun_type = new_check_call_arg(fun_name, fun_type, args, argno, flags); +  debug_malloc_touch(fun_type); +  +  if (!fun_type) return NULL; +  } +  +  do { +  node *prev = args; +  if (args->token == F_LVALUE_LIST) { +  if (!--num_lvalue) flags = orig_flags; +  } +  args = args->parent; +  if (!args) { +  prev->parent = orig_arg_parent; +  break; +  } +  if ((CAR(args) == prev) && CDR(args)) { +  /* NOTE: The above test is NOT SHARED_NODES safe! */ +  args = CDR(args); +  break; +  } +  } while(args); +  } +  +  return fun_type; + } +    struct pike_type *zzap_function_return(struct pike_type *a,    struct pike_type *fun_ret)   {    struct pike_type *ret = NULL;    switch(a->type)    {    case T_SCOPE:    ret = zzap_function_return(a->cdr, fun_ret);    if (!ret) return NULL;    type_stack_mark();