[PATCH] D33193: clang-format: [JS] for async loops.
Martin Probst via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 15 06:32:36 PDT 2017
mprobst marked an inline comment as done.
mprobst added inline comments.
================
Comment at: lib/Format/TokenAnnotator.cpp:583
Contexts.back().ColonIsForRangeExpr = true;
+ // for async ( ...
+ if (CurrentToken->is(Keywords.kw_async))
----------------
djasper wrote:
> Can we make this JS specific, e.g. by turning l. 579 into:
>
> if (Style.Language == FormatStyle::LK_JavaScript) {
> if (Tok->Previous && Tok->Previous->is(tok::period))
> break;
> if (CurrentToken->is(Keywords.kw_async))
> next();
> }
>
> Alternatively, leave a comment that this is JavaScript's "async"
My reasoning was that this would at best be a syntax error in other languages, so it's fine to parse. But changed to be JS specific, that might be cleaner.
https://reviews.llvm.org/D33193
More information about the cfe-commits
mailing list