From: fennecdjay Date: Thu, 26 Sep 2019 00:46:09 +0000 (+0200) Subject: :art: Improve nonnull handling X-Git-Tag: nightly~2199^2~6 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=e46e0b1c1e9a9ee8d2e80993a83682accc28c993;p=gwion.git :art: Improve nonnull handling --- diff --git a/src/emit/emit.c b/src/emit/emit.c index e07b5b88..4672516a 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1693,8 +1693,7 @@ ANN static m_bool emit_exp_dot(const Emitter emit, const Exp_Dot* member) { (isa(exp_self(member)->type, emit->gwion->type[et_function]) > 0 && !is_fptr(emit->gwion, exp_self(member)->type))) ) { CHECK_BB(emit_exp(emit, member->base, 0)) -// emit_except(emit, member->t_base); - emit_add_instr(emit, GWOP_EXCEPT); + emit_except(emit, member->t_base); } if(isa(exp_self(member)->type, emit->gwion->type[et_function]) > 0 && !is_fptr(emit->gwion, exp_self(member)->type)) return emit_member_func(emit, member); diff --git a/src/parse/type_decl.c b/src/parse/type_decl.c index a778ab95..9f4f0259 100644 --- a/src/parse/type_decl.c +++ b/src/parse/type_decl.c @@ -44,7 +44,7 @@ ANN Type type_decl_resolve(const Env env, const Type_Decl* td) { if(GET_FLAG(td, nonnull)) { if(isa(ret, env->gwion->type[et_void]) > 0) ERR_O(td_pos(td), _("void types can't be nonnull.")) - if(isa(ret, env->gwion->type[et_object]) < 0 && isa(ret, env->gwion->type[et_function]) < 0) + if(isa(ret, env->gwion->type[et_object]) < 0 && isa(ret, env->gwion->type[et_fptr]) < 0) return ret; return type_nonnull(env, ret); }