diff src/symbol.c @ 77:a338d496350e

Checkpointing conversion to allow object target
author lost
date Fri, 09 Jan 2009 04:23:00 +0000
parents 92eb93bffa28
children d0ce3f5f6797
line wrap: on
line diff
--- a/src/symbol.c	Thu Jan 08 02:57:24 2009 +0000
+++ b/src/symbol.c	Fri Jan 09 04:23:00 2009 +0000
@@ -35,6 +35,11 @@
 recognize because the expression evaluator must avoid all ambiguity in order
 to achieve predictable results. The checks here are simply a fuzz check.
 */
+
+/*
+NOTE: complex symbols always take their value from slot 0 on the expression placeholders
+for a line!
+*/
 int lwasm_register_symbol(asmstate_t *as, lwasm_line_t *l, char *sym, int val, int flags)
 {
 	lwasm_symbol_ent_t *se, *se2;
@@ -45,9 +50,9 @@
 	// if the symbol is constant, fall back to simple registration!
 	if (flags & SYMBOL_COMPLEX)
 	{
-		if (lwasm_expr_is_constant(l -> expr))
+		if (l -> exprs[0] == NULL)
 		{
-			val = lwasm_expr_get_value(l -> expr);
+			val = l -> exprvals[0];
 			flags &= ~SYMBOL_COMPLEX;
 		}
 	}
@@ -98,7 +103,7 @@
 		se -> value = val;
 		if (flags & SYMBOL_COMPLEX)
 		{
-			se -> expr = l -> expr;
+			se -> expr = l -> exprs[0];
 		}
 		return;
 	}
@@ -121,7 +126,7 @@
 	}
 	se -> value = val;
 	if (flags & SYMBOL_COMPLEX)
-		se -> expr = l -> expr;
+		se -> expr = l -> exprs[0];
 	se -> sym = lwasm_strdup(sym);
 	se -> context = scontext;
 	se -> sect = as -> csect;