pike.git / src / las.c

version» Context lines:

pike.git/src/las.c:1:   /*\   ||| This file is part of Pike. For copyright information see COPYRIGHT.   ||| Pike is distributed under GPL, LGPL and MPL. See the file COPYING   ||| for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: las.c,v 1.294 2002/06/07 17:45:49 nilsson Exp $"); + RCSID("$Id: las.c,v 1.295 2002/06/25 14:26:40 grubba Exp $");      #include "language.h"   #include "interpret.h"   #include "las.h"   #include "array.h"   #include "object.h"   #include "stralloc.h"   #include "dynamic_buffer.h"   #include "lex.h"   #include "pike_types.h"
pike.git/src/las.c:3283:    case F_COMMA_EXPR:    case F_ARG_LIST:    fatal_check_c_stack(16384);       low_build_function_type(CDR(n));    low_build_function_type(CAR(n));    break;       case F_PUSH_ARRAY:    { - #ifdef USE_PIKE_TYPE +     struct pike_type *so_far;    struct pike_type *arg_type;    struct pike_type *tmp;       so_far = pop_type();       copy_pike_type(arg_type, void_type_string);       /* Convert fun(a,b,c...:d) to fun(a|b|c|void...:d)    */
pike.git/src/las.c:3324: Inside #if defined(USE_PIKE_TYPE)
   push_finished_type(tmp);    if (tmp == mixed_type_string) {    /* Ensure "or void"... */    push_type(T_VOID);    push_type(T_OR);    }    free_type(arg_type);    free_type(so_far);    free_type(tmp);    push_type(T_MANY); - #else /* !USE_PIKE_TYPE */ -  /* We let this ruin type-checking for now.. */ -  reset_type_stack(); -  -  push_type(T_MIXED); -  push_type(T_VOID); -  push_type(T_OR); /* return type is void or mixed */ -  -  push_type(T_MIXED); -  push_type(T_VOID); -  push_type(T_OR); /* varargs */ -  -  push_type(T_MANY); - #endif /* USE_PIKE_TYPE */ +     }    return;       default:    if(n->type)    {    if(n->type == void_type_string) return;    push_finished_type(n->type);    }else{    push_type(T_MIXED);    } - #ifdef USE_PIKE_TYPE +     push_type(T_FUNCTION); - #endif /* USE_PIKE_TYPE */ +     }   }      void yytype_error(char *msg, struct pike_type *expected_t,    struct pike_type *got_t, unsigned int flags)   {    if (msg)    {    if (flags & YYTE_IS_WARNING)    yywarning("%s", msg);
pike.git/src/las.c:3567:    case F_AUTO_MAP:    case F_APPLY:    if (!CAR(n) || (CAR(n)->type == void_type_string)) {    my_yyerror("Calling a void expression.");    } else {    struct pike_type *f; /* Expected type. */    struct pike_type *s; /* Actual type */    char *name;    INT32 max_args,args;    - #if defined(USE_PIKE_TYPE) && defined(NEW_ARG_CHECK) + #ifdef NEW_ARG_CHECK       args = 0;       copy_pike_type(f, CAR(n)->type);       f = new_check_call(CAR(n), &args, f, CDR(n));       if (f && (n->type = get_ret_type(f))) {    /* Type/argument-check OK. */    free_type(f);    if(n->token == F_AUTO_MAP)    {    push_finished_type(n->type);    push_type(T_ARRAY);    free_type(n->type);    n->type = pop_type();    }    break;    }    - #else /* !(USE_PIKE_TYPE && NEW_ARG_CHECK) */ + #else /* !NEW_ARG_CHECK */       push_type(T_MIXED); /* match any return type */    push_type(T_VOID); /* even void */    push_type(T_OR);       push_type(T_VOID); /* not varargs */    push_type(T_MANY);    function_type_max=0;    low_build_function_type(CDR(n)); - #ifndef USE_PIKE_TYPE -  push_type(T_FUNCTION); - #endif /* !USE_PIKE_TYPE */ +     s = pop_type();    f = CAR(n)->type?CAR(n)->type:mixed_type_string;    n->type = check_call(s, f,    (lex.pragmas & ID_STRICT_TYPES) &&    !(n->node_info & OPT_WEAK_TYPE));    args = count_arguments(s);    max_args = count_arguments(f);    if(max_args<0) max_args = 0x7fffffff;      
pike.git/src/las.c:3748:    }else{    my_yyerror("Bad argument %d to %s.",    max_correct_args+1, name);    }       yytype_error(NULL, f, s, 0);       /* print_tree(n); */       free_type(s); - #endif /* USE_PIKE_TYPE && NEW_ARG_CHECK */ + #endif /* NEW_ARG_CHECK */    }    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.c:3846:    break;    }    if (!op_node->type) {    fix_type_field(op_node);    }       push_finished_type(CAR(n)->type);    push_type(T_VOID);    push_type(T_MANY);    push_finished_type(CDR(n)->type); - #ifdef USE_PIKE_TYPE +     push_type(T_FUNCTION); - #endif /* USE_PIKE_TYPE */ +     push_finished_type(CAR(n)->type);    push_type(T_FUNCTION);       call_type = pop_type();       n->type = check_call(call_type,    op_node->type ? op_node->type : mixed_type_string,    (lex.pragmas & ID_STRICT_TYPES) &&    !(op_node->node_info & OPT_WEAK_TYPE));    if (n->type) {