From 1658ab29a5f76d7a527a6f8bfa304e1767d7e1d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sun, 15 Dec 2019 11:09:14 +0100 Subject: [PATCH] :art: Add ensure emit --- src/emit/emit.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- 2.43.0