diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2014-05-14 15:31:30 -0400 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2014-06-06 19:51:23 -0400 |
| commit | 0f03b5608cc66aedb94409d62335ec539880b875 (patch) | |
| tree | 6a4a9da63f88c9732164710640fc04addbeaf407 /src/libsyntax | |
| parent | 14d626a9fa645186b87717cab6bfb976d5c13ab0 (diff) | |
| download | rust-0f03b5608cc66aedb94409d62335ec539880b875.tar.gz rust-0f03b5608cc66aedb94409d62335ec539880b875.zip | |
Move Def out of syntax crate, where it does not belong
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 43 | ||||
| -rw-r--r-- | src/libsyntax/ast_util.rs | 27 |
2 files changed, 0 insertions, 70 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 9cbe7e0b5fc..2bc24fd1eb3 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -206,49 +206,6 @@ impl Generics { } } -#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] -pub enum MethodProvenance { - FromTrait(DefId), - FromImpl(DefId), -} - -#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] -pub enum Def { - DefFn(DefId, FnStyle), - DefStaticMethod(/* method */ DefId, MethodProvenance, FnStyle), - DefSelfTy(/* trait id */ NodeId), - DefMod(DefId), - DefForeignMod(DefId), - DefStatic(DefId, bool /* is_mutbl */), - DefArg(NodeId, BindingMode), - DefLocal(NodeId, BindingMode), - DefVariant(DefId /* enum */, DefId /* variant */, bool /* is_structure */), - DefTy(DefId), - DefTrait(DefId), - DefPrimTy(PrimTy), - DefTyParam(DefId, uint), - DefBinding(NodeId, BindingMode), - DefUse(DefId), - DefUpvar(NodeId, // id of closed over var - @Def, // closed over def - NodeId, // expr node that creates the closure - NodeId), // id for the block/body of the closure expr - - /// Note that if it's a tuple struct's definition, the node id of the DefId - /// may either refer to the item definition's id or the StructDef.ctor_id. - /// - /// The cases that I have encountered so far are (this is not exhaustive): - /// - If it's a ty_path referring to some tuple struct, then DefMap maps - /// it to a def whose id is the item definition's id. - /// - If it's an ExprPath referring to some tuple struct, then DefMap maps - /// it to a def whose id is the StructDef.ctor_id. - DefStruct(DefId), - DefTyParamBinder(NodeId), /* struct, impl or trait with ty params */ - DefRegion(NodeId), - DefLabel(NodeId), - DefMethod(DefId /* method */, Option<DefId> /* trait */), -} - #[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)] pub enum DefRegion { DefStaticRegion, diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index e4f2f7f26cf..a1ad3cc14c5 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -52,33 +52,6 @@ pub fn stmt_id(s: &Stmt) -> NodeId { } } -pub fn variant_def_ids(d: Def) -> Option<(DefId, DefId)> { - match d { - DefVariant(enum_id, var_id, _) => { - Some((enum_id, var_id)) - } - _ => None - } -} - -pub fn def_id_of_def(d: Def) -> DefId { - match d { - DefFn(id, _) | DefStaticMethod(id, _, _) | DefMod(id) | - DefForeignMod(id) | DefStatic(id, _) | - DefVariant(_, id, _) | DefTy(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) => { - local_def(id) - } - - DefPrimTy(_) => fail!() - } -} - pub fn binop_to_str(op: BinOp) -> &'static str { match op { BiAdd => "+", |
