X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=parser.c;h=16613908e3034ac6a3b3599e33a8c0c7a38be941;hp=fc2ef35de879a5cb58d49793984650ff6332f3c5;hb=5f2b7e3d57af89e32db489664ed5b6363294ce8b;hpb=d0ee56f25f6fe0e62c4490cc436e9ae2466e511d diff --git a/parser.c b/parser.c index fc2ef35..1661390 100644 --- a/parser.c +++ b/parser.c @@ -587,6 +587,7 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy) } } break; + case opid1('/'): if (exprs[1]->vtype != TYPE_FLOAT) { ast_type_to_string(exprs[0], ty1, sizeof(ty1)); @@ -595,21 +596,9 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy) return false; } if (!(out = fold_op(parser->fold, op, exprs))) { - if (exprs[0]->vtype == TYPE_FLOAT) + if (exprs[0]->vtype == TYPE_FLOAT) out = (ast_expression*)ast_binary_new(ctx, INSTR_DIV_F, exprs[0], exprs[1]); - else if (exprs[0]->vtype == TYPE_VECTOR) { - out = (ast_expression*)ast_binary_new ( - ctx, - INSTR_MUL_VF, - exprs[0], - (ast_expression*)ast_binary_new( - ctx, - INSTR_DIV_F, - (ast_expression*)parser->fold->imm_float[1], - exprs[1] - ) - ); - } else { + else { ast_type_to_string(exprs[0], ty1, sizeof(ty1)); ast_type_to_string(exprs[1], ty2, sizeof(ty2)); compile_error(ctx, "invalid types used in expression: cannot divide types %s and %s", ty1, ty2);