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 as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: las.c,v 1.289 2002/05/15 14:49:33 grubba Exp $"); + RCSID("$Id: las.c,v 1.290 2002/05/23 14:40:24 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:3280:    switch(n->token)    {    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: /* We let this ruin type-checking for now.. */ +  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) +  */ +  +  while(so_far->type == T_FUNCTION) { +  tmp = or_pike_types(arg_type, so_far->car, 1); +  free_type(arg_type); +  arg_type = tmp; +  copy_pike_type(tmp, so_far->cdr); +  free_type(so_far); +  so_far = tmp; +  } +  +  tmp = or_pike_types(arg_type, so_far->car, 1); +  free_type(arg_type); +  arg_type = tmp; +  +  push_finished_type(so_far->cdr); /* Return type */ +  +  free_type(so_far); +  +  so_far = index_type(CAR(n)->type, int_type_string, n); +  tmp = or_pike_types(arg_type, so_far, 1); +  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);    }
pike.git/src/las.c:3537:    {    push_finished_type(n->type);    push_type(T_ARRAY);    free_type(n->type);    n->type = pop_type();    }       break;    }    +  if (!pike_types_le(f, function_type_string)) { +  yytype_error("Calling non function value.", f, s, 0); +  copy_pike_type(n->type, mixed_type_string); +  +  /* print_tree(n); */ +  +  free_type(s); +  break; +  } +     switch(CAR(n)->token)    {   #if 0 /* FIXME */    case F_TRAMPOLINE:   #endif    case F_IDENTIFIER:    name=ID_FROM_INT(Pike_compiler->new_program, CAR(n)->u.id.number)->name->str;    break;       case F_ARROW: