Branch: Tag:

2007-09-29

2007-09-29 15:09:03 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Unified IDENTIFIER_EXTERN and IDENTIFIER_ALIAS into IDENTIFIER_ALIAS.
ID_ALIAS is no more.
Added {low_,}define_alias() in analogue with the other identifiers.
Aliases are now used in some places where previously an identifier was copied.
Added support for constants (ie aliases) referring directly to variables and functions in the surrounding scopes.
A program may now be indexed on such a constant (ie alias).
Added some FIXMEs.
Changed API for low_program_from_function().
Disabled find_child() (could not find anything using it).
Bumped build bumber since the identifier encoding has changed.

Rev: src/language.yacc:1.382
Rev: src/object.c:1.277
Rev: src/program.c:1.621
Rev: src/program.h:1.233
Rev: src/version.h:1.394

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: language.yacc,v 1.381 2007/09/18 13:55:58 grubba Exp $ + || $Id: language.yacc,v 1.382 2007/09/29 15:09:03 grubba Exp $   */      %pure_parser
594:       if(!is_const($3))    { -  if(Pike_compiler->compiler_pass==2) +  if(Pike_compiler->compiler_pass==2) { +  int depth = 0; +  struct program_state *state = Pike_compiler; +  node *n = $3; +  while (((n->token == F_COMMA_EXPR) || (n->token == F_ARG_LIST)) && +  ((!CAR(n)) ^ (!CDR(n)))) { +  if (CAR(n)) n = CAR(n); +  else n = CDR(n); +  } +  if (n->token == F_EXTERNAL) { +  while (state && (state->new_program->id != n->u.integer.a)) { +  depth++; +  state = state->previous; +  } +  } +  if (depth && state) { +  /* Alias for a symbol in a surrounding scope. */ +  int id = really_low_reference_inherited_identifier(state, 0, +  n->u.integer.b); +  define_alias($1->u.sval.u.string, n->type, +  Pike_compiler->current_modifiers & ~ID_EXTERN, +  depth, id); +  } else {    yyerror("Constant definition is not constant."); -  else +  } +  } else    add_constant($1->u.sval.u.string, 0,    Pike_compiler->current_modifiers & ~ID_EXTERN);    } else {