mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-30 15:41:12 +00:00
+= operator implemented
This commit is contained in:
parent
3544cfa2b2
commit
a574da7df8
2 changed files with 14 additions and 2 deletions
|
@ -47,4 +47,12 @@ void() main = {
|
|||
print("Foo\n");
|
||||
a = a - 1;
|
||||
} while (a);
|
||||
|
||||
float b;
|
||||
a = 5;
|
||||
print3("a = ", ftos(a), "\n");
|
||||
b = (a += 7);
|
||||
print("adding\n");
|
||||
print3("a = ", ftos(a), "\n");
|
||||
print3("b = ", ftos(a), "\n");
|
||||
};
|
||||
|
|
8
parser.c
8
parser.c
|
@ -624,12 +624,16 @@ static bool parser_sy_pop(parser_t *parser, shunt *sy)
|
|||
type_name[exprs[1]->expression.vtype]);
|
||||
return false;
|
||||
}
|
||||
if (ast_istype(exprs[0], ast_entfield))
|
||||
assignop = type_storep_instr[exprs[0]->expression.vtype];
|
||||
else
|
||||
assignop = type_store_instr[exprs[0]->expression.vtype];
|
||||
switch (exprs[0]->expression.vtype) {
|
||||
case TYPE_FLOAT:
|
||||
out = (ast_expression*)ast_binstore_new(ctx, INSTR_ADD_F, exprs[0], exprs[1]);
|
||||
out = (ast_expression*)ast_binstore_new(ctx, assignop, INSTR_ADD_F, exprs[0], exprs[1]);
|
||||
break;
|
||||
case TYPE_VECTOR:
|
||||
out = (ast_expression*)ast_binstore_new(ctx, INSTR_ADD_V, exprs[0], exprs[1]);
|
||||
out = (ast_expression*)ast_binstore_new(ctx, assignop, INSTR_ADD_V, exprs[0], exprs[1]);
|
||||
break;
|
||||
default:
|
||||
parseerror(parser, "invalid types used in expression: cannot add type %s and %s",
|
||||
|
|
Loading…
Reference in a new issue