GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/parse/traverse.c Lines: 42 43 97.7 %
Date: 2020-08-07 19:15:19 Branches: 37 50 74.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
633
ANN m_bool traverse_ast(const Env env, const Ast ast) {
7
633
  CHECK_BB(scan0_ast(env, ast))
8
616
  CHECK_BB(scan1_ast(env, ast))
9
552
  CHECK_BB(scan2_ast(env, ast))
10
549
  return check_ast(env, ast);
11
}
12
13
21918
ANN m_bool traverse_exp(const Env env, const Exp exp) {
14
21918
 CHECK_BB(scan1_exp(env, exp))
15
21917
 CHECK_BB(scan2_exp(env, exp))
16
21917
 return check_exp(env, exp) ? 1 : -1;
17
}
18
19
43171
ANN m_bool traverse_func_def(const Env env, const Func_Def def) {
20
43171
  const Func former = env->func;
21
129504
  const m_bool ret = scan1_func_def(env, def) > 0 &&
22

86333
     scan2_func_def(env, def) > 0 &&
23
43162
     check_func_def(env, def) > 0;
24
43171
  env->func = former;
25
43171
  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
736
ANN m_bool traverse_enum_def(const Env env, const Enum_Def def) {
39
736
  CHECK_BB(scan0_enum_def(env, def))
40
735
  CHECK_BB(scan1_enum_def(env, def))
41
//  CHECK_BB(scan2_enum_def(env, def))
42
735
  return check_enum_def(env, def);
43
}
44
45
10
ANN m_bool traverse_fptr_def(const Env env, const Fptr_Def def) {
46
10
  CHECK_BB(scan0_fptr_def(env, def))
47
9
  CHECK_BB(scan1_fptr_def(env, def))
48
8
  return scan2_fptr_def(env, def);
49
// CHECK_BB(check_fptr_def(env, def))
50
}
51
52
731
ANN m_bool traverse_type_def(const Env env, const Type_Def def) {
53
731
  CHECK_BB(scan0_type_def(env, def))
54
731
  CHECK_BB(scan1_type_def(env, def))
55
731
  CHECK_BB(scan2_type_def(env, def))
56
731
  return check_type_def(env, def);
57
}
58
59
6
ANN m_bool traverse_class_def(const Env env, const Class_Def def) {
60
6
  const Type t = def->base.type;
61
6
  if(!GET_FLAG(t, scan1))
62
5
    CHECK_BB(scan1_class_def(env, def))
63
6
  if(!GET_FLAG(t, scan2))
64
6
    CHECK_BB(scan2_class_def(env, def))
65
6
  if(!GET_FLAG(t, valid))
66
6
    return check_class_def(env, def);
67
  return GW_OK;
68
}