From: Jérémie Astor Date: Sun, 15 Dec 2019 10:09:14 +0000 (+0100) Subject: :art: Add ensure emit X-Git-Tag: nightly~1991 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=1658ab29a5f76d7a527a6f8bfa304e1767d7e1d2;p=gwion.git :art: Add ensure emit --- diff --git a/src/emit/emit.c b/src/emit/emit.c index f3570e26..169484f8 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1796,7 +1796,15 @@ ANN static inline m_bool emit_member(const Emitter emit, const Value v, const ui return GW_OK; } +ANN static m_bool ensure_emit(const Emitter emit, const Type type) { + const Type t = actual_type(emit->gwion, type) ?: type; + if(!GET_FLAG(t, emit) && t->e->def) + CHECK_BB(emit_class_def(emit, t->e->def)) + return GW_OK; +} + ANN static m_bool emit_exp_dot(const Emitter emit, const Exp_Dot* member) { + CHECK_BB(ensure_emit(emit, member->t_base)) if(is_special(emit, member->t_base) > 0) return emit_exp_dot_special(emit, member); const Value value = find_value(actual_type(emit->gwion, member->t_base), member->xid);