return GW_OK;
}
+ANN static Type scan1_noret(const Env env, const Func_Base *base) {
+ DECL_OO(const Type, t, = known_type(env, base->td));
+ if(!tflag(t, tflag_noret))
+ return t;
+ ERR_O(base->pos, _("Can't use type `{+G}%s{0}` for return"),
+ t->name);
+}
+
ANN static m_bool _scan1_fdef_base_tmpl(const Env env, Func_Base *base) {
ID_List id = base->tmpl->list;
do nspc_add_type(env->curr, id->xid, env->gwion->type[et_auto]);
while((id = id->next));
- CHECK_OB((base->ret_type = known_type(env, base->td)));
- if(tflag(base->ret_type, tflag_noret))
- ERR_B(base->pos, _("Can't use type `{+G}%s{0}` for return"),
- base->ret_type->name);
+ CHECK_OB((base->ret_type = scan1_noret(env, base)));
if(base->args) {
Arg_List arg = base->args;
do CHECK_OB(known_type(env, arg->td));
fptr->type = nspc_lookup_type0(env->curr, fptr->base->xid);
}
const Func_Def fdef = fptr->base->func->def;
- CHECK_OB((fdef->base->ret_type = scan1_type(env, fdef->base->td)));
- if(tflag(fdef->base->ret_type, tflag_noret))
- ERR_B(fdef->base->pos, _("Can't use type `{+G}%s{0}` for return"),
- fdef->base->ret_type->name);
+ CHECK_OB((fdef->base->ret_type = scan1_noret(env, fdef->base)));
if(!fdef->base->args)
return GW_OK;
RET_NSPC(scan1_args(env, fdef->base->args))
}
ANN m_bool scan1_fdef(const Env env, const Func_Def fdef) {
- if(fdef->base->td) {
- CHECK_OB((fdef->base->ret_type = known_type(env, fdef->base->td)));
- if(tflag(fdef->base->ret_type, tflag_noret))
- ERR_B(fdef->base->pos, _("Can't use type `{+G}%s{0}` for return"),
- fdef->base->ret_type->name);
- }
+ if(fdef->base->td)
+ CHECK_OB((fdef->base->ret_type = scan1_noret(env, fdef->base)));
if(fbflag(fdef->base, fbflag_internal))
CHECK_BB(scan_internal(env, fdef->base));
else if(fbflag(fdef->base, fbflag_op) && env->class_def)