pike.git / src / las.c

version» Context lines:

pike.git/src/las.c:3731:    /* The expression gets the type from the variable. */    /* FIXME: Ought to strip non-applicable subtypes from the type. */    copy_pike_type(n->type, CAR(n)->type);    } else {    copy_pike_type(n->type, mixed_type_string);    }    break;       case F_RETURN:    if (!CAR(n) || (CAR(n)->type == void_type_string)) { -  yywarning("Returning a void expression. Converted to zero."); +     if (!CAR(n)) {    _CAR(n) = mkintnode(0);    copy_pike_type(n->type, CAR(n)->type);    } else {    _CAR(n) = mknode(F_COMMA_EXPR, CAR(n), mkintnode(0));    copy_pike_type(n->type, CDAR(n)->type);    } -  +  if (!Pike_compiler->compiler_frame || +  Pike_compiler->compiler_frame->current_return_type != +  void_type_string) { +  yywarning("Returning a void expression. Converted to zero.");    break;    } -  +  }    else if(Pike_compiler->compiler_frame &&    Pike_compiler->compiler_frame->current_return_type)    {    struct pike_type *t = Pike_compiler->compiler_frame->current_return_type;       if( t->type == PIKE_T_AUTO )    {    if( t->car != zero_type_string )    {    /* Not the first one.. */
pike.git/src/las.c:3764:    }    else    {    /* first one.. */    push_finished_type(CAR(n)->type);    }    push_type(PIKE_T_AUTO);    free_type( t );    t = pop_type();    Pike_compiler->compiler_frame->current_return_type = t; -  } else if ((Pike_compiler->compiler_frame->current_return_type != +  } else { +  node *retval = CAR(n); +  if (retval->token == F_COMMA_EXPR) { +  retval = CDR(retval); +  } +  if ((Pike_compiler->compiler_frame->current_return_type !=    void_type_string) || -  (CAR(n)->token != F_CONSTANT) || -  !SAFE_IS_ZERO(&CAR(n)->u.sval)) { +  (retval->token != F_CONSTANT) || +  !SAFE_IS_ZERO(&retval->u.sval)) {    check_node_type(CAR(n), t, "Wrong return type.");    }    } -  +  }    copy_pike_type(n->type, void_type_string);    break;       case F_CASE_RANGE:    if (CDR(n) && CAR(n)) {    fix_type_field(CAR(n));    fix_type_field(CDR(n));    /* case 1 .. 2: */    if (!match_types(CAR(n)->type, CDR(n)->type)) {    if (!match_types(CAR(n)->type, int_type_string) ||