pike.git / src / language.yacc

version» Context lines:

pike.git/src/language.yacc:102:   %left TOK_LSH TOK_RSH   %left '+' '-'   %left '*' '%' '/'   %right TOK_NOT '~'   %nonassoc TOK_INC TOK_DEC      %{   /* This is the grammar definition of Pike. */      #include "global.h" - RCSID("$Id: language.yacc,v 1.187 2000/06/09 19:00:47 mast Exp $"); + RCSID("$Id: language.yacc,v 1.188 2000/06/21 00:56:02 hubbe Exp $");   #ifdef HAVE_MEMORY_H   #include <memory.h>   #endif      #include "interpret.h"   #include "array.h"   #include "object.h"   #include "stralloc.h"   #include "las.h"   #include "interpret.h"
pike.git/src/language.yacc:1617:    /* WARNING: If the local function adds more variables we are screwed */    /* WARNING2: if add_local_name stops adding local variables at the end,    * this has to be fixed.    */       localid=compiler_frame->current_number_of_locals-1;    if(compiler_frame->variable[localid].def)    {    $$=copy_node(compiler_frame->variable[localid].def);    }else{ +  if(compiler_frame->lexical_scope & SCOPE_SCOPE_USED) +  {    $$ = mknode(F_ASSIGN, mktrampolinenode($<number>3),    mklocalnode(localid,0)); -  +  }else{ +  $$ = mknode(F_ASSIGN, mkidentifiernode($<number>3), +  mklocalnode(localid,0));    }    } -  +  }    | TOK_IDENTIFIER push_compiler_frame1 error    {    pop_compiler_frame();    $$=mkintnode(0);    }    ;      local_function2: optional_stars TOK_IDENTIFIER push_compiler_frame1 func_args    {    char buf[40];
pike.git/src/language.yacc:1730:    /* WARNING: If the local function adds more variables we are screwed */    /* WARNING2: if add_local_name stops adding local variables at the end,    * this has to be fixed.    */       localid=compiler_frame->current_number_of_locals-1;    if(compiler_frame->variable[localid].def)    {    $$=copy_node(compiler_frame->variable[localid].def);    }else{ +  if(compiler_frame->lexical_scope & SCOPE_SCOPE_USED) +  {    $$ = mknode(F_ASSIGN, mktrampolinenode($<number>5),    mklocalnode(localid,0)); -  +  }else{ +  $$ = mknode(F_ASSIGN, mkidentifiernode($<number>5), +  mklocalnode(localid,0));    }    } -  +  }    | optional_stars TOK_IDENTIFIER push_compiler_frame1 error    {    pop_compiler_frame();    free_node($2);    $$=mkintnode(0);    }    ;         failsafe_program: '{' program end_block