diff options
Diffstat (limited to 'lib/Format')
| -rw-r--r-- | lib/Format/Format.cpp | 3 | ||||
| -rw-r--r-- | lib/Format/UnwrappedLineParser.cpp | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index 70b90d6fa14e..389761d48249 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -638,6 +638,9 @@ FormatStyle getChromiumStyle(FormatStyle::LanguageKind Language) { ChromiumStyle.BreakAfterJavaFieldAnnotations = true; ChromiumStyle.ContinuationIndentWidth = 8; ChromiumStyle.IndentWidth = 4; + } else if (Language == FormatStyle::LK_JavaScript) { + ChromiumStyle.AllowShortIfStatementsOnASingleLine = false; + ChromiumStyle.AllowShortLoopsOnASingleLine = false; } else { ChromiumStyle.AllowAllParametersOfDeclarationOnNextLine = false; ChromiumStyle.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline; diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 84e06d05c739..370cf7afa330 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -1255,10 +1255,13 @@ void UnwrappedLineParser::tryToParseJSFunction() { if (FormatTok->is(tok::l_brace)) tryToParseBracedList(); else - while (FormatTok->isNot(tok::l_brace) && !eof()) + while (!FormatTok->isOneOf(tok::l_brace, tok::semi) && !eof()) nextToken(); } + if (FormatTok->is(tok::semi)) + return; + parseChildBlock(); } |
