GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/parse/traverse.c Lines: 42 43 97.7 %
Date: 2020-10-03 10:30:04 Branches: 40 50 80.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
622
ANN m_bool traverse_ast(const Env env, const Ast ast) {
7
622
  CHECK_BB(scan0_ast(env, ast))
8
608
  CHECK_BB(scan1_ast(env, ast))
9
558
  CHECK_BB(scan2_ast(env, ast))
10
555
  return check_ast(env, ast);
11
}
12
13
20704
ANN m_bool traverse_exp(const Env env, const Exp exp) {
14
20704
 CHECK_BB(scan1_exp(env, exp))
15
20703
 CHECK_BB(scan2_exp(env, exp))
16
20703
 return check_exp(env, exp) ? 1 : -1;
17
}
18
19
42173
ANN m_bool traverse_func_def(const Env env, const Func_Def def) {
20
42173
  const Func former = env->func;
21
126512
  const m_bool ret = scan1_func_def(env, def) > 0 &&
22

84339
     scan2_func_def(env, def) > 0 &&
23
42166
     check_func_def(env, def) > 0;
24
42173
  env->func = former;
25
42173
  return ret ? GW_OK : GW_ERROR;
26
}
27
28
5
ANN m_bool traverse_union_def(const Env env, const Union_Def def) {
29
//  if(!GET_FLAG(def, scan1))
30
5
    CHECK_BB(scan1_union_def(env, def))
31
//  if(!GET_FLAG(def, scan2))
32
4
  CHECK_BB(scan2_union_def(env, def))
33
//  if(!GET_FLAG(def, check))
34
4
    CHECK_BB(check_union_def(env, def))
35
4
  return check_union_def(env, def);
36
}
37
38
719
ANN m_bool traverse_enum_def(const Env env, const Enum_Def def) {
39
719
  CHECK_BB(scan0_enum_def(env, def))
40
718
  CHECK_BB(scan1_enum_def(env, def))
41
//  CHECK_BB(scan2_enum_def(env, def))
42
718
  return check_enum_def(env, def);
43
}
44
45
14
ANN m_bool traverse_fptr_def(const Env env, const Fptr_Def def) {
46
14
  CHECK_BB(scan0_fptr_def(env, def))
47
13
  CHECK_BB(scan1_fptr_def(env, def))
48
12
  return scan2_fptr_def(env, def);
49
// CHECK_BB(check_fptr_def(env, def))
50
}
51
52
715
ANN m_bool traverse_type_def(const Env env, const Type_Def def) {
53
715
  CHECK_BB(scan0_type_def(env, def))
54
714
  CHECK_BB(scan1_type_def(env, def))
55
714
  CHECK_BB(scan2_type_def(env, def))
56
714
  return check_type_def(env, def);
57
}
58
59
7
ANN m_bool traverse_class_def(const Env env, const Class_Def def) {
60
7
  const Type t = def->base.type;
61
7
  if(!GET_FLAG(t, scan1))
62
5
    CHECK_BB(scan1_class_def(env, def))
63
7
  if(!GET_FLAG(t, scan2))
64
6
    CHECK_BB(scan2_class_def(env, def))
65
7
  if(!GET_FLAG(t, valid))
66
7
    return check_class_def(env, def);
67
  return GW_OK;
68
}