File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -961,7 +961,8 @@ transcribe_expression (Parser<MacroInvocLexer> &parser)
961961 auto &lexer = parser.get_token_source ();
962962 auto start = lexer.get_offs ();
963963
964- auto expr = parser.parse_expr ();
964+ auto attrs = parser.parse_outer_attributes ();
965+ auto expr = parser.parse_expr (std::move (attrs));
965966 if (expr == nullptr )
966967 return AST::Fragment::create_error ();
967968
Original file line number Diff line number Diff line change @@ -212,6 +212,11 @@ template <typename ManagedTokenSource> class Parser
212212 std::unique_ptr<AST::MacroInvocation>
213213 parse_macro_invocation (AST::AttrVec outer_attrs);
214214
215+ /*
216+ * This has to be public for parsing expressions with outer attributes
217+ */
218+ AST::AttrVec parse_outer_attributes ();
219+
215220private:
216221 void skip_after_semicolon ();
217222 void skip_after_end ();
@@ -228,7 +233,6 @@ template <typename ManagedTokenSource> class Parser
228233
229234 // AST-related stuff - maybe move or something?
230235 AST::Attribute parse_inner_attribute ();
231- AST::AttrVec parse_outer_attributes ();
232236 AST::Attribute parse_outer_attribute ();
233237 std::unique_ptr<AST::AttrInput> parse_attr_input ();
234238 std::tuple<AST::SimplePath, std::unique_ptr<AST::AttrInput>, location_t >
Original file line number Diff line number Diff line change 1+ macro_rules! foo {
2+ ( ) => { #[ cfg( all( ) ) ] 12 }
3+ }
4+
5+ fn main ( ) -> i32 {
6+ foo ! ( )
7+ }
You can’t perform that action at this time.
0 commit comments