ANN static m_bool fptr_tmpl_push(const Env env, struct FptrInfo *info) {
if(!info->rhs->def->base->tmpl)
return GW_OK;
-// some kind of template_match ?
ID_List t0 = info->lhs->def->base->tmpl->list,
t1 = info->rhs->def->base->tmpl->list;
-nspc_push_type(env->gwion->mp, env->curr);
+ nspc_push_type(env->gwion->mp, env->curr);
while(t0) {
-// CHECK_OB(t1)
-nspc_add_type(env->curr, t0->xid, t_undefined);//
-nspc_add_type(env->curr, t1->xid, t_undefined);//
+ if(!t1) {
+ nspc_pop_type(env->gwion->mp, env->curr);
+ return GW_ERROR;
+ }
+ nspc_add_type(env->curr, t0->xid, t_undefined);
+ nspc_add_type(env->curr, t1->xid, t_undefined);
t0 = t0->next;
t1 = t1->next;
}
-// CHECK_BB(template_push_types(env, info->lhs->def->base->tmpl))
-// return template_push_types(env, info->rhs->def->base->tmpl);
-return GW_OK;//
+ return GW_OK;
}
if(fptr_rettype(env, info) > 0 &&
fptr_arity(info) && fptr_args(env, base) > 0)
type = info->lhs->value_ref->type;
- if(info->rhs->def->base->tmpl) {
-// nspc_pop_type(env->gwion->mp, env->curr);
+ if(info->rhs->def->base->tmpl)
nspc_pop_type(env->gwion->mp, env->curr);
- }
}
}
return type;
CHECK_OO(func->next);
return find_func_match_actual(env, func->next, args, implicit, specific);
}
- if(e1->type == t_undefined ||
-(GET_FLAG(func, template) && isa(actual_type(func->value_ref->type), t_fptr) > 0)
-) {
+ if(e1->type == t_undefined || (GET_FLAG(func, template) && is_fptr(func->value_ref->type))) {
if(func->value_ref->owner_class)
CHECK_BO(template_push_types(env, func->value_ref->owner_class->e->def->base.tmpl))
e1->type = known_type(env, e1->td);
e = e->next;
e1 = e1->next;
}
-printf("end %p %p\n", e1, func);
if(!e1)
return func;
} while((func = func->next));
m_func = find_func_match(env, fbase->func, exp->args);
nspc_pop_type(env->gwion->mp, env->curr);
if(!value && m_func) {
-printf("m_func %p\n", m_func);
-if(!m_func->def->base->ret_type)
-CHECK_BO(traverse_func_def(env, m_func->def))
+ if(!m_func->def->base->ret_type)
+ CHECK_BO(traverse_func_def(env, m_func->def))
map_set(&v->owner->info->type->map, (vtype)sym, (vtype)actual_type(m_func->value_ref->type));
-}
+ }
}
free_stmt(env->gwion->mp, stmt);
}
const Exp call = exp->func;
const Exp args = exp->args;
m_uint args_number = 0;
-puts("here ==");
DECL_OO(const Value, value, = nspc_lookup_value1(call->type->e->owner, insert_symbol(call->type->name)))
-puts("after here ==");
const m_uint type_number = get_type_number(value->d.func_ref->def->base->tmpl->list);
-printf("%s func\n", __func__) ;
Type_List tl[type_number];
ID_List list = value->d.func_ref->def->base->tmpl->list;
while(list) {
-printf("%s func\n", __func__) ;
Arg_List arg = value->d.func_ref->def->base->args;
Exp template_arg = args;
while(arg && template_arg) {
DECL_OO(const Func,func, = get_template_func(env, exp, value))
if(!func->def->base->ret_type) // template fptr
CHECK_BO(traverse_func_def(env, func->def))
- return func->def->base->ret_type;
+ return func->def->base->ret_type;
}
ANN static m_bool check_exp_call1_check(const Env env, const Exp exp) {
CHECK_OO((exp->m_func = ret))
return ret->def->base->ret_type;
}
-
- const Type t = check_exp_call1(env, exp);
-printf("here exp_call %p\n", t);
-return t;
-// return check_exp_call1(env, exp);
+ return check_exp_call1(env, exp);
}
ANN static Type check_exp_unary(const Env env, const Exp_Unary* unary) {
ANN m_bool scan1_stmt_fptr(const Env env, const Stmt_Fptr stmt) {
if(!stmt->type)
CHECK_BB(scan0_stmt_fptr(env, stmt))
- if(stmt->base->tmpl)//
- return GW_OK;//
+ if(stmt->base->tmpl)
+ return GW_OK;
CHECK_OB((stmt->base->ret_type = known_type(env, stmt->base->td)))
return stmt->base->args ? scan1_args(env, stmt->base->args) : GW_OK;
}
ptr->type->e->d.func = ptr->base->func;
def->base->tmpl = ptr->base->tmpl;
SET_FLAG(ptr->value, func | ae_flag_checked);
-if(!ptr->base->tmpl)//
- if(ptr->base->args)
+ if(!ptr->base->tmpl && ptr->base->args)
CHECK_BB(scan2_args(env, def))
if(env->class_def) {
if(GET_FLAG(ptr->base->td, global)) {
==4349==
==4349== For counts of detected and suppressed errors, rerun with: -v
==4349== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+/dev/null ==13821== Memcheck, a memory error detector
+==13821== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
+==13821== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
+==13821== Command: ./../../gwion -p. -d dummy /dev/null
+==13821== Parent PID: 13795
+==13821==
+==13821==
+==13821== HEAP SUMMARY:
+==13821== in use at exit: 928 bytes in 10 blocks
+==13821== total heap usage: 974 allocs, 964 frees, 7,596,796 bytes allocated
+==13821==
+==13821== LEAK SUMMARY:
+==13821== definitely lost: 928 bytes in 10 blocks
+==13821== indirectly lost: 0 bytes in 0 blocks
+==13821== possibly lost: 0 bytes in 0 blocks
+==13821== still reachable: 0 bytes in 0 blocks
+==13821== suppressed: 0 bytes in 0 blocks
+==13821== Rerun with --leak-check=full to see details of leaked memory
+==13821==
+==13821== For counts of detected and suppressed errors, rerun with: -v
+==13821== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
+/dev/null ==14729== Memcheck, a memory error detector
+==14729== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
+==14729== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
+==14729== Command: ./../../gwion -p. -d dummy /dev/null
+==14729== Parent PID: 13795
+==14729==
+==14729==
+==14729== HEAP SUMMARY:
+==14729== in use at exit: 576 bytes in 9 blocks
+==14729== total heap usage: 956 allocs, 947 frees, 7,590,612 bytes allocated
+==14729==
+==14729== LEAK SUMMARY:
+==14729== definitely lost: 576 bytes in 9 blocks
+==14729== indirectly lost: 0 bytes in 0 blocks
+==14729== possibly lost: 0 bytes in 0 blocks
+==14729== still reachable: 0 bytes in 0 blocks
+==14729== suppressed: 0 bytes in 0 blocks
+==14729== Rerun with --leak-check=full to see details of leaked memory
+==14729==
+==14729== For counts of detected and suppressed errors, rerun with: -v
+==14729== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
--- /dev/null
+typedef int[2] _int;
+new _int $ _int;
--- /dev/null
+class C {
+ <<<this.aa>>>;
+ int a;
+}
--- /dev/null
+
+#! basic math printed out (note the space after '<<<' and before '>>>'
+<<< 1 + 2 >>>;
+
+#! define and operator
+operator $@+-*%~<>^&!= void (int i, int j) { <<< i, " ", j >>>; }
+
+1 $@+-*%~<>^&!= 2;
--- /dev/null
+typedef int ptr_t<~A~>(A);
+ptr_t ptr;
+<<<ptr>>>;
+
+fun int test<~A~>(A a) { <<< a >>>; }
+test @=> ptr;
+<<< ptr >>>;
+#!3;
+#!3 => test;
+ptr<~int~>(2);
+ptr<~float~>(2.3);