[Python-checkins] python/dist/src/Python newcompile.c,1.1.2.8,1.1.2.9
jhylton@users.sourceforge.net
jhylton@users.sourceforge.net
Mon, 30 Sep 2002 14:45:55 -0700
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv5239
Modified Files:
Tag: ast-branch
newcompile.c
Log Message:
compiler_if(): Must set elif = 0 to break out of while loop!
Also, restructure print code to use temp for expr to be printed,
making code easier on the eyes.
Index: newcompile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -d -r1.1.2.8 -r1.1.2.9
*** newcompile.c 30 Sep 2002 20:47:23 -0000 1.1.2.8
--- newcompile.c 30 Sep 2002 21:45:53 -0000 1.1.2.9
***************
*** 239,244 ****
compiler_new_block(struct compiler *c)
{
- int i;
struct basicblock *b;
if (c->c_nblocks && c->c_nblocks % DEFAULT_BLOCKS == 0) {
--- 239,244 ----
compiler_new_block(struct compiler *c)
{
struct basicblock *b;
+ int block;
if (c->c_nblocks && c->c_nblocks % DEFAULT_BLOCKS == 0) {
***************
*** 250,254 ****
return -1;
}
- i = c->c_nblocks++;
b = (struct basicblock *)PyObject_Malloc(sizeof(struct basicblock));
if (b == NULL)
--- 250,253 ----
***************
*** 256,261 ****
memset((void *)b, 0, sizeof(struct basicblock));
b->b_ialloc = DEFAULT_BLOCK_SIZE;
! c->c_blocks[i] = b;
! return i;
}
--- 255,261 ----
memset((void *)b, 0, sizeof(struct basicblock));
b->b_ialloc = DEFAULT_BLOCK_SIZE;
! block = c->c_nblocks++;
! c->c_blocks[block] = b;
! return block;
}
***************
*** 551,564 ****
}
for (i = 0; i < n; i++) {
if (dest) {
ADDOP(c, DUP_TOP);
! VISIT(c, expr,
! (expr_ty)asdl_seq_GET(s->v.Print.values, i));
ADDOP(c, ROT_TWO);
ADDOP(c, PRINT_ITEM_TO);
}
else {
! VISIT(c, expr,
! (expr_ty)asdl_seq_GET(s->v.Print.values, i));
ADDOP(c, PRINT_ITEM);
}
--- 551,563 ----
}
for (i = 0; i < n; i++) {
+ expr_ty e = (expr_ty)asdl_seq_GET(s->v.Print.values, i);
if (dest) {
ADDOP(c, DUP_TOP);
! VISIT(c, expr, e);
ADDOP(c, ROT_TWO);
ADDOP(c, PRINT_ITEM_TO);
}
else {
! VISIT(c, expr, e);
ADDOP(c, PRINT_ITEM);
}
***************
*** 590,594 ****
VISIT(c, expr, s->v.If.test);
ADDOP_JREL(c, JUMP_IF_FALSE, next);
! /* NEXT_BLOCK(c); */
ADDOP(c, POP_TOP);
VISIT_SEQ(c, stmt, s->v.If.body);
--- 589,593 ----
VISIT(c, expr, s->v.If.test);
ADDOP_JREL(c, JUMP_IF_FALSE, next);
! NEXT_BLOCK(c);
ADDOP(c, POP_TOP);
VISIT_SEQ(c, stmt, s->v.If.body);
***************
*** 604,607 ****
--- 603,608 ----
}
}
+ else
+ elif = 0;
if (!elif)
VISIT_SEQ(c, stmt, s->v.If.orelse);