fixing ast_binstore_codegen's lvalue flag setting, now += on entfields works correctly

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-08-14 17:35:02 +02:00
parent a574da7df8
commit baf6d3ead4
2 changed files with 6 additions and 2 deletions

2
ast.c
View file

@ -1013,7 +1013,7 @@ bool ast_binstore_codegen(ast_binstore *self, ast_function *func, bool lvalue, i
/* for a binstore we need both an lvalue and an rvalue for the left side */
/* rvalue of destination! */
cgen = self->dest->expression.codegen;
if (!(*cgen)((ast_expression*)(self->dest), func, true, &leftr))
if (!(*cgen)((ast_expression*)(self->dest), func, false, &leftr))
return false;
/* source as rvalue only */

View file

@ -51,8 +51,12 @@ void() main = {
float b;
a = 5;
print3("a = ", ftos(a), "\n");
b = (a += 7);
b = a += 7;
print("adding\n");
print3("a = ", ftos(a), "\n");
print3("b = ", ftos(a), "\n");
print3("memb = ", ftos(pawn.memb), "\n");
pawn.memb += 1;
print3("memb = ", ftos(pawn.memb), "\n");
};