- fixed: FxPreIncrDecr depended on undefined compiler behavior.

It could only work with right to left function argument processing, but with left to right it failed because the ParseExpressionA call altered sc.TokenType.
Note that with register-based arguments on 64 bit platforms this is a very critical issue!
This commit is contained in:
Christoph Oelckers 2016-09-06 08:41:13 +02:00
parent 954ac8ce5e
commit 3ce25bc348

View file

@ -309,7 +309,8 @@ static FxExpression *ParseExpressionC (FScanner &sc, PClassActor *cls)
static FxExpression *ParseExpressionB (FScanner &sc, PClassActor *cls) static FxExpression *ParseExpressionB (FScanner &sc, PClassActor *cls)
{ {
sc.GetToken(); sc.GetToken();
switch(sc.TokenType) int token = sc.TokenType;
switch(token)
{ {
case '~': case '~':
return new FxUnaryNotBitwise(ParseExpressionA (sc, cls)); return new FxUnaryNotBitwise(ParseExpressionA (sc, cls));
@ -325,7 +326,7 @@ static FxExpression *ParseExpressionB (FScanner &sc, PClassActor *cls)
case TK_Incr: case TK_Incr:
case TK_Decr: case TK_Decr:
return new FxPreIncrDecr(ParseExpressionA(sc, cls), sc.TokenType); return new FxPreIncrDecr(ParseExpressionA(sc, cls), token);
default: default:
sc.UnGet(); sc.UnGet();