aboutsummaryrefslogtreecommitdiff
path: root/tests/closure.amal
blob: c5b3e150f075b8686a01acd209729f4698de9d9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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);
}