clang-format: [JS] Fix bug in regex literal parsing.
The lexer wasn't properly reset leading to unexpected deletions. llvm-svn: 241262
This commit is contained in:
parent
3d2ba47a90
commit
55c384e039
|
@ -1227,6 +1227,7 @@ private:
|
|||
getFormattingLangOpts(Style), Buffer.begin(),
|
||||
Buffer.begin() + Offset, Buffer.end()));
|
||||
Lex->SetKeepWhitespaceMode(true);
|
||||
TrailingWhitespace = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -631,6 +631,7 @@ TEST_F(FormatTestJS, RegexLiteralSpecialCharacters) {
|
|||
"var x = 0;",
|
||||
format("var regex = /\\/*/;\n"
|
||||
"var x=0;"));
|
||||
EXPECT_EQ("var x = /a\\//;", format("var x = /a\\// \n;"));
|
||||
verifyFormat("var regex = /\"/;", getGoogleJSStyleWithColumns(16));
|
||||
verifyFormat("var regex =\n"
|
||||
" /\"/;",
|
||||
|
|
Loading…
Reference in New Issue