aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/trace_more.zc
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-14 15:54:04 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-14 15:54:04 +0330
commit0879d0a42d137054057cd2a1e37437e6be78ed0b (patch)
treefcb16d3185c1f80fae8d54cd9062bd68d6c0c88d /tests/programs/trace_more.zc
parentmerge spec conformance suite (diff)
parentmerge main into work/line-tables (diff)
merge line tables
Diffstat (limited to 'tests/programs/trace_more.zc')
-rw-r--r--tests/programs/trace_more.zc40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/programs/trace_more.zc b/tests/programs/trace_more.zc
new file mode 100644
index 0000000..512f93f
--- /dev/null
+++ b/tests/programs/trace_more.zc
@@ -0,0 +1,40 @@
+namespace;
+include rt;
+struct pt {
+ int x;
+ int get() {
+ rt.trace();
+ return this.x;
+ }
+};
+int apply(fn(int) f, int v) {
+ return f(v);
+}
+int rec(int n) {
+ if (n == 0) { rt.trace(); return 0; }
+ return rec(n - 1) + 1;
+}
+lines off;
+int quiet(int n) {
+ rt.trace();
+ return n;
+}
+lines on;
+int loud(int n) {
+ return quiet(n) +
+ 1;
+}
+int main() {
+ pt* p = rt.new(pt);
+ p.x = 3;
+ int k = 5;
+ rt.put_n(p.get()); rt.put_c(10);
+ rt.put_n(apply(fn(int a) {
+ int b = a + k;
+ rt.trace();
+ return b;
+ }, 4)); rt.put_c(10);
+ rec(60);
+ loud(2);
+ return 0;
+}