#ifndef __TRAVERSE
#define __TRAVERSE
-ANN m_bool traverse_ast(const Env, const Ast*);
+ANN m_bool traverse_ast(const Env, Ast *const);
ANN m_bool traverse_class_def(const Env, const Class_Def);
ANN m_bool traverse_func_def(const Env, const Func_Def);
ANN m_bool traverse_union_def(const Env, const Union_Def);
}
return env->gwion->type[et_int];
}
-
+/*
ANN static void tofloat(Exp e, const m_int i) {
e->exp_type = ae_exp_primary;
e->d.prim.prim_type = ae_prim_float;
e->d.prim.d.fnum = i;
}
-
+*/
static OP_CHECK(opck_cast_i2f) {
Exp_Cast *cast = (Exp_Cast*)data;
if(is_prim_int(cast->exp)) {
ERR_B(e->pos, _("operand is %s"), access);
}
-ANN static inline Type ptr_base(const Env env, const Type t) {
+ANN static inline Type ptr_base(const Type t) {
return (Type)vector_front(&t->info->tuple->types);
-// return known_type(env, *mp_vector_at(t->info->cdef->base.tmpl->call, Type_Decl*, 0));
}
static OP_CHECK(opck_ptr_assign) {
do {
Type u = bin->rhs->type;
do {
- const Type base = ptr_base(env, u);
+ const Type base = ptr_base(u);
if (isa(t, base) > 0) return bin->rhs->type;
} while ((u = u->info->parent) && u->info->cdef->base.tmpl->call);
} while ((t = t->info->parent));
static OP_CHECK(opck_ptr_deref) {
const Exp_Unary *unary = (Exp_Unary *)data;
- return ptr_base(env, unary->exp->type);
+ return ptr_base(unary->exp->type);
}
static OP_CHECK(opck_ptr_cast) {
static OP_CHECK(opck_ptr_implicit) {
const struct Implicit *imp = (struct Implicit *)data;
const Exp e = imp->e;
- const Type base = ptr_base(env, imp->t);
+ const Type base = ptr_base(imp->t);
if (isa(e->type, base) > 0) {
const m_str access = exp_access(e);
if (access) ERR_N(e->pos, _("can't cast %s value to Ptr"), access);
}
static GWION_IMPORT(global_ugens) {
- const VM * vm = gwi_vm(gwi);
+ VM *const vm = gwi_vm(gwi);
struct ugen_importer imp_hole = {vm, compute_mono, "blackhole", 1};
const UGen hole = add_ugen(gwi, &imp_hole);
- struct ugen_importer imp_dac = {vm, dac_tick, "dac", vm->bbq->si->out};
-
// dac needs to have *multi*
const M_Object dac = new_M_UGen(gwi->gwion);
const UGen u = UGEN(dac);
return ret;
}
-ANN static m_bool scan2_args(const Env env, const Func_Def f) {
+ANN static m_bool scan2_args(const Func_Def f) {
Arg_List args = f->base->args;
const bool global = GET_FLAG(f->base, global);
for(uint32_t i = 0; i < args->len; i++) {
ANN m_bool scan2_fptr_def(const Env env NUSED, const Fptr_Def fptr) {
if (!tmpl_base(fptr->base->tmpl)) {
const Func_Def def = fptr->type->info->func->def;
- if (def->base->args) { RET_NSPC(scan2_args(env, def)) }
+ if (def->base->args) { RET_NSPC(scan2_args(def)) }
} else
set_tflag(fptr->type, tflag_ftmpl);
return GW_OK;
CHECK_OB(func_create(env, f, overload, name));
else
f->base->func = base;
- if (f->base->args) CHECK_BB(scan2_args(env, f));
+ if (f->base->args) CHECK_BB(scan2_args(f));
if (!f->builtin && f->d.code) CHECK_BB(scan2_func_def_code(env, f));
if (!base) {
if (fbflag(f->base, fbflag_op)) CHECK_BB(scan2_func_def_op(env, f));
#include "gwion_env.h"
#include "traverse.h"
-ANN m_bool traverse_ast(const Env env, const Ast *ast) {
+ANN m_bool traverse_ast(const Env env, Ast *const ast) {
CHECK_BB(scan0_ast(env, ast));
CHECK_BB(scan1_ast(env, ast));
CHECK_BB(scan2_ast(env, ast));