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.436 2008/10/15 16:08:22 grubba Exp $ + || $Id: las.c,v 1.437 2009/08/06 13:08:40 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:1908:       return mkconstantsvaluenode(s);   }         /* these routines operates on parsetrees and are mostly used by the    * optimizer    */       - /* FIXME: Ought to use parent pointer to avoid recursion. -  * In the SHARED_NODES case there's no need of course. -  */ +    node *copy_node(node *n)   {    node *b;    debug_malloc_touch(n);    debug_malloc_touch(n->type); - #if 0 -  /* The following needs to be node type specific. */ -  debug_malloc_touch(n->u.node.a); -  debug_malloc_touch(n->u.node.b); - #endif +     check_tree(n,0);    if(!n) return n;    switch(n->token)    {    case F_LOCAL:    case F_IDENTIFIER:    case F_TRAMPOLINE:    b=mknewintnode(0);    if(b->type) free_type(b->type);    *b=*n;    copy_pike_type(b->type, n->type);    return b;       default:    add_ref(n);    return n;    } -  if(n->name) -  { -  if(b->name) free_string(b->name); -  add_ref(b->name=n->name); +    } -  /* FIXME: Should b->name be kept if n->name is NULL? -  * /grubba 1999-09-22 -  */ -  b->line_number = n->line_number; -  b->node_info = n->node_info; -  b->tree_info = n->tree_info; -  return b; - } +       int is_const(node *n)   {    if(!n) return 1;    return !(n->tree_info & (OPT_SIDE_EFFECT |    OPT_NOT_CONST |    OPT_ASSIGNMENT |    OPT_CASE |    OPT_CONTINUE |    OPT_BREAK |