pike.git / src / las.cmod

version» Context lines:

pike.git/src/las.cmod:3813:    case F_MOD_EQ:    case F_DIV_EQ:    /* <lval> <op>= <rval> */    {    const char *efun_name = NULL;    struct pike_string *efun_string = NULL;    int orig_flags;    node *efun_node = NULL;    struct pike_type *f;    enum Pike_opcodes opcode = n->token; -  INT32 args = 0; +  struct call_state cs;    -  +  INIT_CALL_STATE(cs); +     switch(opcode) {    case F_AND_EQ:    efun_name = "`&";    break;    case F_OR_EQ:    efun_name = "`|";    break;    case F_XOR_EQ:    efun_name = "`^";    break;
pike.git/src/las.cmod:3886:       /* NOTE: new_check_call() steals a reference from f! */    copy_pike_type(f, efun_node->type);       free_node(efun_node);       /* NOTE: Temporarily convert the node into an argument list node    * for new_check_call(),    */    n->token = F_ARG_LIST; -  f = debug_malloc_pass(new_check_call(efun_string, f, n, &args, 0)); +  f = debug_malloc_pass(new_check_call(efun_string, f, n, &cs, 0));    n->token = opcode;    if (f) {    struct pike_type *ret = new_get_return_type(f, 0);    free_type(f);    f = ret;    }    -  +  FREE_CALL_STATE(cs); +     if (f && CAR(n)) {    /* Check that the returned type is compatible with the    * variable type.    */    if ((Pike_compiler->compiler_pass == COMPILER_PASS_LAST) &&    !pike_types_le(f, CAR(n)->type, PT_FLAG_CMP_VOID_IS_ZERO, 0)) {    /* a["b"]+=c and a->b+=c can be valid when a is an array.    *    * FIXME: Exactly what case is the problem?    * /grubba 2005-02-15
pike.git/src/las.cmod:4093:    break;       case F_AUTO_MAP:    case F_APPLY:    if (!CAR(n) || (CAR(n)->type == void_type_string)) {    yyerror("Calling a void expression.");    } else {    struct pike_type *f; /* Expected type. */    struct pike_type *s; /* Actual type */    struct pike_string *name = NULL; -  INT32 args; +  struct call_state cs;   #ifdef PIKE_DEBUG    int save_l_flag = l_flag;       if (c->lex.pragmas & ID_COMPILER_TRACE) {    l_flag = 3;    }   #endif    -  args = 0; +  INIT_CALL_STATE(cs);    name = get_name_of_function(CAR(n));      #ifdef PIKE_DEBUG    if (l_flag>2)    safe_pike_fprintf (stderr, "Checking call to %S at %S:%ld.\n", name,    n->current_file, (long)n->line_number);   #endif /* PIKE_DEBUG */       /* NOTE: new_check_call() steals a reference from f! */    copy_pike_type(f, CAR(n)->type); -  f = debug_malloc_pass(new_check_call(name, f, CDR(n), &args, 0)); +  f = debug_malloc_pass(new_check_call(name, f, CDR(n), &cs, 0));       if (!f) {    /* Errors have been generated. */   #ifdef PIKE_DEBUG    l_flag = save_l_flag;   #endif    copy_pike_type(n->type, mixed_type_string); -  +  +  FREE_CALL_STATE(cs);    break;    }       if ((n->type = new_get_return_type(dmalloc_touch(struct pike_type *, f),    0))) {    /* Type/argument-check OK. */    debug_malloc_touch(n->type);       free_type(f);    if(n->token == F_AUTO_MAP)
pike.git/src/las.cmod:4144:    push_finished_type(n->type);    for (depth = is_automap_arg_list(CDR(n)); depth > 0; depth--) {    push_unlimited_array_type(T_ARRAY);    }    free_type(n->type);    n->type = pop_unfinished_type();    }   #ifdef PIKE_DEBUG    l_flag = save_l_flag;   #endif +  +  FREE_CALL_STATE(cs);    break;    }       /* Too few arguments or similar. */    copy_pike_type(n->type, mixed_type_string);       if ((s = get_first_arg_type(dmalloc_touch(struct pike_type *, f),    CALL_NOT_LAST_ARG))) {    yytype_report(REPORT_ERROR, NULL, 0, s,    NULL, 0, NULL,    0, "Too few arguments to %S (got %d).", -  name, args); +  name, cs.argno);    free_type(s);    yytype_report(REPORT_ERROR, NULL, 0, NULL,    NULL, 0, CAR(n)->type,    0, "Function type:");    } else {    yytype_report(REPORT_ERROR, NULL, 0, function_type_string,    NULL, 0, f,    0, "Attempt to call a non function value %S.",    name);    }    free_type(f);   #ifdef PIKE_DEBUG    l_flag = save_l_flag;   #endif -  +  +  FREE_CALL_STATE(cs);    break;    }    copy_pike_type(n->type, mixed_type_string);    break;       case '?':    if (!CAR(n) || (CAR(n)->type == void_type_string)) {    yyerror("Conditional expression is void.");    } else if(!match_types(CAR(n)->type, mixed_type_string))    yyerror("Bad conditional expression.");
pike.git/src/las.cmod:4396:       case F_SSCANF:    if (!CAR(n) || (CAR(n)->token != F_ARG_LIST) || !CAAR(n))    {    yyerror("Too few arguments to sscanf().");    MAKE_CONSTANT_TYPE(n->type, tIntPos);    } else {    struct pike_string *sscanf_name;    struct pike_type *sscanf_type;    node *args; -  INT32 argno = 0; +  struct call_state cs;    MAKE_CONST_STRING(sscanf_name, "sscanf");    add_ref(sscanf_type = sscanf_type_string);    args = mknode(F_ARG_LIST, CAR(n), CDR(n));    add_ref(CAR(n));    if (CDR(n)) add_ref(CDR(n)); -  sscanf_type = new_check_call(sscanf_name, sscanf_type, args, &argno, 0); +  INIT_CALL_STATE(cs); +  sscanf_type = new_check_call(sscanf_name, sscanf_type, args, &cs, 0);    free_node(args);    if (sscanf_type) {    if (!(n->type = new_get_return_type(sscanf_type, 0))) {    struct pike_type *expected;    if ((expected = get_first_arg_type(sscanf_type, CALL_NOT_LAST_ARG))) {    yytype_report(REPORT_ERROR,    NULL, 0, expected,    NULL, 0, NULL,    0, "Too few arguments to sscanf (got %d).", -  argno); +  cs.argno);    free_type(expected);    } else {    /* Most likely not reached. */    yytype_report(REPORT_ERROR,    NULL, 0, function_type_string,    NULL, 0, sscanf_type,    0, "Attempt to call a non function value sscanf.");    }    }    free_type(sscanf_type);    } -  +  FREE_CALL_STATE(cs);    if (!n->type) {    MAKE_CONSTANT_TYPE(n->type, tIntPos);    }    }    break;       case F_TYPEOF:    type_stack_mark();    if (CAR(n)) {    push_finished_type(CAR(n)->type);