1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
//! Common types and enums used across program analysis components.
/// Type of definition.
#[derive(Debug, Clone, PartialEq)]
pub enum DefinitionType {
/// Variable definition
Variable,
/// Function definition
Function,
/// Macro definition
Macro,
/// Constant definition
Constant,
/// Type definition
Type,
}
/// Type of dependency.
#[derive(Debug, Clone, PartialEq)]
pub enum DependencyType {
/// Direct reference
Reference,
/// Function call
Call,
/// Macro use
MacroUse,
/// Type constraint
TypeConstraint,
}
/// Type of scope.
#[derive(Debug, Clone, PartialEq)]
pub enum ScopeType {
/// Global scope
Global,
/// Function definition scope
Function,
/// Lambda expression scope
Lambda,
/// Let binding scope
Let,
/// Letrec binding scope
Letrec,
/// Let* binding scope
LetStar,
/// Do loop scope
Do,
/// Macro expansion scope
Macro,
}
/// Inferred type for an expression.
#[derive(Debug, Clone, PartialEq)]
pub enum InferredType {
/// Primitive types
/// Boolean type.
Boolean,
/// Numeric type.
Number,
/// String type.
String,
/// Character type.
Character,
/// Symbol type.
Symbol,
/// Compound types
Pair(Box<InferredType>, Box<InferredType>),
/// List with element type.
List(Box<InferredType>),
/// Vector with element type.
Vector(Box<InferredType>),
/// Function type
Function {
/// Parameter types.
parameters: Vec<InferredType>,
/// Return type.
return_type: Box<InferredType>,
},
/// Unknown type
Unknown,
/// Type variable
Variable(String),
}
/// Type of constraint.
#[derive(Debug, Clone, PartialEq)]
pub enum ConstraintType {
/// Type equality constraint
Equal,
/// Subtype constraint
Subtype,
/// Supertype constraint
Supertype,
}
/// Type of optimization.
#[derive(Debug, Clone, PartialEq)]
pub enum OptimizationType {
/// Tail call optimization
TailCall,
/// Constant folding
ConstantFolding,
/// Dead code elimination
DeadCode,
/// Common subexpression elimination
CommonSubexpression,
/// Loop optimization
Loop,
/// Inlining
Inline,
/// Strength reduction
StrengthReduction,
}
/// Impact of optimization.
#[derive(Debug, Clone, PartialEq)]
pub enum OptimizationImpact {
/// Low performance impact
Low,
/// Medium performance impact
Medium,
/// High performance impact
High,
}
/// Type of warning.
#[derive(Debug, Clone, PartialEq)]
pub enum WarningType {
/// Unused variable warning
UnusedVariable,
/// Unused function warning
UnusedFunction,
/// Potentially uninitialized variable
PotentiallyUninitializedVariable,
/// Variable shadowing warning
ShadowedVariable,
/// Dead code warning
DeadCode,
/// Complex function warning
ComplexFunction,
/// Duplicated code warning
DuplicatedCode,
/// Performance issue warning
PerformanceIssue,
}
/// Warning severity.
#[derive(Debug, Clone, PartialEq)]
pub enum WarningSeverity {
/// Informational severity
Info,
/// Warning severity
Warning,
/// Error severity
Error,
}