Ayke van Laethem
4dfc289ae5
compiler,runtime: support operations on nil map
The index expression and delete keyword are valid on nil maps, so the
runtime must be modified to support this.
5 years ago
Ayke van Laethem
0d34f933eb
compiler,runtime: implement maps for arbitrary keys
This implementation simply casts types without special support to an
interface, to make the implementation simpler and possibly reducing the
code size too. It will likely be slower than the canonical Go
implementation though (which builds special compare and hash functions
at compile time).
5 years ago
Ayke van Laethem
763b9d7d10
runtime: implement growing hashmaps
Add support for growing hashmaps beyond their initial size.
6 years ago
Ayke van Laethem
55fc7b904a
compiler,runtime: use the size hint when creating a new map
It defaults to hint/8 number of buckets. This number may be tuned in the
future.
6 years ago
Konstantin Yegupov
504c82a0e7
compiler: support for byte arrays as keys in maps
6 years ago
Konstantin Yegupov
f8a1e5f449
interp: support map literals with integer keys
6 years ago
Ayke van Laethem
436901dc49
compiler: implement operations on nil hashmaps
* comparing a map against nil
* getting the length of a nil map
6 years ago
Ayke van Laethem
7c2a6169b0
compiler: support comma-ok in map lookup
6 years ago
Ayke van Laethem
c0c1ccb381
compiler, runtime: implement delete builtin
6 years ago
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.
6 years ago