Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion gcc/rust/resolve/rust-early-name-resolver-2.0.cc
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,9 @@ Early::finalize_glob_import (NameResolutionContext &ctx,
ctx.prelude = mapping.data.container ().get_node_id ();
}

GlobbingVisitor (ctx).go (container.value ());
GlobbingVisitor glob_visit (ctx);
glob_visit.go (container.value ());
dirty |= glob_visit.is_dirty ();
}

void
Expand Down
9 changes: 3 additions & 6 deletions gcc/rust/resolve/rust-finalize-imports-2.0.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,19 @@ GlobbingVisitor::glob_definitions (Rib &dst, Rib &src)
auto res = dst.insert (ent.first, globbed.value ());
// inserting a globbed definition should (?) always succeed
// TODO: double check
// TODO: mark fixed point as dirty/changed?
rust_assert (res.has_value ()
|| res.error ().existing
== globbed.value ().get_node_id ());
dirty |= res.has_value ();
}
}
}

tl::optional<Rib::Definition>
GlobbingVisitor::glob_definition (const Rib::Definition &def)
{
if (def.is_ambiguous ())
{
// TODO: error?
return tl::nullopt;
}
// TODO: normal error?
rust_assert (!def.is_ambiguous ());

return Rib::Definition::Globbed (def.get_node_id ());
}
Expand Down
5 changes: 4 additions & 1 deletion gcc/rust/resolve/rust-finalize-imports-2.0.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace Resolver2_0 {
class GlobbingVisitor
{
public:
GlobbingVisitor (NameResolutionContext &ctx) : ctx (ctx) {}
GlobbingVisitor (NameResolutionContext &ctx) : ctx (ctx), dirty (false) {}

void go (AST::GlobContainer *container);

Expand All @@ -41,8 +41,11 @@ class GlobbingVisitor

tl::optional<Rib::Definition> glob_definition (const Rib::Definition &def);

bool is_dirty () const { return dirty; }

private:
NameResolutionContext &ctx;
bool dirty;
};

} // namespace Resolver2_0
Expand Down
Loading