Commit 86145611 authored by Russ Cox's avatar Russ Cox

allow range on nil maps

R=ken
OCL=26663
CL=26663
parent 8d44052b
......@@ -870,6 +870,10 @@ sys·mapassign2(Hmap *h, ...)
void
sys·mapiterinit(Hmap *h, struct hash_iter *it)
{
if(h == nil) {
it->data = nil;
return;
}
hash_iter_init(h, it);
it->data = hash_next(it);
if(debug) {
......
......@@ -487,4 +487,10 @@ func main() {
fmt.Printf("update mipM[%d][%d] = %i\n", i, i, mipM[i][i]);
}
}
// test range on nil map
var mnil map[string] int;
for x, y := range mnil {
panic("range mnil");
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment