-Subproject commit 88118d803a3256e2443b864a8bb3ab8c154289ba
+Subproject commit 24a5f882a8c2e6ebddf8e05f19a8de0a94d884e1
-Subproject commit 86beb5391447f86ff25890cb017fdb7753540e07
+Subproject commit 50e87bce8f22425e9ab55545226a9db5b67fde8e
loop_idx->m_val2 = -1;
stmt->v->from->offset = offset + SZ_INT *2;
if(stmt->idx)
- stmt->vidx->from->offset = offset + SZ_INT;
+ stmt->idx->v->from->offset = offset + SZ_INT;
if(n) {
const Instr instr = emit_add_instr(emit, AutoUnrollInit);
instr->m_val = offset-SZ_INT;
#include "operator.h"
#include "import.h"
ANN Type array_type(const Env env, const Type src, const m_uint depth) {
+if(src == env->gwion->type[et_auto])return src;
const Symbol sym = array_sym(env, src, depth);
const Type type = nspc_lookup_type1(src->info->owner, sym);
if(type)
set_vflag(stmt->v, vflag_valid);
nspc_add_value(env->curr, stmt->sym, stmt->v);
if(stmt->idx) {
- stmt->vidx = new_value(env->gwion->mp, env->gwion->type[et_int], s_name(stmt->idx));
- set_vflag(stmt->vidx, vflag_valid);
- nspc_add_value(env->curr, stmt->idx, stmt->vidx);
+ stmt->idx->v = new_value(env->gwion->mp, env->gwion->type[et_int], s_name(stmt->idx->sym));
+ valuefrom(env, stmt->idx->v->from, stmt->idx->pos);
+ set_vflag(stmt->idx->v, vflag_valid);
+ nspc_add_value(env->curr, stmt->idx->sym, stmt->idx->v);
}
return check_conts(env, stmt_self(stmt), stmt->body);
}
continue;
if(wagner_fisher(name, value->name)) {
if(!vflag(value, vflag_builtin))
- gwerr_secondary("declared here", value->from->filename, value->from->loc);
+ gwerr_secondary("declared here", value->from->filename, value->from->loc);
}
}
}
ANN static inline m_bool stmt_each_defined(const restrict Env env, const Stmt_Each stmt) {
if(nspc_lookup_value1(env->curr, stmt->sym))
ERR_B(stmt_self(stmt)->pos, _("foreach value '%s' is already defined"), s_name(stmt->sym))
- if(stmt->idx && nspc_lookup_value1(env->curr, stmt->idx))
- ERR_B(stmt_self(stmt)->pos, _("foreach index '%s' is already defined"), s_name(stmt->idx))
+ if(stmt->idx && nspc_lookup_value1(env->curr, stmt->idx->sym))
+ ERR_B(stmt_self(stmt)->pos, _("foreach index '%s' is already defined"), s_name(stmt->idx->sym))
return GW_OK;
}
if(list->td) {
SET_FLAG(list->td, late);
CHECK_OB((list->type = void_type(env, list->td)))
- SET_FLAG(list->td, late);
+ UNSET_FLAG(list->td, late);
}
var->value = arg_value(env, list);
nspc_add_value(env->curr, var->xid, var->value);
return check_exp(env, exp) ? 1 : -1;
}
-ANN m_bool traverse_func_def(const Env env, const Func_Def def) {
+ANN static m_bool _traverse_func_def(const Env env, const Func_Def fdef) {
+ CHECK_BB(scan1_func_def(env, fdef))
+ CHECK_BB(scan2_func_def(env, fdef))
+ return check_func_def(env, fdef);
+}
+
+ANN m_bool traverse_func_def(const Env env, const Func_Def fdef) {
const Func former = env->func;
- const m_bool ret = scan1_func_def(env, def) > 0 &&
- scan2_func_def(env, def) > 0 &&
- check_func_def(env, def) > 0;
+ const m_bool ret = _traverse_func_def(env, fdef);
env->func = former;
- return ret ? GW_OK : GW_ERROR;
+ return ret;
}
ANN m_bool traverse_union_def(const Env env, const Union_Def def) {
DECL_OO(const Type, type, = scan_type(env, base, td))
const Type t = !td->ref ? type : ref(env, td);
const Type ret = !td->option ? t : option(env, td);
- return !td->array ? ret : array_type(env, ret, td->array->depth);
+// if(!td->array || ret == env->gwion->type[et_auto])
+// return ret;
+// return array_type(env, ret, td->array->depth);
+ return !td->array ? ret: array_type(env, ret, td->array->depth);
}
ANN static inline void* type_unknown(const Env env, const Type_Decl* td) {