diff src/lwasm.c @ 78:121bf4a588ea

Checkpointing deployment of non-constant expression handling
author lost
date Sat, 10 Jan 2009 05:00:42 +0000
parents a338d496350e
children d0ce3f5f6797
line wrap: on
line diff
--- a/src/lwasm.c	Fri Jan 09 04:23:00 2009 +0000
+++ b/src/lwasm.c	Sat Jan 10 05:00:42 2009 +0000
@@ -422,6 +422,18 @@
 		*val = l -> exprvals[slot];
 		return 0;
 	}
+
+	// was a constant result on pass 1 requested?
+	// that means we must have a constant on either pass
+	if (flag & EXPR_PASS1CONST)
+	{
+		*val = 0;
+		l -> exprvals[slot] = 0;
+		register_error(as, l, 1, "Illegal forward, external, or inter-section reference");
+		lwasm_expr_stack_free(s);
+		l -> exprs[slot] = NULL;
+		return -1;
+	}
 	
 	return 1;
 }