// BEGIN mycpp output #include "gc_heap.h" using gc_heap::Alloc; using gc_heap::kZeroMask; using gc_heap::StackRoots; #include "my_runtime.h" #include "mylib2.h" using gc_heap::NewStr; using gc_heap::NewList; using gc_heap::NewDict; GLOBAL_STR(str0, "greater"); GLOBAL_STR(str1, "less"); GLOBAL_STR(str2, "global string"); GLOBAL_STR(str3, "."); GLOBAL_STR(str4, "foo"); namespace test_hoist { // forward declare } // forward declare namespace test_hoist namespace test_hoist { // declare Str* f(Str* s); extern Str* S; void g(); Str* strfunc(Str* s); void run_tests(); void run_benchmarks(); } // declare namespace test_hoist namespace test_hoist { // define Str* f(Str* s) { int x; StackRoots _roots({&s}); x = 1; if (x > 0) { s = str0; } else { s = str1; } print(s); return s; } Str* S = str2; void g() { print(S); } Str* strfunc(Str* s) { StackRoots _roots({&s}); return str_concat(s, str3); } void run_tests() { f(str4); g(); } void run_benchmarks() { throw Alloc(); } } // define namespace test_hoist