++OperatorIndex;
}
- next();
+ next(/*SkipPastLeadingComments=*/false);
}
}
}
if (Current->Type == TT_ConditionalExpr)
return prec::Conditional;
else if (Current->is(tok::semi) || Current->Type == TT_InlineASMColon ||
- Current->Type == TT_SelectorName)
+ Current->Type == TT_SelectorName ||
+ (Current->is(tok::comment) && Current->getNextNonComment() &&
+ Current->getNextNonComment()->Type == TT_SelectorName))
return 0;
else if (Current->Type == TT_RangeBasedForLoopColon)
return prec::Comma;
addFakeParenthesis(Start, prec::Conditional);
}
- void next() {
+ void next(bool SkipPastLeadingComments = true) {
if (Current)
Current = Current->Next;
- while (Current && Current->isTrailingComment())
+ while (Current &&
+ (Current->NewlinesBefore == 0 || SkipPastLeadingComments) &&
+ Current->isTrailingComment())
Current = Current->Next;
}
" f(); //\n"
" }\n"
"};");
+ verifyFormat("var stuff = {\n"
+ " // comment for update\n"
+ " update: false,\n"
+ " // comment for modules\n"
+ " modules: false,\n"
+ " // comment for tasks\n"
+ " tasks: false\n"
+ "};");
}
TEST_F(FormatTestJS, SpacesInContainerLiterals) {