rev 695 - trunk/src

SVN User <[email protected]> Fri, 02 Jul 2004 19:09:03 -0400
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-07-02 19:09:00 -0400 (Fri, 02 Jul 2004)
New Revision: 695

Modified:
   trunk/src/parser_routines.c
Log:
fixed bug in with statement

Modified: trunk/src/parser_routines.c
===================================================================
--- trunk/src/parser_routines.c	2004-07-02 13:00:19 UTC (rev 694)
+++ trunk/src/parser_routines.c	2004-07-02 23:09:00 UTC (rev 695)
@@ -1317,7 +1317,7 @@
 	code *res;
 	obj_p func;
 	int i, k=0, len=2, stack_depth=0, max_stack_depth=0;
-	int blen, llen=0, opcode = OP_NOP, pcnt = 0, depth_dec = 0, param_funcs_len = 0;
+	int blen, llen=0, opcode = OP_NOP, pcnt = 0, param_funcs_len = 0;
 	int hdr_in_codet = sizeof(code)/sizeof(code_t);
 	code_t *baseptr, *ptr;
 
@@ -1367,6 +1367,8 @@
 		calc_code(self, &len, &stack_depth, &max_stack_depth); 
 		len++;
 	}
+	if(flg == WTH_FLG) 
+		len--;
 	res = new_code(param, len, stack_depth, max_stack_depth, 0);
 	if (name)
 		add_code(name, res, &k);
@@ -1388,20 +1390,16 @@
 	if (self)
 		add_code(self, res, &k);
 	switch (flg) {
-		case DEF_FLG: opcode = OP_DEF;	  pcnt = 3; depth_dec =  2; break;
-		case GEN_FLG: opcode = OP_GEN;	  pcnt = 3; depth_dec =  2; break;
-		case WTH_FLG: opcode = OP_WITH;	  pcnt = 2; depth_dec =  1; break;
+		case DEF_FLG: opcode = OP_DEF;	  pcnt = 3; break;
+		case GEN_FLG: opcode = OP_GEN;	  pcnt = 3; break;
+		case WTH_FLG: opcode = OP_WITH;	  pcnt = 2; break;
 	}
 	res->code_data[k  ].bytecode.opcode = opcode;
 	res->code_data[k++].bytecode.param  = pcnt;
 	if (pcnt == 3) res->code_data[k++].num = llen;
 	res->code_data[k++].data = (void*) func;
 	add_to_const_list(param, func);
-	res->stack_depth -= llen*2 + depth_dec;
-	if(flg==WTH_FLG) {
-		res->code_data[k  ].bytecode.opcode = OP_POP;
-		res->code_data[k++].bytecode.param  = 1;
-	}
+	res->stack_depth -= llen*2 + 2;
 	pr_assert(res->len == k);
 	if (body->doc_flg)
 		set_attr(IST, func, SYM(DOC_), (obj_p)(body->code_data[1].data));