pike.git / src / docode.c

version» Context lines:

pike.git/src/docode.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: docode.c,v 1.161 2003/02/24 21:00:44 mast Exp $ + || $Id: docode.c,v 1.162 2003/08/18 15:11:38 mast Exp $   */      #include "global.h" - RCSID("$Id: docode.c,v 1.161 2003/02/24 21:00:44 mast Exp $"); + RCSID("$Id: docode.c,v 1.162 2003/08/18 15:11:38 mast Exp $");   #include "las.h"   #include "program.h"   #include "pike_types.h"   #include "stralloc.h"   #include "interpret.h"   #include "constants.h"   #include "array.h"   #include "pike_macros.h"   #include "pike_error.h"   #include "pike_memory.h"
pike.git/src/docode.c:675:    }    if (!state) {    my_yyerror("Program parent %d lost during compiling.", n->u.integer.a);    emit1(F_NUMBER,0);    return 1;    }    if(level)    {    if(flags & WANT_LVALUE)    { +  if (n->u.integer.b == IDREF_MAGIC_THIS) +  yyerror ("Cannot assign to this.");    emit2(F_EXTERNAL_LVALUE, n->u.integer.b, level);    return 2;    }else{    emit2(F_EXTERNAL, n->u.integer.b, level);    return 1;    }    }else{    if(flags & WANT_LVALUE)    {    emit1(F_GLOBAL_LVALUE, n->u.integer.b);    return 2;    }else{ -  +  if (n->u.integer.b == IDREF_MAGIC_THIS) +  emit1(F_THIS_OBJECT, 0); +  else {    struct identifier *id = ID_FROM_INT(state->new_program,n->u.integer.b);    if(IDENTIFIER_IS_FUNCTION(id->identifier_flags) &&    id->identifier_flags & IDENTIFIER_HAS_BODY)    {    /* Only use this opcode when it's certain that the result    * can't zero, i.e. when we know the function isn't just a    * prototype. */    emit1(F_LFUN, n->u.integer.b);    }else{    emit1(F_GLOBAL, n->u.integer.b);    } -  +  }    return 1;    }    }    }    break;       case F_UNDEFINED:    yyerror("Undefined identifier");    emit1(F_NUMBER,0);    return 1;
pike.git/src/docode.c:984:    emit1(flags & DO_POP ? F_ASSIGN_GLOBAL_AND_POP:F_ASSIGN_GLOBAL,    CDR(n)->u.id.number);    }    break;       case F_EXTERNAL:    /* Check that it is in this context */    if(Pike_compiler ->new_program->id == CDR(n)->u.integer.a)    {    /* Check that it is a variable */ -  if(IDENTIFIER_IS_VARIABLE( ID_FROM_INT(Pike_compiler->new_program, CDR(n)->u.integer.b)->identifier_flags)) +  if(CDR(n)->u.integer.b != IDREF_MAGIC_THIS && +  IDENTIFIER_IS_VARIABLE( ID_FROM_INT(Pike_compiler->new_program, CDR(n)->u.integer.b)->identifier_flags))    {    code_expression(CAR(n), 0, "RHS");    emit1(flags & DO_POP ? F_ASSIGN_GLOBAL_AND_POP:F_ASSIGN_GLOBAL,    CDR(n)->u.integer.b);    break;    }    }    /* fall through */       default:
pike.git/src/docode.c:1498:    emit1(F_APPLY, DO_NOT_WARN((INT32)tmp1));    POP_AND_DONT_CLEANUP;       return 1;    }    else if(CAR(n)->token == F_IDENTIFIER)    {    return do_lfun_call(CAR(n)->u.id.number, CDR(n));    }    else if(CAR(n)->token == F_EXTERNAL && -  CAR(n)->u.integer.a == Pike_compiler->new_program->id) +  CAR(n)->u.integer.a == Pike_compiler->new_program->id && +  CAR(n)->u.integer.b != IDREF_MAGIC_THIS)    {    return do_lfun_call(CAR(n)->u.integer.b, CDR(n));    }    else if(CAR(n)->token == F_ARROW)    {    emit0(F_MARK);    PUSH_CLEANUP_FRAME(do_pop_mark, 0);    do_docode(CAAR(n),0); /* object */    do_docode(CDR(n),0); /* args */    emit1(F_CALL_OTHER, store_prog_string(CDAR(n)->u.sval.u.string));