Gwion coverage report


Directory: src/
File: src/parse/traverse.c
Date: 2023-01-30 18:32:28
Exec Total Coverage
Lines: 40 44 90.9%
Functions: 9 9 100.0%
Branches: 29 50 58.0%

Line Branch Exec Source
1 #include "gwion_util.h"
2 #include "gwion_ast.h"
3 #include "gwion_env.h"
4 #include "traverse.h"
5
6 641 ANN m_bool traverse_ast(const Env env, Ast *const ast) {
7
2/2
✓ Branch 1 taken 63 times.
✓ Branch 2 taken 578 times.
641 CHECK_BB(scan0_ast(env, ast));
8
2/2
✓ Branch 1 taken 66 times.
✓ Branch 2 taken 512 times.
578 CHECK_BB(scan1_ast(env, ast));
9
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 508 times.
512 CHECK_BB(scan2_ast(env, ast));
10 508 return check_ast(env, ast);
11 }
12
13 11539 ANN m_bool traverse_exp(const Env env, const Exp exp) {
14
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 11538 times.
11539 CHECK_BB(scan1_exp(env, exp));
15
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 11538 times.
11538 CHECK_BB(scan2_exp(env, exp));
16
2/2
✓ Branch 1 taken 11533 times.
✓ Branch 2 taken 5 times.
11538 return check_exp(env, exp) ? 1 : -1;
17 }
18
19 54551 ANN static m_bool _traverse_func_def(const Env env, const Func_Def fdef) {
20
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 54551 times.
54551 CHECK_BB(scan0_func_def(env, fdef));
21
2/2
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 54537 times.
54551 CHECK_BB(scan1_func_def(env, fdef));
22
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 54537 times.
54537 CHECK_BB(scan2_func_def(env, fdef));
23 54537 return check_func_def(env, fdef);
24 }
25
26 54551 ANN m_bool traverse_func_def(const Env env, const Func_Def fdef) {
27 54551 const Func former = env->func;
28 54551 const m_bool ret = _traverse_func_def(env, fdef);
29 54551 env->func = former;
30 54551 return ret;
31 }
32
33 638 ANN m_bool traverse_union_def(const Env env, const Union_Def def) {
34 // if(!GET_FLAG(def, scan1))
35
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 638 times.
638 CHECK_BB(scan1_union_def(env, def));
36 // if(!GET_FLAG(def, scan2))
37
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 638 times.
638 CHECK_BB(scan2_union_def(env, def));
38 // if(!GET_FLAG(def, check))
39
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 638 times.
638 CHECK_BB(check_union_def(env, def));
40 638 return check_union_def(env, def);
41 }
42
43 638 ANN m_bool traverse_enum_def(const Env env, const Enum_Def def) {
44
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 638 times.
638 CHECK_BB(scan0_enum_def(env, def));
45
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 638 times.
638 CHECK_BB(scan1_enum_def(env, def));
46 // CHECK_BB(scan2_enum_def(env, def));
47 638 return check_enum_def(env, def);
48 }
49
50 14 ANN m_bool traverse_fptr_def(const Env env, const Fptr_Def def) {
51
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
14 CHECK_BB(scan0_fptr_def(env, def));
52
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
14 CHECK_BB(scan1_fptr_def(env, def));
53
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
14 CHECK_BB(scan2_fptr_def(env, def));
54 14 return check_fptr_def(env, def);
55 }
56
57 2 ANN m_bool traverse_type_def(const Env env, const Type_Def def) {
58
1/2
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
2 CHECK_BB(scan0_type_def(env, def));
59 CHECK_BB(scan1_type_def(env, def));
60 CHECK_BB(scan2_type_def(env, def));
61 return check_type_def(env, def);
62 }
63
64 1358 ANN m_bool traverse_class_def(const Env env, const Class_Def def) {
65 1358 const Type t = def->base.type;
66
2/4
✓ Branch 1 taken 1358 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1358 times.
1358 if (!tflag(t, tflag_scan1)) CHECK_BB(scan1_class_def(env, def));
67
2/4
✓ Branch 1 taken 1358 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1358 times.
1358 if (!tflag(t, tflag_scan2)) CHECK_BB(scan2_class_def(env, def));
68
1/2
✓ Branch 1 taken 1358 times.
✗ Branch 2 not taken.
1358 if (!tflag(t, tflag_check)) return check_class_def(env, def);
69 return GW_OK;
70 }
71