uint16_t depth;
bool in_try;
bool in_loop;
+ bool shadowing;
};
typedef struct Env_ {
ANN m_bool traverse_dot_tmpl(const Emitter emit, const struct dottmpl_ *dt) {
const m_uint scope = emit->env->scope->depth;
+ const bool shadowing = emit->env->scope->shadowing;
+ emit->env->scope->shadowing = true;
struct EnvSet es = {.env = emit->env,
.data = emit,
.func = (_exp_func)emit_cdef,
const m_bool ret = traverse_emit_func_def(emit, dt->def);
if (es.run) envset_pop(&es, dt->owner_class);
emit_pop(emit, scope);
+ emit->env->scope->shadowing = shadowing;
return ret;
}
ANN static inline m_bool shadow_err(const Env env, const Value v,
const loc_t loc) {
+ if(env->scope->shadowing)
+ return GW_OK;
gwerr_basic(_("shadowing a previously defined variable"), NULL, NULL,
env->name, loc, 0);
defined_here(v);
}
const Func obase =
!fptr ? overload->d.func_ref : _class_base(overload->type)->info->func;
- if (GET_FLAG(obase->def->base, final))
+ if (GET_FLAG(obase->def->base, final) && obase->value_ref->from->owner_class != env->class_def)
ERR_B(f->base->pos, _("can't overload final function %s"), overload->name)
const m_bool base = tmpl_base(f->base->tmpl);
const m_bool tmpl = fflag(obase, fflag_tmpl);