OILS / _gen / core / value.asdl.cc View on Github | oils.pub

1477 lines, 1020 significant
1// _gen/core/value.asdl.cc is generated by asdl_main.py
2
3#include "_gen/core/value.asdl.h"
4#include <assert.h>
5#include "prebuilt/asdl/runtime.mycpp.h" // generated code uses wrappers here
6#include "_gen/frontend/syntax.asdl.h" // "use" in ASDL
7#include "_gen/core/runtime.asdl.h" // "use" in ASDL
8
9// Generated code uses these types
10using hnode_asdl::hnode;
11using hnode_asdl::Field;
12using hnode_asdl::color_e;
13
14
15namespace value_asdl {
16
17
18hnode_t* IntBox::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
19 seen = seen ? seen : Alloc<Dict<int, bool>>();
20 int heap_id = ObjectId(this);
21 if (dict_contains(seen, heap_id)) {
22 return Alloc<hnode::AlreadySeen>(heap_id);
23 }
24 seen->set(heap_id, true);
25
26 hnode::Record* out_node = runtime::NewRecord(StrFromC("IntBox"));
27 List<Field*>* L = out_node->fields;
28
29 hnode_t* x0 = ToPretty(this->i);
30 L->append(Alloc<Field>(StrFromC("i"), x0));
31
32 return out_node;
33}
34
35
36hnode_t* ProcDefaults::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
37 seen = seen ? seen : Alloc<Dict<int, bool>>();
38 int heap_id = ObjectId(this);
39 if (dict_contains(seen, heap_id)) {
40 return Alloc<hnode::AlreadySeen>(heap_id);
41 }
42 seen->set(heap_id, true);
43
44 hnode::Record* out_node = runtime::NewRecord(StrFromC("ProcDefaults"));
45 List<Field*>* L = out_node->fields;
46
47 if (this->for_word != nullptr) { // List
48 hnode::Array* x0 = Alloc<hnode::Array>(Alloc<List<hnode_t*>>());
49 for (ListIter<value_t*> it(this->for_word); !it.Done(); it.Next()) {
50 value_t* v_ = it.Value();
51 hnode_t* h = (v_ == nullptr) ? Alloc<hnode::Leaf>(StrFromC("_"),
52 color_e::OtherConst) : v_->PrettyTree(do_abbrev, seen);
53 x0->children->append(h);
54 }
55 L->append(Alloc<Field>(StrFromC("for_word"), x0));
56 }
57
58 if (this->for_typed != nullptr) { // List
59 hnode::Array* x1 = Alloc<hnode::Array>(Alloc<List<hnode_t*>>());
60 for (ListIter<value_t*> it(this->for_typed); !it.Done(); it.Next()) {
61 value_t* v_ = it.Value();
62 hnode_t* h = (v_ == nullptr) ? Alloc<hnode::Leaf>(StrFromC("_"),
63 color_e::OtherConst) : v_->PrettyTree(do_abbrev, seen);
64 x1->children->append(h);
65 }
66 L->append(Alloc<Field>(StrFromC("for_typed"), x1));
67 }
68
69 if (this->for_named != nullptr) { // Dict
70 auto* unnamed = NewList<hnode_t*>();
71 auto* hdict = Alloc<hnode::Record>(kEmptyString, StrFromC("{"),
72 StrFromC("}"),
73 NewList<Field*>(), unnamed);
74 for (DictIter<BigStr*, value_t*> it(this->for_named); !it.Done();
75 it.Next()) {
76 auto k = it.Key();
77 auto v = it.Value();
78 unnamed->append(ToPretty(k));
79 unnamed->append(v->PrettyTree(do_abbrev, seen));
80 }
81 L->append(Alloc<Field>(StrFromC("for_named"), hdict));
82 }
83
84 if (this->for_block) { // Optional
85 hnode_t* x3 = this->for_block->PrettyTree(do_abbrev, seen);
86 L->append(Alloc<Field>(StrFromC("for_block"), x3));
87 }
88
89 return out_node;
90}
91
92
93hnode_t* LeftName::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
94 seen = seen ? seen : Alloc<Dict<int, bool>>();
95 int heap_id = ObjectId(this);
96 if (dict_contains(seen, heap_id)) {
97 return Alloc<hnode::AlreadySeen>(heap_id);
98 }
99 seen->set(heap_id, true);
100
101 hnode::Record* out_node = runtime::NewRecord(StrFromC("LeftName"));
102 List<Field*>* L = out_node->fields;
103
104 hnode_t* x0 = ToPretty(this->name);
105 L->append(Alloc<Field>(StrFromC("name"), x0));
106
107 hnode_t* x1 = this->blame_loc->PrettyTree(do_abbrev, seen);
108 L->append(Alloc<Field>(StrFromC("blame_loc"), x1));
109
110 return out_node;
111}
112
113BigStr* y_lvalue_str(int tag, bool dot) {
114 char buf[32];
115 const char* v = nullptr;
116 switch (tag) {
117 case y_lvalue_e::Local:
118 v = "Local"; break;
119 case y_lvalue_e::Container:
120 v = "Container"; break;
121 default:
122 assert(0);
123 }
124 if (dot) {
125 snprintf(buf, 32, "y_lvalue.%s", v);
126 return StrFromC(buf);
127 } else {
128 return StrFromC(v);
129 }
130}
131
132hnode_t* y_lvalue__Container::PrettyTree(bool do_abbrev, Dict<int, bool>* seen)
133 {
134 seen = seen ? seen : Alloc<Dict<int, bool>>();
135 int heap_id = ObjectId(this);
136 if (dict_contains(seen, heap_id)) {
137 return Alloc<hnode::AlreadySeen>(heap_id);
138 }
139 seen->set(heap_id, true);
140
141 hnode::Record* out_node = runtime::NewRecord(y_lvalue_str(this->tag()));
142 List<Field*>* L = out_node->fields;
143
144 hnode_t* x0 = this->obj->PrettyTree(do_abbrev, seen);
145 L->append(Alloc<Field>(StrFromC("obj"), x0));
146
147 hnode_t* x1 = this->index->PrettyTree(do_abbrev, seen);
148 L->append(Alloc<Field>(StrFromC("index"), x1));
149
150 return out_node;
151}
152
153
154hnode_t* y_lvalue_t::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
155 switch (this->tag()) {
156 case y_lvalue_e::Local: {
157 LeftName* obj = static_cast<LeftName*>(this);
158 return obj->PrettyTree(do_abbrev, seen);
159 }
160 case y_lvalue_e::Container: {
161 y_lvalue__Container* obj = static_cast<y_lvalue__Container*>(this);
162 return obj->PrettyTree(do_abbrev, seen);
163 }
164 default:
165 assert(0);
166 }
167}
168BigStr* sh_lvalue_str(int tag, bool dot) {
169 char buf[32];
170 const char* v = nullptr;
171 switch (tag) {
172 case sh_lvalue_e::Var:
173 v = "Var"; break;
174 case sh_lvalue_e::Indexed:
175 v = "Indexed"; break;
176 case sh_lvalue_e::Keyed:
177 v = "Keyed"; break;
178 default:
179 assert(0);
180 }
181 if (dot) {
182 snprintf(buf, 32, "sh_lvalue.%s", v);
183 return StrFromC(buf);
184 } else {
185 return StrFromC(v);
186 }
187}
188
189hnode_t* sh_lvalue__Indexed::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
190 seen = seen ? seen : Alloc<Dict<int, bool>>();
191 int heap_id = ObjectId(this);
192 if (dict_contains(seen, heap_id)) {
193 return Alloc<hnode::AlreadySeen>(heap_id);
194 }
195 seen->set(heap_id, true);
196
197 hnode::Record* out_node = runtime::NewRecord(sh_lvalue_str(this->tag()));
198 List<Field*>* L = out_node->fields;
199
200 hnode_t* x0 = ToPretty(this->name);
201 L->append(Alloc<Field>(StrFromC("name"), x0));
202
203 hnode_t* x1 = ToPretty(this->index);
204 L->append(Alloc<Field>(StrFromC("index"), x1));
205
206 hnode_t* x2 = this->blame_loc->PrettyTree(do_abbrev, seen);
207 L->append(Alloc<Field>(StrFromC("blame_loc"), x2));
208
209 return out_node;
210}
211
212
213hnode_t* sh_lvalue__Keyed::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
214 seen = seen ? seen : Alloc<Dict<int, bool>>();
215 int heap_id = ObjectId(this);
216 if (dict_contains(seen, heap_id)) {
217 return Alloc<hnode::AlreadySeen>(heap_id);
218 }
219 seen->set(heap_id, true);
220
221 hnode::Record* out_node = runtime::NewRecord(sh_lvalue_str(this->tag()));
222 List<Field*>* L = out_node->fields;
223
224 hnode_t* x0 = ToPretty(this->name);
225 L->append(Alloc<Field>(StrFromC("name"), x0));
226
227 hnode_t* x1 = ToPretty(this->key);
228 L->append(Alloc<Field>(StrFromC("key"), x1));
229
230 hnode_t* x2 = this->blame_loc->PrettyTree(do_abbrev, seen);
231 L->append(Alloc<Field>(StrFromC("blame_loc"), x2));
232
233 return out_node;
234}
235
236
237hnode_t* sh_lvalue_t::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
238 switch (this->tag()) {
239 case sh_lvalue_e::Var: {
240 LeftName* obj = static_cast<LeftName*>(this);
241 return obj->PrettyTree(do_abbrev, seen);
242 }
243 case sh_lvalue_e::Indexed: {
244 sh_lvalue__Indexed* obj = static_cast<sh_lvalue__Indexed*>(this);
245 return obj->PrettyTree(do_abbrev, seen);
246 }
247 case sh_lvalue_e::Keyed: {
248 sh_lvalue__Keyed* obj = static_cast<sh_lvalue__Keyed*>(this);
249 return obj->PrettyTree(do_abbrev, seen);
250 }
251 default:
252 assert(0);
253 }
254}
255BigStr* eggex_ops_str(int tag, bool dot) {
256 char buf[32];
257 const char* v = nullptr;
258 switch (tag) {
259 case eggex_ops_e::No:
260 v = "No"; break;
261 case eggex_ops_e::Yes:
262 v = "Yes"; break;
263 default:
264 assert(0);
265 }
266 if (dot) {
267 snprintf(buf, 32, "eggex_ops.%s", v);
268 return StrFromC(buf);
269 } else {
270 return StrFromC(v);
271 }
272}
273
274eggex_ops__No* eggex_ops::No = &geggex_ops__No.obj;
275
276GcGlobal<eggex_ops__No> geggex_ops__No =
277 { ObjHeader::Global(eggex_ops_e::No) };
278
279hnode_t* eggex_ops__No::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
280 seen = seen ? seen : Alloc<Dict<int, bool>>();
281 int heap_id = ObjectId(this);
282 if (dict_contains(seen, heap_id)) {
283 return Alloc<hnode::AlreadySeen>(heap_id);
284 }
285 seen->set(heap_id, true);
286
287 hnode::Record* out_node = runtime::NewRecord(eggex_ops_str(this->tag()));
288 return out_node;
289}
290
291
292hnode_t* eggex_ops__Yes::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
293 seen = seen ? seen : Alloc<Dict<int, bool>>();
294 int heap_id = ObjectId(this);
295 if (dict_contains(seen, heap_id)) {
296 return Alloc<hnode::AlreadySeen>(heap_id);
297 }
298 seen->set(heap_id, true);
299
300 hnode::Record* out_node = runtime::NewRecord(eggex_ops_str(this->tag()));
301 List<Field*>* L = out_node->fields;
302
303 if (this->convert_funcs != nullptr) { // List
304 hnode::Array* x0 = Alloc<hnode::Array>(Alloc<List<hnode_t*>>());
305 for (ListIter<value_t*> it(this->convert_funcs); !it.Done(); it.Next()) {
306 value_t* v_ = it.Value();
307 hnode_t* h = (v_ == nullptr) ? Alloc<hnode::Leaf>(StrFromC("_"),
308 color_e::OtherConst) : v_->PrettyTree(do_abbrev, seen);
309 x0->children->append(h);
310 }
311 L->append(Alloc<Field>(StrFromC("convert_funcs"), x0));
312 }
313
314 if (this->convert_toks != nullptr) { // List
315 hnode::Array* x1 = Alloc<hnode::Array>(Alloc<List<hnode_t*>>());
316 for (ListIter<syntax_asdl::Token*> it(this->convert_toks); !it.Done();
317 it.Next()) {
318 syntax_asdl::Token* v_ = it.Value();
319 hnode_t* h = (v_ == nullptr) ? Alloc<hnode::Leaf>(StrFromC("_"),
320 color_e::OtherConst) : v_->PrettyTree(do_abbrev, seen);
321 x1->children->append(h);
322 }
323 L->append(Alloc<Field>(StrFromC("convert_toks"), x1));
324 }
325
326 if (this->capture_names != nullptr) { // List
327 hnode::Array* x2 = Alloc<hnode::Array>(Alloc<List<hnode_t*>>());
328 for (ListIter<BigStr*> it(this->capture_names); !it.Done(); it.Next()) {
329 BigStr* v_ = it.Value();
330 hnode_t* h = ToPretty(v_);
331 x2->children->append(h);
332 }
333 L->append(Alloc<Field>(StrFromC("capture_names"), x2));
334 }
335
336 return out_node;
337}
338
339
340hnode_t* eggex_ops_t::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
341 switch (this->tag()) {
342 case eggex_ops_e::No: {
343 eggex_ops__No* obj = static_cast<eggex_ops__No*>(this);
344 return obj->PrettyTree(do_abbrev, seen);
345 }
346 case eggex_ops_e::Yes: {
347 eggex_ops__Yes* obj = static_cast<eggex_ops__Yes*>(this);
348 return obj->PrettyTree(do_abbrev, seen);
349 }
350 default:
351 assert(0);
352 }
353}
354
355hnode_t* RegexMatch::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
356 seen = seen ? seen : Alloc<Dict<int, bool>>();
357 int heap_id = ObjectId(this);
358 if (dict_contains(seen, heap_id)) {
359 return Alloc<hnode::AlreadySeen>(heap_id);
360 }
361 seen->set(heap_id, true);
362
363 hnode::Record* out_node = runtime::NewRecord(StrFromC("RegexMatch"));
364 List<Field*>* L = out_node->fields;
365
366 hnode_t* x0 = ToPretty(this->s);
367 L->append(Alloc<Field>(StrFromC("s"), x0));
368
369 if (this->indices != nullptr) { // List
370 hnode::Array* x1 = Alloc<hnode::Array>(Alloc<List<hnode_t*>>());
371 for (ListIter<int> it(this->indices); !it.Done(); it.Next()) {
372 int v_ = it.Value();
373 hnode_t* h = ToPretty(v_);
374 x1->children->append(h);
375 }
376 L->append(Alloc<Field>(StrFromC("indices"), x1));
377 }
378
379 hnode_t* x2 = this->ops->PrettyTree(do_abbrev, seen);
380 L->append(Alloc<Field>(StrFromC("ops"), x2));
381
382 return out_node;
383}
384
385BigStr* regex_match_str(int tag, bool dot) {
386 char buf[32];
387 const char* v = nullptr;
388 switch (tag) {
389 case regex_match_e::No:
390 v = "No"; break;
391 case regex_match_e::Yes:
392 v = "Yes"; break;
393 default:
394 assert(0);
395 }
396 if (dot) {
397 snprintf(buf, 32, "regex_match.%s", v);
398 return StrFromC(buf);
399 } else {
400 return StrFromC(v);
401 }
402}
403
404regex_match__No* regex_match::No = &gregex_match__No.obj;
405
406GcGlobal<regex_match__No> gregex_match__No =
407 { ObjHeader::Global(regex_match_e::No) };
408
409hnode_t* regex_match__No::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
410 seen = seen ? seen : Alloc<Dict<int, bool>>();
411 int heap_id = ObjectId(this);
412 if (dict_contains(seen, heap_id)) {
413 return Alloc<hnode::AlreadySeen>(heap_id);
414 }
415 seen->set(heap_id, true);
416
417 hnode::Record* out_node = runtime::NewRecord(regex_match_str(this->tag()));
418 return out_node;
419}
420
421
422hnode_t* regex_match_t::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
423 switch (this->tag()) {
424 case regex_match_e::No: {
425 regex_match__No* obj = static_cast<regex_match__No*>(this);
426 return obj->PrettyTree(do_abbrev, seen);
427 }
428 case regex_match_e::Yes: {
429 RegexMatch* obj = static_cast<RegexMatch*>(this);
430 return obj->PrettyTree(do_abbrev, seen);
431 }
432 default:
433 assert(0);
434 }
435}
436
437hnode_t* LiteralBlock::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
438 seen = seen ? seen : Alloc<Dict<int, bool>>();
439 int heap_id = ObjectId(this);
440 if (dict_contains(seen, heap_id)) {
441 return Alloc<hnode::AlreadySeen>(heap_id);
442 }
443 seen->set(heap_id, true);
444
445 hnode::Record* out_node = runtime::NewRecord(StrFromC("LiteralBlock"));
446 List<Field*>* L = out_node->fields;
447
448 hnode_t* x0 = this->brace_group->PrettyTree(do_abbrev, seen);
449 L->append(Alloc<Field>(StrFromC("brace_group"), x0));
450
451 if (this->lines != nullptr) { // List
452 hnode::Array* x1 = Alloc<hnode::Array>(Alloc<List<hnode_t*>>());
453 for (ListIter<syntax_asdl::SourceLine*> it(this->lines); !it.Done();
454 it.Next()) {
455 syntax_asdl::SourceLine* v_ = it.Value();
456 hnode_t* h = (v_ == nullptr) ? Alloc<hnode::Leaf>(StrFromC("_"),
457 color_e::OtherConst) : v_->PrettyTree(do_abbrev, seen);
458 x1->children->append(h);
459 }
460 L->append(Alloc<Field>(StrFromC("lines"), x1));
461 }
462
463 return out_node;
464}
465
466BigStr* cmd_frag_str(int tag, bool dot) {
467 char buf[32];
468 const char* v = nullptr;
469 switch (tag) {
470 case cmd_frag_e::LiteralBlock:
471 v = "LiteralBlock"; break;
472 case cmd_frag_e::Expr:
473 v = "Expr"; break;
474 default:
475 assert(0);
476 }
477 if (dot) {
478 snprintf(buf, 32, "cmd_frag.%s", v);
479 return StrFromC(buf);
480 } else {
481 return StrFromC(v);
482 }
483}
484
485hnode_t* cmd_frag__Expr::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
486 seen = seen ? seen : Alloc<Dict<int, bool>>();
487 int heap_id = ObjectId(this);
488 if (dict_contains(seen, heap_id)) {
489 return Alloc<hnode::AlreadySeen>(heap_id);
490 }
491 seen->set(heap_id, true);
492
493 hnode::Record* out_node = runtime::NewRecord(cmd_frag_str(this->tag()));
494 List<Field*>* L = out_node->fields;
495
496 hnode_t* x0 = this->c->PrettyTree(do_abbrev, seen);
497 L->append(Alloc<Field>(StrFromC("c"), x0));
498
499 return out_node;
500}
501
502
503hnode_t* cmd_frag_t::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
504 switch (this->tag()) {
505 case cmd_frag_e::LiteralBlock: {
506 LiteralBlock* obj = static_cast<LiteralBlock*>(this);
507 return obj->PrettyTree(do_abbrev, seen);
508 }
509 case cmd_frag_e::Expr: {
510 cmd_frag__Expr* obj = static_cast<cmd_frag__Expr*>(this);
511 return obj->PrettyTree(do_abbrev, seen);
512 }
513 default:
514 assert(0);
515 }
516}
517
518hnode_t* Obj::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
519 seen = seen ? seen : Alloc<Dict<int, bool>>();
520 int heap_id = ObjectId(this);
521 if (dict_contains(seen, heap_id)) {
522 return Alloc<hnode::AlreadySeen>(heap_id);
523 }
524 seen->set(heap_id, true);
525
526 hnode::Record* out_node = runtime::NewRecord(StrFromC("Obj"));
527 List<Field*>* L = out_node->fields;
528
529 if (this->prototype) { // Optional
530 hnode_t* x0 = this->prototype->PrettyTree(do_abbrev, seen);
531 L->append(Alloc<Field>(StrFromC("prototype"), x0));
532 }
533
534 if (this->d != nullptr) { // Dict
535 auto* unnamed = NewList<hnode_t*>();
536 auto* hdict = Alloc<hnode::Record>(kEmptyString, StrFromC("{"),
537 StrFromC("}"),
538 NewList<Field*>(), unnamed);
539 for (DictIter<BigStr*, value_t*> it(this->d); !it.Done(); it.Next()) {
540 auto k = it.Key();
541 auto v = it.Value();
542 unnamed->append(ToPretty(k));
543 unnamed->append(v->PrettyTree(do_abbrev, seen));
544 }
545 L->append(Alloc<Field>(StrFromC("d"), hdict));
546 }
547
548 return out_node;
549}
550
551BigStr* value_str(int tag, bool dot) {
552 char buf[32];
553 const char* v = nullptr;
554 switch (tag) {
555 case value_e::Interrupted:
556 v = "Interrupted"; break;
557 case value_e::Stdin:
558 v = "Stdin"; break;
559 case value_e::Slice:
560 v = "Slice"; break;
561 case value_e::Undef:
562 v = "Undef"; break;
563 case value_e::Str:
564 v = "Str"; break;
565 case value_e::BashArray:
566 v = "BashArray"; break;
567 case value_e::SparseArray:
568 v = "SparseArray"; break;
569 case value_e::BashAssoc:
570 v = "BashAssoc"; break;
571 case value_e::Null:
572 v = "Null"; break;
573 case value_e::Bool:
574 v = "Bool"; break;
575 case value_e::Int:
576 v = "Int"; break;
577 case value_e::Float:
578 v = "Float"; break;
579 case value_e::List:
580 v = "List"; break;
581 case value_e::Dict:
582 v = "Dict"; break;
583 case value_e::Obj:
584 v = "Obj"; break;
585 case value_e::Range:
586 v = "Range"; break;
587 case value_e::Eggex:
588 v = "Eggex"; break;
589 case value_e::Match:
590 v = "Match"; break;
591 case value_e::Place:
592 v = "Place"; break;
593 case value_e::Frame:
594 v = "Frame"; break;
595 case value_e::BoundFunc:
596 v = "BoundFunc"; break;
597 case value_e::BuiltinFunc:
598 v = "BuiltinFunc"; break;
599 case value_e::Func:
600 v = "Func"; break;
601 case value_e::BuiltinProc:
602 v = "BuiltinProc"; break;
603 case value_e::Proc:
604 v = "Proc"; break;
605 case value_e::Expr:
606 v = "Expr"; break;
607 case value_e::CommandFrag:
608 v = "CommandFrag"; break;
609 case value_e::Command:
610 v = "Command"; break;
611 default:
612 assert(0);
613 }
614 if (dot) {
615 snprintf(buf, 32, "value.%s", v);
616 return StrFromC(buf);
617 } else {
618 return StrFromC(v);
619 }
620}
621
622value__Interrupted* value::Interrupted = &gvalue__Interrupted.obj;
623
624GcGlobal<value__Interrupted> gvalue__Interrupted =
625 { ObjHeader::Global(value_e::Interrupted) };
626
627value__Stdin* value::Stdin = &gvalue__Stdin.obj;
628
629GcGlobal<value__Stdin> gvalue__Stdin =
630 { ObjHeader::Global(value_e::Stdin) };
631
632value__Undef* value::Undef = &gvalue__Undef.obj;
633
634GcGlobal<value__Undef> gvalue__Undef =
635 { ObjHeader::Global(value_e::Undef) };
636
637value__Null* value::Null = &gvalue__Null.obj;
638
639GcGlobal<value__Null> gvalue__Null =
640 { ObjHeader::Global(value_e::Null) };
641
642hnode_t* value__Interrupted::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
643 seen = seen ? seen : Alloc<Dict<int, bool>>();
644 int heap_id = ObjectId(this);
645 if (dict_contains(seen, heap_id)) {
646 return Alloc<hnode::AlreadySeen>(heap_id);
647 }
648 seen->set(heap_id, true);
649
650 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
651 return out_node;
652}
653
654
655hnode_t* value__Stdin::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
656 seen = seen ? seen : Alloc<Dict<int, bool>>();
657 int heap_id = ObjectId(this);
658 if (dict_contains(seen, heap_id)) {
659 return Alloc<hnode::AlreadySeen>(heap_id);
660 }
661 seen->set(heap_id, true);
662
663 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
664 return out_node;
665}
666
667
668hnode_t* value__Slice::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
669 seen = seen ? seen : Alloc<Dict<int, bool>>();
670 int heap_id = ObjectId(this);
671 if (dict_contains(seen, heap_id)) {
672 return Alloc<hnode::AlreadySeen>(heap_id);
673 }
674 seen->set(heap_id, true);
675
676 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
677 List<Field*>* L = out_node->fields;
678
679 if (this->lower) { // Optional
680 hnode_t* x0 = this->lower->PrettyTree(do_abbrev, seen);
681 L->append(Alloc<Field>(StrFromC("lower"), x0));
682 }
683
684 if (this->upper) { // Optional
685 hnode_t* x1 = this->upper->PrettyTree(do_abbrev, seen);
686 L->append(Alloc<Field>(StrFromC("upper"), x1));
687 }
688
689 return out_node;
690}
691
692
693hnode_t* value__Undef::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
694 seen = seen ? seen : Alloc<Dict<int, bool>>();
695 int heap_id = ObjectId(this);
696 if (dict_contains(seen, heap_id)) {
697 return Alloc<hnode::AlreadySeen>(heap_id);
698 }
699 seen->set(heap_id, true);
700
701 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
702 return out_node;
703}
704
705
706hnode_t* value__Str::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
707 seen = seen ? seen : Alloc<Dict<int, bool>>();
708 int heap_id = ObjectId(this);
709 if (dict_contains(seen, heap_id)) {
710 return Alloc<hnode::AlreadySeen>(heap_id);
711 }
712 seen->set(heap_id, true);
713
714 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
715 List<Field*>* L = out_node->fields;
716
717 hnode_t* x0 = ToPretty(this->s);
718 L->append(Alloc<Field>(StrFromC("s"), x0));
719
720 return out_node;
721}
722
723
724hnode_t* value__BashArray::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
725 seen = seen ? seen : Alloc<Dict<int, bool>>();
726 int heap_id = ObjectId(this);
727 if (dict_contains(seen, heap_id)) {
728 return Alloc<hnode::AlreadySeen>(heap_id);
729 }
730 seen->set(heap_id, true);
731
732 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
733 List<Field*>* L = out_node->fields;
734
735 if (this->strs != nullptr) { // List
736 hnode::Array* x0 = Alloc<hnode::Array>(Alloc<List<hnode_t*>>());
737 for (ListIter<BigStr*> it(this->strs); !it.Done(); it.Next()) {
738 BigStr* v_ = it.Value();
739 hnode_t* h = ToPretty(v_);
740 x0->children->append(h);
741 }
742 L->append(Alloc<Field>(StrFromC("strs"), x0));
743 }
744
745 return out_node;
746}
747
748
749hnode_t* value__SparseArray::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
750 seen = seen ? seen : Alloc<Dict<int, bool>>();
751 int heap_id = ObjectId(this);
752 if (dict_contains(seen, heap_id)) {
753 return Alloc<hnode::AlreadySeen>(heap_id);
754 }
755 seen->set(heap_id, true);
756
757 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
758 List<Field*>* L = out_node->fields;
759
760 if (this->d != nullptr) { // Dict
761 auto* unnamed = NewList<hnode_t*>();
762 auto* hdict = Alloc<hnode::Record>(kEmptyString, StrFromC("{"),
763 StrFromC("}"),
764 NewList<Field*>(), unnamed);
765 for (DictIter<mops::BigInt, BigStr*> it(this->d); !it.Done(); it.Next()) {
766 auto k = it.Key();
767 auto v = it.Value();
768 unnamed->append(ToPretty(k));
769 unnamed->append(ToPretty(v));
770 }
771 L->append(Alloc<Field>(StrFromC("d"), hdict));
772 }
773
774 hnode_t* x1 = ToPretty(this->max_index);
775 L->append(Alloc<Field>(StrFromC("max_index"), x1));
776
777 return out_node;
778}
779
780
781hnode_t* value__BashAssoc::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
782 seen = seen ? seen : Alloc<Dict<int, bool>>();
783 int heap_id = ObjectId(this);
784 if (dict_contains(seen, heap_id)) {
785 return Alloc<hnode::AlreadySeen>(heap_id);
786 }
787 seen->set(heap_id, true);
788
789 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
790 List<Field*>* L = out_node->fields;
791
792 if (this->d != nullptr) { // Dict
793 auto* unnamed = NewList<hnode_t*>();
794 auto* hdict = Alloc<hnode::Record>(kEmptyString, StrFromC("{"),
795 StrFromC("}"),
796 NewList<Field*>(), unnamed);
797 for (DictIter<BigStr*, BigStr*> it(this->d); !it.Done(); it.Next()) {
798 auto k = it.Key();
799 auto v = it.Value();
800 unnamed->append(ToPretty(k));
801 unnamed->append(ToPretty(v));
802 }
803 L->append(Alloc<Field>(StrFromC("d"), hdict));
804 }
805
806 return out_node;
807}
808
809
810hnode_t* value__Null::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
811 seen = seen ? seen : Alloc<Dict<int, bool>>();
812 int heap_id = ObjectId(this);
813 if (dict_contains(seen, heap_id)) {
814 return Alloc<hnode::AlreadySeen>(heap_id);
815 }
816 seen->set(heap_id, true);
817
818 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
819 return out_node;
820}
821
822
823hnode_t* value__Bool::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
824 seen = seen ? seen : Alloc<Dict<int, bool>>();
825 int heap_id = ObjectId(this);
826 if (dict_contains(seen, heap_id)) {
827 return Alloc<hnode::AlreadySeen>(heap_id);
828 }
829 seen->set(heap_id, true);
830
831 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
832 List<Field*>* L = out_node->fields;
833
834 hnode_t* x0 = ToPretty(this->b);
835 L->append(Alloc<Field>(StrFromC("b"), x0));
836
837 return out_node;
838}
839
840
841hnode_t* value__Int::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
842 seen = seen ? seen : Alloc<Dict<int, bool>>();
843 int heap_id = ObjectId(this);
844 if (dict_contains(seen, heap_id)) {
845 return Alloc<hnode::AlreadySeen>(heap_id);
846 }
847 seen->set(heap_id, true);
848
849 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
850 List<Field*>* L = out_node->fields;
851
852 hnode_t* x0 = ToPretty(this->i);
853 L->append(Alloc<Field>(StrFromC("i"), x0));
854
855 return out_node;
856}
857
858
859hnode_t* value__Float::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
860 seen = seen ? seen : Alloc<Dict<int, bool>>();
861 int heap_id = ObjectId(this);
862 if (dict_contains(seen, heap_id)) {
863 return Alloc<hnode::AlreadySeen>(heap_id);
864 }
865 seen->set(heap_id, true);
866
867 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
868 List<Field*>* L = out_node->fields;
869
870 hnode_t* x0 = ToPretty(this->f);
871 L->append(Alloc<Field>(StrFromC("f"), x0));
872
873 return out_node;
874}
875
876
877hnode_t* value__List::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
878 seen = seen ? seen : Alloc<Dict<int, bool>>();
879 int heap_id = ObjectId(this);
880 if (dict_contains(seen, heap_id)) {
881 return Alloc<hnode::AlreadySeen>(heap_id);
882 }
883 seen->set(heap_id, true);
884
885 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
886 List<Field*>* L = out_node->fields;
887
888 if (this->items != nullptr) { // List
889 hnode::Array* x0 = Alloc<hnode::Array>(Alloc<List<hnode_t*>>());
890 for (ListIter<value_t*> it(this->items); !it.Done(); it.Next()) {
891 value_t* v_ = it.Value();
892 hnode_t* h = (v_ == nullptr) ? Alloc<hnode::Leaf>(StrFromC("_"),
893 color_e::OtherConst) : v_->PrettyTree(do_abbrev, seen);
894 x0->children->append(h);
895 }
896 L->append(Alloc<Field>(StrFromC("items"), x0));
897 }
898
899 return out_node;
900}
901
902
903hnode_t* value__Dict::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
904 seen = seen ? seen : Alloc<Dict<int, bool>>();
905 int heap_id = ObjectId(this);
906 if (dict_contains(seen, heap_id)) {
907 return Alloc<hnode::AlreadySeen>(heap_id);
908 }
909 seen->set(heap_id, true);
910
911 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
912 List<Field*>* L = out_node->fields;
913
914 if (this->d != nullptr) { // Dict
915 auto* unnamed = NewList<hnode_t*>();
916 auto* hdict = Alloc<hnode::Record>(kEmptyString, StrFromC("{"),
917 StrFromC("}"),
918 NewList<Field*>(), unnamed);
919 for (DictIter<BigStr*, value_t*> it(this->d); !it.Done(); it.Next()) {
920 auto k = it.Key();
921 auto v = it.Value();
922 unnamed->append(ToPretty(k));
923 unnamed->append(v->PrettyTree(do_abbrev, seen));
924 }
925 L->append(Alloc<Field>(StrFromC("d"), hdict));
926 }
927
928 return out_node;
929}
930
931
932hnode_t* value__Range::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
933 seen = seen ? seen : Alloc<Dict<int, bool>>();
934 int heap_id = ObjectId(this);
935 if (dict_contains(seen, heap_id)) {
936 return Alloc<hnode::AlreadySeen>(heap_id);
937 }
938 seen->set(heap_id, true);
939
940 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
941 List<Field*>* L = out_node->fields;
942
943 hnode_t* x0 = ToPretty(this->lower);
944 L->append(Alloc<Field>(StrFromC("lower"), x0));
945
946 hnode_t* x1 = ToPretty(this->upper);
947 L->append(Alloc<Field>(StrFromC("upper"), x1));
948
949 return out_node;
950}
951
952
953hnode_t* value__Eggex::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
954 seen = seen ? seen : Alloc<Dict<int, bool>>();
955 int heap_id = ObjectId(this);
956 if (dict_contains(seen, heap_id)) {
957 return Alloc<hnode::AlreadySeen>(heap_id);
958 }
959 seen->set(heap_id, true);
960
961 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
962 List<Field*>* L = out_node->fields;
963
964 hnode_t* x0 = this->spliced->PrettyTree(do_abbrev, seen);
965 L->append(Alloc<Field>(StrFromC("spliced"), x0));
966
967 hnode_t* x1 = ToPretty(this->canonical_flags);
968 L->append(Alloc<Field>(StrFromC("canonical_flags"), x1));
969
970 if (this->convert_funcs != nullptr) { // List
971 hnode::Array* x2 = Alloc<hnode::Array>(Alloc<List<hnode_t*>>());
972 for (ListIter<value_t*> it(this->convert_funcs); !it.Done(); it.Next()) {
973 value_t* v_ = it.Value();
974 hnode_t* h = (v_ == nullptr) ? Alloc<hnode::Leaf>(StrFromC("_"),
975 color_e::OtherConst) : v_->PrettyTree(do_abbrev, seen);
976 x2->children->append(h);
977 }
978 L->append(Alloc<Field>(StrFromC("convert_funcs"), x2));
979 }
980
981 if (this->convert_toks != nullptr) { // List
982 hnode::Array* x3 = Alloc<hnode::Array>(Alloc<List<hnode_t*>>());
983 for (ListIter<syntax_asdl::Token*> it(this->convert_toks); !it.Done();
984 it.Next()) {
985 syntax_asdl::Token* v_ = it.Value();
986 hnode_t* h = (v_ == nullptr) ? Alloc<hnode::Leaf>(StrFromC("_"),
987 color_e::OtherConst) : v_->PrettyTree(do_abbrev, seen);
988 x3->children->append(h);
989 }
990 L->append(Alloc<Field>(StrFromC("convert_toks"), x3));
991 }
992
993 if (this->as_ere) { // Optional
994 hnode_t* x4 = ToPretty(this->as_ere);
995 L->append(Alloc<Field>(StrFromC("as_ere"), x4));
996 }
997
998 if (this->capture_names != nullptr) { // List
999 hnode::Array* x5 = Alloc<hnode::Array>(Alloc<List<hnode_t*>>());
1000 for (ListIter<BigStr*> it(this->capture_names); !it.Done(); it.Next()) {
1001 BigStr* v_ = it.Value();
1002 hnode_t* h = ToPretty(v_);
1003 x5->children->append(h);
1004 }
1005 L->append(Alloc<Field>(StrFromC("capture_names"), x5));
1006 }
1007
1008 return out_node;
1009}
1010
1011
1012hnode_t* value__Place::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
1013 seen = seen ? seen : Alloc<Dict<int, bool>>();
1014 int heap_id = ObjectId(this);
1015 if (dict_contains(seen, heap_id)) {
1016 return Alloc<hnode::AlreadySeen>(heap_id);
1017 }
1018 seen->set(heap_id, true);
1019
1020 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
1021 List<Field*>* L = out_node->fields;
1022
1023 hnode_t* x0 = this->lval->PrettyTree(do_abbrev, seen);
1024 L->append(Alloc<Field>(StrFromC("lval"), x0));
1025
1026 if (this->frame != nullptr) { // Dict
1027 auto* unnamed = NewList<hnode_t*>();
1028 auto* hdict = Alloc<hnode::Record>(kEmptyString, StrFromC("{"),
1029 StrFromC("}"),
1030 NewList<Field*>(), unnamed);
1031 for (DictIter<BigStr*, runtime_asdl::Cell*> it(this->frame); !it.Done();
1032 it.Next()) {
1033 auto k = it.Key();
1034 auto v = it.Value();
1035 unnamed->append(ToPretty(k));
1036 unnamed->append(v->PrettyTree(do_abbrev, seen));
1037 }
1038 L->append(Alloc<Field>(StrFromC("frame"), hdict));
1039 }
1040
1041 return out_node;
1042}
1043
1044
1045hnode_t* value__Frame::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
1046 seen = seen ? seen : Alloc<Dict<int, bool>>();
1047 int heap_id = ObjectId(this);
1048 if (dict_contains(seen, heap_id)) {
1049 return Alloc<hnode::AlreadySeen>(heap_id);
1050 }
1051 seen->set(heap_id, true);
1052
1053 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
1054 List<Field*>* L = out_node->fields;
1055
1056 if (this->frame != nullptr) { // Dict
1057 auto* unnamed = NewList<hnode_t*>();
1058 auto* hdict = Alloc<hnode::Record>(kEmptyString, StrFromC("{"),
1059 StrFromC("}"),
1060 NewList<Field*>(), unnamed);
1061 for (DictIter<BigStr*, runtime_asdl::Cell*> it(this->frame); !it.Done();
1062 it.Next()) {
1063 auto k = it.Key();
1064 auto v = it.Value();
1065 unnamed->append(ToPretty(k));
1066 unnamed->append(v->PrettyTree(do_abbrev, seen));
1067 }
1068 L->append(Alloc<Field>(StrFromC("frame"), hdict));
1069 }
1070
1071 return out_node;
1072}
1073
1074
1075hnode_t* value__BoundFunc::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
1076 seen = seen ? seen : Alloc<Dict<int, bool>>();
1077 int heap_id = ObjectId(this);
1078 if (dict_contains(seen, heap_id)) {
1079 return Alloc<hnode::AlreadySeen>(heap_id);
1080 }
1081 seen->set(heap_id, true);
1082
1083 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
1084 List<Field*>* L = out_node->fields;
1085
1086 hnode_t* x0 = this->me->PrettyTree(do_abbrev, seen);
1087 L->append(Alloc<Field>(StrFromC("me"), x0));
1088
1089 hnode_t* x1 = this->func->PrettyTree(do_abbrev, seen);
1090 L->append(Alloc<Field>(StrFromC("func"), x1));
1091
1092 return out_node;
1093}
1094
1095
1096hnode_t* value__BuiltinFunc::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
1097 seen = seen ? seen : Alloc<Dict<int, bool>>();
1098 int heap_id = ObjectId(this);
1099 if (dict_contains(seen, heap_id)) {
1100 return Alloc<hnode::AlreadySeen>(heap_id);
1101 }
1102 seen->set(heap_id, true);
1103
1104 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
1105 List<Field*>* L = out_node->fields;
1106
1107 hnode_t* x0 = Alloc<hnode::Leaf>(StrFromC("<extern>"), color_e::External);
1108 L->append(Alloc<Field>(StrFromC("callable"), x0));
1109
1110 return out_node;
1111}
1112
1113
1114hnode_t* value__Func::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
1115 seen = seen ? seen : Alloc<Dict<int, bool>>();
1116 int heap_id = ObjectId(this);
1117 if (dict_contains(seen, heap_id)) {
1118 return Alloc<hnode::AlreadySeen>(heap_id);
1119 }
1120 seen->set(heap_id, true);
1121
1122 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
1123 List<Field*>* L = out_node->fields;
1124
1125 hnode_t* x0 = ToPretty(this->name);
1126 L->append(Alloc<Field>(StrFromC("name"), x0));
1127
1128 hnode_t* x1 = this->parsed->PrettyTree(do_abbrev, seen);
1129 L->append(Alloc<Field>(StrFromC("parsed"), x1));
1130
1131 if (this->pos_defaults != nullptr) { // List
1132 hnode::Array* x2 = Alloc<hnode::Array>(Alloc<List<hnode_t*>>());
1133 for (ListIter<value_t*> it(this->pos_defaults); !it.Done(); it.Next()) {
1134 value_t* v_ = it.Value();
1135 hnode_t* h = (v_ == nullptr) ? Alloc<hnode::Leaf>(StrFromC("_"),
1136 color_e::OtherConst) : v_->PrettyTree(do_abbrev, seen);
1137 x2->children->append(h);
1138 }
1139 L->append(Alloc<Field>(StrFromC("pos_defaults"), x2));
1140 }
1141
1142 if (this->named_defaults != nullptr) { // Dict
1143 auto* unnamed = NewList<hnode_t*>();
1144 auto* hdict = Alloc<hnode::Record>(kEmptyString, StrFromC("{"),
1145 StrFromC("}"),
1146 NewList<Field*>(), unnamed);
1147 for (DictIter<BigStr*, value_t*> it(this->named_defaults); !it.Done();
1148 it.Next()) {
1149 auto k = it.Key();
1150 auto v = it.Value();
1151 unnamed->append(ToPretty(k));
1152 unnamed->append(v->PrettyTree(do_abbrev, seen));
1153 }
1154 L->append(Alloc<Field>(StrFromC("named_defaults"), hdict));
1155 }
1156
1157 if (this->module_frame != nullptr) { // Dict
1158 auto* unnamed = NewList<hnode_t*>();
1159 auto* hdict = Alloc<hnode::Record>(kEmptyString, StrFromC("{"),
1160 StrFromC("}"),
1161 NewList<Field*>(), unnamed);
1162 for (DictIter<BigStr*, runtime_asdl::Cell*> it(this->module_frame);
1163 !it.Done(); it.Next()) {
1164 auto k = it.Key();
1165 auto v = it.Value();
1166 unnamed->append(ToPretty(k));
1167 unnamed->append(v->PrettyTree(do_abbrev, seen));
1168 }
1169 L->append(Alloc<Field>(StrFromC("module_frame"), hdict));
1170 }
1171
1172 return out_node;
1173}
1174
1175
1176hnode_t* value__BuiltinProc::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
1177 seen = seen ? seen : Alloc<Dict<int, bool>>();
1178 int heap_id = ObjectId(this);
1179 if (dict_contains(seen, heap_id)) {
1180 return Alloc<hnode::AlreadySeen>(heap_id);
1181 }
1182 seen->set(heap_id, true);
1183
1184 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
1185 List<Field*>* L = out_node->fields;
1186
1187 hnode_t* x0 = Alloc<hnode::Leaf>(StrFromC("<extern>"), color_e::External);
1188 L->append(Alloc<Field>(StrFromC("builtin"), x0));
1189
1190 return out_node;
1191}
1192
1193
1194hnode_t* value__Proc::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
1195 seen = seen ? seen : Alloc<Dict<int, bool>>();
1196 int heap_id = ObjectId(this);
1197 if (dict_contains(seen, heap_id)) {
1198 return Alloc<hnode::AlreadySeen>(heap_id);
1199 }
1200 seen->set(heap_id, true);
1201
1202 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
1203 List<Field*>* L = out_node->fields;
1204
1205 hnode_t* x0 = ToPretty(this->name);
1206 L->append(Alloc<Field>(StrFromC("name"), x0));
1207
1208 hnode_t* x1 = this->name_tok->PrettyTree(do_abbrev, seen);
1209 L->append(Alloc<Field>(StrFromC("name_tok"), x1));
1210
1211 hnode_t* x2 = this->sig->PrettyTree(do_abbrev, seen);
1212 L->append(Alloc<Field>(StrFromC("sig"), x2));
1213
1214 hnode_t* x3 = this->body->PrettyTree(do_abbrev, seen);
1215 L->append(Alloc<Field>(StrFromC("body"), x3));
1216
1217 if (this->defaults) { // Optional
1218 hnode_t* x4 = this->defaults->PrettyTree(do_abbrev, seen);
1219 L->append(Alloc<Field>(StrFromC("defaults"), x4));
1220 }
1221
1222 hnode_t* x5 = ToPretty(this->sh_compat);
1223 L->append(Alloc<Field>(StrFromC("sh_compat"), x5));
1224
1225 if (this->module_frame != nullptr) { // Dict
1226 auto* unnamed = NewList<hnode_t*>();
1227 auto* hdict = Alloc<hnode::Record>(kEmptyString, StrFromC("{"),
1228 StrFromC("}"),
1229 NewList<Field*>(), unnamed);
1230 for (DictIter<BigStr*, runtime_asdl::Cell*> it(this->module_frame);
1231 !it.Done(); it.Next()) {
1232 auto k = it.Key();
1233 auto v = it.Value();
1234 unnamed->append(ToPretty(k));
1235 unnamed->append(v->PrettyTree(do_abbrev, seen));
1236 }
1237 L->append(Alloc<Field>(StrFromC("module_frame"), hdict));
1238 }
1239
1240 return out_node;
1241}
1242
1243
1244hnode_t* value__Expr::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
1245 seen = seen ? seen : Alloc<Dict<int, bool>>();
1246 int heap_id = ObjectId(this);
1247 if (dict_contains(seen, heap_id)) {
1248 return Alloc<hnode::AlreadySeen>(heap_id);
1249 }
1250 seen->set(heap_id, true);
1251
1252 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
1253 List<Field*>* L = out_node->fields;
1254
1255 hnode_t* x0 = this->e->PrettyTree(do_abbrev, seen);
1256 L->append(Alloc<Field>(StrFromC("e"), x0));
1257
1258 if (this->captured_frame != nullptr) { // Dict
1259 auto* unnamed = NewList<hnode_t*>();
1260 auto* hdict = Alloc<hnode::Record>(kEmptyString, StrFromC("{"),
1261 StrFromC("}"),
1262 NewList<Field*>(), unnamed);
1263 for (DictIter<BigStr*, runtime_asdl::Cell*> it(this->captured_frame);
1264 !it.Done(); it.Next()) {
1265 auto k = it.Key();
1266 auto v = it.Value();
1267 unnamed->append(ToPretty(k));
1268 unnamed->append(v->PrettyTree(do_abbrev, seen));
1269 }
1270 L->append(Alloc<Field>(StrFromC("captured_frame"), hdict));
1271 }
1272
1273 if (this->module_frame != nullptr) { // Dict
1274 auto* unnamed = NewList<hnode_t*>();
1275 auto* hdict = Alloc<hnode::Record>(kEmptyString, StrFromC("{"),
1276 StrFromC("}"),
1277 NewList<Field*>(), unnamed);
1278 for (DictIter<BigStr*, runtime_asdl::Cell*> it(this->module_frame);
1279 !it.Done(); it.Next()) {
1280 auto k = it.Key();
1281 auto v = it.Value();
1282 unnamed->append(ToPretty(k));
1283 unnamed->append(v->PrettyTree(do_abbrev, seen));
1284 }
1285 L->append(Alloc<Field>(StrFromC("module_frame"), hdict));
1286 }
1287
1288 return out_node;
1289}
1290
1291
1292hnode_t* value__CommandFrag::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
1293 seen = seen ? seen : Alloc<Dict<int, bool>>();
1294 int heap_id = ObjectId(this);
1295 if (dict_contains(seen, heap_id)) {
1296 return Alloc<hnode::AlreadySeen>(heap_id);
1297 }
1298 seen->set(heap_id, true);
1299
1300 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
1301 List<Field*>* L = out_node->fields;
1302
1303 hnode_t* x0 = this->c->PrettyTree(do_abbrev, seen);
1304 L->append(Alloc<Field>(StrFromC("c"), x0));
1305
1306 return out_node;
1307}
1308
1309
1310hnode_t* value__Command::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
1311 seen = seen ? seen : Alloc<Dict<int, bool>>();
1312 int heap_id = ObjectId(this);
1313 if (dict_contains(seen, heap_id)) {
1314 return Alloc<hnode::AlreadySeen>(heap_id);
1315 }
1316 seen->set(heap_id, true);
1317
1318 hnode::Record* out_node = runtime::NewRecord(value_str(this->tag()));
1319 List<Field*>* L = out_node->fields;
1320
1321 hnode_t* x0 = this->frag->PrettyTree(do_abbrev, seen);
1322 L->append(Alloc<Field>(StrFromC("frag"), x0));
1323
1324 if (this->captured_frame != nullptr) { // Dict
1325 auto* unnamed = NewList<hnode_t*>();
1326 auto* hdict = Alloc<hnode::Record>(kEmptyString, StrFromC("{"),
1327 StrFromC("}"),
1328 NewList<Field*>(), unnamed);
1329 for (DictIter<BigStr*, runtime_asdl::Cell*> it(this->captured_frame);
1330 !it.Done(); it.Next()) {
1331 auto k = it.Key();
1332 auto v = it.Value();
1333 unnamed->append(ToPretty(k));
1334 unnamed->append(v->PrettyTree(do_abbrev, seen));
1335 }
1336 L->append(Alloc<Field>(StrFromC("captured_frame"), hdict));
1337 }
1338
1339 if (this->module_frame != nullptr) { // Dict
1340 auto* unnamed = NewList<hnode_t*>();
1341 auto* hdict = Alloc<hnode::Record>(kEmptyString, StrFromC("{"),
1342 StrFromC("}"),
1343 NewList<Field*>(), unnamed);
1344 for (DictIter<BigStr*, runtime_asdl::Cell*> it(this->module_frame);
1345 !it.Done(); it.Next()) {
1346 auto k = it.Key();
1347 auto v = it.Value();
1348 unnamed->append(ToPretty(k));
1349 unnamed->append(v->PrettyTree(do_abbrev, seen));
1350 }
1351 L->append(Alloc<Field>(StrFromC("module_frame"), hdict));
1352 }
1353
1354 return out_node;
1355}
1356
1357
1358hnode_t* value_t::PrettyTree(bool do_abbrev, Dict<int, bool>* seen) {
1359 switch (this->tag()) {
1360 case value_e::Interrupted: {
1361 value__Interrupted* obj = static_cast<value__Interrupted*>(this);
1362 return obj->PrettyTree(do_abbrev, seen);
1363 }
1364 case value_e::Stdin: {
1365 value__Stdin* obj = static_cast<value__Stdin*>(this);
1366 return obj->PrettyTree(do_abbrev, seen);
1367 }
1368 case value_e::Slice: {
1369 value__Slice* obj = static_cast<value__Slice*>(this);
1370 return obj->PrettyTree(do_abbrev, seen);
1371 }
1372 case value_e::Undef: {
1373 value__Undef* obj = static_cast<value__Undef*>(this);
1374 return obj->PrettyTree(do_abbrev, seen);
1375 }
1376 case value_e::Str: {
1377 value__Str* obj = static_cast<value__Str*>(this);
1378 return obj->PrettyTree(do_abbrev, seen);
1379 }
1380 case value_e::BashArray: {
1381 value__BashArray* obj = static_cast<value__BashArray*>(this);
1382 return obj->PrettyTree(do_abbrev, seen);
1383 }
1384 case value_e::SparseArray: {
1385 value__SparseArray* obj = static_cast<value__SparseArray*>(this);
1386 return obj->PrettyTree(do_abbrev, seen);
1387 }
1388 case value_e::BashAssoc: {
1389 value__BashAssoc* obj = static_cast<value__BashAssoc*>(this);
1390 return obj->PrettyTree(do_abbrev, seen);
1391 }
1392 case value_e::Null: {
1393 value__Null* obj = static_cast<value__Null*>(this);
1394 return obj->PrettyTree(do_abbrev, seen);
1395 }
1396 case value_e::Bool: {
1397 value__Bool* obj = static_cast<value__Bool*>(this);
1398 return obj->PrettyTree(do_abbrev, seen);
1399 }
1400 case value_e::Int: {
1401 value__Int* obj = static_cast<value__Int*>(this);
1402 return obj->PrettyTree(do_abbrev, seen);
1403 }
1404 case value_e::Float: {
1405 value__Float* obj = static_cast<value__Float*>(this);
1406 return obj->PrettyTree(do_abbrev, seen);
1407 }
1408 case value_e::List: {
1409 value__List* obj = static_cast<value__List*>(this);
1410 return obj->PrettyTree(do_abbrev, seen);
1411 }
1412 case value_e::Dict: {
1413 value__Dict* obj = static_cast<value__Dict*>(this);
1414 return obj->PrettyTree(do_abbrev, seen);
1415 }
1416 case value_e::Obj: {
1417 Obj* obj = static_cast<Obj*>(this);
1418 return obj->PrettyTree(do_abbrev, seen);
1419 }
1420 case value_e::Range: {
1421 value__Range* obj = static_cast<value__Range*>(this);
1422 return obj->PrettyTree(do_abbrev, seen);
1423 }
1424 case value_e::Eggex: {
1425 value__Eggex* obj = static_cast<value__Eggex*>(this);
1426 return obj->PrettyTree(do_abbrev, seen);
1427 }
1428 case value_e::Match: {
1429 RegexMatch* obj = static_cast<RegexMatch*>(this);
1430 return obj->PrettyTree(do_abbrev, seen);
1431 }
1432 case value_e::Place: {
1433 value__Place* obj = static_cast<value__Place*>(this);
1434 return obj->PrettyTree(do_abbrev, seen);
1435 }
1436 case value_e::Frame: {
1437 value__Frame* obj = static_cast<value__Frame*>(this);
1438 return obj->PrettyTree(do_abbrev, seen);
1439 }
1440 case value_e::BoundFunc: {
1441 value__BoundFunc* obj = static_cast<value__BoundFunc*>(this);
1442 return obj->PrettyTree(do_abbrev, seen);
1443 }
1444 case value_e::BuiltinFunc: {
1445 value__BuiltinFunc* obj = static_cast<value__BuiltinFunc*>(this);
1446 return obj->PrettyTree(do_abbrev, seen);
1447 }
1448 case value_e::Func: {
1449 value__Func* obj = static_cast<value__Func*>(this);
1450 return obj->PrettyTree(do_abbrev, seen);
1451 }
1452 case value_e::BuiltinProc: {
1453 value__BuiltinProc* obj = static_cast<value__BuiltinProc*>(this);
1454 return obj->PrettyTree(do_abbrev, seen);
1455 }
1456 case value_e::Proc: {
1457 value__Proc* obj = static_cast<value__Proc*>(this);
1458 return obj->PrettyTree(do_abbrev, seen);
1459 }
1460 case value_e::Expr: {
1461 value__Expr* obj = static_cast<value__Expr*>(this);
1462 return obj->PrettyTree(do_abbrev, seen);
1463 }
1464 case value_e::CommandFrag: {
1465 value__CommandFrag* obj = static_cast<value__CommandFrag*>(this);
1466 return obj->PrettyTree(do_abbrev, seen);
1467 }
1468 case value_e::Command: {
1469 value__Command* obj = static_cast<value__Command*>(this);
1470 return obj->PrettyTree(do_abbrev, seen);
1471 }
1472 default:
1473 assert(0);
1474 }
1475}
1476
1477} // namespace value_asdl