librustc: Add missing cases in kind and privacy checking to try to put out the burning tinderbox. rs=rustbot
This commit is contained in:
parent
83a55ea73a
commit
b6f1e3084f
@ -239,7 +239,7 @@ fn check_expr(e: @expr, cx: ctx, v: visit::vt<ctx>) {
|
|||||||
debug!("kind::check_expr(%s)", expr_to_str(e, cx.tcx.sess.intr()));
|
debug!("kind::check_expr(%s)", expr_to_str(e, cx.tcx.sess.intr()));
|
||||||
let id_to_use = match e.node {
|
let id_to_use = match e.node {
|
||||||
expr_index(*)|expr_assign_op(*)|
|
expr_index(*)|expr_assign_op(*)|
|
||||||
expr_unary(*)|expr_binary(*) => e.callee_id,
|
expr_unary(*)|expr_binary(*)|expr_method_call(*) => e.callee_id,
|
||||||
_ => e.id
|
_ => e.id
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,14 +4,13 @@
|
|||||||
use /*mod*/ syntax::ast;
|
use /*mod*/ syntax::ast;
|
||||||
use /*mod*/ syntax::visit;
|
use /*mod*/ syntax::visit;
|
||||||
use syntax::ast_map;
|
use syntax::ast_map;
|
||||||
use syntax::ast::{def_variant, expr_field, expr_struct, expr_unary, ident,
|
use syntax::ast::{def_variant, expr_field, expr_method_call, expr_struct};
|
||||||
item_class};
|
use syntax::ast::{expr_unary, ident, item_class, item_enum, item_impl};
|
||||||
use syntax::ast::{item_impl, item_trait, item_enum, local_crate, node_id,
|
use syntax::ast::{item_trait, local_crate, node_id, pat_struct, private};
|
||||||
pat_struct};
|
use syntax::ast::{provided, required};
|
||||||
use syntax::ast::{private, provided, required};
|
|
||||||
use syntax::ast_map::{node_item, node_method};
|
use syntax::ast_map::{node_item, node_method};
|
||||||
use syntax::ast_util::{has_legacy_export_attr, is_local,
|
use syntax::ast_util::{Private, Public, has_legacy_export_attr, is_local};
|
||||||
visibility_to_privacy, Private, Public};
|
use syntax::ast_util::{visibility_to_privacy};
|
||||||
use ty::{ty_class, ty_enum};
|
use ty::{ty_class, ty_enum};
|
||||||
use typeck::{method_map, method_origin, method_param, method_self};
|
use typeck::{method_map, method_origin, method_param, method_self};
|
||||||
use typeck::{method_static, method_trait};
|
use typeck::{method_static, method_trait};
|
||||||
@ -213,6 +212,27 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) {
|
|||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
expr_method_call(base, _, _, _, _) => {
|
||||||
|
match ty::get(ty::expr_ty(tcx, base)).sty {
|
||||||
|
ty_class(id, _)
|
||||||
|
if id.crate != local_crate ||
|
||||||
|
!privileged_items.contains(&(id.node)) => {
|
||||||
|
match method_map.find(expr.id) {
|
||||||
|
None => {
|
||||||
|
tcx.sess.span_bug(expr.span,
|
||||||
|
~"method call not in \
|
||||||
|
method map");
|
||||||
|
}
|
||||||
|
Some(entry) => {
|
||||||
|
debug!("(privacy checking) checking \
|
||||||
|
impl method");
|
||||||
|
check_method(expr.span, &entry.origin);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
expr_struct(_, fields, _) => {
|
expr_struct(_, fields, _) => {
|
||||||
match ty::get(ty::expr_ty(tcx, expr)).sty {
|
match ty::get(ty::expr_ty(tcx, expr)).sty {
|
||||||
ty_class(id, _) => {
|
ty_class(id, _) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user