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.141 1999/12/14 00:55:10 grubba Exp $"); + RCSID("$Id: las.c,v 1.142 1999/12/14 08:39:11 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:1375:    }       return mkconstantsvaluenode(s);   }         /* these routines operates on parsetrees and are mostly used by the    * optimizer    */    - #ifdef DEAD_CODE + #if 1 /* DEAD_CODE - I need this /Hubbe */      node *copy_node(node *n)   {    node *b; -  +  debug_malloc_touch(n); +  debug_malloc_touch(n->type); +  debug_malloc_touch(n->u.node.a); +  debug_malloc_touch(n->u.node.b);    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_string(b->type);    *b=*n;    copy_shared_string(b->type, n->type);    return b;       default:   #ifdef SHARED_NODES    n->refs++;    return n;   #else /* !SHARED_NODES */ -  case F_CAST: -  b=mkcastnode(n->type,copy_node(CAR(n))); -  break; +     -  case F_SOFT_CAST: -  b=mksoftcastnode(n->type,copy_node(CAR(n))); -  break; -  -  case F_CONSTANT: -  b=mksvaluenode(&(n->u.sval)); -  break; -  -  default: +     switch((car_is_node(n) << 1) | cdr_is_node(n))    {    default: fatal("fooo?\n");       case 3:    b=mknode(n->token, copy_node(CAR(n)), copy_node(CDR(n)));    break;    case 2:    b=mknode(n->token, copy_node(CAR(n)), CDR(n));    break;
pike.git/src/las.c:1432: Inside #if defined(DEAD_CODE)
   b=mknode(n->token, CAR(n), copy_node(CDR(n)));    break;       case 0:    b=mknode(n->token, CAR(n), CDR(n));    }    if(n->type)    copy_shared_string(b->type, n->type);    else    b->type=0; +  +  break; +  +  case F_CAST: +  b=mkcastnode(n->type,copy_node(CAR(n))); +  break; +  +  case F_SOFT_CAST: +  b=mksoftcastnode(n->type,copy_node(CAR(n))); +  break; +  +  case F_CONSTANT: +  b=mksvaluenode(&(n->u.sval)); +  break;   #endif /* SHARED_NODES */    }    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    */
pike.git/src/las.c:2259:       switch(CAR(n)->token)    {   #if 0 /* FIXME */    case F_TRAMPOLINE:   #endif    case F_IDENTIFIER:    name=ID_FROM_INT(new_program, CAR(n)->u.id.number)->name->str;    break;    +  case F_ARROW: +  case F_INDEX: +  if(CDAR(n)->token == F_CONSTANT && +  CDAR(n)->u.sval.type == T_STRING) +  { +  name=CDAR(n)->u.sval.u.string->str; +  }else{ +  name="dynamically resolved function"; +  } +  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;