diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-02-28 13:09:09 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-03-01 22:40:52 -0800 |
| commit | 58fd6ab90db3eb68c94695e1254a73e57bc44658 (patch) | |
| tree | 51078e799ec82df848205dce6f32a8f1c0c312f5 /src/libsyntax/parse/mod.rs | |
| parent | df40aeccdbfcfb0cc7851c6df24f28fbeccfe046 (diff) | |
| download | rust-58fd6ab90db3eb68c94695e1254a73e57bc44658.tar.gz rust-58fd6ab90db3eb68c94695e1254a73e57bc44658.zip | |
libsyntax: Mechanically change `~[T]` to `Vec<T>`
Diffstat (limited to 'src/libsyntax/parse/mod.rs')
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 8f45f911484..40c9f346007 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -42,7 +42,7 @@ pub struct ParseSess { cm: @codemap::CodeMap, // better be the same as the one in the reader! span_diagnostic: @SpanHandler, // better be the same as the one in the reader! /// Used to determine and report recursive mod inclusions - included_mod_stack: RefCell<~[Path]>, + included_mod_stack: RefCell<Vec<Path> >, } pub fn new_parse_sess() -> @ParseSess { @@ -50,7 +50,7 @@ pub fn new_parse_sess() -> @ParseSess { @ParseSess { cm: cm, span_diagnostic: mk_span_handler(default_handler(), cm), - included_mod_stack: RefCell::new(~[]), + included_mod_stack: RefCell::new(Vec::new()), } } @@ -60,7 +60,7 @@ pub fn new_parse_sess_special_handler(sh: @SpanHandler, @ParseSess { cm: cm, span_diagnostic: sh, - included_mod_stack: RefCell::new(~[]), + included_mod_stack: RefCell::new(Vec::new()), } } @@ -82,7 +82,7 @@ pub fn parse_crate_attrs_from_file( input: &Path, cfg: ast::CrateConfig, sess: @ParseSess -) -> ~[ast::Attribute] { +) -> Vec<ast::Attribute> { let mut parser = new_parser_from_file(sess, cfg, input); let (inner, _) = parser.parse_inner_attrs_and_next(); return inner; @@ -104,7 +104,7 @@ pub fn parse_crate_attrs_from_source_str(name: ~str, source: ~str, cfg: ast::CrateConfig, sess: @ParseSess) - -> ~[ast::Attribute] { + -> Vec<ast::Attribute> { let mut p = new_parser_from_source_str(sess, cfg, name, @@ -144,7 +144,7 @@ pub fn parse_meta_from_source_str(name: ~str, pub fn parse_stmt_from_source_str(name: ~str, source: ~str, cfg: ast::CrateConfig, - attrs: ~[ast::Attribute], + attrs: Vec<ast::Attribute> , sess: @ParseSess) -> @ast::Stmt { let mut p = new_parser_from_source_str( @@ -160,7 +160,7 @@ pub fn parse_tts_from_source_str(name: ~str, source: ~str, cfg: ast::CrateConfig, sess: @ParseSess) - -> ~[ast::TokenTree] { + -> Vec<ast::TokenTree> { let mut p = new_parser_from_source_str( sess, cfg, @@ -214,7 +214,7 @@ pub fn filemap_to_parser(sess: @ParseSess, // compiler expands into it pub fn new_parser_from_tts(sess: @ParseSess, cfg: ast::CrateConfig, - tts: ~[ast::TokenTree]) -> Parser { + tts: Vec<ast::TokenTree> ) -> Parser { tts_to_parser(sess,tts,cfg) } @@ -256,10 +256,10 @@ pub fn string_to_filemap(sess: @ParseSess, source: ~str, path: ~str) // given a filemap, produce a sequence of token-trees pub fn filemap_to_tts(sess: @ParseSess, filemap: @FileMap) - -> ~[ast::TokenTree] { + -> Vec<ast::TokenTree> { // it appears to me that the cfg doesn't matter here... indeed, // parsing tt's probably shouldn't require a parser at all. - let cfg = ~[]; + let cfg = Vec::new(); let srdr = lexer::new_string_reader(sess.span_diagnostic, filemap); let mut p1 = Parser(sess, cfg, ~srdr); p1.parse_all_token_trees() @@ -267,7 +267,7 @@ pub fn filemap_to_tts(sess: @ParseSess, filemap: @FileMap) // given tts and cfg, produce a parser pub fn tts_to_parser(sess: @ParseSess, - tts: ~[ast::TokenTree], + tts: Vec<ast::TokenTree> , cfg: ast::CrateConfig) -> Parser { let trdr = lexer::new_tt_reader(sess.span_diagnostic, None, tts); Parser(sess, cfg, ~trdr) @@ -318,13 +318,13 @@ mod test { node: ast::ExprPath(ast::Path { span: sp(0, 1), global: false, - segments: ~[ + segments: vec!( ast::PathSegment { identifier: str_to_ident("a"), lifetimes: opt_vec::Empty, types: opt_vec::Empty, } - ], + ), }), span: sp(0, 1) }) @@ -337,7 +337,7 @@ mod test { node: ast::ExprPath(ast::Path { span: sp(0, 6), global: true, - segments: ~[ + segments: vec!( ast::PathSegment { identifier: str_to_ident("a"), lifetimes: opt_vec::Empty, @@ -348,7 +348,7 @@ mod test { lifetimes: opt_vec::Empty, types: opt_vec::Empty, } - ] + ) }), span: sp(0, 6) }) @@ -550,13 +550,13 @@ mod test { node:ast::ExprPath(ast::Path{ span: sp(7, 8), global: false, - segments: ~[ + segments: vec!( ast::PathSegment { identifier: str_to_ident("d"), lifetimes: opt_vec::Empty, types: opt_vec::Empty, } - ], + ), }), span:sp(7,8) })), @@ -572,13 +572,13 @@ mod test { node: ast::ExprPath(ast::Path { span:sp(0,1), global:false, - segments: ~[ + segments: vec!( ast::PathSegment { identifier: str_to_ident("b"), lifetimes: opt_vec::Empty, types: opt_vec::Empty, } - ], + ), }), span: sp(0,1)}, ast::DUMMY_NODE_ID), @@ -599,13 +599,13 @@ mod test { ast::Path { span:sp(0,1), global:false, - segments: ~[ + segments: vec!( ast::PathSegment { identifier: str_to_ident("b"), lifetimes: opt_vec::Empty, types: opt_vec::Empty, } - ], + ), }, None /* no idea */), span: sp(0,1)}); @@ -618,22 +618,22 @@ mod test { assert!(string_to_item(~"fn a (b : int) { b; }") == Some( @ast::Item{ident:str_to_ident("a"), - attrs:~[], + attrs:Vec::new(), id: ast::DUMMY_NODE_ID, node: ast::ItemFn(ast::P(ast::FnDecl { - inputs: ~[ast::Arg{ + inputs: vec!(ast::Arg{ ty: ast::P(ast::Ty{id: ast::DUMMY_NODE_ID, node: ast::TyPath(ast::Path{ span:sp(10,13), global:false, - segments: ~[ + segments: vec!( ast::PathSegment { identifier: str_to_ident("int"), lifetimes: opt_vec::Empty, types: opt_vec::Empty, } - ], + ), }, None, ast::DUMMY_NODE_ID), span:sp(10,13) }), @@ -644,21 +644,21 @@ mod test { ast::Path { span:sp(6,7), global:false, - segments: ~[ + segments: vec!( ast::PathSegment { identifier: str_to_ident("b"), lifetimes: opt_vec::Empty, types: opt_vec::Empty, } - ], + ), }, None // no idea ), span: sp(6,7) }, id: ast::DUMMY_NODE_ID - }], + }), output: ast::P(ast::Ty{id: ast::DUMMY_NODE_ID, node: ast::TyNil, span:sp(15,15)}), // not sure @@ -672,15 +672,15 @@ mod test { ty_params: opt_vec::Empty, }, ast::P(ast::Block { - view_items: ~[], - stmts: ~[@Spanned{ + view_items: Vec::new(), + stmts: vec!(@Spanned{ node: ast::StmtSemi(@ast::Expr{ id: ast::DUMMY_NODE_ID, node: ast::ExprPath( ast::Path{ span:sp(17,18), global:false, - segments: ~[ + segments: vec!( ast::PathSegment { identifier: str_to_ident( @@ -690,11 +690,11 @@ mod test { types: opt_vec::Empty } - ], + ), }), span: sp(17,18)}, ast::DUMMY_NODE_ID), - span: sp(17,18)}], + span: sp(17,18)}), expr: None, id: ast::DUMMY_NODE_ID, rules: ast::DefaultBlock, // no idea |
