mirror of https://github.com/microsoft/clang.git
clang-format: [JS] struct and union aren't keywords / reserved words.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253671 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
aaf49845dc
commit
36d78064b0
|
@ -1245,6 +1245,10 @@ private:
|
|||
FormatTok->isOneOf(tok::kw_struct, tok::kw_union, tok::kw_delete)) {
|
||||
FormatTok->Tok.setKind(tok::identifier);
|
||||
FormatTok->Tok.setIdentifierInfo(nullptr);
|
||||
} else if (Style.Language == FormatStyle::LK_JavaScript &&
|
||||
FormatTok->isOneOf(tok::kw_struct, tok::kw_union)) {
|
||||
FormatTok->Tok.setKind(tok::identifier);
|
||||
FormatTok->Tok.setIdentifierInfo(nullptr);
|
||||
}
|
||||
} else if (FormatTok->Tok.is(tok::greatergreater)) {
|
||||
FormatTok->Tok.setKind(tok::greater);
|
||||
|
|
|
@ -111,6 +111,8 @@ TEST_F(FormatTestJS, ReservedWords) {
|
|||
" interface: 1,\n"
|
||||
" switch: 1,\n"
|
||||
"};");
|
||||
verifyFormat("var struct = 2;");
|
||||
verifyFormat("var union = 2;");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJS, ES6DestructuringAssignment) {
|
||||
|
|
Loading…
Reference in New Issue