X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Ftypes%2Flet_exp.c;h=4600abfe37568ebce796de9e4a4dbc339d5695a1;hb=31cfe5e5e1bd44d408c5869e63fcc7419e81c294;hp=1d8e2ec93b8a92d6c280a364fdac8aa18a07f302;hpb=9bcb1df0786a8193d65949c857baaba2f4296e84;p=m6w6%2Fext-psi diff --git a/src/types/let_exp.c b/src/types/let_exp.c index 1d8e2ec..4600abf 100644 --- a/src/types/let_exp.c +++ b/src/types/let_exp.c @@ -26,6 +26,7 @@ #include "php_psi_stdinc.h" #include "data.h" #include "call.h" +#include "calc.h" #include @@ -247,8 +248,8 @@ void *psi_let_exp_exec(struct psi_let_exp *val, struct psi_decl_arg *darg, case PSI_LET_CALLOC: { - zend_long n = psi_long_num_exp(val->data.alloc->nmemb, frame); - zend_long s = psi_long_num_exp(val->data.alloc->size, frame); + zend_long n = psi_long_num_exp(val->data.alloc->nmemb, frame, NULL); + zend_long s = psi_long_num_exp(val->data.alloc->size, frame, NULL); void *tmp = *psi_call_frame_push_auto(frame, safe_emalloc(n, s, sizeof(void *))); @@ -258,7 +259,17 @@ void *psi_let_exp_exec(struct psi_let_exp *val, struct psi_decl_arg *darg, break; case PSI_LET_NUMEXP: - frame_sym->temp_val.zend.lval = psi_long_num_exp(val->data.num, frame); + { + impl_val res; + token_t val_type = psi_decl_type_get_real(val->var->arg->type)->type; + token_t res_type = psi_num_exp_exec(val->data.num, &res, frame, NULL); + + if (val_type == res_type) { + frame_sym->temp_val = res; + } else { + psi_calc_cast(res_type, &res, val_type, &frame_sym->temp_val); + } + } break; case PSI_LET_CALLBACK: