More work toward anonymous objects.

This commit is contained in:
Lindsey Kuper 2011-05-11 16:41:25 -07:00 committed by Graydon Hoare
parent d3242b9644
commit b6f35c6a4b
4 changed files with 15 additions and 8 deletions

View File

@ -1659,7 +1659,6 @@ fn pat_ty(&ctxt cx, &node_type_table ntt, &@ast::pat pat) -> t {
fail; // not reached
}
<<<<<<< HEAD
fn expr_ann(&@ast::expr e) -> ast::ann {
alt (e.node) {
case (ast::expr_vec(_,_,?a)) { ret a; }

View File

@ -2592,20 +2592,23 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) -> @ast::expr {
auto t = ty::mk_nil(fcx.ccx.tcx);
let ty::t this_obj_ty;
// Grab the type of the current object
auto this_obj_id = fcx.ccx.this_obj;
alt (this_obj_id) {
// If we're inside a current object, grab its type.
case (some[ast::def_id](?def_id)) {
this_obj_ty = ty::lookup_item_type(fcx.ccx.sess,
fcx.ccx.tcx, fcx.ccx.type_cache, def_id)._1;
}
case (_) { fail; }
// Otherwise, we should be able to look up the object we're
// "with".
case (_) {
// TODO.
fail;
}
}
// Grab this method's type out of the current object type
// this_obj_ty is an ty::t
// Grab this method's type out of the current object type.
alt (struct(fcx.ccx.tcx, this_obj_ty)) {
case (ty::ty_obj(?methods)) {
for (ty::method method in methods) {

View File

@ -434,7 +434,7 @@ fn walk_expr(&ast_visitor v, @ast::expr e) {
walk_expr(v, x);
}
case (ast.expr_anon_obj(_,_,_,_)) { }
case (ast::expr_anon_obj(_,_,_,_)) { }
}
v.visit_expr_post(e);
}

View File

@ -690,6 +690,11 @@ fn print_expr(ps s, &@ast::expr expr) {
print_expr(s, expr);
pclose(s);
}
case (ast::expr_anon_obj(_,_,_,_)) {
wrd(s.s, "obj");
// TODO
}
}
end(s.s);
}