diff options
| author | Daniel Jasper <djasper@google.com> | 2014-06-13 07:02:04 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2014-06-13 07:02:04 +0000 |
| commit | 71bd6fc3cc738663bfa8888cec4be678a8a75dc6 (patch) | |
| tree | 2a1a5430524501232e4bc2dc077ed1a9f5511c87 /lib/Format/UnwrappedLineParser.cpp | |
| parent | 22b4e77bd6ac8b36a61fb1cf830c3af191950d4c (diff) | |
| download | clang-71bd6fc3cc738663bfa8888cec4be678a8a75dc6.tar.gz clang-71bd6fc3cc738663bfa8888cec4be678a8a75dc6.tar.bz2 clang-71bd6fc3cc738663bfa8888cec4be678a8a75dc6.tar.xz | |
clang-format: [JS] Understand named function literals.
Before:
return {a: function SomeFunction(){// ...
return 1;
}
}
;
After:
return {
a: function SomeFunction() {
// ...
return 1;
}
};
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210887 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/UnwrappedLineParser.cpp')
| -rw-r--r-- | lib/Format/UnwrappedLineParser.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 6a8156f92e..71ba893cf3 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -907,6 +907,11 @@ bool UnwrappedLineParser::tryToParseLambdaIntroducer() { void UnwrappedLineParser::tryToParseJSFunction() { nextToken(); + + // Consume function name. + if (FormatTok->is(tok::identifier)) + nextToken(); + if (FormatTok->isNot(tok::l_paren)) return; nextToken(); |
