[qfcc] Dereference constructor parameters

Sometimes, premature optimization can help, but whatever. Finally,
alias.vert compiles, but the output is fairly broken (incorrect handling
of `return` and the parameters aren't initialized).
This commit is contained in:
Bill Currie 2024-12-11 23:22:28 +09:00
parent 3eef231d70
commit ae0cfe47cc

View file

@ -253,6 +253,12 @@ math_constructor (const type_t *type, const expr_t *params, const expr_t *e)
const expr_t *param_exprs[num_param + 1] = {}; const expr_t *param_exprs[num_param + 1] = {};
list_scatter_rev (&params->list, param_exprs); list_scatter_rev (&params->list, param_exprs);
for (int i = 0; i < num_param; i++) {
if (is_reference (get_type (param_exprs[i]))) {
param_exprs[i] = pointer_deref (param_exprs[i]);
}
}
if (num_param == 1 && is_scalar (get_type (param_exprs[0]))) { if (num_param == 1 && is_scalar (get_type (param_exprs[0]))) {
if (is_matrix (type)) { if (is_matrix (type)) {
return construct_diagonal (type, param_exprs[0], e); return construct_diagonal (type, param_exprs[0], e);