tinygo/testdata/calls.txt
Ayke van Laethem 82be43f4e6
compiler: implement deferring of immediately-applied closures
This is a common operation:

    freevar := ...
    defer func() {
        println("I am deferred:", freevar)
    }()

The function is thus an immediately applied closure. Only this form is
currently supported, support for regular (fat) function pointers should
be trivial to add but is not currently implemented as it wasn't
necessary to get fmt to compile.
2018-10-22 14:06:51 +02:00

8 строки
176 Б
Text

hello from function pointer: 5
deferring...
...run as defer 3
...run closure deferred: 4
...run as defer 1
bound method: foo
thing inside closure: foo
inside fp closure: foo 3