pike.git/
src/
docode.c
Branch:
Tag:
Non-build tags
All tags
No tags
2004-12-18
2004-12-18 18:21:57 by Henrik Grubbström (Grubba) <grubba@grubba.org>
57306e5c99327cb1147c7f39bc732c128b73faa9 (
27
lines) (+
26
/-
1
)
[
Show
|
Annotate
]
Branch:
7.9
Added code generation for F_THIS.
Rev: src/docode.c:1.182
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: 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"
737:
}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{
761:
} 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);