[clang] [clang-format] js handle anonymous classes (PR #106242)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 28 01:59:15 PDT 2024


================
@@ -3238,6 +3238,12 @@ TEST_F(TokenAnnotatorTest, BraceKind) {
   EXPECT_BRACE_KIND(Tokens[8], BK_BracedInit);
   EXPECT_BRACE_KIND(Tokens[11], BK_BracedInit);
   EXPECT_BRACE_KIND(Tokens[13], BK_Block);
+
+  Tokens = annotate("a = class extends goog.a {}",
+                    getGoogleStyle(FormatStyle::LanguageKind::LK_JavaScript));
+  ASSERT_EQ(Tokens.size(), 10u) << Tokens;
----------------
owenca wrote:

```suggestion
  Tokens = annotate("a = class extends goog.a {};",
                    getGoogleStyle(FormatStyle::LK_JavaScript));
  ASSERT_EQ(Tokens.size(), 11u) << Tokens;
```

https://github.com/llvm/llvm-project/pull/106242


More information about the cfe-commits mailing list