Untabify code

This commit is contained in:
Arkshine 2014-12-09 22:29:43 +01:00
parent 45bf43d76e
commit 78940b46a4

View File

@ -974,27 +974,27 @@ 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 left value is a symbol and is tagged, we want to check that first.
If we tag array and an enum member is passed as index, we assume enum If we tag array and an enum member is passed as index, we assume enum
is a simple list of constants (as opposite, not a "structure"). E.g.: is a simple list of constants (as opposite, not a "structure"). E.g.:
enum X {A, B}; new Float:array[X]; enum X {A, B}; new Float:array[X];
array[A] = 1.0; array[A] = 1.0;
^ tag of array is checked instead of tag of A. ^ 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))
error(213); error(213);
} }
else if (lval3.tag && !lval2.tag && lval2.forceuntag) { else if (lval3.tag && !lval2.tag && lval2.forceuntag) {
/* Because of the above fix included in AMXX 1.60, a regression has been introduced /* Because of the above fix included in AMXX 1.60, a regression has been introduced
as well, where any tagged members of an enum is ignored when a tag check is required. as well, where any tagged members of an enum is ignored when a tag check is required.
E.g.: enum X {Float:A, SomeTag:B }; new array[X]; E.g.: enum X {Float:A, SomeTag:B }; new array[X];
array[A] = 1.0; array[A] = 1.0;
With the original fix, tag of array is checked instead of tag of A. Result: tag mismatch. With the original fix, tag of array is checked instead of tag of A. Result: tag mismatch.
To bypass the issue, plugin has to untag the value like _:1.0. To bypass the issue, plugin has to untag the value like _:1.0.
To fix this and to avoid old plugins suddenly getting spammed by warnings, we track To fix this and to avoid old plugins suddenly getting spammed by warnings, we track
when a value is untagged, and if the related enum member is tagged and the value is forced when a value is untagged, and if the related enum member is tagged and the value is forced
to be untagged, we assume this matches. to be untagged, we assume this matches.
*/ */
} }
else if (!matchtag(lval3.tag, lval2.tag, TRUE)) { else if (!matchtag(lval3.tag, lval2.tag, TRUE)) {
@ -1225,10 +1225,10 @@ 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 == '_'); /* forced to be untagged with _: */ forceuntag=(*st == '_'); /* forced to be untagged with _: */
lvalue=hier2(lval); lvalue=hier2(lval);
lval->tag=tag; lval->tag=tag;
lval->forceuntag=forceuntag; lval->forceuntag=forceuntag;
return lvalue; return lvalue;
case tDEFINED: case tDEFINED:
paranthese=0; paranthese=0;