diff options
| author | bors <bors@rust-lang.org> | 2013-06-12 18:10:49 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-06-12 18:10:49 -0700 |
| commit | da510bfb4a3f6ca805e849372f9bbe7b2b0f6a61 (patch) | |
| tree | cb272a50c99d8001304f044fd8a1128d30654b61 /src/libsyntax/util/parser_testing.rs | |
| parent | 84bed9769b5d15871481b657860ad6a7d0a62f42 (diff) | |
| parent | 5ebffd46d5f7476c8124856c37538088da0c918e (diff) | |
| download | rust-da510bfb4a3f6ca805e849372f9bbe7b2b0f6a61.tar.gz rust-da510bfb4a3f6ca805e849372f9bbe7b2b0f6a61.zip | |
auto merge of #7086 : huonw/rust/5048, r=graydon
Fixes #5048. I'm sure this reduces memory usage, but I can't get cgroups to work properly to actually measure memory. (It doesn't appear to offer much speed improvement, but I'm fairly sure it's not slower.) This is quite huge, so it'd be nice to get a resolution soon.
Diffstat (limited to 'src/libsyntax/util/parser_testing.rs')
| -rw-r--r-- | src/libsyntax/util/parser_testing.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index 76055ca7914..d0961ddbc70 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -18,50 +18,50 @@ use parse::token; // map a string to tts, using a made-up filename: return both the token_trees // and the ParseSess -pub fn string_to_tts_and_sess (source_str : @~str) -> (~[ast::token_tree],@mut ParseSess) { +pub fn string_to_tts_and_sess (source_str : @str) -> (~[ast::token_tree],@mut ParseSess) { let ps = new_parse_sess(None); - (filemap_to_tts(ps,string_to_filemap(ps,source_str,~"bogofile")),ps) + (filemap_to_tts(ps,string_to_filemap(ps,source_str,@"bogofile")),ps) } -pub fn string_to_parser_and_sess(source_str: @~str) -> (Parser,@mut ParseSess) { +pub fn string_to_parser_and_sess(source_str: @str) -> (Parser,@mut ParseSess) { let ps = new_parse_sess(None); - (new_parser_from_source_str(ps,~[],~"bogofile",source_str),ps) + (new_parser_from_source_str(ps,~[],@"bogofile",source_str),ps) } // map string to parser (via tts) -pub fn string_to_parser(source_str: @~str) -> Parser { +pub fn string_to_parser(source_str: @str) -> Parser { let (p,_) = string_to_parser_and_sess(source_str); p } -pub fn string_to_crate (source_str : @~str) -> @ast::crate { +pub fn string_to_crate (source_str : @str) -> @ast::crate { string_to_parser(source_str).parse_crate_mod() } // parse a string, return an expr -pub fn string_to_expr (source_str : @~str) -> @ast::expr { +pub fn string_to_expr (source_str : @str) -> @ast::expr { string_to_parser(source_str).parse_expr() } // parse a string, return an item -pub fn string_to_item (source_str : @~str) -> Option<@ast::item> { +pub fn string_to_item (source_str : @str) -> Option<@ast::item> { string_to_parser(source_str).parse_item(~[]) } // parse a string, return an item and the ParseSess -pub fn string_to_item_and_sess (source_str : @~str) -> (Option<@ast::item>,@mut ParseSess) { +pub fn string_to_item_and_sess (source_str : @str) -> (Option<@ast::item>,@mut ParseSess) { let (p,ps) = string_to_parser_and_sess(source_str); (p.parse_item(~[]),ps) } // parse a string, return a stmt -pub fn string_to_stmt(source_str : @~str) -> @ast::stmt { +pub fn string_to_stmt(source_str : @str) -> @ast::stmt { string_to_parser(source_str).parse_stmt(~[]) } // parse a string, return a pat. Uses "irrefutable"... which doesn't // (currently) affect parsing. -pub fn string_to_pat(source_str : @~str) -> @ast::pat { +pub fn string_to_pat(source_str : @str) -> @ast::pat { string_to_parser(source_str).parse_pat() } |
