mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-20 23:30:42 +00:00
It was much easier in the AST, really.
This commit is contained in:
parent
81df8fa139
commit
7c25af973c
1 changed files with 10 additions and 0 deletions
10
ast.c
10
ast.c
|
@ -518,6 +518,16 @@ ast_unary* ast_unary_new(lex_ctx_t ctx, int op,
|
||||||
self->op = op;
|
self->op = op;
|
||||||
self->operand = expr;
|
self->operand = expr;
|
||||||
|
|
||||||
|
if (ast_istype(expr, ast_unary)) {
|
||||||
|
ast_expression *prev = (ast_expression*)((ast_unary*)expr)->operand;
|
||||||
|
if (ast_istype(prev, ast_unary)) {
|
||||||
|
ast_expression_delete((ast_expression*)self);
|
||||||
|
mem_d(self);
|
||||||
|
++opts_optimizationcount[OPTIM_PEEPHOLE];
|
||||||
|
return (ast_unary*)prev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ast_propagate_effects(self, expr);
|
ast_propagate_effects(self, expr);
|
||||||
|
|
||||||
if (op >= INSTR_NOT_F && op <= INSTR_NOT_FNC) {
|
if (op >= INSTR_NOT_F && op <= INSTR_NOT_FNC) {
|
||||||
|
|
Loading…
Reference in a new issue