|
@@ -326,6 +326,11 @@ void UnwrappedLineParser::parseLevel(bool HasOpeningBrace) {
|
|
break;
|
|
break;
|
|
case tok::kw_default:
|
|
case tok::kw_default:
|
|
case tok::kw_case:
|
|
case tok::kw_case:
|
|
|
|
+ if (Style.Language == FormatStyle::LK_JavaScript && Line->MustBeDeclaration) {
|
|
|
|
+ // A 'case: string' style field declaration.
|
|
|
|
+ parseStructuralElement();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
if (!SwitchLabelEncountered &&
|
|
if (!SwitchLabelEncountered &&
|
|
(Style.IndentCaseLabels || (Line->InPPDirective && Line->Level == 1)))
|
|
(Style.IndentCaseLabels || (Line->InPPDirective && Line->Level == 1)))
|
|
++Line->Level;
|
|
++Line->Level;
|
|
@@ -953,13 +958,22 @@ void UnwrappedLineParser::parseStructuralElement() {
|
|
parseDoWhile();
|
|
parseDoWhile();
|
|
return;
|
|
return;
|
|
case tok::kw_switch:
|
|
case tok::kw_switch:
|
|
|
|
+ if (Style.Language == FormatStyle::LK_JavaScript && Line->MustBeDeclaration)
|
|
|
|
+ // 'switch: string' field declaration.
|
|
|
|
+ break;
|
|
parseSwitch();
|
|
parseSwitch();
|
|
return;
|
|
return;
|
|
case tok::kw_default:
|
|
case tok::kw_default:
|
|
|
|
+ if (Style.Language == FormatStyle::LK_JavaScript && Line->MustBeDeclaration)
|
|
|
|
+ // 'default: string' field declaration.
|
|
|
|
+ break;
|
|
nextToken();
|
|
nextToken();
|
|
parseLabel();
|
|
parseLabel();
|
|
return;
|
|
return;
|
|
case tok::kw_case:
|
|
case tok::kw_case:
|
|
|
|
+ if (Style.Language == FormatStyle::LK_JavaScript && Line->MustBeDeclaration)
|
|
|
|
+ // 'case: string' field declaration.
|
|
|
|
+ break;
|
|
parseCaseLabel();
|
|
parseCaseLabel();
|
|
return;
|
|
return;
|
|
case tok::kw_try:
|
|
case tok::kw_try:
|