]> git.lizzy.rs Git - rust.git/commitdiff
Removed the obsolete ast::CallSugar (previously used by `do`).
authorEduard Burtescu <edy.burt@gmail.com>
Fri, 14 Feb 2014 08:28:32 +0000 (10:28 +0200)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 14 Feb 2014 15:48:13 +0000 (07:48 -0800)
23 files changed:
src/librustc/middle/borrowck/check_loans.rs
src/librustc/middle/cfg/construct.rs
src/librustc/middle/check_const.rs
src/librustc/middle/dataflow.rs
src/librustc/middle/effect.rs
src/librustc/middle/liveness.rs
src/librustc/middle/moves.rs
src/librustc/middle/privacy.rs
src/librustc/middle/resolve.rs
src/librustc/middle/trans/consts.rs
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/trans/expr.rs
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/regionck.rs
src/librustc/middle/typeck/check/vtable.rs
src/librustc/middle/typeck/check/writeback.rs
src/libsyntax/ast.rs
src/libsyntax/ext/build.rs
src/libsyntax/fold.rs
src/libsyntax/parse/classify.rs
src/libsyntax/parse/parser.rs
src/libsyntax/print/pprust.rs
src/libsyntax/visit.rs

index 1f90d2d8f0f8d3a67a30cf18ba479c6fd2b6eadd..590229a6652a29a6a8ca29a38e928783ea724d56 100644 (file)
@@ -831,10 +831,10 @@ fn check_loans_in_expr<'a>(this: &mut CheckLoanCtxt<'a>,
       ast::ExprAssignOp(_, _, dest, _) => {
         this.check_assignment(dest);
       }
