Commit Graph

18 Commits

Author SHA1 Message Date
Ayke van Laethem e2f6aedd9d compiler: implement comparing structs directly 2018-10-23 13:27:18 +02:00
Ayke van Laethem cbd7d401fe testdata: go fmt 2018-10-23 13:24:18 +02:00
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
Ayke van Laethem 9b9b66a09d compiler: add complex manipulation
* builtins: real, imag, complex
* printing of complex numbers

No support for complex arithmetic yet.
2018-10-22 13:49:03 +02:00
Ayke van Laethem 7c2a6169b0 compiler: support comma-ok in map lookup 2018-10-20 17:54:16 +02:00
Ayke van Laethem da89464a63 compiler: compare slice against nil 2018-10-20 17:22:51 +02:00
Ayke van Laethem c0c1ccb381 compiler, runtime: implement delete builtin 2018-10-20 16:18:55 +02:00
Ayke van Laethem 963ba16d7b compiler: add support for the append builtin 2018-10-19 14:40:19 +02:00
Ayke van Laethem f9edf7cc5c test: add slice tests 2018-10-18 15:02:53 +02:00
Ayke van Laethem 0ed00bf6c6 test: add hashmap tests
Hashmaps are still very primitive. These tests check that there are at
least no regressions in hashmap support.
2018-10-10 14:11:15 +02:00
Ayke van Laethem 73709922b2 main: extra interface test for simple named types 2018-10-07 19:40:21 +02:00
Ayke van Laethem e8f211935e compiler: fix expanded structs in invoke calls 2018-10-07 13:19:38 +02:00
Ayke van Laethem 4957db89f4 compiler: fix interface calls for big underlying values
When the underlying value of an interface does not fit in a pointer, a
pointer to the value was correctly inserted in the heap. However, the
receiving method still assumed it got the underlying value instead of a
pointer to it leading to a crash.

This commit inserts wrapper functions for method calls on interfaces.

The bug wasn't obvious as on a 64-bit system, the underlying value was
almost always put directly in the interface. However, it led to a crash
on the AVR platform where pointer are (usually) just 16 bits making it
far more likely that underlying values cannot be directly stored in an
interface.
2018-10-07 02:06:48 +02:00
Ayke van Laethem c1a833c7cc main: add basic float tests 2018-09-29 00:12:23 +02:00
Ayke van Laethem 717262c0a6 main: add coroutine/sleep tests 2018-09-29 00:11:58 +02:00
Ayke van Laethem 4731f2f787 testdata: add better tests for struct expanding 2018-09-25 14:24:44 +02:00
Ayke van Laethem 174b6333f8 compiler: fix expanding zero-length structs 2018-09-25 13:45:04 +02:00
Ayke van Laethem d8f0ddf3fa main: add tests
Add testing infrastructure and one initial test (for
src/runtime/print.go). More tests to be added later.
2018-09-24 17:24:58 +02:00