[PATCH] D105087: [clang-format] PR49960 clang-format doesn't handle ASI after "return" on JavaScript
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 1 03:28:52 PDT 2021
MyDeveloperDay marked 2 inline comments as done.
MyDeveloperDay added inline comments.
================
Comment at: clang/lib/Format/UnwrappedLineParser.cpp:1019
+ FormatToken *NextNext = Tokens->getNextToken();
+ Tokens->setPosition(StoredPosition);
+ if (NextNext && NextNext->is(tok::equal))
----------------
mprobst wrote:
> parsePPEndIf uses a different method to peek - any opinion on why you're doing it differently here?
I'm not entirely convinced parsePPEndIf IS looking at the next token
shouldn't
```
unsigned TokenPosition = Tokens->getPosition();
FormatToken *PeekNext = AllTokens[TokenPosition];
```
be
```
unsigned TokenPosition = Tokens->getPosition();
FormatToken *PeekNext = AllTokens[TokenPosition+1];
```
I followed the pattern in `parseStructuralElement()` but I think I should avoid that repitition by adding a function
also from elsewhere we see this:
`FormatToken *Previous = AllTokens[Tokens->getPosition() - 1];`
and so by definition, I would think it was.
`FormatToken *CurrentToken= AllTokens[Tokens->getPosition()];`
`FormatToken *NextToken= AllTokens[Tokens->getPosition() + 1];`
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105087/new/
https://reviews.llvm.org/D105087
More information about the cfe-commits
mailing list