diff options
Diffstat (limited to 'src/libsyntax/util/parser_testing.rs')
| -rw-r--r-- | src/libsyntax/util/parser_testing.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index 7b96cf3c60d..bc5b9bc6c18 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -9,6 +9,7 @@ // except according to those terms. use ast; +use ast::P; use parse::{new_parse_sess}; use parse::{ParseSess,string_to_filemap,filemap_to_tts}; use parse::{new_parser_from_source_str}; @@ -48,21 +49,21 @@ pub fn string_to_crate (source_str : String) -> ast::Crate { } /// Parse a string, return an expr -pub fn string_to_expr (source_str : String) -> Gc<ast::Expr> { +pub fn string_to_expr (source_str : String) -> P<ast::Expr> { with_error_checking_parse(source_str, |p| { p.parse_expr() }) } /// Parse a string, return an item -pub fn string_to_item (source_str : String) -> Option<Gc<ast::Item>> { +pub fn string_to_item (source_str : String) -> Option<P<ast::Item>> { with_error_checking_parse(source_str, |p| { p.parse_item(Vec::new()) }) } /// Parse a string, return a stmt -pub fn string_to_stmt(source_str : String) -> Gc<ast::Stmt> { +pub fn string_to_stmt(source_str : String) -> P<ast::Stmt> { with_error_checking_parse(source_str, |p| { p.parse_stmt(Vec::new()) }) @@ -70,7 +71,7 @@ pub fn string_to_stmt(source_str : String) -> Gc<ast::Stmt> { /// Parse a string, return a pat. Uses "irrefutable"... which doesn't /// (currently) affect parsing. -pub fn string_to_pat(source_str: String) -> Gc<ast::Pat> { +pub fn string_to_pat(source_str: String) -> P<ast::Pat> { string_to_parser(&new_parse_sess(), source_str).parse_pat() } |
