From 300e2b851324bac92c8e0cd21735b5550be51435 Mon Sep 17 00:00:00 2001 From: Lindsey Kuper Date: Tue, 31 Jul 2012 18:14:49 -0700 Subject: [PATCH] Start adding infrastructure for checking trait method bodies. --- src/rustc/middle/typeck/check.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs index a9578d688c4f..440ec24092ec 100644 --- a/src/rustc/middle/typeck/check.rs +++ b/src/rustc/middle/typeck/check.rs @@ -419,6 +419,21 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) { node_id: it.id }; for ms.each |m| { check_method(ccx, m, self_info);} } + ast::item_trait(_, trait_methods) { + for trait_methods.each |trait_method| { + alt trait_method { + required(ty_m) { + // Nothing to do, since required methods don't have + // bodies to check. + } + provided(m) { + let self_info = {self_ty: ty::mk_self(ccx.tcx), + node_id: it.id}; + check_method(ccx, m, self_info); + } + } + } + } ast::item_class(tps, traits, members, m_ctor, m_dtor) { let tcx = ccx.tcx; let class_t = {self_ty: ty::node_id_to_type(tcx, it.id),