-      ast::ExprCall(f, ref args, _) => {
+      ast::ExprCall(f, ref args) => {
         this.check_call(expr, Some(f), f.id, f.span, *args);
       }
-      ast::ExprMethodCall(callee_id, _, _, ref args, _) => {
+      ast::ExprMethodCall(callee_id, _, _, ref args) => {
         this.check_call(expr, None, callee_id, expr.span, *args);
       }
       ast::ExprIndex(callee_id, _, rval) |
index 9c213558d9ca507c77d04780933663d78c320dd1..6ca779906e2d17670ab17c413d234e7c1bb278bf 100644 (file)
@@ -351,11 +351,11 @@ fn expr(&mut self, expr: @ast::Expr, pred: CFGIndex) -> CFGIndex {
                 self.straightline(expr, pred, *elems)
             }
 
-            ast::ExprCall(func, ref args, _) => {
+            ast::ExprCall(func, ref args) => {
                 self.call(expr, pred, func, *args)
             }
 
-            ast::ExprMethodCall(_, _, _, ref args, _) => {
+            ast::ExprMethodCall(_, _, _, ref args) => {
                 self.call(expr, pred, args[0], args.slice_from(1))
             }
 
index 88ade3e225a04d17a1ee1824f691b6db06c0009e..75337a27a6c4fc9da41da7885bf6cf3330ec7eb4 100644 (file)
@@ -160,7 +160,7 @@ pub fn check_expr(v: &mut CheckCrateVisitor,
               }
             }
           }
-          ExprCall(callee, _, NoSugar) => {
+          ExprCall(callee, _) => {
             let def_map = def_map.borrow();
             match def_map.get().find(&callee.id) {
                 Some(&DefStruct(..)) => {}    // OK.
index 4d22f5414320b837f85339125aa203c42e52135f..60d83d7559e03a0d78bd65329167baf53dea2de2 100644 (file)
@@ -577,12 +577,12 @@ fn walk_expr(&mut self,
                 self.walk_opt_expr(with_expr, in_out, loop_scopes);
             }
 
-            ast::ExprCall(f, ref args, _) => {
+            ast::ExprCall(f, ref args) => {
                 self.walk_expr(f, in_out, loop_scopes);
                 self.walk_call(f.id, expr.id, *args, in_out, loop_scopes);
             }
 
-            ast::ExprMethodCall(callee_id, _, _, ref args, _) => {
+            ast::ExprMethodCall(callee_id, _, _, ref args) => {
                 self.walk_call(callee_id, expr.id, *args, in_out, loop_scopes);
             }
 
index 1445d5734ad1945555fc7056a471a5bc817b0d67..2a40c8148fd6db24e5d0fcaa0bf322f3203273cf 100644 (file)
@@ -120,7 +120,7 @@ fn visit_block(&mut self, block: &ast::Block, _:()) {
 
     fn visit_expr(&mut self, expr: &ast::Expr, _:()) {
         match expr.node {
-            ast::ExprMethodCall(callee_id, _, _, _, _) => {
+            ast::ExprMethodCall(callee_id, _, _, _) => {
                 let base_type = ty::node_id_to_type(self.tcx, callee_id);
                 debug!("effect: method call case, base type is {}",
                        ppaux::ty_to_str(self.tcx, base_type));
@@ -129,7 +129,7 @@ fn visit_expr(&mut self, expr: &ast::Expr, _:()) {
                                         "invocation of unsafe method")
                 }
             }
-            ast::ExprCall(base, _, _) => {
+            ast::ExprCall(base, _) => {
                 let base_type = ty::node_id_to_type(self.tcx, base.id);
                 debug!("effect: call case, base type is {}",
                        ppaux::ty_to_str(self.tcx, base_type));
index b7a89db4b9e4a3b0aeacf78049a76297f598e5e4..70b5aab4c934ab011bdacd3978c4a6424c23b77c 100644 (file)
@@ -1205,7 +1205,7 @@ pub fn propagate_through_expr(&self, expr: @Expr, succ: LiveNode)
             })
           }
 
-          ExprCall(f, ref args, _) => {
+          ExprCall(f, ref args) => {
             // calling a fn with bot return type means that the fn
             // will fail, and hence the successors can be ignored
             let t_ret = ty::ty_fn_ret(ty::expr_ty(self.tcx, f));
@@ -1215,7 +1215,7 @@ pub fn propagate_through_expr(&self, expr: @Expr, succ: LiveNode)
             self.propagate_through_expr(f, succ)
           }
 
-          ExprMethodCall(callee_id, _, _, ref args, _) => {
+          ExprMethodCall(callee_id, _, _, ref args) => {
             // calling a method with bot return type means that the method
             // will fail, and hence the successors can be ignored
             let t_ret = ty::ty_fn_ret(ty::node_id_to_type(self.tcx, callee_id));
index a0dc86347929fa1b6a244ef99d76eb59af863c02..32cb7ca57dae7d6d4d87785ec6c584e91998a84a 100644 (file)
@@ -382,7 +382,7 @@ pub fn use_expr(&mut self,
                 }
             }
 
-            ExprCall(callee, ref args, _) => {    // callee(args)
+            ExprCall(callee, ref args) => {    // callee(args)
                 // Figure out whether the called function is consumed.
                 let mode = match ty::get(ty::expr_ty(self.tcx, callee)).sty {
                     ty::ty_closure(ref cty) => {
@@ -412,7 +412,7 @@ pub fn use_expr(&mut self,
                 self.use_fn_args(callee.id, *args);
             }
 
-            ExprMethodCall(callee_id, _, _, ref args, _) => { // callee.m(args)
+            ExprMethodCall(callee_id, _, _, ref args) => { // callee.m(args)
                 self.use_fn_args(callee_id, *args);
             }
 
index 1f3bb2ba70dcc244b205c872613456343cdb8057..8c5654d3fcecb0b8a8aec4c018ce7bcb8e7341ac 100644 (file)
@@ -705,7 +705,7 @@ fn visit_expr(&mut self, expr: &ast::Expr, _: ()) {
                     _ => {}
                 }
             }
-            ast::ExprMethodCall(_, ident, _, ref args, _) => {
+            ast::ExprMethodCall(_, ident, _, ref args) => {
                 // see above
                 let t = ty::type_autoderef(ty::expr_ty(self.tcx, args[0]));
                 match ty::get(t).sty {
index bedaff70121d9c8d8b11175e46517f777e119fc3..cb9e772dcea08dcaeac4119ac18e649f43d3cc91 100644 (file)
@@ -5221,7 +5221,7 @@ fn record_candidate_traits_for_expr_if_necessary(&mut self, expr: &Expr) {
                 let traits = self.search_for_traits_containing_method(ident);
                 self.trait_map.insert(expr.id, @RefCell::new(traits));
             }
-            ExprMethodCall(_, ident, _, _, _) => {
+            ExprMethodCall(_, ident, _, _) => {
                 debug!("(recording candidate traits for expr) recording \
                         traits for {}",
                        expr.id);
index 9c04f6d9399facc43944605dd592ea65a1a606c0..68be851449a9a8bd47f8089decb04714114cea38 100644 (file)
@@ -647,7 +647,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: &ast::Expr,
                 }
             }
           }
-          ast::ExprCall(callee, ref args, _) => {
+          ast::ExprCall(callee, ref args) => {
               let tcx = cx.tcx;
               let opt_def = {
                   let def_map = tcx.def_map.borrow();
index 74450695ae758f26b92e73edcc19a195cefc6566..86f4275cf985700a3ed7c8ff67f64619d1eadd64 100644 (file)
@@ -2624,7 +2624,7 @@ fn walk_expr(cx: &CrateContext,
                 })
             }
 
-            ast::ExprCall(fn_exp, ref args, _) => {
+            ast::ExprCall(fn_exp, ref args) => {
                 walk_expr(cx, fn_exp, scope_stack, scope_map);
 
                 for arg_exp in args.iter() {
@@ -2632,7 +2632,7 @@ fn walk_expr(cx: &CrateContext,
                 }
             }
 
-            ast::ExprMethodCall(node_id, _, _, ref args, _) => {
+            ast::ExprMethodCall(node_id, _, _, ref args) => {
                 scope_map.insert(node_id, scope_stack.last().unwrap().scope_metadata);
 
                 for arg_exp in args.iter() {
index 357e2e5e9ef6acc291a8b8d25f61931fe6ef9587..794964e10540446af369ee3cd9d4e3e4b670c193 100644 (file)
@@ -777,11 +777,11 @@ fn trans_rvalue_dps_unadjusted<'a>(bcx: &'a Block<'a>,
                    expr_to_str(expr), expr_ty.repr(tcx));
             closure::trans_expr_fn(bcx, sigil, decl, body, expr.id, dest)
         }
-        ast::ExprCall(f, ref args, _) => {
+        ast::ExprCall(f, ref args) => {
             callee::trans_call(bcx, expr, f,
                                callee::ArgExprs(*args), expr.id, dest)
         }
-        ast::ExprMethodCall(callee_id, _, _, ref args, _) => {
+        ast::ExprMethodCall(callee_id, _, _, ref args) => {
             callee::trans_method_call(bcx, expr, callee_id, args[0],
                                       callee::ArgExprs(*args), dest)
         }
index 5d33f6d172201700545fd90511079b44131f545b..177eba5aa1b1ad0f9a116f6a03a8a2ef9deeea4c 100644 (file)
@@ -1592,22 +1592,20 @@ fn check_method_argument_types(
         method_fn_ty: ty::t,
         callee_expr: &ast::Expr,
         args: &[@ast::Expr],
-        sugar: ast::CallSugar,
-        deref_args: DerefArgs) -> ty::t
-    {
+        deref_args: DerefArgs) -> ty::t {
         // HACK(eddyb) ignore provided self (it has special typeck rules).
         let args = args.slice_from(1);
         if ty::type_is_error(method_fn_ty) {
             let err_inputs = err_args(args.len());
             check_argument_types(fcx, sp, err_inputs, callee_expr,
-                                 args, sugar, deref_args, false);
+                                 args, deref_args, false);
             method_fn_ty
         } else {
             match ty::get(method_fn_ty).sty {
                 ty::ty_bare_fn(ref fty) => {
                     // HACK(eddyb) ignore self in the definition (see above).
                     check_argument_types(fcx, sp, fty.sig.inputs.slice_from(1),
-                                         callee_expr, args, sugar, deref_args,
+                                         callee_expr, args, deref_args,
                                          fty.sig.variadic);
                     fty.sig.output
                 }
@@ -1625,7 +1623,6 @@ fn check_argument_types(fcx: @FnCtxt,
                             fn_inputs: &[ty::t],
                             callee_expr: &ast::Expr,
                             args: &[@ast::Expr],
-                            sugar: ast::CallSugar,
                             deref_args: DerefArgs,
                             variadic: bool) {
         /*!
@@ -1659,18 +1656,12 @@ fn check_argument_types(fcx: @FnCtxt,
                 err_args(supplied_arg_count)
             }
         } else {
-            let suffix = match sugar {
-                ast::NoSugar => "",
-                ast::ForSugar => " (including the closure passed by \
-                                  the `for` keyword)"
-            };
             let msg = format!(
                 "this function takes {} parameter{} \
-                 but {} parameter{} supplied{}",
+                 but {} parameter{} supplied",
                  expected_arg_count, if expected_arg_count == 1 {""} else {"s"},
                  supplied_arg_count,
-                 if supplied_arg_count == 1 {" was"} else {"s were"},
-                 suffix);
+                 if supplied_arg_count == 1 {" was"} else {"s were"});
 
             tcx.sess.span_err(sp, msg);
 
@@ -1783,24 +1774,8 @@ fn check_assignment(fcx: @FnCtxt,
         // The callee checks for bot / err, we don't need to
     }
 
-    fn write_call(fcx: @FnCtxt,
-                  call_expr: &ast::Expr,
-                  output: ty::t,
-                  sugar: ast::CallSugar) {
-        let ret_ty = match sugar {
-            ast::ForSugar => {
-                match ty::get(output).sty {
-                    ty::ty_bool => {}
-                    _ => fcx.type_error_message(call_expr.span, |actual| {
-                            format!("expected `for` closure to return `bool`, \
-                                  but found `{}`", actual) },
-                            output, None)
-                }
-                ty::mk_nil()
-            }
-            _ => output
-        };
-        fcx.write_ty(call_expr.id, ret_ty);
+    fn write_call(fcx: @FnCtxt, call_expr: &ast::Expr, output: ty::t) {
+        fcx.write_ty(call_expr.id, output);
     }
 
     // A generic function for doing all of the checking for call expressions
@@ -1808,8 +1783,7 @@ fn check_call(fcx: @FnCtxt,
                   callee_id: ast::NodeId,
                   call_expr: &ast::Expr,
                   f: &ast::Expr,
-                  args: &[@ast::Expr],
-                  sugar: ast::CallSugar) {
+                  args: &[@ast::Expr]) {
         // Index expressions need to be handled separately, to inform them
         // that they appear in call position.
         check_expr(fcx, f);
@@ -1857,9 +1831,9 @@ fn check_call(fcx: @FnCtxt,
 
         // Call the generic checker.
         check_argument_types(fcx, call_expr.span, fn_sig.inputs, f,
-                             args, sugar, DontDerefArgs, fn_sig.variadic);
+                             args, DontDerefArgs, fn_sig.variadic);
 
-        write_call(fcx, call_expr, fn_sig.output, sugar);
+        write_call(fcx, call_expr, fn_sig.output);
     }
 
     // Checks a method call.
@@ -1868,8 +1842,7 @@ fn check_method_call(fcx: @FnCtxt,
                          expr: &ast::Expr,
                          method_name: ast::Ident,
                          args: &[@ast::Expr],
-                         tps: &[ast::P<ast::Ty>],
-                         sugar: ast::CallSugar) {
+                         tps: &[ast::P<ast::Ty>]) {
         let rcvr = args[0];
         check_expr(fcx, rcvr);
 
@@ -1915,10 +1888,10 @@ fn check_method_call(fcx: @FnCtxt,
         // Call the generic checker.
         let fn_ty = fcx.node_ty(callee_id);
         let ret_ty = check_method_argument_types(fcx, expr.span,
-                                                 fn_ty, expr, args, sugar,
+                                                 fn_ty, expr, args,
                                                  DontDerefArgs);
 
-        write_call(fcx, expr, ret_ty, sugar);
+        write_call(fcx, expr, ret_ty);
     }
 
     // A generic function for checking the then and else in an if
@@ -1985,8 +1958,8 @@ fn lookup_op_method(fcx: @FnCtxt,
                     method_map.get().insert(op_ex.id, *origin);
                 }
                 check_method_argument_types(fcx, op_ex.span,
-                                            method_ty, op_ex, args,
-                                            ast::NoSugar, deref_args)
+                                            method_ty, op_ex,
+                                            args, deref_args)
             }
             _ => {
                 unbound_method();
@@ -1994,8 +1967,8 @@ fn lookup_op_method(fcx: @FnCtxt,
                 // so we get all the error messages
                 let expected_ty = ty::mk_err();
                 check_method_argument_types(fcx, op_ex.span,
-                                            expected_ty, op_ex, args,
-                                            ast::NoSugar, deref_args);
+                                            expected_ty, op_ex,
+                                            args, deref_args);
                 ty::mk_err()
             }
         }
@@ -2948,8 +2921,8 @@ fn check_struct_enum_variant(fcx: @FnCtxt,
         check_block_with_expected(fcx, b, expected);
         fcx.write_ty(id, fcx.node_ty(b.id));
       }
-      ast::ExprCall(f, ref args, sugar) => {
-          check_call(fcx, expr.id, expr, f, *args, sugar);
+      ast::ExprCall(f, ref args) => {
+          check_call(fcx, expr.id, expr, f, *args);
           let f_ty = fcx.expr_ty(f);
           let (args_bot, args_err) = args.iter().fold((false, false),
              |(rest_bot, rest_err), a| {
@@ -2964,8 +2937,8 @@ fn check_struct_enum_variant(fcx: @FnCtxt,
               fcx.write_bot(id);
           }
       }
-      ast::ExprMethodCall(callee_id, ident, ref tps, ref args, sugar) => {
-        check_method_call(fcx, callee_id, expr, ident, *args, *tps, sugar);
+      ast::ExprMethodCall(callee_id, ident, ref tps, ref args) => {
+        check_method_call(fcx, callee_id, expr, ident, *args, *tps);
         let arg_tys = args.map(|a| fcx.expr_ty(*a));
         let (args_bot, args_err) = arg_tys.iter().fold((false, false),
              |(rest_bot, rest_err), a| {
index a015f43b2302b7e73c52150971e5e1ed1ea8f1cc..384007727780a36768fe87a1fef33ac62d63ed24 100644 (file)
@@ -432,14 +432,14 @@ fn visit_expr(rcx: &mut Rcx, expr: &ast::Expr) {
     }
 
     match expr.node {
-        ast::ExprCall(callee, ref args, _) => {
+        ast::ExprCall(callee, ref args) => {
             constrain_callee(rcx, callee.id, expr, callee);
             constrain_call(rcx, callee.id, expr, None, *args, false);
 
             visit::walk_expr(rcx, expr, ());
         }
 
-        ast::ExprMethodCall(callee_id, _, _, ref args, _) => {
+        ast::ExprMethodCall(callee_id, _, _, ref args) => {
             constrain_call(rcx, callee_id, expr, Some(args[0]),
                            args.slice_from(1), false);
 
index 46e79f4d1d5f713a6cc08cf0146741c5226e6dca..721672ab677aca513af0f365888ea84814ea885f 100644 (file)
@@ -702,7 +702,7 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
       ast::ExprUnary(callee_id, _, _) |
       ast::ExprAssignOp(callee_id, _, _, _) |
       ast::ExprIndex(callee_id, _, _) |
-      ast::ExprMethodCall(callee_id, _, _, _, _) => {
+      ast::ExprMethodCall(callee_id, _, _, _) => {
         match ty::method_call_type_param_defs(cx.tcx, fcx.inh.method_map, ex.id) {
           Some(type_param_defs) => {
             debug!("vtable resolution on parameter bounds for method call {}",
index 36abb7aa457334ce1a988a56b7d3e5b3e7bef5d2..c05afcf859af52b0dd765f71ebd8d7cd85580dd7 100644 (file)
@@ -307,7 +307,7 @@ fn visit_expr(e: &ast::Expr, wbcx: &mut WbCtxt) {
             maybe_resolve_type_vars_for_node(wbcx, e.span, callee_id);
         }
 
-        ast::ExprMethodCall(callee_id, _, _, _, _) => {
+        ast::ExprMethodCall(callee_id, _, _, _) => {
             // We must always have written in a callee ID type for these.
             resolve_type_vars_for_node(wbcx, e.span, callee_id);
         }
index 72330bb7f31393202b6b405d06248f292b85909d..132cb396ddd392955c52a77589e7450725f4901e 100644 (file)
@@ -519,7 +519,7 @@ pub struct Expr {
 impl Expr {
     pub fn get_callee_id(&self) -> Option<NodeId> {
         match self.node {
-            ExprMethodCall(callee_id, _, _, _, _) |
+            ExprMethodCall(callee_id, _, _, _) |
             ExprIndex(callee_id, _, _) |
             ExprBinary(callee_id, _, _, _) |
             ExprAssignOp(callee_id, _, _, _) |
@@ -529,20 +529,14 @@ pub fn get_callee_id(&self) -> Option<NodeId> {
     }
 }
 
-#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
-pub enum CallSugar {
-    NoSugar,
-    ForSugar
-}
-
 #[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
 pub enum Expr_ {
     ExprVstore(@Expr, ExprVstore),
     // First expr is the place; second expr is the value.
     ExprBox(@Expr, @Expr),
     ExprVec(~[@Expr], Mutability),
-    ExprCall(@Expr, ~[@Expr], CallSugar),
-    ExprMethodCall(NodeId, Ident, ~[P<Ty>], ~[@Expr], CallSugar),
+    ExprCall(@Expr, ~[@Expr]),
+    ExprMethodCall(NodeId, Ident, ~[P<Ty>], ~[@Expr]),
     ExprTup(~[@Expr]),
     ExprBinary(NodeId, BinOp, @Expr, @Expr),
     ExprUnary(NodeId, UnOp, @Expr),
index e41decbd8ef280f1789067c2a5cf70034b8168a3..d311a542ac689f4074a78cf06eb44c22d80f181a 100644 (file)
@@ -525,11 +525,10 @@ fn expr_mut_addr_of(&self, sp: Span, e: @ast::Expr) -> @ast::Expr {
     }
 
     fn expr_call(&self, span: Span, expr: @ast::Expr, args: ~[@ast::Expr]) -> @ast::Expr {
-        self.expr(span, ast::ExprCall(expr, args, ast::NoSugar))
+        self.expr(span, ast::ExprCall(expr, args))
     }
     fn expr_call_ident(&self, span: Span, id: ast::Ident, args: ~[@ast::Expr]) -> @ast::Expr {
-        self.expr(span,
-                  ast::ExprCall(self.expr_ident(span, id), args, ast::NoSugar))
+        self.expr(span, ast::ExprCall(self.expr_ident(span, id), args))
     }
     fn expr_call_global(&self, sp: Span, fn_path: ~[ast::Ident],
                       args: ~[@ast::Expr]) -> @ast::Expr {
@@ -541,7 +540,7 @@ fn expr_method_call(&self, span: Span,
                         ident: ast::Ident,
                         mut args: ~[@ast::Expr]) -> @ast::Expr {
         args.unshift(expr);
-        self.expr(span, ast::ExprMethodCall(ast::DUMMY_NODE_ID, ident, ~[], args, ast::NoSugar))
+        self.expr(span, ast::ExprMethodCall(ast::DUMMY_NODE_ID, ident, ~[], args))
     }
     fn expr_block(&self, b: P<ast::Block>) -> @ast::Expr {
         self.expr(b.span, ast::ExprBlock(b))
index 6fb66a66f18b5c6d2cafcae555aa268896de87f0..e150d1685de24b570fe31243e5a5ca82fe6806c5 100644 (file)
@@ -727,19 +727,16 @@ pub fn noop_fold_expr<T: Folder>(e: @Expr, folder: &mut T) -> @Expr {
             ExprRepeat(folder.fold_expr(expr), folder.fold_expr(count), mutt)
         }
         ExprTup(ref elts) => ExprTup(elts.map(|x| folder.fold_expr(*x))),
-        ExprCall(f, ref args, blk) => {
+        ExprCall(f, ref args) => {
             ExprCall(folder.fold_expr(f),
-                     args.map(|&x| folder.fold_expr(x)),
-                     blk)
+                     args.map(|&x| folder.fold_expr(x)))
         }
-        ExprMethodCall(callee_id, i, ref tps, ref args, blk) => {
+        ExprMethodCall(callee_id, i, ref tps, ref args) => {
             ExprMethodCall(
                 folder.new_id(callee_id),
                 folder.fold_ident(i),
                 tps.map(|&x| folder.fold_ty(x)),
-                args.map(|&x| folder.fold_expr(x)),
-                blk
-            )
+                args.map(|&x| folder.fold_expr(x)))
         }
         ExprBinary(callee_id, binop, lhs, rhs) => {
             ExprBinary(folder.new_id(callee_id),
index accf5e735404504f01ee4104e65e9e1fc4763dc0..d6dcb956f25c6981df446abe4305ee96648d7109 100644 (file)
 // isn't parsed as (if true {...} else {...} | x) | 5
 pub fn expr_requires_semi_to_be_stmt(e: @ast::Expr) -> bool {
     match e.node {
-      ast::ExprIf(..)
-      | ast::ExprMatch(..)
-      | ast::ExprBlock(_)
-      | ast::ExprWhile(..)
-      | ast::ExprLoop(..)
-      | ast::ExprForLoop(..)
-      | ast::ExprCall(_, _, ast::ForSugar)
-      | ast::ExprMethodCall(_, _, _, _, ast::ForSugar) => false,
-      _ => true
+        ast::ExprIf(..)
+        | ast::ExprMatch(..)
+        | ast::ExprBlock(_)
+        | ast::ExprWhile(..)
+        | ast::ExprLoop(..)
+        | ast::ExprForLoop(..) => false,
+        _ => true
     }
 }
 
index 674d41e9dbe2a456f0697e9b3f5f5b080479ddb6..a02971ae8eaf287246c6ac04290fbe8b5ea62ae7 100644 (file)
@@ -13,7 +13,6 @@
 use abi;
 use abi::AbiSet;
 use ast::{Sigil, BorrowedSigil, ManagedSigil, OwnedSigil};
-use ast::{CallSugar, NoSugar};
 use ast::{BareFnTy, ClosureTy};
 use ast::{RegionTyParamBound, TraitTyParamBound};
 use ast::{Provided, Public, Purity};
@@ -1690,13 +1689,12 @@ pub fn mk_binary(&mut self, binop: ast::BinOp, lhs: @Expr, rhs: @Expr) -> ast::E
         ExprBinary(ast::DUMMY_NODE_ID, binop, lhs, rhs)
     }
 
-    pub fn mk_call(&mut self, f: @Expr, args: ~[@Expr], sugar: CallSugar) -> ast::Expr_ {
-        ExprCall(f, args, sugar)
+    pub fn mk_call(&mut self, f: @Expr, args: ~[@Expr]) -> ast::Expr_ {
+        ExprCall(f, args)
     }
 
-    fn mk_method_call(&mut self, ident: Ident, tps: ~[P<Ty>], args: ~[@Expr],
-                      sugar: CallSugar) -> ast::Expr_ {
-        ExprMethodCall(ast::DUMMY_NODE_ID, ident, tps, args, sugar)
+    fn mk_method_call(&mut self, ident: Ident, tps: ~[P<Ty>], args: ~[@Expr]) -> ast::Expr_ {
+        ExprMethodCall(ast::DUMMY_NODE_ID, ident, tps, args)
     }
 
     pub fn mk_index(&mut self, expr: @Expr, idx: @Expr) -> ast::Expr_ {
@@ -1997,7 +1995,7 @@ pub fn parse_dot_or_call_expr_with(&mut self, e0: @Expr) -> @Expr {
                             hi = self.last_span.hi;
 
                             es.unshift(e);
-                            let nd = self.mk_method_call(i, tys, es, NoSugar);
+                            let nd = self.mk_method_call(i, tys, es);
                             e = self.mk_expr(lo, hi, nd);
                         }
                         _ => {
@@ -2022,7 +2020,7 @@ pub fn parse_dot_or_call_expr_with(&mut self, e0: @Expr) -> @Expr {
                 );
                 hi = self.last_span.hi;
 
-                let nd = self.mk_call(e, es, NoSugar);
+                let nd = self.mk_call(e, es);
                 e = self.mk_expr(lo, hi, nd);
               }
 
index 85bc372b9c61d4dceba56c8073ff2ef582c058bb..bb2f345ac2883810b708457cfd204dbd752e1905 100644 (file)
@@ -1141,33 +1141,10 @@ pub fn print_expr_vstore(s: &mut State, t: ast::ExprVstore) -> io::IoResult<()>
     }
 }
 
-pub fn print_call_pre(s: &mut State,
-                      sugar: ast::CallSugar,
-                      base_args: &mut ~[@ast::Expr])
-                   -> io::IoResult<Option<@ast::Expr>> {
-    match sugar {
-        ast::ForSugar => {
-            if_ok!(head(s, "for"));
-            Ok(Some(base_args.pop().unwrap()))
-        }
-        ast::NoSugar => Ok(None)
-    }
-}
-
-pub fn print_call_post(s: &mut State,
-                       sugar: ast::CallSugar,
-                       blk: &Option<@ast::Expr>,
-                       base_args: &mut ~[@ast::Expr]) -> io::IoResult<()> {
-    if sugar == ast::NoSugar || !base_args.is_empty() {
-        if_ok!(popen(s));
-        if_ok!(commasep_exprs(s, Inconsistent, *base_args));
-        if_ok!(pclose(s));
-    }
-    if sugar != ast::NoSugar {
-        if_ok!(nbsp(s));
-        // not sure if this can happen
-        if_ok!(print_expr(s, blk.unwrap()));
-    }
+fn print_call_post(s: &mut State, args: &[@ast::Expr]) -> io::IoResult<()> {
+    if_ok!(popen(s));
+    if_ok!(commasep_exprs(s, Inconsistent, args));
+    if_ok!(pclose(s));
     Ok(())
 }
 
@@ -1254,15 +1231,12 @@ fn print_field(s: &mut State, field: &ast::Field) -> io::IoResult<()> {
         }
         if_ok!(pclose(s));
       }
-      ast::ExprCall(func, ref args, sugar) => {
-        let mut base_args = (*args).clone();
-        let blk = if_ok!(print_call_pre(s, sugar, &mut base_args));
+      ast::ExprCall(func, ref args) => {
         if_ok!(print_expr(s, func));
-        if_ok!(print_call_post(s, sugar, &blk, &mut base_args));
+        if_ok!(print_call_post(s, *args));
       }
-      ast::ExprMethodCall(_, ident, ref tys, ref args, sugar) => {
-        let mut base_args = args.slice_from(1).to_owned();
-        let blk = if_ok!(print_call_pre(s, sugar, &mut base_args));
+      ast::ExprMethodCall(_, ident, ref tys, ref args) => {
+        let base_args = args.slice_from(1);
         if_ok!(print_expr(s, args[0]));
         if_ok!(word(&mut s.s, "."));
         if_ok!(print_ident(s, ident));
@@ -1271,7 +1245,7 @@ fn print_field(s: &mut State, field: &ast::Field) -> io::IoResult<()> {
             if_ok!(commasep(s, Inconsistent, *tys, print_type_ref));
             if_ok!(word(&mut s.s, ">"));
         }
-        if_ok!(print_call_post(s, sugar, &blk, &mut base_args));
+        if_ok!(print_call_post(s, base_args));
       }
       ast::ExprBinary(_, op, lhs, rhs) => {
         if_ok!(print_expr(s, lhs));
index ce87c3d7591f52c5e6780cd95e2f199e5be3ca7a..feab4e0e84df254856d353f2893b81719e8948e2 100644 (file)
@@ -652,13 +652,13 @@ pub fn walk_expr<E: Clone, V: Visitor<E>>(visitor: &mut V, expression: &Expr, en
                 visitor.visit_expr(*subexpression, env.clone())
             }
         }
-        ExprCall(callee_expression, ref arguments, _) => {
+        ExprCall(callee_expression, ref arguments) => {
             for argument in arguments.iter() {
                 visitor.visit_expr(*argument, env.clone())
             }
             visitor.visit_expr(callee_expression, env.clone())
         }
-        ExprMethodCall(_, _, ref types, ref arguments, _) => {
+        ExprMethodCall(_, _, ref types, ref arguments) => {
             walk_exprs(visitor, *arguments, env.clone());
             for &typ in types.iter() {
                 visitor.visit_ty(typ, env.clone())