From 76d92c547288d5b9a39789868465bb83e0bcead2 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 26 Sep 2013 21:53:40 -0700 Subject: librustc: Inline cross-crate tuple struct constructors --- src/libsyntax/ast_map.rs | 4 ++-- src/libsyntax/ast_util.rs | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 105d222926e..b3d5e03331c 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -403,9 +403,9 @@ pub fn map_decoded_item(diag: @mut span_handler, diag: diag, }; - // methods get added to the AST map when their impl is visited. Since we + // Methods get added to the AST map when their impl is visited. Since we // don't decode and instantiate the impl, but just the method, we have to - // add it to the table now: + // add it to the table now. Likewise with foreign items. match *ii { ii_item(*) => {} // fallthrough ii_foreign(i) => { diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index f93fc1e81da..f42eb89456d 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -590,6 +590,17 @@ impl Visitor<()> for IdVisitor { self.operation.visit_id(struct_field.node.id); visit::walk_struct_field(self, struct_field, env) } + + fn visit_struct_def(&mut self, + struct_def: @struct_def, + ident: ast::Ident, + generics: &ast::Generics, + id: NodeId, + _: ()) { + self.operation.visit_id(id); + struct_def.ctor_id.map(|&ctor_id| self.operation.visit_id(ctor_id)); + visit::walk_struct_def(self, struct_def, ident, generics, id, ()); + } } pub fn visit_ids_for_inlined_item(item: &inlined_item, -- cgit 1.4.1-3-g733a5