Branch: Tag:

2001-08-02

2001-08-02 22:24:11 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

preserve variables used by lambdas so that they do not fall out of scope, Kupo

Rev: src/language.yacc:1.257
Rev: src/las.h:1.51
Rev: src/program.c:1.361
Rev: src/testsuite.in:1.447

5:   \*/   /**/   #include "global.h" - RCSID("$Id: program.c,v 1.360 2001/07/20 16:23:49 grubba Exp $"); + RCSID("$Id: program.c,v 1.361 2001/08/02 22:24:10 hubbe Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"
5028:       f->current_number_of_locals=0;    f->max_number_of_locals=0; +  f->min_number_of_locals=0;    f->last_block_level=-1;       f->current_function_number=-2; /* no function */
5038:    Pike_compiler->compiler_frame=f;   }    - void pop_local_variables(int level) + void low_pop_local_variables(int level)   {    while(Pike_compiler->compiler_frame->current_number_of_locals > level)    {
5053:    }   }    + void pop_local_variables(int level) + { + #if 1 +  /* We need to save the variables Kuppo (but not their names) */ +  if(level < Pike_compiler->compiler_frame->min_number_of_locals) +  { +  for(;level<Pike_compiler->compiler_frame->min_number_of_locals;level++) +  { +  free_string(Pike_compiler->compiler_frame->variable[level].name); +  MAKE_CONSTANT_SHARED_STRING(Pike_compiler->compiler_frame->variable[level].name,""); +  } +  } + #endif +  low_pop_local_variables(level); + }    -  +    void pop_compiler_frame(void)   {    struct compiler_frame *f;
5064:    fatal("Popping out of compiler frames\n");   #endif    -  pop_local_variables(0); +  low_pop_local_variables(0);    if(f->current_type)    free_type(f->current_type);