Added experimental "any" tag to compiler...

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40638
This commit is contained in:
Scott Ehlert 2007-03-16 20:10:26 +00:00
parent 19cfb041aa
commit 43af1a130e
3 changed files with 9 additions and 0 deletions

View File

@ -823,6 +823,7 @@ SC_VDECL int pc_optimize; /* (peephole) optimization level */
SC_VDECL int pc_memflags; /* special flags for the stack/heap usage */
SC_VDECL int pc_functag; /* global function tag */
SC_VDECL int pc_tag_string; /* global string tag */
SC_VDECL int pc_anytag; /* global any tag */
SC_VDECL int glbstringread; /* last global string read */
SC_VDECL constvalue sc_automaton_tab; /* automaton table */

View File

@ -70,6 +70,7 @@
#define VERSION_STR "3.2.3636"
#define VERSION_INT 0x0302
int pc_anytag = 0;
int pc_functag = 0;
int pc_tag_string = 0;
@ -1256,6 +1257,8 @@ static void setconstants(void)
assert(sc_status==statIDLE);
append_constval(&tagname_tab,"_",0,0);/* "untagged" */
append_constval(&tagname_tab,"bool",1,0);
pc_anytag = pc_addtag("any");
pc_functag = pc_addfunctag("Function");
pc_tag_string = pc_addtag("String");

View File

@ -327,6 +327,11 @@ SC_FUNC int matchtag(int formaltag,int actualtag,int allowcoerce)
* tag is "coerced" to zero
*/
if (!allowcoerce || formaltag!=0 || (actualtag & FIXEDTAG)!=0) {
if (formaltag == pc_anytag)
{
return TRUE;
}
if (formaltag & FUNCTAG)
{
if (actualtag == pc_functag || (formaltag == pc_functag && actualtag & FUNCTAG))