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. - || $Id: las.c,v 1.400 2007/12/26 11:35:52 grubba Exp $ + || $Id: las.c,v 1.401 2008/01/06 17:32:55 grubba Exp $   */      #include "global.h"   #include "interpret.h"   #include "las.h"   #include "array.h"   #include "object.h"   #include "stralloc.h"   #include "dynamic_buffer.h"   #include "lex.h"
pike.git/src/las.c:4061:    yyerror("Bad argument 1 to foreach().");    } else {    if ((lex.pragmas & ID_STRICT_TYPES) &&    !pike_types_le(CAAR(n)->type, array_type_string)) {    struct pike_string *t = describe_type(CAAR(n)->type);    yywarning("Argument 1 to foreach() is not always an array.");    yywarning("Got: %S", t);    free_string(t);    }    -  if (!CDAR(n) || pike_types_le(CDAR(n)->type, void_type_string)) { +  if (!CDAR(n)) { +  /* No loop variable. Will be converted to a counted loop +  * by treeopt. */ +  } else if (pike_types_le(CDAR(n)->type, void_type_string)) {    yyerror("Bad argument 2 to foreach().");    } else {    struct pike_type *array_value_type;       type_stack_mark();    push_finished_type(CDAR(n)->type);    push_type(T_ARRAY);    array_value_type = pop_unfinished_type();       check_node_type(CAAR(n), array_value_type,