clang-format: [JS] Support ES6 spread operator.
Specifically, don't add a space before it.
Before:
someFunction(... a);
var x = [1, 2, ... a];
After:
someFunction(...a);
var x = [1, 2, ...a];
llvm-svn: 238183
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index 1481ef0..d5625a2 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/unittests/Format/FormatTestJS.cpp
@@ -82,6 +82,10 @@
verifyFormat("var b = a.map((x) => x + 1);");
verifyFormat("return ('aaa') in bbbb;");
+
+ // ES6 spread operator.
+ verifyFormat("someFunction(...a);");
+ verifyFormat("var x = [1, ...a, 2];");
}
TEST_F(FormatTestJS, UnderstandsAmpAmp) {