-
Alan Donovan authored
The lowering of ast.RangeStmt now has three distinct cases: 1) rangeIter for maps and strings; approximately: it = range x for { k, v, ok = next it if !ok { break } ... } The Range instruction and the interpreter's "iter" datatype are now restricted to these types. 2) rangeChan for channels; approximately: for { k, ok = <-x if !ok { break } ... } 3) rangeIndexed for slices, arrays, and *array; approximately: for k, l = 0, len(x); k < l; k++ { v = x[k] ... } In all cases we now evaluate the side effects of the range expression exactly once, per comments on http://code.google.com/p/go/issues/detail?id=4644. However the exact spec wording is still being discussed in https://golang.org/cl/7307083/. Further (small) changes may be required once the dust settles. R=iant CC=golang-dev https://golang.org/cl/7303074
d8e3b16f
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
archive | ||
bufio | ||
builtin | ||
bytes | ||
compress | ||
container | ||
crypto | ||
database/sql | ||
debug | ||
encoding | ||
errors | ||
exp | ||
expvar | ||
flag | ||
fmt | ||
go | ||
hash | ||
html | ||
image | ||
index/suffixarray | ||
io | ||
log | ||
math | ||
mime | ||
net | ||
old/netchan | ||
os | ||
path | ||
reflect | ||
regexp | ||
runtime | ||
sort | ||
strconv | ||
strings | ||
sync | ||
syscall | ||
testing | ||
text | ||
time | ||
unicode | ||
unsafe |