mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 21:13:39 +00:00
interp: support map literals with integer keys
This commit is contained in:
committed by
Ayke van Laethem
parent
0308c92e67
commit
f8a1e5f449
Vendored
+4
@@ -15,6 +15,7 @@ var testmap2 = map[string]int{
|
||||
"eleven": 11,
|
||||
"twelve": 12,
|
||||
}
|
||||
var testmapIntInt = map[int]int{1: 1, 2: 4, 3: 9}
|
||||
|
||||
func main() {
|
||||
m := map[string]int{"answer": 42, "foo": 3}
|
||||
@@ -31,6 +32,9 @@ func main() {
|
||||
var nilmap map[string]int
|
||||
println(m == nil, m != nil, len(m))
|
||||
println(nilmap == nil, nilmap != nil, len(nilmap))
|
||||
println(testmapIntInt[2])
|
||||
testmapIntInt[2] = 42
|
||||
println(testmapIntInt[2])
|
||||
}
|
||||
|
||||
func readMap(m map[string]int, key string) {
|
||||
|
||||
Vendored
+2
@@ -50,3 +50,5 @@ lookup with comma-ok: eight 8 true
|
||||
lookup with comma-ok: nokey 0 false
|
||||
false true 2
|
||||
true false 0
|
||||
4
|
||||
42
|
||||
|
||||
Reference in New Issue
Block a user