changeset 84:e12edcfbebd5

Fixed problem with expression evaluation infrastructure not advancing input pointer on pass 2
author lost
date Wed, 14 Jan 2009 07:04:45 +0000
parents 964d68cde469
children 918be0c02239
files src/insn_indexed.c src/lwasm.c
diffstat 2 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/insn_indexed.c	Wed Jan 14 06:33:13 2009 +0000
+++ b/src/insn_indexed.c	Wed Jan 14 07:04:45 2009 +0000
@@ -125,13 +125,11 @@
 		*b1 = 0x9f;
 		*b2 = 0;
 		*b3 = 0;
-		
 		r = lwasm_expr_result2(as, l, (char **)p, 0, &v, 0);
 		if (r < 0)
 		{
 			return;
 		}
-
 		if (**p != ']')
 		{
 			register_error(as, l, 1, "Bad operand");
--- a/src/lwasm.c	Wed Jan 14 06:33:13 2009 +0000
+++ b/src/lwasm.c	Wed Jan 14 07:04:45 2009 +0000
@@ -402,17 +402,18 @@
 		*inp = (char *)ep;
 		if (slot >= 0)
 		{
-			l -> exprends[slot] = *inp;
+			l -> exprends[slot] = ep;
 			l -> exprvals[slot] = lwasm_expr_get_value(s);
 		}
 	}
 	else if (l -> exprs[slot])
 	{
 		s = l -> exprs[slot];
-		*inp = l -> exprends[slot];
 		lwasm_reevaluate_expr(as, l, s);
 		l -> exprvals[slot] = lwasm_expr_get_value(s);
 	}
+	if (as -> passnum == 2 && slot >= 0)
+		*inp = l -> exprends[slot];
 
 	if (s && lwasm_expr_is_constant(s))
 	{