[all-commits] [llvm/llvm-project] 70ae84: clang-format: [JS] do not wrap after `asserts`

Martin Probst via All-commits all-commits at lists.llvm.org
Wed Apr 21 07:34:30 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 70ae843d99808b19247e968507c0019225597066
      https://github.com/llvm/llvm-project/commit/70ae843d99808b19247e968507c0019225597066
  Author: Martin Probst <martin at probst.io>
  Date:   2021-04-21 (Wed, 21 Apr 2021)

  Changed paths:
    M clang/lib/Format/TokenAnnotator.cpp
    M clang/unittests/Format/FormatTestJS.cpp

  Log Message:
  -----------
  clang-format: [JS] do not wrap after `asserts`

`asserts` is a pseudo keyword in TypeScript used in return types.
Wrapping after it triggers automatic semicolon insertion, which
breaks the code semantics/syntax.

`asserts` is different from other pseudo keywords in that it is
specific to TS and only carries meaning in a very specific location.
Thus introducing a token type is probably overkill.

Differential Revision: https://reviews.llvm.org/D100953




More information about the All-commits mailing list