pike.git / src / las.c

version» Context lines:

pike.git/src/las.c:1:   /*   || 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: las.c,v 1.337 2003/07/30 18:44:38 mast Exp $ + || $Id: las.c,v 1.338 2003/08/03 00:58:06 mast Exp $   */      #include "global.h" - RCSID("$Id: las.c,v 1.337 2003/07/30 18:44:38 mast Exp $"); + RCSID("$Id: las.c,v 1.338 2003/08/03 00:58:06 mast 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:123: Inside #if defined(PIKE_DEBUG)
   {    case F_EXTERNAL:    if(n->type)    {    int parent_id = n->u.integer.a;    int id_no = n->u.integer.b;    struct program_state *state = Pike_compiler;    while (state && (state->new_program->id != parent_id)) {    state = state->previous;    } -  if (state) { +  if (state && id_no != IDREF_MAGIC_THIS) {    struct identifier *id = ID_FROM_INT(state->new_program, id_no);    if (id) {   #if 0   #ifdef PIKE_DEBUG    /* FIXME: This test crashes on valid code because the type of the    * identifier can change in pass 2 - Hubbe    */    if(id->type != n->type)    {    fprintf(stderr, "Type of external node "
pike.git/src/las.c:991:    if(a->u.sval.u.program->flags & PROGRAM_CONSTANT) {    opt_flags=0;    }    if (a->u.sval.u.program->flags & PROGRAM_USES_PARENT) {    yyerror("Can not clone program without parent context.");    }    break;    }    break;    case F_EXTERNAL: -  { +  if (a->u.integer.b != IDREF_MAGIC_THIS) {    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.");    }
pike.git/src/las.c:1390:    res = freeze_node(res);       check_tree(res,0);    return res;   }      node *debug_mkexternalnode(struct program *parent_prog, int i)   {    struct program_state *state;    node *res = mkemptynode(); -  struct identifier *id; +     res->token = F_EXTERNAL;    -  id = ID_FROM_INT(parent_prog, i); +  if (i == IDREF_MAGIC_THIS) { +  type_stack_mark(); +  push_object_type (0, parent_prog->id); +  res->type = pop_unfinished_type(); +  res->node_info = OPT_NOT_CONST; +  } +  +  else { +  struct identifier *id = ID_FROM_INT(parent_prog, i);   #ifdef PIKE_DEBUG    if(d_flag)    {    check_type_string(id->type);    check_string(id->name);    }   #endif       copy_pike_type(res->type, id->type);       /* FIXME */    if(IDENTIFIER_IS_CONSTANT(id->identifier_flags))    {    res->node_info = OPT_EXTERNAL_DEPEND;    }else{    res->node_info = OPT_NOT_CONST;    } -  +  }    res->tree_info = res->node_info;      #ifdef __CHECKER__    _CDR(res) = 0;   #endif    res->u.integer.a = parent_prog->id;    res->u.integer.b = i;       /* Bzot-i-zot */    state = Pike_compiler;
pike.git/src/las.c:1564:    {    push_int(0);    }else{    switch(n->token)    {    case F_CONSTANT:    push_svalue(& n->u.sval);    return;       case F_EXTERNAL: -  { -  struct program_state *state = Pike_compiler; +  if (n->u.integer.b == IDREF_MAGIC_THIS) { +  yyerror ("Expected constant, got reference to this"); +  push_int (0); +  return; +  }    -  +  else { +  struct program_state *state = Pike_compiler;    while (state && (state->new_program->id != n->u.integer.a)) {    state = state->previous;    }    if(!state)    {    yyerror("Failed to resolve external constant");    push_int(0);    return;    }    p = state->new_program;
pike.git/src/las.c:2509:    }    break;       case F_EXTERNAL:    if(needlval) fputc('&', stderr);    {    struct program_state *state = Pike_compiler;    char *name = "?";    int program_id = foo->u.integer.a;    int level = 0; +  int id_no = foo->u.integer.b;    while(state && (state->new_program->id != program_id)) {    state = state->previous;    level++;    } -  if (state) { -  int id_no = foo->u.integer.b; +  if (id_no == IDREF_MAGIC_THIS) +  name = "this"; +  else if (state) {    struct identifier *id = ID_FROM_INT(state->new_program, id_no);    if (id && id->name) {    name = id->name->str;    }    }    fprintf(stderr, "ext(%d:%s)", level, name);    }    break;       case F_TRAMPOLINE:
pike.git/src/las.c:3809:    break;       default:    name="`() (function call)";    break;    }    break;       case F_EXTERNAL:    { -  int program_id = CAR(n)->u.integer.a; +     int id_no = CAR(n)->u.integer.b; -  +  +  if (id_no == IDREF_MAGIC_THIS) +  name = "this"; /* Should perhaps qualify it. */ +  +  else { +  int program_id = CAR(n)->u.integer.a;    struct program_state *state = Pike_compiler;       name="external symbol";       while (state && (state->new_program->id != program_id)) {    state = state->previous;    }       if (state) {    struct identifier *id = ID_FROM_INT(state->new_program, id_no);
pike.git/src/las.c:3843: Inside #if 0 and #if defined(PIKE_DEBUG)
   simple_describe_type(f);    printf("\n");       Pike_fatal("Type of external node is not matching it's identifier.\n");    }   #endif   #endif    }    }    } +  }    break;       default:    name="unknown function";    }       if(max_args < args)    {    if(TEST_COMPAT(0,6))    {