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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
pub struct StructA;
impl StructA {
async fn impl_func_a<T: Into<u64>>(i: T) -> T {
i
}
}
pub struct StructB {
field_1: i32,
pub field_2: usize,
pub(crate) field_3: u64,
}
impl StructB {
pub fn impl_func_b1<T>(&mut self, i: T) -> impl std::future::Future<Output = T> where T: Into<i32> { // FIXME: Should this be parsed as async function?
async { i }
}
pub(crate) fn impl_func_b2() -> usize {
24
}
}
pub struct StructC(i32, pub usize, pub(crate) u64);
impl StructC {
pub fn impl_func_c() -> Self {
Self(0, 1, 2)
}
}
mod module_a {
use super::*;
pub struct StructD;
impl StructD {
pub fn impl_func_d(self: std::pin::Pin<&mut Self>) -> Self {
Self
}
}
mod module_a_a {
pub struct StructE;
impl StructE {
pub fn impl_func_e() -> Self {
Self
}
}
}
pub struct StructF;
impl StructF {
pub fn impl_func_f() -> Self {
Self
}
pub fn impl_func_f_empty() {
}
}
}
use firedbg_protocol::source::*;
use firedbg_rust_parser::*;
pub fn get_breakpoints() -> Vec<FunctionDef> {
vec![
FunctionDef {
ty: FunctionType::ImplFn {
self_type: "StructA".into(),
fn_name: "impl_func_a".into(),
is_async: true,
is_static: true,
return_type: true,
},
loc: BreakableSpan {
start: LineColumn {
line: 4,
column: Some(52),
},
end: LineColumn {
line: 5,
column: Some(9),
},
},
},
FunctionDef {
ty: FunctionType::ImplFn {
self_type: "StructB".into(),
fn_name: "impl_func_b1".into(),
is_async: false,
is_static: false,
return_type: true,
},
loc: BreakableSpan {
start: LineColumn {
line: 16,
column: Some(105),
},
end: LineColumn {
line: 17,
column: Some(9),
},
},
},
FunctionDef {
ty: FunctionType::ImplFn {
self_type: "StructB".into(),
fn_name: "impl_func_b2".into(),
is_async: false,
is_static: true,
return_type: true,
},
loc: BreakableSpan {
start: LineColumn {
line: 20,
column: Some(44),
},
end: LineColumn {
line: 21,
column: Some(9),
},
},
},
FunctionDef {
ty: FunctionType::ImplFn {
self_type: "StructC".into(),
fn_name: "impl_func_c".into(),
is_async: false,
is_static: true,
return_type: true,
},
loc: BreakableSpan {
start: LineColumn {
line: 28,
column: Some(35),
},
end: LineColumn {
line: 29,
column: Some(9),
},
},
},
FunctionDef {
ty: FunctionType::ImplFn {
self_type: "StructD".into(),
fn_name: "impl_func_d".into(),
is_async: false,
is_static: false,
return_type: true,
},
loc: BreakableSpan {
start: LineColumn {
line: 39,
column: Some(69),
},
end: LineColumn {
line: 40,
column: Some(13),
},
},
},
FunctionDef {
ty: FunctionType::ImplFn {
self_type: "StructE".into(),
fn_name: "impl_func_e".into(),
is_async: false,
is_static: true,
return_type: true,
},
loc: BreakableSpan {
start: LineColumn {
line: 48,
column: Some(43),
},
end: LineColumn {
line: 49,
column: Some(17),
},
},
},
FunctionDef {
ty: FunctionType::ImplFn {
self_type: "StructF".into(),
fn_name: "impl_func_f".into(),
is_async: false,
is_static: true,
return_type: true,
},
loc: BreakableSpan {
start: LineColumn {
line: 57,
column: Some(39),
},
end: LineColumn {
line: 58,
column: Some(13),
},
},
},
FunctionDef {
ty: FunctionType::ImplFn {
self_type: "StructF".into(),
fn_name: "impl_func_f_empty".into(),
is_async: false,
is_static: true,
return_type: false,
},
loc: BreakableSpan {
start: LineColumn {
line: 61,
column: Some(37),
},
end: LineColumn {
line: 61,
column: Some(37),
},
},
},
]
}