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.50 1998/02/01 04:01:34 hubbe Exp $"); + RCSID("$Id: las.c,v 1.51 1998/02/23 23:24:02 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:1417:    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_APPLY:    {    struct pike_string *s;    struct pike_string *f; +  INT32 max_args,args;    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); -  +  args=count_arguments(s); +  max_args=get_max_args(f);       if(!n->type)    {    char *name;    int args;    switch(CAR(n)->token)    {    case F_IDENTIFIER:    name=ID_FROM_INT(new_program, CAR(n)->u.number)->name->str;    break;       case F_CONSTANT:    switch(CAR(n)->u.sval.type)    {    case T_FUNCTION: -  +  if(CAR(n)->u.sval.subtype == FUNCTION_BUILTIN) +  { +  name=CAR(n)->u.sval.u.efun->name->str; +  }else{    name=ID_FROM_INT(CAR(n)->u.sval.u.object->prog,    CAR(n)->u.sval.subtype)->name->str; -  +  }    break;       case T_ARRAY:    name="array call";    break;       case T_PROGRAM:    name="clone call";    break;       default:    name="`() (function call)";    break;    } -  +  break;       default:    name="unknown function";    }    -  if(max_correct_args == count_arguments(s)) +  if(max_args < args)    { -  +  my_yyerror("To many arguments to %s.\n",name); +  } +  else if(max_correct_args == args) +  {    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;    }