aboutsummaryrefslogtreecommitdiff
path: root/tests/closure.amal
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-12-23 08:57:48 +0100
committerdec05eba <dec05eba@protonmail.com>2020-07-25 14:37:00 +0200
commit902a81528b9d2edcf93226a2ca13da6fcc1839e5 (patch)
treeea868fae662aab61f1caa50b16a8b02fe1e6836b /tests/closure.amal
parent111bd0c7cb4b446c4bfe192b1df82845de17c005 (diff)
wip: function pointers and other stuff
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