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.288 2002/05/14 16:08:46 grubba Exp $"); + RCSID("$Id: las.c,v 1.289 2002/05/15 14:49:33 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:3428:    copy_pike_type(n->type, zero_type_string);    } else {    type_a=CAR(n)->type;    type_b=CDR(n)->type;    if(!check_indexing(type_a, type_b, n))    if(!Pike_compiler->catch_level)    my_yyerror("Indexing on illegal type.");    n->type=index_type(type_a, type_b,n);    }    break; +  case F_RANGE: +  { +  node **nptr = my_get_arg(&_CDR(n), 0);    -  +  if (!CAR(n)) { +  /* Unlikely to occurr, and if it does, it has probably +  * already been complained about. +  */ +  copy_pike_type(n->type, mixed_type_string); +  break; +  } +  +  if (nptr) { +  node *arg1 = *nptr; +  +  if ((nptr = my_get_arg(&_CDR(n), 1))) { +  node *arg2 = *nptr; +  +  n->type = range_type(CAR(n)->type, arg1->type, arg2->type); +  break; +  } +  } +  /* Fewer than 2 arguments to F_RANGE. */ +  fatal("Bad number of arguments to F_RANGE.\n"); +  } +  break;    case F_AUTO_MAP_MARKER:    if (!CAR(n) || (CAR(n)->type == void_type_string)) {    my_yyerror("Indexing a void expression.");    /* The optimizer converts this to an expression returning 0. */    copy_pike_type(n->type, zero_type_string);    } else {    type_a=CAR(n)->type;    if(!match_types(type_a, array_type_string))    if(!Pike_compiler->catch_level)    my_yyerror("[*] on non-array.");
pike.git/src/las.c:3750:    }    my_yyerror("Bad arguments to %s=().", op_string->str);    yytype_error(NULL, op_node->type ? op_node->type : mixed_type_string,    call_type, 0);    free_node(op_node);    free_type(call_type);    free_string(op_string);    }    copy_pike_type(n->type, mixed_type_string);    break; -  case F_RANGE: +     case F_INC:    case F_DEC:    case F_POST_INC:    case F_POST_DEC:    if (CAR(n)) {    /* 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);