diff options
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/expand/rust-macro-expand.cc | 16 | ||||
-rw-r--r-- | gcc/rust/expand/rust-macro-expand.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc index 2620fea..852e619 100644 --- a/gcc/rust/expand/rust-macro-expand.cc +++ b/gcc/rust/expand/rust-macro-expand.cc @@ -909,6 +909,19 @@ transcribe_expression (Parser<MacroInvocLexer> &parser) return {AST::SingleASTNode (std::move (expr))}; } +/** + * Transcribe one type from a macro invocation + * + * @param parser Parser to extract statements from + */ +static std::vector<AST::SingleASTNode> +transcribe_type (Parser<MacroInvocLexer> &parser) +{ + auto expr = parser.parse_type (); + + return {AST::SingleASTNode (std::move (expr))}; +} + static std::vector<AST::SingleASTNode> transcribe_on_delimiter (Parser<MacroInvocLexer> &parser, bool semicolon, AST::DelimType delimiter, TokenId last_token_id) @@ -957,6 +970,9 @@ transcribe_context (MacroExpander::ContextType ctx, case MacroExpander::ContextType::EXTERN: return transcribe_many_ext (parser, last_token_id); break; + case MacroExpander::ContextType::TYPE: + return transcribe_type (parser); + break; default: return transcribe_on_delimiter (parser, semicolon, delimiter, last_token_id); diff --git a/gcc/rust/expand/rust-macro-expand.h b/gcc/rust/expand/rust-macro-expand.h index f08525f..3cac617 100644 --- a/gcc/rust/expand/rust-macro-expand.h +++ b/gcc/rust/expand/rust-macro-expand.h @@ -188,6 +188,7 @@ struct MacroExpander ITEM, BLOCK, EXTERN, + TYPE, TRAIT, IMPL, TRAIT_IMPL, |