range function requires for loop now

This commit is contained in:
Brian Anderson 2012-05-26 15:10:37 -07:00
parent 59a6f69d3a
commit 8b013462d5
4 changed files with 8 additions and 8 deletions

View file

@ -70,7 +70,7 @@ crust fn debug(cx: *JSContext, argc: uintN, vp: *jsval) {
unsafe { unsafe {
let argv = JS_ARGV(cx, vp); let argv = JS_ARGV(cx, vp);
uint::range(0u, argc as uint) { |i| for uint::range(0u, argc as uint) { |i|
let jsstr = JS_ValueToString(cx, argv[i]); let jsstr = JS_ValueToString(cx, argv[i]);
let bytes = JS_EncodeString(cx, jsstr); let bytes = JS_EncodeString(cx, jsstr);
let str = str::unsafe::from_c_str(bytes); let str = str::unsafe::from_c_str(bytes);

View file

@ -278,10 +278,10 @@ mod test {
let read_chan = comm::chan(read_port); let read_chan = comm::chan(read_port);
// fire up a reader task // fire up a reader task
uint::range(0u, iter1) { |i| for uint::range(0u, iter1) { |i|
s.reader_forked(); s.reader_forked();
let wait_chan = task::spawn_listener {|wait_port| let wait_chan = task::spawn_listener {|wait_port|
uint::range(0u, iter2) { |_i| for uint::range(0u, iter2) { |_i|
comm::send(read_chan, henrietta.rd(read_characteristic)); comm::send(read_chan, henrietta.rd(read_characteristic));
comm::send(read_chan, ferdinand.rd(read_characteristic)); comm::send(read_chan, ferdinand.rd(read_characteristic));
comm::recv(wait_port); comm::recv(wait_port);
@ -294,7 +294,7 @@ mod test {
let frc = ferdinand.rd(read_characteristic); let frc = ferdinand.rd(read_characteristic);
assert frc == i * iter2; assert frc == i * iter2;
uint::range(0u, iter2) { |_i| for uint::range(0u, iter2) { |_i|
assert hrc == comm::recv(read_port); assert hrc == comm::recv(read_port);
s.wr(henrietta, mutate); s.wr(henrietta, mutate);
assert frc == comm::recv(read_port); assert frc == comm::recv(read_port);

View file

@ -91,9 +91,9 @@ fn draw_image(draw_target: AzDrawTargetRef, item: dl::display_item,
} }
let stride = image.width * image.depth; let stride = image.width * image.depth;
uint::range(0u, image.height) { for uint::range(0u, image.height) {
|y| |y|
uint::range(0u, image.width) { for uint::range(0u, image.width) {
|x| |x|
let color = { let color = {
r: image.data[y * stride + x * image.depth].to_float() r: image.data[y * stride + x * image.depth].to_float()

View file

@ -76,7 +76,7 @@ impl layout_methods_priv for @box {
#[doc="Dumps the box tree, for debugging, with indentation."] #[doc="Dumps the box tree, for debugging, with indentation."]
fn dump_indent(indent: uint) { fn dump_indent(indent: uint) {
let mut s = ""; let mut s = "";
uint::range(0u, indent) { for uint::range(0u, indent) {
|_i| |_i|
s += " "; s += " ";
} }
@ -118,7 +118,7 @@ impl node_methods_priv for node {
#[doc="Dumps the node tree, for debugging, with indentation."] #[doc="Dumps the node tree, for debugging, with indentation."]
fn dump_indent(indent: uint) { fn dump_indent(indent: uint) {
let mut s = ""; let mut s = "";
uint::range(0u, indent) { for uint::range(0u, indent) {
|_i| |_i|
s += " "; s += " ";
} }