[PATCH] clang-format: [JS] support optional methods.

Martin Probst martinprobst at google.com
Mon May 4 16:56:29 PDT 2015


Hi djasper,

Optional methods use `?` tokens like this:

    interface X { y?(): z; }

It seems easiest to detect and disambiguate these
from ternary expressions by checking if the code
is in a declaration context. Turns out that that
didn't quite work properly for interfaces in Java
and JS, and for JS file root contexts.

http://reviews.llvm.org/D9491

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

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9491.24925.patch
Type: text/x-patch
Size: 5323 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150504/4a004855/attachment.bin>


More information about the cfe-commits mailing list