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.181 2004/10/30 11:38:25 mast Exp $ + || $Id: docode.c,v 1.182 2004/12/18 18:21:57 grubba Exp $   */      #include "global.h"   #include "las.h"   #include "program.h"   #include "pike_types.h"   #include "stralloc.h"   #include "interpret.h"   #include "constants.h"   #include "array.h"
pike.git/src/docode.c:730:    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)    { +  if (n->u.integer.b == IDREF_MAGIC_THIS) { +  my_yyerror("this is not an 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)    {
pike.git/src/docode.c:754:    }else{    emit1(F_GLOBAL, n->u.integer.b);    }    }    return 1;    }    }    }    break;    +  case F_THIS: +  { +  int level = 0; +  struct program_state *state = Pike_compiler; +  int inh = n->u.integer.b; +  while (state && (state->new_program->id != n->u.integer.a)) { +  state = state->previous; +  level++; +  } +  if (!state) { +  my_yyerror("Program parent %d lost during compiling.", n->u.integer.a); +  emit1(F_NUMBER,0); +  } else if (!level && !inh) { +  emit1(F_THIS_OBJECT, 0); +  } else { +  emit2(F_THIS, level, inh); +  } +  return 1; +  } +  break; +     case F_UNDEFINED:    yyerror("Undefined identifier");    emit1(F_NUMBER,0);    return 1;       case F_PUSH_ARRAY: {    if (current_label != &top_statement_label_dummy || current_label->cleanups) {    /* Might not have a surrounding apply node if evaluated as a    * constant by the optimizer. */   #ifdef PIKE_DEBUG