[[fallthrough]];
}
case tok::kw_case:
- if (Style.isVerilog() ||
+ if (Style.isProto() || Style.isVerilog() ||
(Style.isJavaScript() && Line->MustBeDeclaration)) {
+ // Proto: there are no switch/case statements
// Verilog: Case labels don't have this word. We handle case
// labels including default in TokenAnnotator.
// JavaScript: A 'case: string' style field declaration.
// e.g. "default void f() {}" in a Java interface.
break;
case tok::kw_case:
- // In Verilog switch is called case.
+ // Proto: there are no switch/case statements.
+ if (Style.isProto()) {
+ nextToken();
+ return;
+ }
if (Style.isVerilog()) {
parseBlock();
addUnwrappedLine();
parseNew();
break;
case tok::kw_case:
+ // Proto: there are no switch/case statements.
+ if (Style.isProto()) {
+ nextToken();
+ return;
+ }
// In Verilog switch is called case.
if (Style.isVerilog()) {
parseBlock();
"}");
}
+TEST_F(FormatTestProto, CaseAsFieldName) {
+ verifyFormat("message SomeMessage {\n"
+ " required string case = 1;\n"
+ " repeated int32 fizz = 2;\n"
+ "}");
+}
+
TEST_F(FormatTestProto, UnderstandsReturns) {
verifyFormat("rpc Search(SearchRequest) returns (SearchResponse);");
}