pike.git
/
src
/
docode.c
version
»
Context lines:
10
20
40
80
file
none
3
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.
185
2006/
02
/
27
12
:
07
:
09
mast
Exp $
+
|| $Id: docode.c,v 1.
186
2006/
03/
02
10
:
24
:
47
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:1041:
default: switch(CDR(n)->token) { case F_LOCAL: if(CDR(n)->u.integer.a >= find_local_frame(CDR(n)->u.integer.b)->max_number_of_locals) yyerror("Illegal to use local variable here."); if(CDR(n)->u.integer.b) goto normal_assign;
+
if (CDR(n)->node_info & OPT_ASSIGNMENT) {
+
/* Initialize. */
+
emit0(F_CONST0);
+
emit1(F_ASSIGN_LOCAL_AND_POP, CDR(n)->u.integer.a);
+
}
code_expression(CAR(n), 0, "RHS"); emit1(flags & DO_POP ? F_ASSIGN_LOCAL_AND_POP:F_ASSIGN_LOCAL, CDR(n)->u.integer.a ); break; /* FIXME: Make special case for F_EXTERNAL */ case F_IDENTIFIER: if(!IDENTIFIER_IS_VARIABLE( ID_FROM_INT(Pike_compiler->new_program, CDR(n)->u.id.number)->identifier_flags)) { yyerror("Cannot assign functions or constants.\n");
pike.git/src/docode.c:2281:
case F_LOCAL: if(n->u.integer.a >= find_local_frame(n->u.integer.b)->max_number_of_locals) yyerror("Illegal to use local variable here."); if(n->u.integer.b) { if(flags & WANT_LVALUE) {
-
emit2(F_LEXICAL_LOCAL_LVALUE,n->u.
id
.
number
,n->u.integer.b);
+
emit2(F_LEXICAL_LOCAL_LVALUE,
n->u.
integer
.
a
,
n->u.integer.b);
return 2; }else{
-
emit2(F_LEXICAL_LOCAL,n->u.
id
.
number
,n->u.integer.b);
+
emit2(F_LEXICAL_LOCAL,
n->u.
integer
.
a
,
n->u.integer.b);
return 1; } }else{ if(flags & WANT_LVALUE) {
-
emit1(F_LOCAL_LVALUE,n->u.
id
.
number
);
+
if (n->node_info & OPT_ASSIGNMENT) {
+
/* Initialize the variable. */
+
emit0(F_CONST0);
+
emit1(F_
ASSIGN_
LOCAL_
AND_POP, n->u.integer.a);
+
}
+
emit1(F_LOCAL_
LVALUE,
n->u.
integer
.
a
);
return 2; }else{
-
emit1(F_LOCAL,n->u.
id
.
number
);
+
if (n->node_info & OPT_ASSIGNMENT) {
+
/* Initialize the variable. */
+
emit0(F_CONST0);
+
emit1(F_
ASSIGN_
LOCAL,
n->u.
integer
.
a
);
+
} else {
+
emit1(F_LOCAL, n->u.integer.a);
+
}
return 1; } } case F_TRAMPOLINE: { struct compiler_frame *f; int depth=0; for(f=Pike_compiler->compiler_frame; f!=n->u.trampoline.frame;f=f->previous)