Simplify code.

This commit is contained in:
Arkshine 2014-12-13 11:15:06 +01:00
parent 4b11a54345
commit c068eed19d

View File

@ -974,12 +974,9 @@ static int hier14(value *lval1)
} /* if */ } /* if */
if (!oper) { /* tagname mismatch (if "oper", warning already given in plunge2()) */ if (!oper) { /* tagname mismatch (if "oper", warning already given in plunge2()) */
/* If left value is a symbol and is tagged, we want to check that first. /* If the left value is a tagged symbol, assume that it is not an "enum struct." For
If we tag array and an enum member is passed as index, we assume enum example, for "enum X { A, B }; new Float:array[X]" we assume that `A` and `B`
is a simple list of constants (as opposite, not a "structure"). E.g.: are not tagged and the array is an array of floats.
enum X {A, B}; new Float:array[X];
array[A] = 1.0;
^ tag of array is checked instead of tag of A.
*/ */
if (lval3.sym && lval3.sym->tag != 0) { if (lval3.sym && lval3.sym->tag != 0) {
if (!matchtag(lval3.sym->tag, lval2.tag, TRUE)) if (!matchtag(lval3.sym->tag, lval2.tag, TRUE))
@ -1150,7 +1147,6 @@ static int hier2(value *lval)
char *st; char *st;
symbol *sym=NULL; symbol *sym=NULL;
int saveresult; int saveresult;
char forceuntag=FALSE;
sym = NULL; sym = NULL;
tok=lex(&val,&st); tok=lex(&val,&st);
@ -1225,10 +1221,9 @@ static int hier2(value *lval)
return FALSE; return FALSE;
case tLABEL: /* tagname override */ case tLABEL: /* tagname override */
tag=pc_addtag(st); tag=pc_addtag(st);
forceuntag=(*st == '_' && !tag); /* forced to be untagged with _: */
lvalue=hier2(lval); lvalue=hier2(lval);
lval->tag=tag; lval->tag=tag;
lval->forceuntag=forceuntag; lval->forceuntag=!tag; /* forced to be untagged with _: */
return lvalue; return lvalue;
case tDEFINED: case tDEFINED:
paranthese=0; paranthese=0;