}
ANN void env_err(const Env env, const loc_t loc, const m_str fmt, ...) {
-// if (env->context && env->context->error) return;
#ifndef __FUZZING__
va_list arg;
va_start(arg, fmt);
if (i) text_add(&info->fmt->ls->text, ",");
TmplArg *targ = mp_vector_at(tl, TmplArg, i);
if(targ->type == tmplarg_td) {
- // we may need to stop errors
- if(env->context) env->context->error = true;
- const Type t = known_type(env, targ->d.td);
- if(env->context) env->context->error = false;
- if(t)
- td_fullname(env, &info->fmt->ls->text, t);
- else {
- Exp* exp = td2exp(gwion->mp, targ->d.td);
- if(traverse_exp(env, exp)) {
- if(is_class(gwion, exp->type)) {
- td_fullname(env, &info->fmt->ls->text, exp->type);
- free_exp(gwion->mp, exp);
- } else gwfmt_exp(info->fmt, exp);
- } else GWION_ERR_B(targ->d.td->tag.loc, "invalid template argument");
- }
+ DECL_B(const Type, t, = known_type(env, targ->d.td));
+ td_fullname(env, &info->fmt->ls->text, t);
} else {
Exp* exp = targ->d.exp;
if(check_exp(env, targ->d.exp)) {
}
static void op_narg_err(const Env env, const Func_Def fdef, const loc_t loc) {
- if (!env->context->error) {
- gwerr_basic(_("invalid operator decay"),
- _("Decayed operators take two arguments"), NULL, env->name, loc,
- 0);
- if (fdef) defined_here(fdef->base->func->value_ref);
- env_set_error(env, true);
- }
+ gwerr_basic(_("invalid operator decay"),
+ _("Decayed operators take two arguments"), NULL, env->name, loc,
+ 0);
+ if (fdef) defined_here(fdef->base->func->value_ref);
+ env_set_error(env, true);
}
static bool op_call_narg(const Env env, Exp* arg, const loc_t loc) {
m_uint narg = 0;
static OP_CHECK(bool2float) {
struct Implicit *impl = (struct Implicit *)data;
- if(!env->context->error) {
- gwerr_basic("Can't implicitely cast {G+}bool{0} to {G+}float{0}", NULL, "Did you forget a cast?",
+ gwerr_basic("Can't implicitely cast {G+}bool{0} to {G+}float{0}", NULL, "Did you forget a cast?",
env->name, impl->e->loc, 0);
- env_set_error(env, true);
- }
+ env_set_error(env, true);
return env->gwion->type[et_error];
}
const Value parent = nspc_lookup_value1(env->global_nspc, request->base->tag.sym);
if(parent) {
const Value v = nspc_lookup_value1(env->curr, request->base->tag.sym);
- if(!env->context->error) {
- gwerr_basic_from("is missing {+G}global{0}", NULL, NULL, v->from, 0);
- gwerr_secondary("from requested func", env->name, request->base->tag.loc);
- env_set_error(env, true);
- }
+ gwerr_basic_from("is missing {+G}global{0}", NULL, NULL, v->from, 0);
+ gwerr_secondary("from requested func", env->name, request->base->tag.loc);
+ env_set_error(env, true);
} else gwerr_basic("missing requested function", NULL, NULL, env->name,
request->base->tag.loc, 0);
return false;
ANN static Func ensure_tmpl(const Env env, const Func_Def fdef,
Exp_Call *const exp, const m_str filename) {
if (!tmpl_valid(env, fdef, filename)) return NULL;
- if(env->context && env->context->error) return NULL;
if (exp->args && !exp->args->type) return NULL;
const Func f = fdef->base->func;
const Tmpl tmpl = {.list = fdef->base->tmpl->list, .call = exp->tmpl->call};
POISON_NODE(ok, env, stmt);
}
} else if (stmt->stmt_type == ae_stmt_spread) {
- if(!spreadable(env)) {
+ if(!spreadable(env))
ERR_OK_NODE(ok, stmt, stmt->loc, "spread statement outside of variadic environment");
- stmt->poison = true;
- env->context->error = true;
- }
if(!env->context->extend)
env->context->extend = new_mp_vector(env->gwion->mp, Section, 0);
if(!spread_tmpl(env, &stmt->d.stmt_spread))
Type_Decl *last = td;
while (last->next) last = last->next;
DECL_O(const Type, base, = find(env, td));
- const Context ctx = base->info->value->from->ctx;
- if (ctx && ctx->error) ERR_O(td->tag.loc, _("type '%s' is invalid"), base->name);
+ if (base->error) ERR_O(td->tag.loc, _("type '%s' is invalid"), base->name);
DECL_O(const Type, type, = find1(env, base, td));
DECL_O(const Type, t, = !td->ref ? type : ref(env, td));
DECL_O(const Type, ret, = !td->option ? t : option(env, td));
#define N_SCANPASS 4
static bool typecheck_ast(const Env env, Ast *ast) {
- if(!scan0_ast(env, ast))
- env->context->error = true;
- if(!scan1_ast(env, ast))
- env->context->error = true;
- if(!scan2_ast(env, ast))
- env->context->error = true;
- if(!check_ast(env, ast))
- env->context->error = true;
-// CHECK_B(traverse_ast(env, ast));
-// if(env->scope->poison)env->context->error = true;
- if(env->context->error)return false;
- return true;
+ scan0_ast(env, ast);
+ scan1_ast(env, ast);
+ scan2_ast(env, ast);
+ check_ast(env, ast);
+ return !env->context->error;
}
static const m_str default_passes_name[2] = {"check", "emit"};
ANN bool plugin_ini(struct Gwion_ *gwion, const m_str iname, const loc_t loc) {
const Env env = gwion->env;
if(!_plugin_ini(gwion, iname, loc)) {
- if(gwion->env->context && !gwion->env->context->error)
- env_err(env, loc, "%s: no such plugin\n", iname);
+ env_err(env, loc, "%s: no such plugin\n", iname);
return false;
}
return true;