GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/parse/traverse.c Lines: 42 43 97.7 %
Date: 2020-09-14 00:22:58 Branches: 39 50 78.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
619
ANN m_bool traverse_ast(const Env env, const Ast ast) {
7
619
  CHECK_BB(scan0_ast(env, ast))
8
605
  CHECK_BB(scan1_ast(env, ast))
9
553
  CHECK_BB(scan2_ast(env, ast))
10
550
  return check_ast(env, ast);
11
}
12
13
20646
ANN m_bool traverse_exp(const Env env, const Exp exp) {
14
20646
 CHECK_BB(scan1_exp(env, exp))
15
20645
 CHECK_BB(scan2_exp(env, exp))
16
20645
 return check_exp(env, exp) ? 1 : -1;
17
}
18
19
42052
ANN m_bool traverse_func_def(const Env env, const Func_Def def) {
20
42052
  const Func former = env->func;
21
126149
  const m_bool ret = scan1_func_def(env, def) > 0 &&
22

84097
     scan2_func_def(env, def) > 0 &&
23
42045
     check_func_def(env, def) > 0;
24
42052
  env->func = former;
25
42052
  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
717
ANN m_bool traverse_enum_def(const Env env, const Enum_Def def) {
39
717
  CHECK_BB(scan0_enum_def(env, def))
40
716
  CHECK_BB(scan1_enum_def(env, def))
41
//  CHECK_BB(scan2_enum_def(env, def))
42
716
  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
712
ANN m_bool traverse_type_def(const Env env, const Type_Def def) {
53
712
  CHECK_BB(scan0_type_def(env, def))
54
712
  CHECK_BB(scan1_type_def(env, def))
55
712
  CHECK_BB(scan2_type_def(env, def))
56
712
  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
}