diff options
author | Martin Probst <martin@probst.io> | 2016-04-11 07:35:57 +0000 |
---|---|---|
committer | Martin Probst <martin@probst.io> | 2016-04-11 07:35:57 +0000 |
commit | bbffeac569e89a61201ce159790f68b8493042b6 (patch) | |
tree | 85aa3c93841b370e8c44ca1fc6b048950d18cc20 /clang/lib/Format | |
parent | d8d2f62107cf72c347907a3eb6234eac99555e26 (diff) | |
download | bcm5719-llvm-bbffeac569e89a61201ce159790f68b8493042b6.tar.gz bcm5719-llvm-bbffeac569e89a61201ce159790f68b8493042b6.zip |
clang-format: [JS] do not insert semicolons after wrapped annotations.
Reviewers: djasper
Subscribers: klimek
Differential Revision: http://reviews.llvm.org/D18943
llvm-svn: 265916
Diffstat (limited to 'clang/lib/Format')
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index e36d7efffd2..b25abeae937 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -715,6 +715,13 @@ void UnwrappedLineParser::readTokenWithJavaScriptASI() { return; bool PreviousMustBeValue = mustBeJSIdentOrValue(Keywords, Previous); + if (PreviousMustBeValue && Line && Line->Tokens.size() > 1) { + // If the token before the previous one is an '@', the previous token is an + // annotation and can precede another identifier/value. + const FormatToken *PrePrevious = std::next(Line->Tokens.rend(), 2)->Tok; + if (PrePrevious->is(tok::at)) + return; + } if (Next->is(tok::exclaim) && PreviousMustBeValue) addUnwrappedLine(); bool NextMustBeValue = mustBeJSIdentOrValue(Keywords, Next); |