]> git.ipfire.org Git - thirdparty/gcc.git/commit
Use stacked context for nested bindings.
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Sun, 6 Apr 2025 16:49:11 +0000 (18:49 +0200)
committerP-E-P <32375388+P-E-P@users.noreply.github.com>
Thu, 24 Apr 2025 16:53:44 +0000 (16:53 +0000)
commit7acf75a3af9b367a3afdc8d465f1e34b6fb83e19
tree6b87b09e7c9709f5cebee171540c5f106c3beefc
parent5d6320ceb3b00a7ea6b988ec55c772f563dfd675
Use stacked context for nested bindings.

Binding context may be stacked when a new binding group is introduced
within a const expression.

gcc/rust/ChangeLog:

* resolve/rust-name-resolution-context.h: Use BindingLayer instead.
* resolve/rust-name-resolution-context.cc (BindingLayer::BindingLayer):
Add new constructor for binding layer.
(BindingLayer::bind_test): Add a function to test a binding constraint.
(BindingLayer::push): Push a new binding group.
(BindingLayer::and_binded): Add function to test and-binding
constraint.
(BindingLayer::or_binded): Add function to test or-binding constraints.
(BindingLayer::insert_ident): Insert a new identifier in the current
binding group.
(BindingLayer::merge): Merge current binding group with it's parent.
(BindingLayer::get_source): Get the source of the current binding
group.
* resolve/rust-late-name-resolver-2.0.cc: Use stacked context for
binding group.
* util/rust-stacked-contexts.h: Add mutable peek function.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/resolve/rust-late-name-resolver-2.0.cc
gcc/rust/resolve/rust-name-resolution-context.cc
gcc/rust/resolve/rust-name-resolution-context.h
gcc/rust/util/rust-stacked-contexts.h