]> Nishi Git Mirror - gwion.git/commitdiff
:art: Improve nonnull handling
authorfennecdjay <astor.jeremie@wanadoo.fr>
Thu, 26 Sep 2019 00:46:09 +0000 (02:46 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Thu, 26 Sep 2019 00:46:09 +0000 (02:46 +0200)
src/emit/emit.c
src/parse/type_decl.c

index e07b5b88cd3da046371fe1ee7f37d255b21afdc4..4672516a3800873838fea533c261ec87721c0608 100644 (file)
@@ -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);
index a778ab95e8805585fab0904e044a4bc4c43e0dae..9f4f02594216cd37497bfb98ef6fc4041cc0fb76 100644 (file)
@@ -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);
   }