[PATCH] D73335: clang-format: [JS] options for arrow functions.

Martin Probst via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 24 02:35:14 PST 2020


mprobst created this revision.
mprobst added a reviewer: krasimir.
Herald added a project: clang.

clang-format currently always wraps the body of non-empty arrow
functions:

  const x = () => {
    z();
  };

This change implements support for the `AllowShortLambdasOnASingleLine`
style options, and also sets the default Google style to `SLS_All`, i.e.
to indent arrow function bodies that have one or fewer statements on a
single line:

  const x = () => { z(); };

Multi-statement arrow functions continue to be wrapped. Function
expressions (`a = function() {}`) and function/method declarations are
unaffected as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73335

Files:
  clang/lib/Format/Format.cpp
  clang/lib/Format/TokenAnnotator.cpp
  clang/unittests/Format/FormatTestJS.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73335.240134.patch
Type: text/x-patch
Size: 4661 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200124/2dc2e5bb/attachment.bin>


More information about the cfe-commits mailing list