pike.git / src / las.c

version» Context lines:

pike.git/src/las.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| 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.12 1997/01/19 09:08:00 hubbe Exp $"); + RCSID("$Id: las.c,v 1.13 1997/01/22 05:19:45 hubbe 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:1131:    break;       case F_ASSIGN:    if(CAR(n) && CDR(n) &&    !match_types(CDR(n)->type,CAR(n)->type))    my_yyerror("Bad type in assignment.");    copy_shared_string(n->type, CDR(n)->type);    break;       case F_INDEX: +  type_a=CAR(n)->type; +  type_b=CDR(n)->type; +  if(!check_indexing(type_a, type_b, n)) +  my_yyerror("Indexing on illegal type."); +  n->type=index_type(type_a,n); +  break; +     case F_ARROW:    type_a=CAR(n)->type;    type_b=CDR(n)->type; -  if(!check_indexing(type_a, type_b)) +  if(!check_indexing(type_a, type_b, n))    my_yyerror("Indexing on illegal type."); -  n->type=index_type(type_a); +  n->type=index_type(type_a,n);    break;       case F_APPLY:    {    struct pike_string *s; -  +  struct pike_string *f;    push_type(T_MIXED); /* match any return type, even void */    push_type(T_VOID); /* not varargs */    push_type(T_MANY);    low_build_function_type(CDR(n));    push_type(T_FUNCTION);    s=pop_type(); -  +  f=CAR(n)->type?CAR(n)->type:mixed_type_string; +  n->type=check_call(s,f);    -  n->type=check_call(s,CAR(n)->type?CAR(n)->type:mixed_type_string); -  +     if(!n->type)    { -  +  char *name; +  int args;    switch(CAR(n)->token)    {    case F_IDENTIFIER:    setup_fake_program(); -  my_yyerror("Bad argument %d to '%s'.", -  max_correct_args+1, -  ID_FROM_INT(& fake_program, CAR(n)->u.number)->name->str); +  name=ID_FROM_INT(&fake_program, CAR(n)->u.number)->name->str;    break;       case F_CONSTANT:    default: -  my_yyerror("Bad argument %d to function call.",max_correct_args+1); +  name="function call";    } -  +  +  if(max_correct_args == count_arguments(s)) +  { +  my_yyerror("To few arguments to %s.\n",name); +  }else{ +  my_yyerror("Bad argument %d to %s.", +  max_correct_args+1, name); +  }    copy_shared_string(n->type, mixed_type_string);    }    free_string(s);    break;    }       case '?':    if(!match_types(CAR(n)->type,mixed_type_string))    yyerror("Bad conditional expression.\n");