From: fennecdjay Date: Fri, 11 Oct 2019 13:08:22 +0000 (+0200) Subject: :art: Cpy_ast coverage X-Git-Tag: nightly~2180 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=f30f8c1c46526ea4f5835b1349bdc969be18dfe8;p=gwion.git :art: Cpy_ast coverage --- diff --git a/src/parse/cpy_ast.c b/src/parse/cpy_ast.c index 4337474e..f881b055 100644 --- a/src/parse/cpy_ast.c +++ b/src/parse/cpy_ast.c @@ -435,11 +435,9 @@ ANN static Stmt cpy_stmt(MemPool p, const Stmt src) { ANN Func_Def cpy_func_def(MemPool p, const Func_Def src) { Func_Def a = mp_calloc(p, Func_Def); a->base = cpy_func_base(p, src->base); - if(!GET_FLAG(a, builtin)) { - if(src->d.code) - a->d.code = cpy_stmt(p, src->d.code); - } else - a->d.dl_func_ptr = src->d.dl_func_ptr; + assert(!GET_FLAG(a, builtin)); + if(src->d.code) + a->d.code = cpy_stmt(p, src->d.code); a->pos = loc_cpy(p, src->pos); a->flag = src->flag; return a; diff --git a/tests/tree/cpy_ast.gw b/tests/tree/cpy_ast.gw index a079bad4..94319435 100644 --- a/tests/tree/cpy_ast.gw +++ b/tests/tree/cpy_ast.gw @@ -9,7 +9,8 @@ class <~A~>C { i++; i ? i : !i; ++i; - union { int ui; }; + union { int ui; } u; + union <~A~>U{ int ui; }; typeof(i); if(i) i; else i; for(int; i < 1; ++i);