comp/fuzzer: rewrite to use io::with_str_reader.
This commit is contained in:
parent
f630ebdb6a
commit
3cb2cd1f71
@ -412,12 +412,14 @@ fn parse_and_print(code: @str) -> str {
|
||||
write_file(filename, *code);
|
||||
let crate = parser::parse_crate_from_source_str(
|
||||
filename, code, [], sess);
|
||||
ret as_str(bind pprust::print_crate(sess.cm,
|
||||
io::with_str_reader(*code) { |rdr|
|
||||
as_str(bind pprust::print_crate(sess.cm,
|
||||
sess.span_diagnostic,
|
||||
crate,
|
||||
filename,
|
||||
io::str_reader(*code), _,
|
||||
pprust::no_ann()));
|
||||
rdr, _,
|
||||
pprust::no_ann()))
|
||||
}
|
||||
}
|
||||
|
||||
fn has_raw_pointers(c: ast::crate) -> bool {
|
||||
@ -557,13 +559,15 @@ fn check_variants(files: [str], cx: context) {
|
||||
parser::parse_crate_from_source_str(
|
||||
file,
|
||||
s, [], sess);
|
||||
#error("%s",
|
||||
as_str(bind pprust::print_crate(sess.cm,
|
||||
sess.span_diagnostic,
|
||||
crate,
|
||||
file,
|
||||
io::str_reader(*s), _,
|
||||
pprust::no_ann())));
|
||||
io::with_str_reader(*s) { |rdr|
|
||||
#error("%s",
|
||||
as_str(bind pprust::print_crate(sess.cm,
|
||||
sess.span_diagnostic,
|
||||
crate,
|
||||
file,
|
||||
rdr, _,
|
||||
pprust::no_ann())));
|
||||
}
|
||||
check_variants_of_ast(*crate, sess.cm, file, cx);
|
||||
}
|
||||
}
|
||||
|
@ -272,8 +272,10 @@ fn pretty_print_input(sess: session, cfg: ast::crate_cfg, input: str,
|
||||
ppm_expanded | ppm_normal {}
|
||||
}
|
||||
let src = codemap::get_filemap(sess.codemap, input).src;
|
||||
pprust::print_crate(sess.codemap, sess.span_diagnostic, crate, input,
|
||||
io::str_reader(*src), io::stdout(), ann);
|
||||
io::with_str_reader(*src) { |rdr|
|
||||
pprust::print_crate(sess.codemap, sess.span_diagnostic, crate, input,
|
||||
rdr, io::stdout(), ann);
|
||||
}
|
||||
}
|
||||
|
||||
fn get_os(triple: str) -> option<session::os> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user