ANN static inline void pop_exp(const Emitter emit, Exp e);
+ANN static m_bool scoped_stmt(const Emitter emit, const Stmt stmt,
+ const m_bool pop);
+
+#ifdef GWION_INLINE
ANN static inline bool check_inline(const Emitter emit, const Func f) {
const uint16_t caller_size = emit->env->func ? emit->env->func->weight
: emit->env->class_def
}
}
-ANN static m_bool scoped_stmt(const Emitter emit, const Stmt stmt,
- const m_bool pop);
ANN static inline m_bool inline_body(const Emitter emit, const Func f) {
struct Vector_ v = {.ptr = emit->code->stack_return.ptr};
vector_init(&emit->code->stack_return);
emit->vararg_offset = vararg_offset;
return ret;
}
-
+#endif
ANN static m_bool _emit_exp_call(const Emitter emit, const Exp_Call *exp_call) {
/*
#ifndef GWION_NOINLINE
return op_emit(emit, &opi);
}
-ANN static inline void emit_func_def_fglobal(const Emitter emit,
- const Value value) {
- const Instr set_mem = emit_add_instr(emit, MemSetImm);
- set_mem->m_val = value->from->offset;
- set_mem->m_val2 = (m_uint)value->d.func_ref->code;
-}
-
ANN static inline void emit_func_def_init(const Emitter emit, const Func func) {
emit_push_code(emit, func->name);
}
#include "gwion.h"
#include "clean.h"
#include "object.h"
+#include "instr.h"
+#include "operator.h"
+#include "import.h"
ANN static inline m_bool freeable(const Type a) {
return tflag(a, tflag_tmpl) || GET_FLAG(a, global);
return insert_symbol(name);
}
-#include "instr.h"
-#include "operator.h"
-#include "import.h"
ANN Type array_type(const Env env, const Type src, const m_uint depth) {
const Symbol sym = array_sym(env, src, depth);
const Type type = nspc_lookup_type1(src->info->value->from->owner, sym);
}
ANN bool type_global(const Env env, Type t) {
- while(t) {
- if(from_global_nspc(env, t->info->value->from->owner)) return true;
- t = t->info->value->from->owner_class;
- }
+ do if(from_global_nspc(env, t->info->value->from->owner)) return true;
+ while((t = t->info->value->from->owner_class));
return false;
}
handle(shred, "InvalidMapAccess");
}
-static inline size_t grow(size_t c) { return c * 2; }
-
static INSTR(hmap_grow) {
const M_Object o = *(M_Object*)(shred->reg - SZ_INT);
const HMap *hmap = (HMap*)o->data;
return ret;
}
-ANN static Exp order_curry(const Env env, Exp fn, Exp arg) {
+ANN static Exp order_curry(const Env env, Exp fn, const Exp _arg) {
const MemPool mp = env->gwion->mp;
Exp base = NULL;
Exp next = NULL;
+ Exp arg = _arg;
do {
const bool hole = is_hole(env, fn);
const Exp curr = !hole ? fn : arg;
return GW_OK;
}
-ANN static inline Type foreach_type(const Env env, const Exp exp) {
- const Type et = exp->type;
- if (isa(et, env->gwion->type[et_array]) < 0)
- ERR_O(exp->pos,
- _("type '%s' is not array.\n"
- " This is not allowed in foreach loop"),
- et->name)
- DECL_OO(Type, base, = typedef_base(et));
- DECL_OO(const Type, t, = array_base_simple(base));
- const m_uint depth = base->array_depth - 1;
- return depth ? array_type(env, t, depth) : t;
-}
-
ANN static void check_idx(const Env env, const Type base, struct EachIdx_ *const idx) {
idx->v = new_value(env->gwion->mp, base, s_name(idx->sym));
valuefrom(env, idx->v->from, idx->pos);
struct Op_Import opi = {
.lhs = exp->type,
.op = insert_symbol("@each_idx"),
- .data = exp,
+ .data = (m_uint)exp,
.pos = idx->pos
};
DECL_OB(const Type, t, = op_check(env, &opi));