diff lwasm/pass1.c @ 53:cb4efc47ce9d

Allow macros to shadow/override builtin operations when the "shadow" pragma is active, which is NOT the default
author lost@l-w.ca
date Tue, 05 Apr 2011 21:48:51 -0600
parents bd8b3fbd1e28
children 1830faeef332
line wrap: on
line diff
--- a/lwasm/pass1.c	Tue Apr 05 21:48:22 2011 -0600
+++ b/lwasm/pass1.c	Tue Apr 05 21:48:51 2011 -0600
@@ -260,6 +260,16 @@
 			if (as -> skipcond && !(instab[opnum].flags & lwasm_insn_cond))
 				goto linedone;
         	
+        	if (as -> pragmas & PRAGMA_SHADOW)
+        	{
+        		// check for macros even if they shadow real operations
+        		// NOTE: "ENDM" cannot be shadowed
+        		if (expand_macro(as, cl, &p1, sym) == 0)
+        		{
+        			// a macro was expanded here
+        			goto linedone;
+        		}
+        	}
 			if (instab[opnum].opcode == NULL)
 			{
 				cl -> insn = -1;