File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -25,14 +25,15 @@ namespace Privacy {
25
25
26
26
VisibilityResolver::VisibilityResolver (Analysis::Mappings &mappings)
27
27
: mappings (mappings)
28
- {
29
- // FIXME: Insert a top module (crate) inside the module_stack
30
- // FIXME: Insert the visibility of the crate in the mappings maybe?
31
- }
28
+ {}
32
29
33
30
void
34
31
VisibilityResolver::go (HIR::Crate &crate)
35
32
{
33
+ module_stack.push_back (crate.get_mappings ().get_defid ());
34
+ mappings.insert_visibility (crate.get_mappings ().get_defid (),
35
+ ModuleVisibility::create_public ());
36
+
36
37
for (auto &item : crate.items )
37
38
{
38
39
if (item->get_hir_kind () == HIR::Node::VIS_ITEM)
@@ -74,7 +75,20 @@ VisibilityResolver::peek_module ()
74
75
75
76
void
76
77
VisibilityResolver::visit (HIR::Module &mod)
77
- {}
78
+ {
79
+ module_stack.push_back (mod.get_mappings ().get_defid ());
80
+
81
+ for (auto &item : mod.get_items ())
82
+ {
83
+ if (item->get_hir_kind () == HIR::Node::VIS_ITEM)
84
+ {
85
+ auto vis_item = static_cast <HIR::VisItem *> (item.get ());
86
+ vis_item->accept_vis (*this );
87
+ }
88
+ }
89
+
90
+ module_stack.pop_back ();
91
+ }
78
92
79
93
void
80
94
VisibilityResolver::visit (HIR::ExternCrate &crate)
You can’t perform that action at this time.
0 commit comments