Rename a few typeck method-related structures to UpperCamelCase.
This commit is contained in:
parent
6c41f993d3
commit
7a588ceff2
22 changed files with 115 additions and 119 deletions
|
@ -50,7 +50,7 @@ use writer = serialize::ebml::writer;
|
|||
// Auxiliary maps of things to be encoded
|
||||
pub struct Maps {
|
||||
root_map: middle::borrowck::root_map,
|
||||
method_map: middle::typeck::method_map,
|
||||
method_map: middle::typeck::MethodMap,
|
||||
vtable_map: middle::typeck::vtable_map,
|
||||
capture_map: middle::moves::CaptureMap,
|
||||
}
|
||||
|
@ -579,25 +579,23 @@ impl tr for moves::CaptureVar {
|
|||
impl tr for method_origin {
|
||||
fn tr(&self, xcx: @ExtendedDecodeContext) -> method_origin {
|
||||
match *self {
|
||||
typeck::method_static(did) => {
|
||||
typeck::method_static(did.tr(xcx))
|
||||
}
|
||||
typeck::method_param(ref mp) => {
|
||||
typeck::method_param(
|
||||
typeck::method_param {
|
||||
trait_id: mp.trait_id.tr(xcx),
|
||||
.. *mp
|
||||
}
|
||||
)
|
||||
}
|
||||
typeck::method_object(ref mo) => {
|
||||
typeck::method_object(
|
||||
typeck::method_object {
|
||||
trait_id: mo.trait_id.tr(xcx),
|
||||
.. *mo
|
||||
}
|
||||
)
|
||||
}
|
||||
typeck::MethodStatic(did) => typeck::MethodStatic(did.tr(xcx)),
|
||||
typeck::MethodParam(ref mp) => {
|
||||
typeck::MethodParam(
|
||||
typeck::MethodParam {
|
||||
trait_id: mp.trait_id.tr(xcx),
|
||||
.. *mp
|
||||
}
|
||||
)
|
||||
}
|
||||
typeck::MethodObject(ref mo) => {
|
||||
typeck::MethodObject(
|
||||
typeck::MethodObject {
|
||||
trait_id: mo.trait_id.tr(xcx),
|
||||
.. *mo
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ impl Visitor<()> for BorrowckCtxt {
|
|||
}
|
||||
|
||||
pub fn check_crate(tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
moves_map: moves::MovesMap,
|
||||
moved_variables_set: moves::MovedVariablesSet,
|
||||
capture_map: moves::CaptureMap,
|
||||
|
@ -156,7 +156,7 @@ fn borrowck_fn(this: &mut BorrowckCtxt,
|
|||
|
||||
pub struct BorrowckCtxt {
|
||||
tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
moves_map: moves::MovesMap,
|
||||
moved_variables_set: moves::MovedVariablesSet,
|
||||
capture_map: moves::CaptureMap,
|
||||
|
@ -909,7 +909,7 @@ impl Repr for LoanPath {
|
|||
|
||||
struct TcxTyper {
|
||||
tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
}
|
||||
|
||||
impl mc::Typer for TcxTyper {
|
||||
|
|
|
@ -565,7 +565,7 @@ impl MoveData {
|
|||
impl FlowedMoveData {
|
||||
pub fn new(move_data: MoveData,
|
||||
tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
id_range: ast_util::IdRange,
|
||||
body: &ast::Block)
|
||||
-> FlowedMoveData {
|
||||
|
|
|
@ -19,7 +19,7 @@ use syntax::opt_vec;
|
|||
|
||||
struct CFGBuilder {
|
||||
tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
exit_map: HashMap<ast::NodeId, CFGIndex>,
|
||||
graph: CFGGraph,
|
||||
loop_scopes: ~[LoopScope],
|
||||
|
@ -32,7 +32,7 @@ struct LoopScope {
|
|||
}
|
||||
|
||||
pub fn construct(tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
blk: &ast::Block) -> CFG {
|
||||
let mut cfg_builder = CFGBuilder {
|
||||
exit_map: HashMap::new(),
|
||||
|
|
|
@ -54,7 +54,7 @@ pub struct CFGIndices {
|
|||
|
||||
impl CFG {
|
||||
pub fn new(tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
blk: &ast::Block) -> CFG {
|
||||
construct::construct(tcx, method_map, blk)
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ use syntax::visit;
|
|||
struct CheckCrateVisitor {
|
||||
sess: Session,
|
||||
def_map: resolve::DefMap,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
tcx: ty::ctxt,
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ impl Visitor<bool> for CheckCrateVisitor {
|
|||
pub fn check_crate(sess: Session,
|
||||
krate: &Crate,
|
||||
def_map: resolve::DefMap,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
tcx: ty::ctxt) {
|
||||
let mut v = CheckCrateVisitor {
|
||||
sess: sess,
|
||||
|
@ -102,7 +102,7 @@ pub fn check_pat(v: &mut CheckCrateVisitor, p: &Pat, _is_const: bool) {
|
|||
pub fn check_expr(v: &mut CheckCrateVisitor,
|
||||
sess: Session,
|
||||
def_map: resolve::DefMap,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
tcx: ty::ctxt,
|
||||
e: &Expr,
|
||||
is_const: bool) {
|
||||
|
|
|
@ -15,7 +15,7 @@ use middle::const_eval::{eval_const_expr, const_val, const_bool, const_float};
|
|||
use middle::pat_util::*;
|
||||
use middle::ty::*;
|
||||
use middle::ty;
|
||||
use middle::typeck::method_map;
|
||||
use middle::typeck::MethodMap;
|
||||
use middle::moves;
|
||||
use util::ppaux::ty_to_str;
|
||||
|
||||
|
@ -31,7 +31,7 @@ use syntax::visit::{Visitor, FnKind};
|
|||
|
||||
struct MatchCheckCtxt {
|
||||
tcx: ty::ctxt,
|
||||
method_map: method_map,
|
||||
method_map: MethodMap,
|
||||
moves_map: moves::MovesMap
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ impl Visitor<()> for CheckMatchVisitor {
|
|||
}
|
||||
|
||||
pub fn check_crate(tcx: ty::ctxt,
|
||||
method_map: method_map,
|
||||
method_map: MethodMap,
|
||||
moves_map: moves::MovesMap,
|
||||
krate: &Crate) {
|
||||
let cx = @MatchCheckCtxt {tcx: tcx,
|
||||
|
|
|
@ -32,7 +32,7 @@ use util::ppaux::Repr;
|
|||
#[deriving(Clone)]
|
||||
pub struct DataFlowContext<O> {
|
||||
priv tcx: ty::ctxt,
|
||||
priv method_map: typeck::method_map,
|
||||
priv method_map: typeck::MethodMap,
|
||||
|
||||
/// the data flow operator
|
||||
priv oper: O,
|
||||
|
@ -122,7 +122,7 @@ impl<O:DataFlowOperator> pprust::PpAnn for DataFlowContext<O> {
|
|||
|
||||
impl<O:DataFlowOperator> DataFlowContext<O> {
|
||||
pub fn new(tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
oper: O,
|
||||
id_range: IdRange,
|
||||
bits_per_id: uint) -> DataFlowContext<O> {
|
||||
|
|
|
@ -49,14 +49,14 @@ fn should_explore(tcx: ty::ctxt, def_id: ast::DefId) -> bool {
|
|||
|
||||
struct MarkSymbolVisitor {
|
||||
worklist: ~[ast::NodeId],
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
tcx: ty::ctxt,
|
||||
live_symbols: ~HashSet<ast::NodeId>,
|
||||
}
|
||||
|
||||
impl MarkSymbolVisitor {
|
||||
fn new(tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
worklist: ~[ast::NodeId]) -> MarkSymbolVisitor {
|
||||
MarkSymbolVisitor {
|
||||
worklist: worklist,
|
||||
|
@ -96,18 +96,18 @@ impl MarkSymbolVisitor {
|
|||
match method_map.get().find(id) {
|
||||
Some(&origin) => {
|
||||
match origin {
|
||||
typeck::method_static(def_id) => {
|
||||
typeck::MethodStatic(def_id) => {
|
||||
match ty::provided_source(self.tcx, def_id) {
|
||||
Some(p_did) => self.check_def_id(p_did),
|
||||
None => self.check_def_id(def_id)
|
||||
}
|
||||
}
|
||||
typeck::method_param(typeck::method_param {
|
||||
typeck::MethodParam(typeck::MethodParam {
|
||||
trait_id: trait_id,
|
||||
method_num: index,
|
||||
..
|
||||
})
|
||||
| typeck::method_object(typeck::method_object {
|
||||
| typeck::MethodObject(typeck::MethodObject {
|
||||
trait_id: trait_id,
|
||||
method_num: index,
|
||||
..
|
||||
|
@ -285,7 +285,7 @@ fn create_and_seed_worklist(tcx: ty::ctxt,
|
|||
}
|
||||
|
||||
fn find_live(tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
exported_items: &privacy::ExportedItems,
|
||||
reachable_symbols: &HashSet<ast::NodeId>,
|
||||
krate: &ast::Crate)
|
||||
|
@ -408,7 +408,7 @@ impl Visitor<()> for DeadVisitor {
|
|||
}
|
||||
|
||||
pub fn check_crate(tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
exported_items: &privacy::ExportedItems,
|
||||
reachable_symbols: &HashSet<ast::NodeId>,
|
||||
krate: &ast::Crate) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
/// `unsafe`.
|
||||
|
||||
use middle::ty;
|
||||
use middle::typeck::method_map;
|
||||
use middle::typeck::MethodMap;
|
||||
use util::ppaux;
|
||||
|
||||
use syntax::ast;
|
||||
|
@ -39,7 +39,7 @@ struct EffectCheckVisitor {
|
|||
tcx: ty::ctxt,
|
||||
|
||||
/// The method map.
|
||||
method_map: method_map,
|
||||
method_map: MethodMap,
|
||||
/// Whether we're in an unsafe context.
|
||||
unsafe_context: UnsafeContext,
|
||||
}
|
||||
|
@ -190,9 +190,7 @@ impl Visitor<()> for EffectCheckVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn check_crate(tcx: ty::ctxt,
|
||||
method_map: method_map,
|
||||
krate: &ast::Crate) {
|
||||
pub fn check_crate(tcx: ty::ctxt, method_map: MethodMap, krate: &ast::Crate) {
|
||||
let mut visitor = EffectCheckVisitor {
|
||||
tcx: tcx,
|
||||
method_map: method_map,
|
||||
|
|
|
@ -53,7 +53,7 @@ use syntax::visit::Visitor;
|
|||
#[deriving(Clone)]
|
||||
pub struct Context {
|
||||
tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
}
|
||||
|
||||
impl Visitor<()> for Context {
|
||||
|
@ -76,7 +76,7 @@ impl Visitor<()> for Context {
|
|||
}
|
||||
|
||||
pub fn check_crate(tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
krate: &Crate) {
|
||||
let mut ctx = Context {
|
||||
tcx: tcx,
|
||||
|
|
|
@ -405,7 +405,7 @@ struct Context<'a> {
|
|||
tcx: ty::ctxt,
|
||||
// maps from an expression id that corresponds to a method call to the
|
||||
// details of the method to be invoked
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
// Items exported by the crate; used by the missing_doc lint.
|
||||
exported_items: &'a privacy::ExportedItems,
|
||||
// The id of the current `ast::StructDef` being walked.
|
||||
|
@ -1415,7 +1415,7 @@ fn check_stability(cx: &Context, e: &ast::Expr) {
|
|||
match method_map.get().find(&e.id) {
|
||||
Some(&origin) => {
|
||||
match origin {
|
||||
typeck::method_static(def_id) => {
|
||||
typeck::MethodStatic(def_id) => {
|
||||
// If this implements a trait method, get def_id
|
||||
// of the method inside trait definition.
|
||||
// Otherwise, use the current def_id (which refers
|
||||
|
@ -1423,12 +1423,12 @@ fn check_stability(cx: &Context, e: &ast::Expr) {
|
|||
ty::trait_method_of_method(
|
||||
cx.tcx, def_id).unwrap_or(def_id)
|
||||
}
|
||||
typeck::method_param(typeck::method_param {
|
||||
typeck::MethodParam(typeck::MethodParam {
|
||||
trait_id: trait_id,
|
||||
method_num: index,
|
||||
..
|
||||
})
|
||||
| typeck::method_object(typeck::method_object {
|
||||
| typeck::MethodObject(typeck::MethodObject {
|
||||
trait_id: trait_id,
|
||||
method_num: index,
|
||||
..
|
||||
|
@ -1646,7 +1646,7 @@ impl<'a> IdVisitingOperation for Context<'a> {
|
|||
}
|
||||
|
||||
pub fn check_crate(tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
exported_items: &privacy::ExportedItems,
|
||||
krate: &ast::Crate) {
|
||||
let mut cx = Context {
|
||||
|
|
|
@ -174,7 +174,7 @@ impl Visitor<@IrMaps> for LivenessVisitor {
|
|||
}
|
||||
|
||||
pub fn check_crate(tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
capture_map: moves::CaptureMap,
|
||||
krate: &Crate) {
|
||||
let mut visitor = LivenessVisitor;
|
||||
|
@ -253,7 +253,7 @@ enum VarKind {
|
|||
|
||||
struct IrMaps {
|
||||
tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
capture_map: moves::CaptureMap,
|
||||
|
||||
num_live_nodes: Cell<uint>,
|
||||
|
@ -266,7 +266,7 @@ struct IrMaps {
|
|||
}
|
||||
|
||||
fn IrMaps(tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
capture_map: moves::CaptureMap)
|
||||
-> IrMaps {
|
||||
IrMaps {
|
||||
|
|
|
@ -130,7 +130,7 @@ and so on.
|
|||
use middle::pat_util::{pat_bindings};
|
||||
use middle::freevars;
|
||||
use middle::ty;
|
||||
use middle::typeck::method_map;
|
||||
use middle::typeck::MethodMap;
|
||||
use util::ppaux;
|
||||
use util::ppaux::Repr;
|
||||
use util::common::indenter;
|
||||
|
@ -182,7 +182,7 @@ pub struct MoveMaps {
|
|||
#[deriving(Clone)]
|
||||
struct VisitContext {
|
||||
tcx: ty::ctxt,
|
||||
method_map: method_map,
|
||||
method_map: MethodMap,
|
||||
move_maps: MoveMaps
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@ impl visit::Visitor<()> for VisitContext {
|
|||
}
|
||||
|
||||
pub fn compute_moves(tcx: ty::ctxt,
|
||||
method_map: method_map,
|
||||
method_map: MethodMap,
|
||||
krate: &Crate) -> MoveMaps
|
||||
{
|
||||
let mut visit_cx = VisitContext {
|
||||
|
|
|
@ -18,8 +18,8 @@ use collections::{HashSet, HashMap};
|
|||
use metadata::csearch;
|
||||
use middle::resolve;
|
||||
use middle::ty;
|
||||
use middle::typeck::{method_map, method_origin, method_param};
|
||||
use middle::typeck::{method_static, method_object};
|
||||
use middle::typeck::{MethodMap, MethodOrigin, MethodParam};
|
||||
use middle::typeck::{MethodStatic, MethodObject};
|
||||
|
||||
use syntax::ast;
|
||||
use syntax::ast_map;
|
||||
|
@ -31,7 +31,7 @@ use syntax::opt_vec;
|
|||
use syntax::visit;
|
||||
use syntax::visit::Visitor;
|
||||
|
||||
type Context<'a> = (&'a method_map, &'a resolve::ExportMap2);
|
||||
type Context<'a> = (&'a MethodMap, &'a resolve::ExportMap2);
|
||||
|
||||
/// A set of AST nodes exported by the crate.
|
||||
pub type ExportedItems = HashSet<ast::NodeId>;
|
||||
|
@ -347,7 +347,7 @@ struct PrivacyVisitor<'a> {
|
|||
curitem: ast::NodeId,
|
||||
in_fn: bool,
|
||||
in_foreign: bool,
|
||||
method_map: &'a method_map,
|
||||
method_map: &'a MethodMap,
|
||||
parents: HashMap<ast::NodeId, ast::NodeId>,
|
||||
external_exports: resolve::ExternalExports,
|
||||
last_private_map: resolve::LastPrivateMap,
|
||||
|
@ -738,16 +738,16 @@ impl<'a> PrivacyVisitor<'a> {
|
|||
}
|
||||
|
||||
// Checks that a method is in scope.
|
||||
fn check_method(&mut self, span: Span, origin: &method_origin,
|
||||
fn check_method(&mut self, span: Span, origin: MethodOrigin,
|
||||
ident: ast::Ident) {
|
||||
match *origin {
|
||||
method_static(method_id) => {
|
||||
match origin {
|
||||
MethodStatic(method_id) => {
|
||||
self.check_static_method(span, method_id, ident)
|
||||
}
|
||||
// Trait methods are always all public. The only controlling factor
|
||||
// is whether the trait itself is accessible or not.
|
||||
method_param(method_param { trait_id: trait_id, .. }) |
|
||||
method_object(method_object { trait_id: trait_id, .. }) => {
|
||||
MethodParam(MethodParam { trait_id: trait_id, .. }) |
|
||||
MethodObject(MethodObject { trait_id: trait_id, .. }) => {
|
||||
self.report_error(self.ensure_public(span, trait_id, None, "source trait"));
|
||||
}
|
||||
}
|
||||
|
@ -1170,7 +1170,7 @@ impl SanePrivacyVisitor {
|
|||
}
|
||||
|
||||
pub fn check_crate(tcx: ty::ctxt,
|
||||
method_map: &method_map,
|
||||
method_map: &MethodMap,
|
||||
exp_map2: &resolve::ExportMap2,
|
||||
external_exports: resolve::ExternalExports,
|
||||
last_private_map: resolve::LastPrivateMap,
|
||||
|
|
|
@ -86,7 +86,7 @@ struct ReachableContext {
|
|||
tcx: ty::ctxt,
|
||||
// The method map, which links node IDs of method call expressions to the
|
||||
// methods they've been resolved to.
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
// The set of items which must be exported in the linkage sense.
|
||||
reachable_symbols: @RefCell<HashSet<ast::NodeId>>,
|
||||
// A worklist of item IDs. Each item ID in this worklist will be inlined
|
||||
|
@ -96,7 +96,7 @@ struct ReachableContext {
|
|||
|
||||
struct MarkSymbolVisitor {
|
||||
worklist: @RefCell<~[ast::NodeId]>,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
tcx: ty::ctxt,
|
||||
reachable_symbols: @RefCell<HashSet<ast::NodeId>>,
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ impl Visitor<()> for MarkSymbolVisitor {
|
|||
|
||||
impl ReachableContext {
|
||||
// Creates a new reachability computation context.
|
||||
fn new(tcx: ty::ctxt, method_map: typeck::method_map) -> ReachableContext {
|
||||
fn new(tcx: ty::ctxt, method_map: typeck::MethodMap) -> ReachableContext {
|
||||
ReachableContext {
|
||||
tcx: tcx,
|
||||
method_map: method_map,
|
||||
|
@ -398,7 +398,7 @@ impl ReachableContext {
|
|||
}
|
||||
|
||||
pub fn find_reachable(tcx: ty::ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
exported_items: &privacy::ExportedItems)
|
||||
-> @RefCell<HashSet<ast::NodeId>> {
|
||||
let reachable_context = ReachableContext::new(tcx, method_map);
|
||||
|
|
|
@ -104,13 +104,13 @@ pub fn trans_method_callee<'a>(
|
|||
callee_id, origin.repr(bcx.tcx()));
|
||||
|
||||
match origin {
|
||||
typeck::method_static(did) => {
|
||||
typeck::MethodStatic(did) => {
|
||||
Callee {
|
||||
bcx: bcx,
|
||||
data: Fn(callee::trans_fn_ref(bcx, did, callee_id))
|
||||
}
|
||||
}
|
||||
typeck::method_param(typeck::method_param {
|
||||
typeck::MethodParam(typeck::MethodParam {
|
||||
trait_id: trait_id,
|
||||
method_num: off,
|
||||
param_num: p,
|
||||
|
@ -131,7 +131,7 @@ pub fn trans_method_callee<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
typeck::method_object(ref mt) => {
|
||||
typeck::MethodObject(ref mt) => {
|
||||
trans_trait_callee(bcx,
|
||||
callee_id,
|
||||
mt.real_index,
|
||||
|
|
|
@ -3254,19 +3254,19 @@ pub fn expr_has_ty_params(cx: ctxt, expr: &ast::Expr) -> bool {
|
|||
return node_id_has_type_params(cx, expr.id);
|
||||
}
|
||||
|
||||
pub fn method_call_type_param_defs(tcx: ctxt, origin: typeck::method_origin)
|
||||
pub fn method_call_type_param_defs(tcx: ctxt, origin: typeck::MethodOrigin)
|
||||
-> Rc<~[TypeParameterDef]> {
|
||||
match origin {
|
||||
typeck::method_static(did) => {
|
||||
typeck::MethodStatic(did) => {
|
||||
// n.b.: When we encode impl methods, the bounds
|
||||
// that we encode include both the impl bounds
|
||||
// and then the method bounds themselves...
|
||||
ty::lookup_item_type(tcx, did).generics.type_param_defs
|
||||
}
|
||||
typeck::method_param(typeck::method_param {
|
||||
typeck::MethodParam(typeck::MethodParam {
|
||||
trait_id: trt_id,
|
||||
method_num: n_mth, ..}) |
|
||||
typeck::method_object(typeck::method_object {
|
||||
typeck::MethodObject(typeck::MethodObject {
|
||||
trait_id: trt_id,
|
||||
method_num: n_mth, ..}) => {
|
||||
// ...trait methods bounds, in contrast, include only the
|
||||
|
@ -3295,7 +3295,7 @@ pub fn resolve_expr(tcx: ctxt, expr: &ast::Expr) -> ast::Def {
|
|||
}
|
||||
|
||||
pub fn expr_is_lval(tcx: ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
e: &ast::Expr) -> bool {
|
||||
match expr_kind(tcx, method_map, e) {
|
||||
LvalueExpr => true,
|
||||
|
@ -3316,7 +3316,7 @@ pub enum ExprKind {
|
|||
}
|
||||
|
||||
pub fn expr_kind(tcx: ctxt,
|
||||
method_map: typeck::method_map,
|
||||
method_map: typeck::MethodMap,
|
||||
expr: &ast::Expr) -> ExprKind {
|
||||
{
|
||||
let method_map = method_map.borrow();
|
||||
|
|
|
@ -89,8 +89,8 @@ use middle::typeck::check::{structurally_resolved_type};
|
|||
use middle::typeck::check::vtable;
|
||||
use middle::typeck::check;
|
||||
use middle::typeck::infer;
|
||||
use middle::typeck::{method_origin, method_param};
|
||||
use middle::typeck::{method_static, method_object};
|
||||
use middle::typeck::{MethodOrigin, MethodParam};
|
||||
use middle::typeck::{MethodStatic, MethodObject};
|
||||
use middle::typeck::{param_numbered, param_self, param_index};
|
||||
use middle::typeck::check::regionmanip::replace_bound_regions_in_fn_sig;
|
||||
use util::common::indenter;
|
||||
|
@ -230,7 +230,7 @@ pub struct Candidate {
|
|||
rcvr_match_condition: RcvrMatchCondition,
|
||||
rcvr_substs: ty::substs,
|
||||
method_ty: @ty::Method,
|
||||
origin: method_origin,
|
||||
origin: MethodOrigin,
|
||||
}
|
||||
|
||||
/// This type represents the conditions under which the receiver is
|
||||
|
@ -464,7 +464,7 @@ impl<'a> LookupContext<'a> {
|
|||
rcvr_match_condition: RcvrMatchesIfObject(did),
|
||||
rcvr_substs: new_trait_ref.substs.clone(),
|
||||
method_ty: @m,
|
||||
origin: method_object(method_object {
|
||||
origin: MethodObject(MethodObject {
|
||||
trait_id: new_trait_ref.def_id,
|
||||
object_trait_id: did,
|
||||
method_num: method_num,
|
||||
|
@ -518,7 +518,7 @@ impl<'a> LookupContext<'a> {
|
|||
rcvr_match_condition: RcvrMatchesIfSubtype(self_ty),
|
||||
rcvr_substs: trait_ref.substs.clone(),
|
||||
method_ty: m,
|
||||
origin: method_param(method_param {
|
||||
origin: MethodParam(MethodParam {
|
||||
trait_id: trait_ref.def_id,
|
||||
method_num: method_num,
|
||||
param_num: param,
|
||||
|
@ -626,7 +626,7 @@ impl<'a> LookupContext<'a> {
|
|||
rcvr_match_condition: RcvrMatchesIfSubtype(impl_ty),
|
||||
rcvr_substs: impl_substs,
|
||||
method_ty: method,
|
||||
origin: method_static(method.def_id)
|
||||
origin: MethodStatic(method.def_id)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -938,7 +938,7 @@ impl<'a> LookupContext<'a> {
|
|||
candidate_a, candidate_b);
|
||||
let candidates_same = match (&candidate_a.origin,
|
||||
&candidate_b.origin) {
|
||||
(&method_param(ref p1), &method_param(ref p2)) => {
|
||||
(&MethodParam(ref p1), &MethodParam(ref p2)) => {
|
||||
let same_trait = p1.trait_id == p2.trait_id;
|
||||
let same_method = p1.method_num == p2.method_num;
|
||||
let same_param = p1.param_num == p2.param_num;
|
||||
|
@ -1031,7 +1031,7 @@ impl<'a> LookupContext<'a> {
|
|||
|
||||
let fn_sig = &bare_fn_ty.sig;
|
||||
let inputs = match candidate.origin {
|
||||
method_object(..) => {
|
||||
MethodObject(..) => {
|
||||
// For annoying reasons, we've already handled the
|
||||
// substitution of self for object calls.
|
||||
let args = fn_sig.inputs.slice_from(1).iter().map(|t| {
|
||||
|
@ -1154,10 +1154,10 @@ impl<'a> LookupContext<'a> {
|
|||
*/
|
||||
|
||||
match candidate.origin {
|
||||
method_static(..) | method_param(..) => {
|
||||
MethodStatic(..) | MethodParam(..) => {
|
||||
return; // not a call to a trait instance
|
||||
}
|
||||
method_object(..) => {}
|
||||
MethodObject(..) => {}
|
||||
}
|
||||
|
||||
match candidate.method_ty.explicit_self {
|
||||
|
@ -1213,14 +1213,14 @@ impl<'a> LookupContext<'a> {
|
|||
// No code can call the finalize method explicitly.
|
||||
let bad;
|
||||
match candidate.origin {
|
||||
method_static(method_id) => {
|
||||
MethodStatic(method_id) => {
|
||||
let destructors = self.tcx().destructors.borrow();
|
||||
bad = destructors.get().contains(&method_id);
|
||||
}
|
||||
// FIXME: does this properly enforce this on everything now
|
||||
// that self has been merged in? -sully
|
||||
method_param(method_param { trait_id: trait_id, .. }) |
|
||||
method_object(method_object { trait_id: trait_id, .. }) => {
|
||||
MethodParam(MethodParam { trait_id: trait_id, .. }) |
|
||||
MethodObject(MethodObject { trait_id: trait_id, .. }) => {
|
||||
let destructor_for_type = self.tcx()
|
||||
.destructor_for_type
|
||||
.borrow();
|
||||
|
@ -1316,9 +1316,9 @@ impl<'a> LookupContext<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
fn report_candidate(&self, idx: uint, origin: &method_origin) {
|
||||
fn report_candidate(&self, idx: uint, origin: &MethodOrigin) {
|
||||
match *origin {
|
||||
method_static(impl_did) => {
|
||||
MethodStatic(impl_did) => {
|
||||
// If it is an instantiated default method, use the original
|
||||
// default method for error reporting.
|
||||
let did = match provided_source(self.tcx(), impl_did) {
|
||||
|
@ -1327,10 +1327,10 @@ impl<'a> LookupContext<'a> {
|
|||
};
|
||||
self.report_static_candidate(idx, did)
|
||||
}
|
||||
method_param(ref mp) => {
|
||||
MethodParam(ref mp) => {
|
||||
self.report_param_candidate(idx, (*mp).trait_id)
|
||||
}
|
||||
method_object(ref mo) => {
|
||||
MethodObject(ref mo) => {
|
||||
self.report_trait_candidate(idx, mo.trait_id)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ 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, method_map, vtable_map};
|
||||
use middle::typeck::{require_same_types, MethodMap, vtable_map};
|
||||
use middle::lang_items::TypeIdLangItem;
|
||||
use util::common::{block_query, indenter, loop_query};
|
||||
use util::ppaux;
|
||||
|
@ -160,7 +160,7 @@ pub struct Inherited {
|
|||
node_types: RefCell<HashMap<ast::NodeId, ty::t>>,
|
||||
node_type_substs: RefCell<HashMap<ast::NodeId, ty::substs>>,
|
||||
adjustments: RefCell<HashMap<ast::NodeId, @ty::AutoAdjustment>>,
|
||||
method_map: method_map,
|
||||
method_map: MethodMap,
|
||||
vtable_map: vtable_map,
|
||||
upvar_borrow_map: RefCell<ty::UpvarBorrowMap>,
|
||||
}
|
||||
|
|
|
@ -93,22 +93,22 @@ pub enum param_index {
|
|||
}
|
||||
|
||||
#[deriving(Clone, Encodable, Decodable)]
|
||||
pub enum method_origin {
|
||||
pub enum MethodOrigin {
|
||||
// fully statically resolved method
|
||||
method_static(ast::DefId),
|
||||
MethodStatic(ast::DefId),
|
||||
|
||||
// method invoked on a type parameter with a bounded trait
|
||||
method_param(method_param),
|
||||
MethodParam(MethodParam),
|
||||
|
||||
// method invoked on a trait instance
|
||||
method_object(method_object),
|
||||
MethodObject(MethodObject),
|
||||
|
||||
}
|
||||
|
||||
// details for a method invoked with a receiver whose type is a type parameter
|
||||
// with a bounded trait.
|
||||
#[deriving(Clone, Encodable, Decodable)]
|
||||
pub struct method_param {
|
||||
pub struct MethodParam {
|
||||
// the trait containing the method to be invoked
|
||||
trait_id: ast::DefId,
|
||||
|
||||
|
@ -125,7 +125,7 @@ pub struct method_param {
|
|||
|
||||
// details for a method invoked with a receiver whose type is an object
|
||||
#[deriving(Clone, Encodable, Decodable)]
|
||||
pub struct method_object {
|
||||
pub struct MethodObject {
|
||||
// the (super)trait containing the method to be invoked
|
||||
trait_id: ast::DefId,
|
||||
|
||||
|
@ -215,7 +215,7 @@ pub type impl_vtable_map = RefCell<HashMap<ast::DefId, impl_res>>;
|
|||
pub struct CrateCtxt {
|
||||
// A mapping from method call sites to traits that have that method.
|
||||
trait_map: resolve::TraitMap,
|
||||
method_map: method_map,
|
||||
method_map: MethodMap,
|
||||
vtable_map: vtable_map,
|
||||
tcx: ty::ctxt
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ fn check_for_entry_fn(ccx: &CrateCtxt) {
|
|||
pub fn check_crate(tcx: ty::ctxt,
|
||||
trait_map: resolve::TraitMap,
|
||||
krate: &ast::Crate)
|
||||
-> (method_map, vtable_map) {
|
||||
-> (MethodMap, vtable_map) {
|
||||
let time_passes = tcx.sess.time_passes();
|
||||
let ccx = @CrateCtxt {
|
||||
trait_map: trait_map,
|
||||
|
|
|
@ -870,25 +870,25 @@ impl Repr for ty::FnSig {
|
|||
}
|
||||
}
|
||||
|
||||
impl Repr for typeck::method_origin {
|
||||
impl Repr for typeck::MethodOrigin {
|
||||
fn repr(&self, tcx: ctxt) -> ~str {
|
||||
match self {
|
||||
&typeck::method_static(def_id) => {
|
||||
format!("method_static({})", def_id.repr(tcx))
|
||||
&typeck::MethodStatic(def_id) => {
|
||||
format!("MethodStatic({})", def_id.repr(tcx))
|
||||
}
|
||||
&typeck::method_param(ref p) => {
|
||||
&typeck::MethodParam(ref p) => {
|
||||
p.repr(tcx)
|
||||
}
|
||||
&typeck::method_object(ref p) => {
|
||||
&typeck::MethodObject(ref p) => {
|
||||
p.repr(tcx)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Repr for typeck::method_param {
|
||||
impl Repr for typeck::MethodParam {
|
||||
fn repr(&self, tcx: ctxt) -> ~str {
|
||||
format!("method_param({},{:?},{:?},{:?})",
|
||||
format!("MethodParam({},{:?},{:?},{:?})",
|
||||
self.trait_id.repr(tcx),
|
||||
self.method_num,
|
||||
self.param_num,
|
||||
|
@ -896,9 +896,9 @@ impl Repr for typeck::method_param {
|
|||
}
|
||||
}
|
||||
|
||||
impl Repr for typeck::method_object {
|
||||
impl Repr for typeck::MethodObject {
|
||||
fn repr(&self, tcx: ctxt) -> ~str {
|
||||
format!("method_object({},{:?},{:?})",
|
||||
format!("MethodObject({},{:?},{:?})",
|
||||
self.trait_id.repr(tcx),
|
||||
self.method_num,
|
||||
self.real_index)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue