use util::nodemap::{FnvHashMap, NodeSet};
use lint::{Context, LintPass, LintArray};
-use std::cmp;
+use std::{cmp, slice};
use std::collections::hash_map::{Occupied, Vacant};
use std::num::SignedInt;
-use std::slice;
use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
-use syntax::abi;
-use syntax::ast_map;
-use syntax::ast_util::is_shift_binop;
-use syntax::attr::AttrMetaMethods;
-use syntax::attr;
+use syntax::{abi, ast, ast_map};
+use syntax::ast_util::{mod, is_shift_binop};
+use syntax::attr::{mod, AttrMetaMethods};
use syntax::codemap::{Span, DUMMY_SP};
use syntax::parse::token;
-use syntax::{ast, ast_util, visit};
use syntax::ast::{TyI, TyU, TyI8, TyU8, TyI16, TyU16, TyI32, TyU32, TyI64, TyU64};
use syntax::ptr::P;
-use syntax::visit::Visitor;
+use syntax::visit::{mod, Visitor};
declare_lint!(WHILE_TRUE, Warn,
"suggest using `loop { }` instead of `while true { }`")
}
ast::ExprUnary(_, ref x) |
ast::ExprCast(ref x, _) |
- ast::ExprField(ref x, _, _) |
- ast::ExprTupField(ref x, _, _) |
+ ast::ExprField(ref x, _) |
+ ast::ExprTupField(ref x, _) |
ast::ExprIndex(ref x, _) => {
// &X { y: 1 }, X { y: 1 }.y
contains_exterior_struct_lit(&**x)
ast::ExprCast(ref e, _) |
ast::ExprUnary(_, ref e) |
ast::ExprParen(ref e) |
- ast::ExprField(ref e, _, _) |
- ast::ExprTupField(ref e, _, _) => {
+ ast::ExprField(ref e, _) |
+ ast::ExprTupField(ref e, _) => {
self.straightline(expr, pred, Some(&**e).into_iter())
}
pub use self::constness::*;
use metadata::csearch;
-use middle::astencode;
-use middle::def;
+use middle::{astencode, def};
use middle::pat_util::def_to_path;
use middle::ty::{mod, Ty};
-use middle::typeck::astconv;
-use middle::typeck::check;
-use util::nodemap::{DefIdMap};
+use middle::typeck::{astconv, check};
+use util::nodemap::DefIdMap;
use syntax::ast::{mod, Expr};
use syntax::parse::token::InternedString;
use syntax::ptr::P;
-use syntax::visit::Visitor;
-use syntax::visit;
+use syntax::visit::{mod, Visitor};
use syntax::{ast_map, ast_util, codemap};
use std::rc::Rc;
}
}
- ast::ExprField(ref base, _, _) => self.classify(&**base),
+ ast::ExprField(ref base, _) => self.classify(&**base),
- ast::ExprTupField(ref base, _, _) => self.classify(&**base),
+ ast::ExprTupField(ref base, _) => self.classify(&**base),
ast::ExprIndex(ref base, ref idx) =>
join(self.classify(&**base), self.classify(&**idx)),
// closely. The idea is that all reachable symbols are live, codes called
// from live codes are live, and everything else is dead.
-use middle::def;
-use middle::pat_util;
-use middle::privacy;
-use middle::ty;
-use middle::typeck;
+use middle::{def, pat_util, privacy, ty, typeck};
use lint;
use util::nodemap::NodeSet;
use std::collections::HashSet;
-use syntax::ast;
-use syntax::ast_map;
+use syntax::{ast, ast_map, codemap};
use syntax::ast_util::{local_def, is_local, PostExpansionMethod};
use syntax::attr::{mod, AttrMetaMethods};
-use syntax::codemap;
use syntax::visit::{mod, Visitor};
// Any local node that may call something in its body block should be
ast::ExprMethodCall(..) => {
self.lookup_and_handle_method(expr.id, expr.span);
}
- ast::ExprField(ref lhs, ref ident, _) => {
+ ast::ExprField(ref lhs, ref ident) => {
self.handle_field_access(&**lhs, &ident.node);
}
- ast::ExprTupField(ref lhs, idx, _) => {
+ ast::ExprTupField(ref lhs, idx) => {
self.handle_tup_field_access(&**lhs, idx.node);
}
_ => ()
pub use self::MoveReason::*;
use self::OverloadedCallType::*;
+use middle::{def, region, pat_util};
use middle::mem_categorization as mc;
-use middle::def;
use middle::mem_categorization::Typer;
-use middle::region;
-use middle::pat_util;
use middle::ty::{mod, Ty};
use middle::typeck::{MethodCall, MethodObject, MethodTraitObject};
use middle::typeck::{MethodOrigin, MethodParam, MethodTypeParam};
}
}
- ast::ExprField(ref base, _, _) => { // base.f
+ ast::ExprField(ref base, _) => { // base.f
self.select_from_expr(&**base);
}
- ast::ExprTupField(ref base, _, _) => { // base.<n>
+ ast::ExprTupField(ref base, _) => { // base.<n>
self.select_from_expr(&**base);
}
use middle::def::*;
use middle::mem_categorization::Typer;
-use middle::pat_util;
-use middle::typeck;
-use middle::ty;
+use middle::{pat_util, typeck, ty};
use lint;
use util::nodemap::NodeMap;
-use std::fmt;
-use std::io;
+use std::{fmt, io, uint};
use std::rc::Rc;
-use std::uint;
use syntax::ast::{mod, NodeId, Expr};
use syntax::codemap::{BytePos, original_sp, Span};
-use syntax::parse::token::special_idents;
-use syntax::parse::token;
+use syntax::parse::token::{mod, special_idents};
use syntax::print::pprust::{expr_to_string, block_to_string};
use syntax::ptr::P;
-use syntax::{visit, ast_util};
-use syntax::visit::{Visitor, FnKind};
+use syntax::ast_util;
+use syntax::visit::{mod, Visitor, FnKind};
/// For use with `propagate_through_loop`.
enum LoopKind<'a> {
self.access_path(expr, succ, ACC_READ | ACC_USE)
}
- ast::ExprField(ref e, _, _) => {
+ ast::ExprField(ref e, _) => {
self.propagate_through_expr(&**e, succ)
}
- ast::ExprTupField(ref e, _, _) => {
+ ast::ExprTupField(ref e, _) => {
self.propagate_through_expr(&**e, succ)
}
match expr.node {
ast::ExprPath(_) => succ,
- ast::ExprField(ref e, _, _) => self.propagate_through_expr(&**e, succ),
- ast::ExprTupField(ref e, _, _) => self.propagate_through_expr(&**e, succ),
+ ast::ExprField(ref e, _) => self.propagate_through_expr(&**e, succ),
+ ast::ExprTupField(ref e, _) => self.propagate_through_expr(&**e, succ),
_ => self.propagate_through_expr(expr, succ)
}
}
Ok(self.cat_deref(expr, base_cmt, 0, false))
}
- ast::ExprField(ref base, f_name, _) => {
+ ast::ExprField(ref base, f_name) => {
let base_cmt = if_ok!(self.cat_expr(&**base));
debug!("cat_expr(cat_field): id={} expr={} base={}",
expr.id,
Ok(self.cat_field(expr, base_cmt, f_name.node.name, expr_ty))
}
- ast::ExprTupField(ref base, idx, _) => {
+ ast::ExprTupField(ref base, idx) => {
let base_cmt = if_ok!(self.cat_expr(&**base));
Ok(self.cat_tup_field(expr, base_cmt, idx.node, expr_ty))
}
use std::mem::replace;
use metadata::csearch;
-use middle::def;
-use middle::resolve;
+use middle::{def, resolve};
use middle::ty::{mod, Ty};
use middle::typeck::{MethodCall, MethodMap, MethodOrigin, MethodParam, MethodTypeParam};
use middle::typeck::{MethodStatic, MethodStaticUnboxedClosure, MethodObject, MethodTraitObject};
use util::nodemap::{NodeMap, NodeSet};
-use syntax::ast;
-use syntax::ast_map;
+use syntax::{ast, ast_map};
use syntax::ast_util::{is_local, local_def, PostExpansionMethod};
use syntax::codemap::Span;
use syntax::parse::token;
-use syntax::visit;
-use syntax::visit::Visitor;
+use syntax::visit::{mod, Visitor};
type Context<'a, 'tcx> = (&'a MethodMap<'tcx>, &'a resolve::ExportMap2);
fn visit_expr(&mut self, expr: &ast::Expr) {
match expr.node {
- ast::ExprField(ref base, ident, _) => {
- match ty::expr_ty_adjusted(self.tcx, &**base).sty {
- ty::ty_struct(id, _) => {
- self.check_field(expr.span, id, NamedField(ident.node));
- }
- _ => {}
+ ast::ExprField(ref base, ident) => {
+ if let ty::ty_struct(id, _) = ty::expr_ty_adjusted(self.tcx, &**base).sty {
+ self.check_field(expr.span, id, NamedField(ident.node));
}
}
- ast::ExprTupField(ref base, idx, _) => {
- match ty::expr_ty_adjusted(self.tcx, &**base).sty {
- ty::ty_struct(id, _) => {
- self.check_field(expr.span, id, UnnamedField(idx.node));
- }
- _ => {}
+ ast::ExprTupField(ref base, idx) => {
+ if let ty::ty_struct(id, _) = ty::expr_ty_adjusted(self.tcx, &**base).sty {
+ self.check_field(expr.span, id, UnnamedField(idx.node));
}
}
ast::ExprMethodCall(ident, _, _) => {
use session::Session;
-use middle::ty::{FreeRegion};
-use middle::ty::{mod, Ty};
+use middle::ty::{mod, Ty, FreeRegion};
use util::nodemap::{FnvHashMap, FnvHashSet, NodeMap};
use util::common::can_reach;
use syntax::{ast, visit};
use syntax::ast::{Block, Item, FnDecl, NodeId, Arm, Pat, Stmt, Expr, Local};
use syntax::ast_util::{stmt_id};
-use syntax::ptr::P;
use syntax::visit::{Visitor, FnKind};
/// CodeExtent represents a statically-describable extent that can be
match expr.node {
ast::ExprAddrOf(_, ref subexpr) |
ast::ExprUnary(ast::UnDeref, ref subexpr) |
- ast::ExprField(ref subexpr, _, _) |
- ast::ExprTupField(ref subexpr, _, _) |
+ ast::ExprField(ref subexpr, _) |
+ ast::ExprTupField(ref subexpr, _) |
ast::ExprIndex(ref subexpr, _) |
ast::ExprParen(ref subexpr) => {
- let subexpr: &'a P<Expr> = subexpr; // FIXME(#11586)
expr = &**subexpr;
}
_ => {
use syntax::ast::{ViewItemUse, ViewPathGlob, ViewPathList, ViewPathSimple};
use syntax::ast::{Visibility};
use syntax::ast;
-use syntax::ast_util::{PostExpansionMethod, local_def, walk_pat};
-use syntax::ast_util;
+use syntax::ast_util::{mod, PostExpansionMethod, local_def, walk_pat};
use syntax::attr::AttrMetaMethods;
use syntax::ext::mtwt;
-use syntax::parse::token::special_names;
-use syntax::parse::token::special_idents;
-use syntax::parse::token;
+use syntax::parse::token::{mod, special_names, special_idents};
use syntax::codemap::{Span, DUMMY_SP, Pos};
use syntax::owned_slice::OwnedSlice;
-use syntax::visit;
-use syntax::visit::Visitor;
+use syntax::visit::{mod, Visitor};
use std::collections::{HashMap, HashSet};
use std::collections::hash_map::{Occupied, Vacant};
fn record_candidate_traits_for_expr_if_necessary(&mut self, expr: &Expr) {
match expr.node {
- ExprField(_, ident, _) => {
+ ExprField(_, ident) => {
// FIXME(#6890): Even though you can't treat a method like a
// field, we need to add any trait methods we find that match
// the field name so that we can do some nice error reporting
use super::probe;
-use middle::subst;
-use middle::subst::Subst;
+use middle::subst::{mod, Subst};
use middle::traits;
use middle::ty::{mod, Ty};
-use middle::typeck::check;
-use middle::typeck::check::{FnCtxt, NoPreference, PreferMutLvalue};
+use middle::typeck::check::{mod, FnCtxt, NoPreference, PreferMutLvalue};
use middle::typeck::{MethodCall, MethodCallee, MethodObject, MethodOrigin,
MethodParam, MethodStatic, MethodTraitObject, MethodTypeParam};
-use middle::typeck::infer;
-use middle::typeck::infer::InferCtxt;
+use middle::typeck::infer::{mod, InferCtxt};
use middle::ty_fold::HigherRankedFoldable;
use syntax::ast;
use syntax::codemap::Span;
let last = exprs[exprs.len() - 1];
match last.node {
ast::ExprParen(ref expr) |
- ast::ExprField(ref expr, _, _) |
- ast::ExprTupField(ref expr, _, _) |
+ ast::ExprField(ref expr, _) |
+ ast::ExprTupField(ref expr, _) |
ast::ExprSlice(ref expr, _, _, _) |
ast::ExprIndex(ref expr, _) |
ast::ExprUnary(ast::UnDeref, ref expr) => exprs.push(&**expr),
use self::TupleArgumentsFlag::*;
use session::Session;
-use middle::const_eval;
-use middle::def;
+use middle::{const_eval, def, traits};
use middle::lang_items::IteratorItem;
-use middle::mem_categorization::McResult;
-use middle::mem_categorization;
-use middle::pat_util::pat_id_map;
-use middle::pat_util;
+use middle::mem_categorization::{mod, McResult};
+use middle::pat_util::{mod, pat_id_map};
use middle::region::CodeExtent;
-use middle::subst;
-use middle::subst::{Subst, Substs, VecPerParamSpace, ParamSpace};
-use middle::traits;
-use middle::ty::{FnSig, VariantInfo};
-use middle::ty::{Polytype};
+use middle::subst::{mod, Subst, Substs, VecPerParamSpace, ParamSpace};
+use middle::ty::{FnSig, VariantInfo, Polytype};
use middle::ty::{Disr, ParamTy, ParameterEnvironment};
use middle::ty::{mod, Ty};
use middle::ty::liberate_late_bound_regions;
use middle::ty_fold::TypeFolder;
-use middle::typeck::astconv::AstConv;
-use middle::typeck::astconv::{ast_region_to_region, ast_ty_to_ty};
-use middle::typeck::astconv;
+use middle::typeck::astconv::{mod, ast_region_to_region, ast_ty_to_ty, AstConv};
use middle::typeck::check::_match::pat_ctxt;
-use middle::typeck::CrateCtxt;
-use middle::typeck::infer;
use middle::typeck::rscope::RegionScope;
-use middle::typeck::{lookup_def_ccx};
-use middle::typeck::no_params;
-use middle::typeck::{require_same_types};
-use middle::typeck::{MethodCall, MethodCallee, MethodMap, ObjectCastMap};
-use middle::typeck::{TypeAndSubsts};
-use middle::typeck;
+use middle::typeck::{mod, CrateCtxt, infer, lookup_def_ccx, no_params, require_same_types};
+use middle::typeck::{MethodCall, MethodCallee, MethodMap, ObjectCastMap, TypeAndSubsts};
use middle::lang_items::TypeIdLangItem;
use lint;
use util::common::{block_query, indenter, loop_query};
-use util::ppaux;
-use util::ppaux::{UserString, Repr};
+use util::ppaux::{mod, UserString, Repr};
use util::nodemap::{DefIdMap, FnvHashMap, NodeMap};
use std::cell::{Cell, Ref, RefCell};
use std::collections::hash_map::{Occupied, Vacant};
use std::mem::replace;
use std::rc::Rc;
-use syntax::abi;
-use syntax::ast::{ProvidedMethod, RequiredMethod, TypeTraitItem};
-use syntax::ast;
-use syntax::ast_util::{local_def, PostExpansionMethod};
-use syntax::ast_util;
-use syntax::attr;
-use syntax::codemap::Span;
-use syntax::codemap;
+use syntax::{mod, abi, attr};
+use syntax::ast::{mod, ProvidedMethod, RequiredMethod, TypeTraitItem};
+use syntax::ast_util::{mod, local_def, PostExpansionMethod};
+use syntax::codemap::{mod, Span};
use syntax::owned_slice::OwnedSlice;
use syntax::parse::token;
use syntax::print::pprust;
use syntax::ptr::P;
-use syntax::visit;
-use syntax::visit::Visitor;
-use syntax;
+use syntax::visit::{mod, Visitor};
pub mod _match;
pub mod vtable;
fcx.require_expr_have_sized_type(expr, traits::StructInitializerSized);
}
- ast::ExprField(ref base, ref field, _) => {
+ ast::ExprField(ref base, ref field) => {
check_field(fcx, expr, lvalue_pref, &**base, field);
}
- ast::ExprTupField(ref base, idx, _) => {
+ ast::ExprTupField(ref base, idx) => {
check_tup_field(fcx, expr, lvalue_pref, &**base, idx);
}
ast::ExprIndex(ref base, ref idx) => {
ExprBlock(..) => SawExprBlock,
ExprAssign(..) => SawExprAssign,
ExprAssignOp(op, _, _) => SawExprAssignOp(op),
- ExprField(_, id, _) => SawExprField(content(id.node)),
- ExprTupField(_, id, _) => SawExprTupField(id.node),
+ ExprField(_, id) => SawExprField(content(id.node)),
+ ExprTupField(_, id) => SawExprTupField(id.node),
ExprIndex(..) => SawExprIndex,
ExprSlice(..) => SawExprSlice,
ExprPath(..) => SawExprPath,
use driver::driver::CrateAnalysis;
use session::Session;
-use middle::def;
+use middle::{def, typeck};
use middle::ty::{mod, Ty};
-use middle::typeck;
use std::cell::Cell;
-use std::io;
-use std::io::File;
-use std::io::fs;
+use std::io::{mod, File, fs};
use std::os;
-use syntax::ast;
-use syntax::ast_util;
-use syntax::ast_util::PostExpansionMethod;
-use syntax::ast::{NodeId,DefId};
+use syntax::ast_util::{mod, PostExpansionMethod};
+use syntax::ast::{mod, NodeId, DefId};
use syntax::ast_map::NodeItem;
use syntax::attr;
use syntax::codemap::*;
-use syntax::parse::token;
-use syntax::parse::token::{get_ident,keywords};
+use syntax::parse::token::{mod, get_ident, keywords};
use syntax::owned_slice::OwnedSlice;
-use syntax::visit;
-use syntax::visit::Visitor;
+use syntax::visit::{mod, Visitor};
use syntax::print::pprust::{path_to_string,ty_to_string};
use syntax::ptr::P;
use self::span_utils::SpanUtils;
-use self::recorder::Recorder;
-use self::recorder::FmtStrs;
+use self::recorder::{Recorder, FmtStrs};
use util::ppaux;
ast::ExprStruct(ref path, ref fields, ref base) =>
self.process_struct_lit(ex, path, fields, base),
ast::ExprMethodCall(_, _, ref args) => self.process_method_call(ex, args),
- ast::ExprField(ref sub_ex, ident, _) => {
+ ast::ExprField(ref sub_ex, ident) => {
if generated_code(sub_ex.span) {
return
}
"Expected struct type, but not ty_struct"),
}
},
- ast::ExprTupField(ref sub_ex, idx, _) => {
+ ast::ExprTupField(ref sub_ex, idx) => {
if generated_code(sub_ex.span) {
return
}
use llvm;
use llvm::{ConstFCmp, ConstICmp, SetLinkage, PrivateLinkage, ValueRef, Bool, True, False};
use llvm::{IntEQ, IntNE, IntUGT, IntUGE, IntULT, IntULE, IntSGT, IntSGE, IntSLT, IntSLE,
- RealOEQ, RealOGT, RealOGE, RealOLT, RealOLE, RealONE};
+ RealOEQ, RealOGT, RealOGE, RealOLT, RealOLE, RealONE};
use metadata::csearch;
-use middle::const_eval;
-use middle::def;
-use trans::adt;
-use trans::base;
-use trans::base::push_ctxt;
-use trans::closure;
+use middle::{const_eval, def};
+use trans::{adt, closure, consts, debuginfo, expr, inline, machine};
+use trans::base::{mod, push_ctxt};
use trans::common::*;
-use trans::consts;
-use trans::expr;
-use trans::inline;
-use trans::machine;
use trans::type_::Type;
use trans::type_of;
-use trans::debuginfo;
use middle::ty::{mod, Ty};
use util::ppaux::{Repr, ty_to_string};
}
}
}
- ast::ExprField(ref base, field, _) => {
+ ast::ExprField(ref base, field) => {
let (bv, bt) = const_expr(cx, &**base);
let brepr = adt::represent_type(cx, bt);
expr::with_field_tys(cx.tcx(), bt, None, |discr, field_tys| {
adt::const_get_field(cx, &*brepr, bv, discr, ix)
})
}
- ast::ExprTupField(ref base, idx, _) => {
+ ast::ExprTupField(ref base, idx) => {
let (bv, bt) = const_expr(cx, &**base);
let brepr = adt::represent_type(cx, bt);
expr::with_field_tys(cx.tcx(), bt, None, |discr, _| {
use llvm::debuginfo::*;
use metadata::csearch;
use middle::subst::{mod, Subst, Substs};
-use trans::adt;
+use trans::{mod, adt, machine, type_of};
use trans::common::*;
-use trans::machine;
use trans::_match::{BindingInfo, TrByCopy, TrByMove, TrByRef};
-use trans::type_of;
use trans::type_::Type;
-use trans;
use middle::ty::{mod, Ty};
use middle::pat_util;
use session::config::{mod, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
use syntax::codemap::{Span, Pos};
use syntax::{ast, codemap, ast_util, ast_map};
use syntax::ast_util::PostExpansionMethod;
-use syntax::parse::token;
-use syntax::parse::token::special_idents;
+use syntax::parse::token::{mod, special_idents};
static DW_LANG_RUST: c_uint = 0x9000;
ast::ExprCast(ref sub_exp, _) |
ast::ExprAddrOf(_, ref sub_exp) |
- ast::ExprField(ref sub_exp, _, _) |
- ast::ExprTupField(ref sub_exp, _, _) |
+ ast::ExprField(ref sub_exp, _) |
+ ast::ExprTupField(ref sub_exp, _) |
ast::ExprParen(ref sub_exp) =>
walk_expr(cx, &**sub_exp, scope_stack, scope_map),
use self::lazy_binop_ty::*;
use back::abi;
-use llvm;
-use llvm::{ValueRef};
+use llvm::{mod, ValueRef};
use middle::def;
use middle::mem_categorization::Typer;
-use middle::subst;
-use middle::subst::Subst;
-use trans::_match;
-use trans::adt;
-use trans::asm;
+use middle::subst::{mod, Subst};
+use trans::{_match, adt, asm, base, callee, closure, consts, controlflow};
+use trans::{debuginfo, glue, machine, meth, inline, tvec, type_of};
use trans::base::*;
-use trans::base;
use trans::build::*;
-use trans::callee;
-use trans::cleanup;
-use trans::cleanup::CleanupMethods;
-use trans::closure;
+use trans::cleanup::{mod, CleanupMethods};
use trans::common::*;
-use trans::consts;
-use trans::controlflow;
use trans::datum::*;
-use trans::debuginfo;
-use trans::glue;
-use trans::machine;
-use trans::meth;
-use trans::inline;
-use trans::tvec;
-use trans::type_of;
-use middle::ty::{struct_fields, tup_fields};
-use middle::ty::{AdjustDerefRef, AdjustAddEnv, AutoUnsafe};
-use middle::ty::{AutoPtr};
-use middle::ty::{mod, Ty};
-use middle::typeck;
-use middle::typeck::MethodCall;
+use middle::ty::{mod, struct_fields, tup_fields};
+use middle::ty::{AdjustDerefRef, AdjustAddEnv, AutoUnsafe, AutoPtr, Ty};
+use middle::typeck::{mod, MethodCall};
use util::common::indenter;
use util::ppaux::Repr;
use trans::machine::{llsize_of, llsize_of_alloc};
use trans::type_::Type;
-use syntax::ast;
-use syntax::ast_util;
-use syntax::codemap;
+use syntax::{ast, ast_util, codemap};
use syntax::print::pprust::{expr_to_string};
use syntax::ptr::P;
use std::rc::Rc;
ast::ExprPath(_) => {
trans_def(bcx, expr, bcx.def(expr.id))
}
- ast::ExprField(ref base, ident, _) => {
+ ast::ExprField(ref base, ident) => {
trans_rec_field(bcx, &**base, ident.node)
}
- ast::ExprTupField(ref base, idx, _) => {
+ ast::ExprTupField(ref base, idx) => {
trans_rec_tup_field(bcx, &**base, idx.node)
}
ast::ExprIndex(ref base, ref idx) => {
ExprAssign(P<Expr>, P<Expr>),
ExprAssignOp(BinOp, P<Expr>, P<Expr>),
- ExprField(P<Expr>, SpannedIdent, Vec<P<Ty>>),
- ExprTupField(P<Expr>, Spanned<uint>, Vec<P<Ty>>),
+ ExprField(P<Expr>, SpannedIdent),
+ ExprTupField(P<Expr>, Spanned<uint>),
ExprIndex(P<Expr>, P<Expr>),
ExprSlice(P<Expr>, Option<P<Expr>>, Option<P<Expr>>, Mutability),
};
let id = Spanned { node: ident, span: field_span };
- self.expr(sp, ast::ExprField(expr, id, Vec::new()))
+ self.expr(sp, ast::ExprField(expr, id))
}
fn expr_tup_field_access(&self, sp: Span, expr: P<ast::Expr>, idx: uint) -> P<ast::Expr> {
let field_span = Span {
};
let id = Spanned { node: idx, span: field_span };
- self.expr(sp, ast::ExprTupField(expr, id, Vec::new()))
+ self.expr(sp, ast::ExprTupField(expr, id))
}
fn expr_addr_of(&self, sp: Span, e: P<ast::Expr>) -> P<ast::Expr> {
self.expr(sp, ast::ExprAddrOf(ast::MutImmutable, e))
folder.fold_expr(el),
folder.fold_expr(er))
}
- ExprField(el, ident, tys) => {
+ ExprField(el, ident) => {
ExprField(folder.fold_expr(el),
- respan(ident.span, folder.fold_ident(ident.node)),
- tys.move_map(|x| folder.fold_ty(x)))
+ respan(ident.span, folder.fold_ident(ident.node)))
}
- ExprTupField(el, ident, tys) => {
+ ExprTupField(el, ident) => {
ExprTupField(folder.fold_expr(el),
- respan(ident.span, folder.fold_uint(ident.node)),
- tys.move_map(|x| folder.fold_ty(x)))
+ respan(ident.span, folder.fold_uint(ident.node)))
}
ExprIndex(el, er) => {
ExprIndex(folder.fold_expr(el), folder.fold_expr(er))
use parse;
use parse::attr::ParserAttr;
use parse::classify;
-use parse::common::{SeqSep, seq_sep_none};
-use parse::common::{seq_sep_trailing_allowed};
-use parse::lexer::Reader;
-use parse::lexer::TokenAndSpan;
+use parse::common::{SeqSep, seq_sep_none, seq_sep_trailing_allowed};
+use parse::lexer::{Reader, TokenAndSpan};
use parse::obsolete::*;
-use parse::token::{MatchNt, SubstNt, InternedString};
+use parse::token::{mod, MatchNt, SubstNt, InternedString};
use parse::token::{keywords, special_idents};
-use parse::token;
use parse::{new_sub_parser_from_file, ParseSess};
use print::pprust;
use ptr::P;
use std::collections::HashSet;
use std::io::fs::PathExtensions;
-use std::mem::replace;
use std::mem;
use std::num::Float;
use std::rc::Rc;
tok: token::Underscore,
sp: self.span,
};
- replace(&mut self.buffer[buffer_start], placeholder)
+ mem::replace(&mut self.buffer[buffer_start], placeholder)
};
self.span = next.sp;
self.token = next.tok;
/// Advance the parser by one token and return the bumped token.
pub fn bump_and_get(&mut self) -> token::Token {
- let old_token = replace(&mut self.token, token::Underscore);
+ let old_token = mem::replace(&mut self.token, token::Underscore);
self.bump();
old_token
}
ExprSlice(expr, start, end, mutbl)
}
- pub fn mk_field(&mut self, expr: P<Expr>, ident: ast::SpannedIdent,
- tys: Vec<P<Ty>>) -> ast::Expr_ {
- ExprField(expr, ident, tys)
+ pub fn mk_field(&mut self, expr: P<Expr>, ident: ast::SpannedIdent) -> ast::Expr_ {
+ ExprField(expr, ident)
}
- pub fn mk_tup_field(&mut self, expr: P<Expr>, idx: codemap::Spanned<uint>,
- tys: Vec<P<Ty>>) -> ast::Expr_ {
- ExprTupField(expr, idx, tys)
+ pub fn mk_tup_field(&mut self, expr: P<Expr>, idx: codemap::Spanned<uint>) -> ast::Expr_ {
+ ExprTupField(expr, idx)
}
pub fn mk_assign_op(&mut self, binop: ast::BinOp,
}
let id = spanned(dot, hi, i);
- let field = self.mk_field(e, id, tys);
+ let field = self.mk_field(e, id);
e = self.mk_expr(lo, hi, field);
}
}
match index {
Some(n) => {
let id = spanned(dot, hi, n);
- let field = self.mk_tup_field(e, id, Vec::new());
+ let field = self.mk_tup_field(e, id);
e = self.mk_expr(lo, hi, field);
}
None => {
try!(self.word_space("="));
try!(self.print_expr(&**rhs));
}
- ast::ExprField(ref expr, id, ref tys) => {
+ ast::ExprField(ref expr, id) => {
try!(self.print_expr(&**expr));
try!(word(&mut self.s, "."));
try!(self.print_ident(id.node));
- if tys.len() > 0u {
- try!(word(&mut self.s, "::<"));
- try!(self.commasep(
- Inconsistent, tys.as_slice(),
- |s, ty| s.print_type(&**ty)));
- try!(word(&mut self.s, ">"));
- }
}
- ast::ExprTupField(ref expr, id, ref tys) => {
+ ast::ExprTupField(ref expr, id) => {
try!(self.print_expr(&**expr));
try!(word(&mut self.s, "."));
try!(self.print_uint(id.node));
- if tys.len() > 0u {
- try!(word(&mut self.s, "::<"));
- try!(self.commasep(
- Inconsistent, tys.as_slice(),
- |s, ty| s.print_type(&**ty)));
- try!(word(&mut self.s, ">"));
- }
}
ast::ExprIndex(ref expr, ref index) => {
try!(self.print_expr(&**expr));
visitor.visit_expr(&**right_expression);
visitor.visit_expr(&**left_expression)
}
- ExprField(ref subexpression, _, ref types) => {
+ ExprField(ref subexpression, _) => {
visitor.visit_expr(&**subexpression);
- for typ in types.iter() {
- visitor.visit_ty(&**typ)
- }
}
- ExprTupField(ref subexpression, _, ref types) => {
+ ExprTupField(ref subexpression, _) => {
visitor.visit_expr(&**subexpression);
- for typ in types.iter() {
- visitor.visit_ty(&**typ)
- }
}
ExprIndex(ref main_expression, ref index_expression) => {
visitor.visit_expr(&**main_expression);