r307034 - Revert "clang-format: [JS] space between pseudo keywords and template literals."

Martin Probst via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 3 08:31:29 PDT 2017


Author: mprobst
Date: Mon Jul  3 08:31:28 2017
New Revision: 307034

URL: http://llvm.org/viewvc/llvm-project?rev=307034&view=rev
Log:
Revert "clang-format: [JS] space between pseudo keywords and template literals."

This reverts commit 71d3b5cd916106005ef23467e3f6c7fbca7bc499.

Modified:
    cfe/trunk/lib/Format/TokenAnnotator.cpp
    cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=307034&r1=307033&r2=307034&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Jul  3 08:31:28 2017
@@ -2319,11 +2319,7 @@ bool TokenAnnotator::spaceRequiredBefore
     if ((Left.is(TT_TemplateString) && Left.TokenText.endswith("${")) ||
         (Right.is(TT_TemplateString) && Right.TokenText.startswith("}")))
       return false;
-    // In tagged template literals ("html`bar baz`"), there is no space between
-    // the tag identifier and the template string. getIdentifierInfo makes sure
-    // that the identifier is not a pseudo keyword like `yield`, either.
-    if (Left.is(tok::identifier) && Left.Tok.getIdentifierInfo() == nullptr &&
-        Right.is(TT_TemplateString))
+    if (Left.is(tok::identifier) && Right.is(TT_TemplateString))
       return false;
     if (Right.is(tok::star) &&
         Left.isOneOf(Keywords.kw_function, Keywords.kw_yield))

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=307034&r1=307033&r2=307034&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Mon Jul  3 08:31:28 2017
@@ -1564,7 +1564,6 @@ TEST_F(FormatTestJS, TemplateStrings) {
                "                               aaaaa(  //\n"
                "                                   aaaaa)\n"
                "                             })`);");
-  verifyFormat("yield `hello`;");
 }
 
 TEST_F(FormatTestJS, TemplateStringMultiLineExpression) {




More information about the cfe-commits mailing list