Branch: Tag:

1999-12-31

1999-12-31 01:53:58 by Martin Stjernholm <mast@lysator.liu.se>

Added new magic identifier "this_program". It behaves like a private
constant that is the current program. (Useful to refer to the same class
when it has no name.) Being private implies that it's the current lexical
program, as opposed to object_program(this_object()).

Rev: src/language.yacc:1.159
Rev: src/program.c:1.194
Rev: src/program.h:1.75

186:   /* This is the grammar definition of Pike. */      #include "global.h" - RCSID("$Id: language.yacc,v 1.158 1999/12/30 16:47:18 grubba Exp $"); + RCSID("$Id: language.yacc,v 1.159 1999/12/31 01:53:57 mast Exp $");   #ifdef HAVE_MEMORY_H   #include <memory.h>   #endif
2197:    if(last_identifier) free_string(last_identifier);    copy_shared_string(last_identifier, $1->u.sval.u.string);    -  if(($$=lexical_islocal(last_identifier))) +  if(last_identifier == this_program_string) { +  struct svalue s; +  s.type=T_PROGRAM; +  s.u.program=new_program; +  $$=mkconstantsvaluenode(&s); +  } +  else if(($$=lexical_islocal(last_identifier)))    {    /* done, nothing to do here */    }else if((i=isidentifier(last_identifier))>=0){