diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-04-04 11:24:44 +0200 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2023-04-05 08:09:09 +0000 |
commit | 75ec5f4f4879b96afcf6eec70dad81b9c59d4172 (patch) | |
tree | 1231d2b8dc3f39ce618fa47ef3c671a492127ef8 /gcc | |
parent | f749a7fa0b411b6d71e81ff5a95c3bad54eca09b (diff) | |
download | gcc-75ec5f4f4879b96afcf6eec70dad81b9c59d4172.zip gcc-75ec5f4f4879b96afcf6eec70dad81b9c59d4172.tar.gz gcc-75ec5f4f4879b96afcf6eec70dad81b9c59d4172.tar.bz2 |
ast: Fix tokenstream extern block statements
The visitor created some additional semicolon between statements in
extern blocks, this lead to empty statement.
gcc/rust/ChangeLog:
* ast/rust-ast-tokenstream.cc (TokenStream::visit): Remove
additional semicolon output.
* ast/rust-ast-tokenstream.h: Change block visitor prototype
with a default value for trailing tokens.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/ast/rust-ast-tokenstream.cc | 3 | ||||
-rw-r--r-- | gcc/rust/ast/rust-ast-tokenstream.h | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/gcc/rust/ast/rust-ast-tokenstream.cc b/gcc/rust/ast/rust-ast-tokenstream.cc index f965b4d..b947309 100644 --- a/gcc/rust/ast/rust-ast-tokenstream.cc +++ b/gcc/rust/ast/rust-ast-tokenstream.cc @@ -2243,8 +2243,7 @@ TokenStream::visit (ExternBlock &block) Rust::Token::make_string (Location (), std::move (abi))); } - visit_items_as_block (block.get_extern_items (), - {Rust::Token::make (SEMICOLON, Location ())}); + visit_items_as_block (block.get_extern_items ()); } static std::pair<TokenId, TokenId> diff --git a/gcc/rust/ast/rust-ast-tokenstream.h b/gcc/rust/ast/rust-ast-tokenstream.h index e580335..8ce25e1 100644 --- a/gcc/rust/ast/rust-ast-tokenstream.h +++ b/gcc/rust/ast/rust-ast-tokenstream.h @@ -85,7 +85,7 @@ private: * collection to print only the delimiters with no new line inside. */ template <typename T> - void visit_items_as_block (T &collection, std::vector<TokenPtr> trailing, + void visit_items_as_block (T &collection, std::vector<TokenPtr> trailing = {}, TokenId left_brace = LEFT_CURLY, TokenId right_brace = RIGHT_CURLY); |