mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 15:01:41 +00:00
these changes from earlier seem to be ok
This commit is contained in:
parent
c43950abd8
commit
61da478188
2 changed files with 19 additions and 6 deletions
|
@ -149,6 +149,7 @@ convert_to_float (expr_t *e)
|
||||||
case ex_def:
|
case ex_def:
|
||||||
case ex_expr:
|
case ex_expr:
|
||||||
case ex_uexpr:
|
case ex_uexpr:
|
||||||
|
case ex_temp:
|
||||||
return cast_expr (&type_float, e);
|
return cast_expr (&type_float, e);
|
||||||
default:
|
default:
|
||||||
internal_error (e);
|
internal_error (e);
|
||||||
|
@ -169,7 +170,15 @@ do_op_float (int op, expr_t *e, expr_t *e1, expr_t *e2)
|
||||||
if (!valid_op (op, valid))
|
if (!valid_op (op, valid))
|
||||||
return error (e1, "invalid operand for float");
|
return error (e1, "invalid operand for float");
|
||||||
|
|
||||||
if (op == '=') {
|
if (op == 'b') {
|
||||||
|
// bind is backwards to assign (why did I do that? :P)
|
||||||
|
if ((type = get_type (e2)) != &type_float) {
|
||||||
|
//FIXME optimize casting a constant
|
||||||
|
e->e.expr.e1 = e1 = cast_expr (type, e1);
|
||||||
|
} else if ((conv = convert_to_float (e1)) != e1) {
|
||||||
|
e->e.expr.e1 = e1 = conv;
|
||||||
|
}
|
||||||
|
} else if (op == '=' || op == PAS) {
|
||||||
if ((type = get_type (e1)) != &type_float) {
|
if ((type = get_type (e1)) != &type_float) {
|
||||||
//FIXME optimize casting a constant
|
//FIXME optimize casting a constant
|
||||||
e->e.expr.e2 = e2 = cast_expr (type, e2);
|
e->e.expr.e2 = e2 = cast_expr (type, e2);
|
||||||
|
@ -636,6 +645,7 @@ convert_to_uinteger (expr_t *e)
|
||||||
case ex_def:
|
case ex_def:
|
||||||
case ex_expr:
|
case ex_expr:
|
||||||
case ex_uexpr:
|
case ex_uexpr:
|
||||||
|
case ex_temp:
|
||||||
return cast_expr (&type_uinteger, e);
|
return cast_expr (&type_uinteger, e);
|
||||||
default:
|
default:
|
||||||
internal_error (e);
|
internal_error (e);
|
||||||
|
@ -660,7 +670,14 @@ do_op_uinteger (int op, expr_t *e, expr_t *e1, expr_t *e2)
|
||||||
convert_short_uint (e1);
|
convert_short_uint (e1);
|
||||||
if (e1->type == ex_integer)
|
if (e1->type == ex_integer)
|
||||||
convert_int_uint (e1);
|
convert_int_uint (e1);
|
||||||
if (op == '=') {
|
if (op == 'b') {
|
||||||
|
// bind is backwards to assign (why did I do that? :P)
|
||||||
|
if ((type = get_type (e2)) != &type_uinteger) {
|
||||||
|
e->e.expr.e1 = e1 = cast_expr (type, e1);
|
||||||
|
} else if ((conv = convert_to_uinteger (e1)) != e1) {
|
||||||
|
e->e.expr.e1 = e1 = conv;
|
||||||
|
}
|
||||||
|
} else if (op == '=' || op == PAS) {
|
||||||
if ((type = get_type (e1)) != &type_uinteger) {
|
if ((type = get_type (e1)) != &type_uinteger) {
|
||||||
e->e.expr.e2 = e2 = cast_expr (type, e2);
|
e->e.expr.e2 = e2 = cast_expr (type, e2);
|
||||||
} else if ((conv = convert_to_uinteger (e2)) != e2) {
|
} else if ((conv = convert_to_uinteger (e2)) != e2) {
|
||||||
|
|
|
@ -468,10 +468,6 @@ method_check_params (method_t *method, expr_t *args)
|
||||||
if (!t)
|
if (!t)
|
||||||
return e;
|
return e;
|
||||||
|
|
||||||
if (mtype->parm_types[i] == &type_float && e->type == ex_integer) {
|
|
||||||
convert_int (e);
|
|
||||||
t = &type_float;
|
|
||||||
}
|
|
||||||
if (i < parm_count) {
|
if (i < parm_count) {
|
||||||
if (e->type != ex_nil)
|
if (e->type != ex_nil)
|
||||||
if (!type_assignable (mtype->parm_types[i], t)) {
|
if (!type_assignable (mtype->parm_types[i], t)) {
|
||||||
|
|
Loading…
Reference in a new issue