Skip to content

Commit f5c8c85

Browse files
committed
rt: Implement logging of vectors
1 parent dc720c3 commit f5c8c85

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/rt/rust_shape.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1243,6 +1243,10 @@ class log : public data<log,ptr> {
12431243
: data<log,ptr>(other.task, in_sp, in_params, in_tables, other.dp),
12441244
out(other.out) {}
12451245

1246+
log(log &other, ptr in_dp)
1247+
: data<log,ptr>(other.task, other.sp, other.params, other.tables, in_dp),
1248+
out(other.out) {}
1249+
12461250
void walk_string(const std::pair<ptr,ptr> &data);
12471251

12481252
void walk_evec(bool align, bool is_pod, uint16_t sp_size) {
@@ -1301,7 +1305,22 @@ log::walk_vec(bool align, bool is_pod, const std::pair<ptr,ptr> &data) {
13011305
return;
13021306
}
13031307

1304-
// TODO: Write vectors [ ..., ..., ... ] style.
1308+
out << "[";
1309+
1310+
log sub(*this, data.first);
1311+
1312+
bool first = true;
1313+
while (sub.dp < data.second) {
1314+
if (!first)
1315+
out << ", ";
1316+
1317+
sub.walk_reset(align);
1318+
1319+
align = true;
1320+
first = false;
1321+
}
1322+
1323+
out << "]";
13051324
}
13061325

13071326
} // end namespace shape

0 commit comments

Comments
 (0)