[PATCH] clang-format: [JS] Allow periods and commata in class declarations
Martin Probst
martinprobst at google.com
Sat Apr 11 17:11:05 PDT 2015
Hi djasper,
http://reviews.llvm.org/D8992
Files:
lib/Format/UnwrappedLineParser.cpp
unittests/Format/FormatTestJS.cpp
Index: lib/Format/UnwrappedLineParser.cpp
===================================================================
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -1541,7 +1541,8 @@
// it is often token-pasted.
while (FormatTok->is(tok::identifier) || FormatTok->is(tok::coloncolon) ||
FormatTok->is(tok::hashhash) ||
- (Style.Language == FormatStyle::LK_Java &&
+ ((Style.Language == FormatStyle::LK_Java ||
+ Style.Language == FormatStyle::LK_JavaScript) &&
FormatTok->isOneOf(tok::period, tok::comma)))
nextToken();
Index: unittests/Format/FormatTestJS.cpp
===================================================================
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -544,6 +544,7 @@
verifyFormat("class C {\n private static x: string = 12;\n}");
verifyFormat("class C {\n static x(): string { return 'asd'; }\n}");
verifyFormat("class C extends P implements I {}");
+ verifyFormat("class C extends p.P implements i.I {}");
}
TEST_F(FormatTestJS, MetadataAnnotations) {
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8992.23652.patch
Type: text/x-patch
Size: 1130 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150412/e0a57b7f/attachment.bin>
More information about the cfe-commits
mailing list