diff options
| author | bors <bors@rust-lang.org> | 2013-04-29 14:33:37 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-04-29 14:33:37 -0700 |
| commit | f1ddb8d5cc66941763039d3f727465b7cc34a100 (patch) | |
| tree | 66132a53979403297cbe192ce936cfa7c5b3cb1f /src/libsyntax/ext | |
| parent | dbcc3fe63a71d92d194d99dfd5e73fb62d09e79a (diff) | |
| parent | 78f33437b66793b10eb2a72d0d20cbf2bf0eacb5 (diff) | |
| download | rust-f1ddb8d5cc66941763039d3f727465b7cc34a100.tar.gz rust-f1ddb8d5cc66941763039d3f727465b7cc34a100.zip | |
auto merge of #6080 : pcwalton/rust/demode-everything, r=pcwalton
r? @brson
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/asm.rs | 23 | ||||
| -rw-r--r-- | src/libsyntax/ext/auto_encode.rs | 75 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/ast_builder.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/ext/pipes/pipec.rs | 10 |
5 files changed, 82 insertions, 28 deletions
diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index 534027bd295..dfebf6f786a 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -52,7 +52,10 @@ pub fn expand_asm(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree]) let mut dialect = ast::asm_att; let mut state = Asm; - loop outer: { + + // Not using labeled break to get us through one round of bootstrapping. + let mut continue = true; + while continue { match state { Asm => { asm = expr_to_str(cx, p.parse_expr(), @@ -139,20 +142,30 @@ pub fn expand_asm(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree]) p.bump(); match next_state(state) { Some(x) => x, - None => break outer + None => { + continue = false; + break + } } } else if *p.token == token::MOD_SEP { p.bump(); let s = match next_state(state) { Some(x) => x, - None => break outer + None => { + continue = false; + break + } }; match next_state(s) { Some(x) => x, - None => break outer + None => { + continue = false; + break + } } } else if *p.token == token::EOF { - break outer; + continue = false; + break; } else { state }; diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs index 0d451c66edb..2ceb6f0c4bb 100644 --- a/src/libsyntax/ext/auto_encode.rs +++ b/src/libsyntax/ext/auto_encode.rs @@ -215,7 +215,50 @@ pub fn expand_auto_decode( } } -priv impl @ext_ctxt { +trait ExtCtxtMethods { + fn bind_path(&self, + span: span, + ident: ast::ident, + path: @ast::Path, + bounds: @OptVec<ast::TyParamBound>) + -> ast::TyParam; + fn expr(&self, span: span, node: ast::expr_) -> @ast::expr; + fn path(&self, span: span, strs: ~[ast::ident]) -> @ast::Path; + fn path_global(&self, span: span, strs: ~[ast::ident]) -> @ast::Path; + fn path_tps(&self, span: span, strs: ~[ast::ident], tps: ~[@ast::Ty]) + -> @ast::Path; + fn path_tps_global(&self, + span: span, + strs: ~[ast::ident], + tps: ~[@ast::Ty]) + -> @ast::Path; + fn ty_path(&self, span: span, strs: ~[ast::ident], tps: ~[@ast::Ty]) + -> @ast::Ty; + fn binder_pat(&self, span: span, nm: ast::ident) -> @ast::pat; + fn stmt(&self, expr: @ast::expr) -> @ast::stmt; + fn lit_str(&self, span: span, s: @~str) -> @ast::expr; + fn lit_uint(&self, span: span, i: uint) -> @ast::expr; + fn lambda(&self, blk: ast::blk) -> @ast::expr; + fn blk(&self, span: span, stmts: ~[@ast::stmt]) -> ast::blk; + fn expr_blk(&self, expr: @ast::expr) -> ast::blk; + fn expr_path(&self, span: span, strs: ~[ast::ident]) -> @ast::expr; + fn expr_path_global(&self, span: span, strs: ~[ast::ident]) -> @ast::expr; + fn expr_var(&self, span: span, var: ~str) -> @ast::expr; + fn expr_field(&self, span: span, expr: @ast::expr, ident: ast::ident) + -> @ast::expr; + fn expr_call(&self, span: span, expr: @ast::expr, args: ~[@ast::expr]) + -> @ast::expr; + fn expr_method_call(&self, + span: span, + expr: @ast::expr, + ident: ast::ident, + args: ~[@ast::expr]) + -> @ast::expr; + fn lambda_expr(&self, expr: @ast::expr) -> @ast::expr; + fn lambda_stmts(&self, span: span, stmts: ~[@ast::stmt]) -> @ast::expr; +} + +impl ExtCtxtMethods for @ext_ctxt { fn bind_path( &self, _span: span, @@ -608,7 +651,6 @@ fn mk_ser_method( }; let ser_inputs = ~[ast::arg { - mode: ast::infer(cx.next_id()), is_mutbl: false, ty: ty_s, pat: @ast::pat { @@ -670,20 +712,22 @@ fn mk_deser_method( span: span, }; - let deser_inputs = ~[ast::arg { - mode: ast::infer(cx.next_id()), - is_mutbl: false, - ty: ty_d, - pat: @ast::pat { + let deser_inputs = ~[ + ast::arg { + is_mutbl: false, + ty: ty_d, + pat: @ast::pat { + id: cx.next_id(), + node: ast::pat_ident(ast::bind_by_copy, + ast_util::ident_to_path(span, + cx.ident_of( + ~"__d")), + None), + span: span, + }, id: cx.next_id(), - node: ast::pat_ident( - ast::bind_by_copy, - ast_util::ident_to_path(span, cx.ident_of(~"__d")), - None), - span: span, - }, - id: cx.next_id(), - }]; + } + ]; let deser_decl = ast::fn_decl { inputs: deser_inputs, @@ -1120,7 +1164,6 @@ fn mk_enum_deser_body( ast::expr_fn_block( ast::fn_decl { inputs: ~[ast::arg { - mode: ast::infer(ext_cx.next_id()), is_mutbl: false, ty: @ast::Ty { id: ext_cx.next_id(), diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index c4c2fed778f..4c876669f47 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -419,7 +419,6 @@ pub fn mk_arg(cx: @ext_ctxt, -> ast::arg { let arg_pat = mk_pat_ident(cx, span, ident); ast::arg { - mode: ast::infer(cx.next_id()), is_mutbl: false, ty: ty, pat: arg_pat, diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index ede3711b052..deaf1b1c754 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -196,7 +196,6 @@ impl ext_ctxt_ast_builder for @ext_ctxt { fn arg(&self, name: ident, ty: @ast::Ty) -> ast::arg { ast::arg { - mode: ast::infer(self.next_id()), is_mutbl: false, ty: ty, pat: @ast::pat { diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index e6f5d3608af..3311c61de8b 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -75,10 +75,10 @@ impl gen_send for message { body += ~"let b = pipe.reuse_buffer();\n"; body += fmt!("let %s = ::core::pipes::SendPacketBuffered(\ - ::ptr::addr_of(&(b.buffer.data.%s)));\n", + &(b.buffer.data.%s));\n", sp, next.name); body += fmt!("let %s = ::core::pipes::RecvPacketBuffered(\ - ::ptr::addr_of(&(b.buffer.data.%s)));\n", + &(b.buffer.data.%s));\n", rp, next.name); } else { @@ -365,9 +365,9 @@ impl gen_init for protocol { |s| ext_cx.parse_stmt( fmt!("data.%s.set_buffer(buffer)", s.name))), - ext_cx.parse_expr( - fmt!("::ptr::addr_of(&(data.%s))", - self.states[0].name)))); + ext_cx.parse_expr(fmt!( + "::core::ptr::to_unsafe_ptr(&(data.%s))", + self.states[0].name)))); quote_expr!({ let buffer = $buffer; |
