diff options
| author | bors <bors@rust-lang.org> | 2013-07-22 08:19:32 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-07-22 08:19:32 -0700 |
| commit | 52b7fc14fe4444f0de91a474c70cbf248f96b763 (patch) | |
| tree | 3eb8238a1e8ab4f9999d1185077e2bec74707ed5 /src/libsyntax/ext | |
| parent | 7a3eaf8f27bd626a9667a574bc62464a815a6ad4 (diff) | |
| parent | 5aee3e01a02e0b31ad225e70899a671937ab65ee (diff) | |
| download | rust-52b7fc14fe4444f0de91a474c70cbf248f96b763.tar.gz rust-52b7fc14fe4444f0de91a474c70cbf248f96b763.zip | |
auto merge of #7903 : michaelwoerister/rust/end_of_spanned, r=jdm
Continuation of https://github.com/mozilla/rust/pull/7826. AST spanned<T> refactoring, AST type renamings: `crate => Crate` `local => Local` `blk => Block` `crate_num => CrateNum` `crate_cfg => CrateConfig` `field => Field` Also, Crate, Field and Local are not wrapped in spanned<T> anymore.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 72 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 4 |
5 files changed, 49 insertions, 49 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 753d32fee5a..e831e32f23d 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -212,7 +212,7 @@ pub fn syntax_expander_table() -> SyntaxEnv { // -> expn_info of their expansion context stored into their span. pub struct ExtCtxt { parse_sess: @mut parse::ParseSess, - cfg: ast::crate_cfg, + cfg: ast::CrateConfig, backtrace: @mut Option<@ExpnInfo>, // These two @mut's should really not be here, @@ -225,7 +225,7 @@ pub struct ExtCtxt { } impl ExtCtxt { - pub fn new(parse_sess: @mut parse::ParseSess, cfg: ast::crate_cfg) + pub fn new(parse_sess: @mut parse::ParseSess, cfg: ast::CrateConfig) -> @ExtCtxt { @ExtCtxt { parse_sess: parse_sess, @@ -238,7 +238,7 @@ impl ExtCtxt { pub fn codemap(&self) -> @CodeMap { self.parse_sess.cm } pub fn parse_sess(&self) -> @mut parse::ParseSess { self.parse_sess } - pub fn cfg(&self) -> ast::crate_cfg { self.cfg.clone() } + pub fn cfg(&self) -> ast::CrateConfig { self.cfg.clone() } pub fn call_site(&self) -> span { match *self.backtrace { Some(@ExpnInfo {call_site: cs, _}) => cs, diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index df5f3d8d895..b3d65dfa9e2 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -76,12 +76,12 @@ pub trait AstBuilder { fn stmt_let(&self, sp: span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt; // blocks - fn blk(&self, span: span, stmts: ~[@ast::stmt], expr: Option<@ast::expr>) -> ast::blk; - fn blk_expr(&self, expr: @ast::expr) -> ast::blk; + fn blk(&self, span: span, stmts: ~[@ast::stmt], expr: Option<@ast::expr>) -> ast::Block; + fn blk_expr(&self, expr: @ast::expr) -> ast::Block; fn blk_all(&self, span: span, view_items: ~[ast::view_item], stmts: ~[@ast::stmt], - expr: Option<@ast::expr>) -> ast::blk; + expr: Option<@ast::expr>) -> ast::Block; // expressions fn expr(&self, span: span, node: ast::expr_) -> @ast::expr; @@ -105,11 +105,11 @@ pub trait AstBuilder { fn expr_method_call(&self, span: span, expr: @ast::expr, ident: ast::ident, args: ~[@ast::expr]) -> @ast::expr; - fn expr_blk(&self, b: ast::blk) -> @ast::expr; + fn expr_blk(&self, b: ast::Block) -> @ast::expr; - fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::field; - fn expr_struct(&self, span: span, path: ast::Path, fields: ~[ast::field]) -> @ast::expr; - fn expr_struct_ident(&self, span: span, id: ast::ident, fields: ~[ast::field]) -> @ast::expr; + fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::Field; + fn expr_struct(&self, span: span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr; + fn expr_struct_ident(&self, span: span, id: ast::ident, fields: ~[ast::Field]) -> @ast::expr; fn expr_lit(&self, sp: span, lit: ast::lit_) -> @ast::expr; @@ -147,11 +147,11 @@ pub trait AstBuilder { fn expr_if(&self, span: span, cond: @ast::expr, then: @ast::expr, els: Option<@ast::expr>) -> @ast::expr; - fn lambda_fn_decl(&self, span: span, fn_decl: ast::fn_decl, blk: ast::blk) -> @ast::expr; + fn lambda_fn_decl(&self, span: span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr; - fn lambda(&self, span: span, ids: ~[ast::ident], blk: ast::blk) -> @ast::expr; - fn lambda0(&self, span: span, blk: ast::blk) -> @ast::expr; - fn lambda1(&self, span: span, blk: ast::blk, ident: ast::ident) -> @ast::expr; + fn lambda(&self, span: span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr; + fn lambda0(&self, span: span, blk: ast::Block) -> @ast::expr; + fn lambda1(&self, span: span, blk: ast::Block, ident: ast::ident) -> @ast::expr; fn lambda_expr(&self, span: span, ids: ~[ast::ident], blk: @ast::expr) -> @ast::expr; fn lambda_expr_0(&self, span: span, expr: @ast::expr) -> @ast::expr; @@ -175,13 +175,13 @@ pub trait AstBuilder { inputs: ~[ast::arg], output: ast::Ty, generics: Generics, - body: ast::blk) -> @ast::item; + body: ast::Block) -> @ast::item; fn item_fn(&self, span: span, name: ident, inputs: ~[ast::arg], output: ast::Ty, - body: ast::blk) -> @ast::item; + body: ast::Block) -> @ast::item; fn variant(&self, span: span, name: ident, tys: ~[ast::Ty]) -> ast::variant; fn item_enum_poly(&self, @@ -375,31 +375,31 @@ impl AstBuilder for @ExtCtxt { fn stmt_let(&self, sp: span, mutbl: bool, ident: ast::ident, ex: @ast::expr) -> @ast::stmt { let pat = self.pat_ident(sp, ident); - let local = @respan(sp, - ast::local_ { - is_mutbl: mutbl, - ty: self.ty_infer(sp), - pat: pat, - init: Some(ex), - id: self.next_id(), - }); + let local = @ast::Local { + is_mutbl: mutbl, + ty: self.ty_infer(sp), + pat: pat, + init: Some(ex), + id: self.next_id(), + span: sp, + }; let decl = respan(sp, ast::decl_local(local)); @respan(sp, ast::stmt_decl(@decl, self.next_id())) } - fn blk(&self, span: span, stmts: ~[@ast::stmt], expr: Option<@expr>) -> ast::blk { + fn blk(&self, span: span, stmts: ~[@ast::stmt], expr: Option<@expr>) -> ast::Block { self.blk_all(span, ~[], stmts, expr) } - fn blk_expr(&self, expr: @ast::expr) -> ast::blk { + fn blk_expr(&self, expr: @ast::expr) -> ast::Block { self.blk_all(expr.span, ~[], ~[], Some(expr)) } fn blk_all(&self, span: span, view_items: ~[ast::view_item], stmts: ~[@ast::stmt], - expr: Option<@ast::expr>) -> ast::blk { - ast::blk { + expr: Option<@ast::expr>) -> ast::Block { + ast::Block { view_items: view_items, stmts: stmts, expr: expr, @@ -474,17 +474,17 @@ impl AstBuilder for @ExtCtxt { self.expr(span, ast::expr_method_call(self.next_id(), expr, ident, ~[], args, ast::NoSugar)) } - fn expr_blk(&self, b: ast::blk) -> @ast::expr { + fn expr_blk(&self, b: ast::Block) -> @ast::expr { self.expr(b.span, ast::expr_block(b)) } - fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::field { - respan(span, ast::field_ { ident: name, expr: e }) + fn field_imm(&self, span: span, name: ident, e: @ast::expr) -> ast::Field { + ast::Field { ident: name, expr: e, span: span } } - fn expr_struct(&self, span: span, path: ast::Path, fields: ~[ast::field]) -> @ast::expr { + fn expr_struct(&self, span: span, path: ast::Path, fields: ~[ast::Field]) -> @ast::expr { self.expr(span, ast::expr_struct(path, fields, None)) } fn expr_struct_ident(&self, span: span, - id: ast::ident, fields: ~[ast::field]) -> @ast::expr { + id: ast::ident, fields: ~[ast::Field]) -> @ast::expr { self.expr_struct(span, self.path_ident(span, id), fields) } @@ -595,23 +595,23 @@ impl AstBuilder for @ExtCtxt { self.expr(span, ast::expr_if(cond, self.blk_expr(then), els)) } - fn lambda_fn_decl(&self, span: span, fn_decl: ast::fn_decl, blk: ast::blk) -> @ast::expr { + fn lambda_fn_decl(&self, span: span, fn_decl: ast::fn_decl, blk: ast::Block) -> @ast::expr { self.expr(span, ast::expr_fn_block(fn_decl, blk)) } - fn lambda(&self, span: span, ids: ~[ast::ident], blk: ast::blk) -> @ast::expr { + fn lambda(&self, span: span, ids: ~[ast::ident], blk: ast::Block) -> @ast::expr { let fn_decl = self.fn_decl( ids.map(|id| self.arg(span, *id, self.ty_infer(span))), self.ty_infer(span)); self.expr(span, ast::expr_fn_block(fn_decl, blk)) } - fn lambda0(&self, _span: span, blk: ast::blk) -> @ast::expr { + fn lambda0(&self, _span: span, blk: ast::Block) -> @ast::expr { let ext_cx = *self; let blk_e = self.expr(blk.span, ast::expr_block(blk.clone())); quote_expr!(|| $blk_e ) } - fn lambda1(&self, _span: span, blk: ast::blk, ident: ast::ident) -> @ast::expr { + fn lambda1(&self, _span: span, blk: ast::Block, ident: ast::ident) -> @ast::expr { let ext_cx = *self; let blk_e = self.expr(blk.span, ast::expr_block(blk.clone())); quote_expr!(|$ident| $blk_e ) @@ -674,7 +674,7 @@ impl AstBuilder for @ExtCtxt { inputs: ~[ast::arg], output: ast::Ty, generics: Generics, - body: ast::blk) -> @ast::item { + body: ast::Block) -> @ast::item { self.item(span, name, ~[], @@ -690,7 +690,7 @@ impl AstBuilder for @ExtCtxt { name: ident, inputs: ~[ast::arg], output: ast::Ty, - body: ast::blk + body: ast::Block ) -> @ast::item { self.item_fn_poly( span, diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index e78254f11f5..af05f726860 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ast::{blk, crate, expr_, expr_mac, mac_invoc_tt}; +use ast::{Block, Crate, expr_, expr_mac, mac_invoc_tt}; use ast::{item_mac, stmt_, stmt_mac, stmt_expr, stmt_semi}; use ast::{illegal_ctxt}; use ast; @@ -395,10 +395,10 @@ pub fn new_name_finder() -> @Visitor<@mut ~[ast::ident]> { pub fn expand_block(extsbox: @mut SyntaxEnv, _cx: @ExtCtxt, - blk: &blk, + blk: &Block, fld: @ast_fold, - orig: @fn(&blk, @ast_fold) -> blk) - -> blk { + orig: @fn(&Block, @ast_fold) -> Block) + -> Block { // see note below about treatment of exts table with_exts_frame!(extsbox,false,orig(blk,fld)) } @@ -691,7 +691,7 @@ pub fn std_macros() -> @str { // add a bunch of macros as though they were placed at the head of the // program (ick). This should run before cfg stripping. pub fn inject_std_macros(parse_sess: @mut parse::ParseSess, - cfg: ast::crate_cfg, c: &crate) -> @crate { + cfg: ast::CrateConfig, c: &Crate) -> @Crate { let sm = match parse_item_from_source_str(@"<std-macros>", std_macros(), cfg.clone(), @@ -718,7 +718,7 @@ pub fn inject_std_macros(parse_sess: @mut parse::ParseSess, } pub fn expand_crate(parse_sess: @mut parse::ParseSess, - cfg: ast::crate_cfg, c: &crate) -> @crate { + cfg: ast::CrateConfig, c: &Crate) -> @Crate { // adding *another* layer of indirection here so that the block // visitor can swap out one exts table for another for the duration // of the block. The cleaner alternative would be to thread the diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index d8ac2ede29e..1439f4cabab 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -110,7 +110,7 @@ pub mod rt { } } - impl ToSource for ast::blk { + impl ToSource for ast::Block { fn to_source(&self) -> @str { pprust::block_to_str(self, get_ident_interner()).to_managed() } @@ -238,7 +238,7 @@ pub mod rt { } } - impl ToTokens for ast::blk { + impl ToTokens for ast::Block { fn to_tokens(&self, cx: @ExtCtxt) -> ~[token_tree] { cx.parse_tts(self.to_source()) } diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 54ccd489171..9d9155ff0d5 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -223,7 +223,7 @@ pub enum parse_result { pub fn parse_or_else( sess: @mut ParseSess, - cfg: ast::crate_cfg, + cfg: ast::CrateConfig, rdr: @reader, ms: ~[matcher] ) -> HashMap<ident, @named_match> { @@ -236,7 +236,7 @@ pub fn parse_or_else( pub fn parse( sess: @mut ParseSess, - cfg: ast::crate_cfg, + cfg: ast::CrateConfig, rdr: @reader, ms: &[matcher] ) -> parse_result { |
