aboutsummaryrefslogtreecommitdiff
path: root/tests/closure.amal
diff options
context:
space:
mode:
Diffstat (limited to 'tests/closure.amal')
-rw-r--r--tests/closure.amal37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/closure.amal b/tests/closure.amal
new file mode 100644
index 0000000..c5b3e15
--- /dev/null
+++ b/tests/closure.amal
@@ -0,0 +1,37 @@
+// extern const printf: fn(fmt: &c_char, ...) c_int;
+
+/*
+const apply = fn(func: fn() bool) i32 {
+ //const f = func;
+ const result = func();
+ //const result2 = f();
+}
+
+const main = fn {
+ // TODO: Test this
+ // const f = printf;
+ // f("hello");
+
+ apply(fn() bool {
+ return true;
+ });
+
+ // Or store in a variable and use it
+ const func = fn() bool {
+ return true;
+ }
+ apply(func);
+}
+*/
+
+const f = fn(func: fn() i32) i32 {
+ func();
+}
+
+const bla = fn() i32 {
+
+}
+
+const main = fn {
+ f(bla);
+} \ No newline at end of file