r286468 - clang-format: [JS] do not break after declare namespace.
Martin Probst via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 10 08:21:02 PST 2016
Author: mprobst
Date: Thu Nov 10 10:21:02 2016
New Revision: 286468
URL: http://llvm.org/viewvc/llvm-project?rev=286468&view=rev
Log:
clang-format: [JS] do not break after declare namespace.
Summary:
See TypeScript grammar for tokens following 'declare':
https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#A.10
Additional minor change:
clang-format: [JS] Prevent ASI before const.
Reviewers: djasper
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D26274
Modified:
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=286468&r1=286467&r2=286468&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Thu Nov 10 10:21:02 2016
@@ -669,14 +669,14 @@ static bool mustBeJSIdent(const Addition
// FIXME: This returns true for C/C++ keywords like 'struct'.
return FormatTok->is(tok::identifier) &&
(FormatTok->Tok.getIdentifierInfo() == nullptr ||
- !FormatTok->isOneOf(Keywords.kw_in, Keywords.kw_of, Keywords.kw_as,
- Keywords.kw_async, Keywords.kw_await,
- Keywords.kw_yield, Keywords.kw_finally,
- Keywords.kw_function, Keywords.kw_import,
- Keywords.kw_is, Keywords.kw_let, Keywords.kw_var,
- Keywords.kw_abstract, Keywords.kw_extends,
- Keywords.kw_implements, Keywords.kw_instanceof,
- Keywords.kw_interface, Keywords.kw_throws));
+ !FormatTok->isOneOf(
+ Keywords.kw_in, Keywords.kw_of, Keywords.kw_as, Keywords.kw_async,
+ Keywords.kw_await, Keywords.kw_yield, Keywords.kw_finally,
+ Keywords.kw_function, Keywords.kw_import, Keywords.kw_is,
+ Keywords.kw_let, Keywords.kw_var, tok::kw_const,
+ Keywords.kw_abstract, Keywords.kw_extends, Keywords.kw_implements,
+ Keywords.kw_instanceof, Keywords.kw_interface,
+ Keywords.kw_throws));
}
static bool mustBeJSIdentOrValue(const AdditionalKeywords &Keywords,
More information about the cfe-commits
mailing list