-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for ambiguous use declarations
Glob use declarations may lead to ambiguous situation where two definitions with the same name are imported in a given scope. The compiler now handles shadowable items inserted after non shadowable items. An error is now thrown when multiple shadowable items are imported and used in the same rib. gcc/rust/ChangeLog: * resolve/rust-early-name-resolver-2.0.cc (Early::visit): Adapt resolved type to the new API. (Early::visit_attributes): Retrieve the node id from the definition. * resolve/rust-forever-stack.h: Change the return type of getter functions. Those functions now return a definition type instead of a node id. * resolve/rust-forever-stack.hxx: Change member function implementation in the forever stack to accomodate it's API changes. * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Use internal node id. Emit an error when resolving multiple ambiguous values. * resolve/rust-rib.cc (Rib::Definition::Definition): Add a default constructor. (Rib::Definition::is_ambiguous): Add a new function to determine whether a function definition is ambiguous or not. (Rib::Definition::to_string): Add a member function to convert a given definition to a string. (Rib::insert): Add new rules for value insertion in a rib. Insertion order does not impact the result anymore: inserting a shadowable value after a non shadowable one does not trigger an error anymore. All shadowable values inserted in a rib are kepts until being replaced by a non shadowable one. (Rib::get): Return a definition instead of a node id. * resolve/rust-rib.h: Update function prototypes. * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_glob): Update return value container to match the new function's prototype. (TopLevel::handle_use_dec): Likewise. (flatten_glob): Likewise. Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
- Loading branch information
Showing
7 changed files
with
141 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.