const Type lhs = gwi_get_type(gwi, op->lhs),
rhs = gwi_get_type(gwi, op->rhs),
ret = gwi_get_type(gwi, op->ret);
- const struct Op_Func opfunc = { .ck=op->ck, .em=op->em };
+ const struct Op_Func opfunc = { .ck=op->ck, .em=op->em, .effect = { .ptr=op->effect.ptr } };
const struct Op_Import opi = { .lhs=lhs, .rhs=rhs, .ret=ret,
.func=&opfunc, .data=(uintptr_t)f, .pos=gwi->loc, .op=op->sym };
return add_op(gwi->gwion, &opi);
return GW_OK;
}
+ANN void gwi_oper_eff(const Gwi gwi, const m_str effect) {
+ if(!gwi->oper->effect.ptr)
+ vector_init(&gwi->oper->effect);
+ vector_add(&gwi->oper->effect, (m_uint)insert_symbol(gwi->gwion->st, effect));
+}
+
ANN m_int gwi_oper_end(const Gwi gwi, const m_str op, const f_instr f) {
gwi->oper->sym = insert_symbol(gwi->gwion->st, op);
const m_bool ret = import_op(gwi, gwi->oper, f);
GWI_BB(gwi_oper_add(gwi, opck_int_mul))
GWI_BB(gwi_oper_end(gwi, "*", int_mul))
GWI_BB(gwi_oper_add(gwi, opck_int_div))
+ GWI_BB(gwi_oper_eff(gwi, "ZeroDivideException"))
GWI_BB(gwi_oper_end(gwi, "/", int_div))
GWI_BB(gwi_oper_add(gwi, opck_int_mod))
return gwi_oper_end(gwi, "%", int_modulo);
GWI_BB(gwi_oper_add(gwi, opck_int_float_sub))
GWI_BB(gwi_oper_end(gwi, "-", int_float_minus))
GWI_BB(gwi_oper_add(gwi, opck_int_float_div))
+ GWI_BB(gwi_oper_eff(gwi, "ZeroDivideException"))
GWI_BB(gwi_oper_end(gwi, "/", int_float_div))
CHECK_IF("=>", rassign, r_assign)
CHECK_IF("+=>", rassign, r_plus)
GWI_BB(gwi_oper_add(gwi, opck_float_int_mul))
GWI_BB(gwi_oper_end(gwi, "*", float_int_mul))
GWI_BB(gwi_oper_add(gwi, opck_float_int_div))
+ GWI_BB(gwi_oper_eff(gwi, "ZeroDivideException"))
GWI_BB(gwi_oper_end(gwi, "/", float_int_div))
CHECK_FI("=>", rassign, r_assign)
CHECK_FI("+=>", rassign, r_plus)
GWI_BB(gwi_oper_end(gwi, "-", FloatMinus))
GWI_BB(gwi_oper_end(gwi, "*", FloatTimes))
GWI_BB(gwi_oper_ini(gwi, "dur", "dur", "float"))
+ GWI_BB(gwi_oper_eff(gwi, "ZeroDivideException"))
GWI_BB(gwi_oper_end(gwi, "/", FloatDivide))
GWI_BB(gwi_oper_ini(gwi, "dur", "float", "dur"))
+ GWI_BB(gwi_oper_eff(gwi, "ZeroDivideException"))
GWI_BB(gwi_oper_end(gwi, "/", FloatDivide))
GWI_BB(gwi_oper_ini(gwi, "float", "dur", "dur"))
GWI_BB(gwi_oper_ini(gwi, "time", "dur", "time"))
GWI_BB(gwi_oper_end(gwi, "+", FloatPlus))
GWI_BB(gwi_oper_end(gwi, "*", FloatTimes))
+ GWI_BB(gwi_oper_eff(gwi, "ZeroDivideException"))
GWI_BB(gwi_oper_end(gwi, "/", FloatDivide))
GWI_BB(gwi_oper_ini(gwi, "time", "time", "dur"))
GWI_BB(gwi_oper_end(gwi, "-", FloatMinus))
GWI_BB(gwi_oper_add(gwi, opck_float_mul))
GWI_BB(gwi_oper_end(gwi, "*", FloatTimes))
GWI_BB(gwi_oper_add(gwi, opck_float_div))
+ GWI_BB(gwi_oper_eff(gwi, "ZeroDivideException"))
GWI_BB(gwi_oper_end(gwi, "/", FloatDivide))
GWI_BB(gwi_oper_end(gwi, "@implicit", NULL))
CHECK_FF("=>", rassign, r_assign)