-Subproject commit c32bbfb803ba875ce098b18f5f4e09f97040a5f2
+Subproject commit 83effb10458c2461f366b689c315013bbe491f76
static const f_instr allocmember[] = { RegPushImm, RegPushImm2, RegPushImm3, AllocMember4 };
static const f_instr allocword[] = { AllocWord, AllocWord2, AllocWord3, AllocWord4 };
-ANN static inline Exp this_exp(const Emitter emit, const Type t, const uint pos) {
+ANN static inline Exp this_exp(const Emitter emit, const Type t, const loc_t pos) {
const Exp exp = new_exp_prim_id(emit->gwion->p, insert_symbol("this"), pos);
exp->type = t;
return exp;
return escape;
}
-static int get_escape(const Emitter emit, const char c, const uint pos) {
+static int get_escape(const Emitter emit, const char c, const loc_t pos) {
return emit->escape[(int)c] ?: err_msg(pos, "unrecognized escape sequence '\\%c'", c);
}
-m_bool escape_str(const Emitter emit, const m_str base, const uint pos) {
+m_bool escape_str(const Emitter emit, const m_str base, const loc_t pos) {
unsigned char* str_lit = (unsigned char*)base;
m_str str = base;
while(*str_lit) {
return GW_OK;
}
-ANN m_int str2char(const Emitter emit, const m_str c, const uint pos) {
+ANN m_int str2char(const Emitter emit, const m_str c, const loc_t pos) {
return c[0] != '\\' ? c[0] : get_escape(emit, c[1], pos);
}
mempool_end(gwion->p);
}
-ANN void env_err(const Env env, const uint pos, const m_str fmt, ...) {
+ANN void env_err(const Env env, const loc_t pos, const m_str fmt, ...) {
gw_err("in file: '%s'\n", env->name);
if(env->class_def)
gw_err("in class: '%s'\n", env->class_def->name);
}
#define GET(a,b) ((a) & (b)) == (b)
-ANN m_bool env_access(const Env env, const ae_flag flag, const uint pos) {
+ANN m_bool env_access(const Env env, const ae_flag flag, const loc_t pos) {
if(env->scope->depth) {
if(GET(flag, ae_flag_global))
ERR_B(pos, "'global' can only be used at %s scope.",
return GW_OK;
}
-ANN m_bool env_storage(const Env env, ae_flag flag, const uint pos) {
+ANN m_bool env_storage(const Env env, ae_flag flag, const loc_t pos) {
CHECK_BB(env_access(env, flag, pos))
return !(env->class_def && GET(flag, ae_flag_global)) ? GW_OK :GW_ERROR;
}
return type;
}
-ANN m_bool already_defined(const Env env, const Symbol s, const uint pos) {
+ANN m_bool already_defined(const Env env, const Symbol s, const loc_t pos) {
const Value v = nspc_lookup_value0(env->curr, s);
return v ? err_msg(pos,
"'%s' already declared as variable of type '%s'.", s_name(s), v->type->name) : GW_OK;
return (Exp)vector_at(&sw->exp, sw->iter++);
}
-ANN m_bool switch_inside(const Env env, const uint pos) {
+ANN m_bool switch_inside(const Env env, const loc_t pos) {
if(!VLEN(&env->scope->swi))
ERR_B(pos, "case found outside switch statement.")
return GW_OK;
}
-ANN m_bool switch_dup(const Env env, const m_int value, const uint pos) {
+ANN m_bool switch_dup(const Env env, const m_int value, const loc_t pos) {
const Switch sw = (Switch)_scope_back(&env->scope->swi);
if(map_get(sw->cases, (vtype)value))
ERR_B(pos, "duplicated cases value %i", value)
return vector_size(&sw->exp);
}
-ANN m_bool switch_default(const Env env, const m_uint pc, const uint pos) {
+ANN m_bool switch_default(const Env env, const m_uint pc, const loc_t pos) {
const Switch sw = (Switch)_scope_back(&env->scope->swi);
if(sw->default_case_index)
ERR_B(pos, "default case already defined")
while((e = e->next) && gw_err(","));
}
-ANN2(1) static void* function_alternative(const Env env, const Type f, const Exp args, const uint pos){
+ANN2(1) static void* function_alternative(const Env env, const Type f, const Exp args, const loc_t pos){
env_err(env, pos, "argument type(s) do not match for function. should be :");
Func up = f->d.func;
do {
return v;
}
-ANN static inline m_bool scan0_defined(const Env env, const Symbol s, const uint pos) {
+ANN static inline m_bool scan0_defined(const Env env, const Symbol s, const loc_t pos) {
if(nspc_lookup_type1(env->curr, s))
ERR_B(pos, "type '%s' already defined", s_name(s));
return already_defined(env, s, pos);
ANN m_bool scan1_class_def(const Env env, const Class_Def class_def);
ANN static m_bool scan1_stmt(const Env env, Stmt stmt);
-ANN static Type void_type(const Env env, const Type_Decl* td, const uint pos) {
+ANN static Type void_type(const Env env, const Type_Decl* td, const loc_t pos) {
const Type t = known_type(env, td);
CHECK_OO(t)
if(t->size)
DECL_SECTION_FUNC(scan1)
ANN static m_bool scan1_class_parent(const Env env, const Class_Def class_def) {
- const uint pos = td_pos(class_def->base.ext);
+ const loc_t pos = td_pos(class_def->base.ext);
if(class_def->base.ext->array)
CHECK_BB(scan1_exp(env, class_def->base.ext->array->exp))
const Type parent = class_def->base.type->parent = known_type(env, class_def->base.ext);
#include "vm.h"
#include "parse.h"
-ANN m_bool isres(const Env env, const Symbol xid, const uint pos) {
+ANN m_bool isres(const Env env, const Symbol xid, const loc_t pos) {
const m_str s = s_name(xid);
if(!strcmp(s, "this") || !strcmp(s, "vararg") || !name2op(s))
ERR_B(pos, "%s is reserved.", s_name(xid));
-Subproject commit ed43d9d14df891ffd3b9ae09ac63ad2c9de4d24e
+Subproject commit c09b4ef1af52812816a0cb2fde12e0d81ccc3b06