fix: index expression on binary map (#223)
This commit is contained in:
committed by
Ludovic Fernandez
parent
146cac6a0f
commit
cd12274ec6
20
_test/map17.go
Normal file
20
_test/map17.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import "net/http"
|
||||
|
||||
type T struct {
|
||||
header string
|
||||
}
|
||||
|
||||
func (b *T) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
if b.header != "" {
|
||||
req.Header[b.header] = []string{"hello"}
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
println("ok")
|
||||
}
|
||||
|
||||
// Output:
|
||||
// ok
|
||||
@@ -917,7 +917,7 @@ func getIndexArray(n *Node) {
|
||||
func getIndexMap(n *Node) {
|
||||
value0 := genValue(n.child[0]) // map
|
||||
tnext := getExec(n.tnext)
|
||||
z := reflect.New(n.child[0].typ.val.TypeOf()).Elem()
|
||||
z := reflect.New(n.child[0].typ.TypeOf().Elem()).Elem()
|
||||
|
||||
if n.child[1].rval.IsValid() { // constant map index
|
||||
mi := n.child[1].rval
|
||||
|
||||
Reference in New Issue
Block a user