-Subproject commit 3cbaf19df28f60ce7b3bb5b0cb3d867902782f88
+Subproject commit 2a9afe545081756266000246a32193648f9b9618
ANN static m_bool emit_exp_if(const Emitter emit, const Exp_If* exp_if) {
CHECK_BB(emit_exp(emit, exp_if->cond, 0))
const Instr op = emit_flow(emit, exp_if->cond->type, BranchEqInt, BranchEqFloat);
- CHECK_BB(emit_exp(emit, exp_if->if_exp, 0))
+ CHECK_BB(emit_exp(emit, exp_if->if_exp ?: exp_if->cond, 0))
const Instr op2 = emit_add_instr(emit, Goto);
op->m_val = emit_code_size(emit);
const m_bool ret = emit_exp(emit, exp_if->else_exp, 0);
ANN static Type check_exp_if(const Env env, const Exp_If* exp_if) {
DECL_OO(const Type, cond, = check_exp(env, exp_if->cond))
- DECL_OO(const Type, if_exp, = check_exp(env, exp_if->if_exp))
+ DECL_OO(const Type, if_exp, = (exp_if->if_exp ? check_exp(env, exp_if->if_exp) : cond))
DECL_OO(const Type, else_exp, = check_exp(env, exp_if->else_exp))
if(isa(cond, t_int) < 0 && isa(cond, t_float) < 0 && isa(cond, t_object) < 0)
ERR_O(exp_self(exp_if)->pos,
ANN static m_bool scan1_exp_if(const Env env, const Exp_If* exp_if) {
CHECK_BB(scan1_exp(env, exp_if->cond))
- CHECK_BB(scan1_exp(env, exp_if->if_exp))
+ CHECK_BB(scan1_exp(env, exp_if->if_exp ?: exp_if->cond))
return scan1_exp(env, exp_if->else_exp);
}
ANN static inline m_bool scan2_exp_if(const Env env, const Exp_If* exp_if) {
CHECK_BB(scan2_exp(env, exp_if->cond))
- CHECK_BB(scan2_exp(env, exp_if->if_exp))
+ CHECK_BB(scan2_exp(env, exp_if->if_exp ?: exp_if->cond))
return scan2_exp(env, exp_if->else_exp);
}