diff options
author | Martin Probst <martin@probst.io> | 2019-08-26 15:37:05 +0000 |
---|---|---|
committer | Martin Probst <martin@probst.io> | 2019-08-26 15:37:05 +0000 |
commit | 5836472ac48884432ca9af3fd279a3b203ec98e4 (patch) | |
tree | 8af288dcabb6cb94cf0fbe574ca225e9769ca930 /clang/unittests/Format/FormatTestJS.cpp | |
parent | 0cd4ab91abee8e5de876514dcc4479aadfe4417d (diff) | |
download | bcm5719-llvm-5836472ac48884432ca9af3fd279a3b203ec98e4.tar.gz bcm5719-llvm-5836472ac48884432ca9af3fd279a3b203ec98e4.zip |
clang-format: [JS] handle `as const`.
Summary:
TypeScript 3.4 supports casting into a const type using `as const`:
const x = {x: 1} as const;
Previously, clang-format would insert a space after the `const`. With
this patch, no space is inserted after the sequence `as const`.
Reviewers: krasimir
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66736
llvm-svn: 369916
Diffstat (limited to 'clang/unittests/Format/FormatTestJS.cpp')
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index b332f1bd975..ca2093a05cc 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -1479,6 +1479,9 @@ TEST_F(FormatTestJS, TypeAnnotations) { " .someFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);"); verifyFormat("const xIsALongIdent:\n"" YJustBarelyFitsLinex[];", getGoogleJSStyleWithColumns(20)); + verifyFormat("const x = {\n" + " y: 1\n" + "} as const;"); } TEST_F(FormatTestJS, UnionIntersectionTypes) { |