@@ -315,7 +315,6 @@ AttrVisitor::visit (AST::MacroInvocation ¯o_invoc)
315
315
// I don't think any macro token trees can be stripped in any way
316
316
317
317
// TODO: maybe have cfg! macro stripping behaviour here?
318
-
319
318
if (macro_invoc.has_semicolon ())
320
319
expander.expand_invoc_semi (macro_invoc);
321
320
else
@@ -532,23 +531,17 @@ AttrVisitor::visit (AST::ArithmeticOrLogicalExpr &expr)
532
531
* with outer expr */
533
532
auto &l_expr = expr.get_left_expr ();
534
533
l_expr->accept_vis (*this );
535
- auto l_fragment = expander.take_expanded_fragment ();
534
+ auto l_fragment = expander.take_expanded_fragment (* this );
536
535
if (l_fragment.should_expand ())
537
- {
538
- l_fragment.accept_vis (*this );
539
- l_expr = l_fragment.take_expression_fragment ();
540
- }
536
+ l_expr = l_fragment.take_expression_fragment ();
541
537
542
538
/* should syntactically not have outer attributes, though this may
543
539
* not have worked in practice */
544
540
auto &r_expr = expr.get_right_expr ();
545
541
r_expr->accept_vis (*this );
546
- auto r_fragment = expander.take_expanded_fragment ();
542
+ auto r_fragment = expander.take_expanded_fragment (* this );
547
543
if (r_fragment.should_expand ())
548
- {
549
- r_fragment.accept_vis (*this );
550
- r_expr = r_fragment.take_expression_fragment ();
551
- }
544
+ r_expr = r_fragment.take_expression_fragment ();
552
545
553
546
// ensure that they are not marked for strip
554
547
if (expr.get_left_expr ()->is_marked_for_strip ())
@@ -666,23 +659,17 @@ AttrVisitor::visit (AST::CompoundAssignmentExpr &expr)
666
659
* with outer expr */
667
660
auto &l_expr = expr.get_left_expr ();
668
661
l_expr->accept_vis (*this );
669
- auto l_frag = expander.take_expanded_fragment ();
662
+ auto l_frag = expander.take_expanded_fragment (* this );
670
663
if (l_frag.should_expand ())
671
- {
672
- l_frag.accept_vis (*this );
673
- l_expr = l_frag.take_expression_fragment ();
674
- }
664
+ l_expr = l_frag.take_expression_fragment ();
675
665
676
666
/* should syntactically not have outer attributes, though this may
677
667
* not have worked in practice */
678
668
auto &r_expr = expr.get_right_expr ();
679
669
r_expr->accept_vis (*this );
680
- auto r_frag = expander.take_expanded_fragment ();
670
+ auto r_frag = expander.take_expanded_fragment (* this );
681
671
if (r_frag.should_expand ())
682
- {
683
- r_frag.accept_vis (*this );
684
- r_expr = r_frag.take_expression_fragment ();
685
- }
672
+ r_expr = r_frag.take_expression_fragment ();
686
673
687
674
// ensure that they are not marked for strip
688
675
if (expr.get_left_expr ()->is_marked_for_strip ())
@@ -1033,10 +1020,9 @@ AttrVisitor::visit (AST::CallExpr &expr)
1033
1020
1034
1021
stmt->accept_vis (*this );
1035
1022
1036
- auto fragment = expander.take_expanded_fragment ();
1023
+ auto fragment = expander.take_expanded_fragment (* this );
1037
1024
if (fragment.should_expand ())
1038
1025
{
1039
- fragment.accept_vis (*this );
1040
1026
// Remove the current expanded invocation
1041
1027
it = params.erase (it);
1042
1028
for (auto &node : fragment.get_nodes ())
@@ -1157,10 +1143,9 @@ AttrVisitor::visit (AST::BlockExpr &expr)
1157
1143
1158
1144
stmt->accept_vis (*this );
1159
1145
1160
- auto fragment = expander.take_expanded_fragment ();
1146
+ auto fragment = expander.take_expanded_fragment (* this );
1161
1147
if (fragment.should_expand ())
1162
1148
{
1163
- fragment.accept_vis (*this );
1164
1149
// Remove the current expanded invocation
1165
1150
it = stmts.erase (it);
1166
1151
for (auto &node : fragment.get_nodes ())
@@ -1182,12 +1167,9 @@ AttrVisitor::visit (AST::BlockExpr &expr)
1182
1167
auto &tail_expr = expr.get_tail_expr ();
1183
1168
1184
1169
tail_expr->accept_vis (*this );
1185
- auto fragment = expander.take_expanded_fragment ();
1170
+ auto fragment = expander.take_expanded_fragment (* this );
1186
1171
if (fragment.should_expand ())
1187
- {
1188
- fragment.accept_vis (*this );
1189
- tail_expr = fragment.take_expression_fragment ();
1190
- }
1172
+ tail_expr = fragment.take_expression_fragment ();
1191
1173
1192
1174
if (tail_expr->is_marked_for_strip ())
1193
1175
expr.strip_tail_expr ();
@@ -3031,12 +3013,9 @@ AttrVisitor::visit (AST::LetStmt &stmt)
3031
3013
" cannot strip expression in this position - outer "
3032
3014
" attributes not allowed" );
3033
3015
3034
- auto fragment = expander.take_expanded_fragment ();
3016
+ auto fragment = expander.take_expanded_fragment (* this );
3035
3017
if (fragment.should_expand ())
3036
- {
3037
- fragment.accept_vis (*this );
3038
- init_expr = fragment.take_expression_fragment ();
3039
- }
3018
+ init_expr = fragment.take_expression_fragment ();
3040
3019
}
3041
3020
}
3042
3021
void
0 commit comments