From f30f8c1c46526ea4f5835b1349bdc969be18dfe8 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Fri, 11 Oct 2019 15:08:22 +0200 Subject: [PATCH] :art: Cpy_ast coverage --- src/parse/cpy_ast.c | 8 +++----- tests/tree/cpy_ast.gw | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) 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); -- 2.43.0