// option. This file may not be copied, modified, or distributed
// except according to those terms.
+use middle::subst::ParamSpace;
use syntax::ast;
use syntax::ast_util::local_def;
use std::gc::Gc;
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
+#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum Def {
DefFn(ast::DefId, ast::FnStyle),
DefStaticMethod(/* method */ ast::DefId, MethodProvenance, ast::FnStyle),
DefMod(ast::DefId),
DefForeignMod(ast::DefId),
DefStatic(ast::DefId, bool /* is_mutbl */),
- DefArg(ast::NodeId, ast::BindingMode),
DefLocal(ast::NodeId, ast::BindingMode),
DefVariant(ast::DefId /* enum */, ast::DefId /* variant */, bool /* is_structure */),
- DefTy(ast::DefId),
+ DefTy(ast::DefId, bool /* is_enum */),
+ DefAssociatedTy(ast::DefId),
DefTrait(ast::DefId),
DefPrimTy(ast::PrimTy),
- DefTyParam(ast::DefId, uint),
- DefBinding(ast::NodeId, ast::BindingMode),
+ DefTyParam(ParamSpace, ast::DefId, uint),
DefUse(ast::DefId),
DefUpvar(ast::NodeId, // id of closed over var
Gc<Def>, // closed over def
DefMethod(ast::DefId /* method */, Option<ast::DefId> /* trait */),
}
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
+#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum MethodProvenance {
FromTrait(ast::DefId),
FromImpl(ast::DefId),
match *self {
DefFn(id, _) | DefStaticMethod(id, _, _) | DefMod(id) |
DefForeignMod(id) | DefStatic(id, _) |
- DefVariant(_, id, _) | DefTy(id) | DefTyParam(id, _) |
- DefUse(id) | DefStruct(id) | DefTrait(id) | DefMethod(id, _) => {
+ DefVariant(_, id, _) | DefTy(id, _) | DefAssociatedTy(id) |
+ DefTyParam(_, id, _) | DefUse(id) | DefStruct(id) | DefTrait(id) |
+ DefMethod(id, _) => {
id
}
- DefArg(id, _) |
DefLocal(id, _) |
DefSelfTy(id) |
DefUpvar(id, _, _, _) |
- DefBinding(id, _) |
DefRegion(id) |
DefTyParamBinder(id) |
DefLabel(id) => {
}
}
}
+