diff options
author | Daniel Jasper <djasper@google.com> | 2015-03-31 14:34:15 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-03-31 14:34:15 +0000 |
commit | f46dec86b647ea5bebeb08eaf4d51471c930f1ba (patch) | |
tree | c7a84166a184e33144e9c86223d5e64b629a9c7a /clang/lib/Format | |
parent | 462501ee7e05d9ccad2515277159f818c181b6ae (diff) | |
download | bcm5719-llvm-f46dec86b647ea5bebeb08eaf4d51471c930f1ba.tar.gz bcm5719-llvm-f46dec86b647ea5bebeb08eaf4d51471c930f1ba.zip |
clang-format: [JS] Support getters, setters and methods in object literals.
llvm-svn: 233698
Diffstat (limited to 'clang/lib/Format')
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index a036fb29da3..7e8efad26b6 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1036,6 +1036,17 @@ bool UnwrappedLineParser::parseBracedList(bool ContinueOnSemicolons) { FormatTok->BlockKind = BK_BracedInit; parseBracedList(); break; + case tok::r_paren: + // JavaScript can just have free standing methods and getters/setters in + // object literals. Detect them by a "{" following ")". + if (Style.Language == FormatStyle::LK_JavaScript) { + nextToken(); + if (FormatTok->is(tok::l_brace)) + parseChildBlock(); + break; + } + nextToken(); + break; case tok::r_brace: nextToken(); return !HasError; |