public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] ast: Fix StructExprStruct tokenstream
@ 2023-04-18 16:45 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-04-18 16:45 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:ac79c65365bdbcee00916e3785fd6bb8aeee0ba2
commit ac79c65365bdbcee00916e3785fd6bb8aeee0ba2
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date: Wed Apr 5 13:45:36 2023 +0200
ast: Fix StructExprStruct tokenstream
StructExprStructFields inherit from StructExprStruct and shall output
the struct name and curly braces.
gcc/rust/ChangeLog:
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Add struct
name and curly braces to output tokenstream.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diff:
---
gcc/rust/ast/rust-ast-tokenstream.cc | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/gcc/rust/ast/rust-ast-tokenstream.cc b/gcc/rust/ast/rust-ast-tokenstream.cc
index 8c54141fd78..cdfd8701c6d 100644
--- a/gcc/rust/ast/rust-ast-tokenstream.cc
+++ b/gcc/rust/ast/rust-ast-tokenstream.cc
@@ -1111,11 +1111,6 @@ void
TokenStream::visit (StructExprStruct &expr)
{
visit (expr.get_struct_name ());
- tokens.push_back (Rust::Token::make (LEFT_CURLY, expr.get_locus ()));
- // FIXME: Reference says it should have fields but node doesn't have them for
- // now. We need to disambiguate with StructExprUnit and visit fields.
- gcc_unreachable ();
- tokens.push_back (Rust::Token::make (RIGHT_CURLY, Location ()));
}
void
@@ -1161,6 +1156,8 @@ TokenStream::visit (StructBase &base)
void
TokenStream::visit (StructExprStructFields &expr)
{
+ visit (expr.get_struct_name ());
+ tokens.push_back (Rust::Token::make (LEFT_CURLY, expr.get_locus ()));
visit_items_joined_by_separator (expr.get_fields (), COMMA);
if (expr.has_struct_base ())
{
@@ -1171,6 +1168,7 @@ TokenStream::visit (StructExprStructFields &expr)
{
trailing_comma ();
}
+ tokens.push_back (Rust::Token::make (RIGHT_CURLY, expr.get_locus ()));
}
void
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-18 16:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 16:45 [gcc/devel/rust/master] ast: Fix StructExprStruct tokenstream Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).