diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-06-12 16:25:09 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-06-12 17:37:04 -0700 |
| commit | aa9d2d88d33266437ca770a7345cce0d23ad1011 (patch) | |
| tree | 66225e5bd762c78643cb298e90d1f626355cb569 /src/libsyntax | |
| parent | e9fc19c3c22174dd4308337805e686bbd4960635 (diff) | |
| download | rust-aa9d2d88d33266437ca770a7345cce0d23ad1011.tar.gz rust-aa9d2d88d33266437ca770a7345cce0d23ad1011.zip | |
Handle class destructors correctly in metadata
This allows destructors to be inlined, which is necessary since classes can have both ty params and destructors.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ast_map.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ast_util.rs | 5 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 536ce3c294e..ad1501dd8b0 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -730,7 +730,8 @@ enum inlined_item { ii_item(@item), ii_method(def_id /* impl id */, @method), ii_native(@native_item), - ii_ctor(class_ctor, ident, [ty_param], def_id /* parent id */) + ii_ctor(class_ctor, ident, [ty_param], def_id /* parent id */), + ii_dtor(class_dtor, ident, [ty_param], def_id /* parent id */) } // diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index b2e6446d7ee..10397e795ab 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -106,7 +106,7 @@ fn map_decoded_item(diag: span_handler, // don't decode and instantiate the impl, but just the method, we have to // add it to the table now: alt ii { - ii_item(_) | ii_ctor(_,_,_,_) { /* fallthrough */ } + ii_item(*) | ii_ctor(*) | ii_dtor(*) { /* fallthrough */ } ii_native(i) { cx.map.insert(i.id, node_native_item(i, native_abi_rust_intrinsic, @path)); diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index c81f6d9590f..9eee9a33af8 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -320,6 +320,7 @@ impl inlined_item_methods for inlined_item { ii_native(i) { /* FIXME: bad */ copy i.ident } ii_method(_, m) { /* FIXME: bad */ copy m.ident } ii_ctor(_, nm, _, _) { /* FIXME: bad */ copy nm } + ii_dtor(_, nm, _, _) { /* FIXME: bad */ copy nm } } } @@ -329,6 +330,7 @@ impl inlined_item_methods for inlined_item { ii_native(i) { i.id } ii_method(_, m) { m.id } ii_ctor(ctor, _, _, _) { ctor.node.id } + ii_dtor(dtor, _, _, _) { dtor.node.id } } } @@ -340,6 +342,9 @@ impl inlined_item_methods for inlined_item { ii_ctor(ctor, nm, tps, parent_id) { visit::visit_class_ctor_helper(ctor, nm, tps, parent_id, e, v); } + ii_dtor(dtor, nm, tps, parent_id) { + visit::visit_class_dtor_helper(dtor, tps, parent_id, e, v); + } } } } |
