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.198 2000/08/28 10:29:47 grubba Exp $"); + RCSID("$Id: las.c,v 1.199 2000/08/30 21:58:16 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:610:    switch(token)    {    case F_CATCH:    res->node_info |= OPT_SIDE_EFFECT;    if (a) {    res->tree_info |= a->tree_info & ~OPT_BREAK;    }    break;       case F_APPLY: -  if(a && a->token == F_CONSTANT && -  a->u.sval.type == T_FUNCTION && -  a->u.sval.subtype == FUNCTION_BUILTIN) +     { -  res->node_info |= a->u.sval.u.efun->flags; -  }else{ -  res->node_info |= OPT_SIDE_EFFECT | OPT_EXTERNAL_DEPEND; /* for now */ -  if(a) res->tree_info |= a->tree_info; +  unsigned INT16 opt_flags = OPT_SIDE_EFFECT | OPT_EXTERNAL_DEPEND; +  struct identifier *i = NULL; +  +  if (a) { +  switch(a->token) { +  case F_CONSTANT: +  if (a->u.sval.type == T_FUNCTION) { +  if (a->u.sval.subtype == FUNCTION_BUILTIN) { +  opt_flags = a->u.sval.u.efun->flags; +  } else if (a->u.sval.u.object->prog) { +  i = ID_FROM_INT(a->u.sval.u.object->prog, a->u.sval.subtype); +  } else { +  yyerror("Calling function in destructed module.");    } -  +  } +  break; +  case F_EXTERNAL: +  { +  struct program_state *state = Pike_compiler; +  int program_id = a->u.integer.a; +  while (state && (state->new_program->id != program_id)) { +  state = state->previous; +  } +  if (state) { +  i = ID_FROM_INT(state->new_program, a->u.integer.b); +  } else { +  yyerror("Parent has left."); +  } +  } +  break; +  case F_LOCAL: +  /* FIXME: Should lookup functions in the local scope. */ +  default: +  res->tree_info |= a->tree_info; +  } +  if (i && IDENTIFIER_IS_FUNCTION(i->identifier_flags)) { + #ifdef PIKE_DEBUG +  /* Temporary check to see that the flags aren't reset somewhere. */ +  if (i->opt_flags != (OPT_SIDE_EFFECT | OPT_EXTERNAL_DEPEND)) { +  my_yyerror("Identifier %s has opt_flags 0x%04x!", +  i->name->str, i->opt_flags); +  } + #endif /* PIKE_DEBUG */ +  res->node_info |= i->opt_flags; +  } else { +  res->node_info |= opt_flags; +  } +  } else { +  res->node_info |= opt_flags; +  }    if(b) res->tree_info |= b->tree_info; -  +  }    break;       case F_POP_VALUE:    copy_shared_string(res->type, void_type_string);       if(a) res->tree_info |= a->tree_info;    if(b) res->tree_info |= b->tree_info;    break;       case F_MAGIC_SET_INDEX:
pike.git/src/las.c:4361: Inside #if defined(PIKE_DEBUG)
   fprintf(stderr,"%s:%d: IDENTIFIER OPTIMIZATION %s == %s\n",    lex.current_file->str,    lex.current_line,    name->str,    foo->u.efun->name->str);   #endif    ret=define_function(name,    type,    modifiers,    IDENTIFIER_C_FUNCTION | vargs, -  &tmp); +  &tmp, +  foo->u.efun->flags);    free_node(n);    return ret;    }    }    }       tmp.offset=PC;    Pike_compiler->compiler_frame->num_args=args;      #ifdef PIKE_DEBUG
pike.git/src/las.c:4392:    if(vargs) remove_clear_locals++;    do_code_block(check_node_hash(n));    remove_clear_locals=0x7fffffff;    }    }       ret=define_function(name,    type,    modifiers,    IDENTIFIER_PIKE_FUNCTION | vargs, -  &tmp); +  &tmp, +  Pike_compiler->compiler_frame->opt_flags);         #ifdef PIKE_DEBUG    if(a_flag > 1)    fprintf(stderr,"Identifer = %d\n",ret);   #endif       free_node(n);    return ret;   }