mirror of
https://github.com/golang/go
synced 2024-11-22 03:04:41 -07:00
allow range on nil maps
R=ken OCL=26663 CL=26663
This commit is contained in:
parent
8d44052b6d
commit
86145611b0
@ -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");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user