Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ForeverStack APIs for Name Resolution 2.0 #2739

Merged

Conversation

CohenArthur
Copy link
Member

  • ast: Change *Path nodes API
  • rib: Add Namespace enum
  • forever-stack: Fix basic get logic
  • foreverstack: Specialize get for Namespace::Labels
  • forever stack: Fix resolve_path signature
  • forever stack: Improve resolve_path implementation
  • foreverstack: Add to_canonical_path method
  • foreverstack: Add to_rib method

This PR introduces the necessary changes from #2620 in order to make late name resolution possible. Cherry-picked, cleaned up and all changelog'ed up.

Copy link
Member

@P-E-P P-E-P left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments, otherwise LGTM

Comment on lines +402 to 403
bool is_lower_self_seg () const { return as_string ().compare ("self") == 0; }
bool is_big_self () const { return as_string ().compare ("Self") == 0; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely sure why is_lower_self got renamed, shouldn't is_big_self be renamed too ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for using them in a templated function, so that the API is consistent with other Path-like nodes. I think changing is_big_self also makes sense

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should fix this in another PR though, I'm not sure about any potential conflicts or anything later down the line

gcc/rust/resolve/rust-forever-stack.hxx Outdated Show resolved Hide resolved
@CohenArthur CohenArthur force-pushed the add-forever-stack-apis-for-nr2.0 branch from b7ffa66 to d3b3c56 Compare November 21, 2023 09:15
@CohenArthur CohenArthur added this pull request to the merge queue Nov 21, 2023
gcc/rust/ChangeLog:

	* ast/rust-ast.h: Change Path API to be more consistent.
	* ast/rust-path.h: Likewise.
	* ast/rust-ast-collector.cc (TokenCollector::visit): Use new API.
	* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Likewise.
	* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Likewise.
	* resolve/rust-forever-stack.hxx: Likewise.
gcc/rust/ChangeLog:

	* resolve/rust-rib.h: Add Namespace enum.
gcc/rust/ChangeLog:

	* resolve/rust-forever-stack.h: Improve resolve_path API.
	* resolve/rust-forever-stack.hxx: Likewise and fix implementation.
gcc/rust/ChangeLog:

	* resolve/rust-forever-stack.hxx: Add specific behavior for
	`ForeverStack::get` when dealing with labels.
gcc/rust/ChangeLog:

	* resolve/rust-forever-stack.h: Fix `ForeverStack::resolve_path`
	signature.
	* resolve/rust-forever-stack.hxx: Likewise.
	* resolve/rust-early-name-resolver-2.0.cc (Early::visit): Use new API.
	(Early::visit_attributes): Likewise.
gcc/rust/ChangeLog:

	* resolve/rust-forever-stack.hxx: Do not copy segment when
	dereferencing iterator in `find_starting_point`.
gcc/rust/ChangeLog:

	* resolve/rust-forever-stack.h: New method.
	* resolve/rust-forever-stack.hxx: Likewise.
gcc/rust/ChangeLog:

	* resolve/rust-forever-stack.h: New method.
	* resolve/rust-forever-stack.hxx: Likewise.
gcc/rust/ChangeLog:

	* resolve/rust-ast-resolve-path.cc (ResolvePath::resolve_path): Format.
gcc/rust/ChangeLog:

	* resolve/rust-forever-stack.hxx: Remove debug log.
Merged via the queue into Rust-GCC:master with commit 1a758c3 Nov 21, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants