tint/reader/wgsl: Remove case_body()
This was not used.
Change-Id: Ic79993be201a2f02c6dc2dc8d92d1aea2f382fe4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124221
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn
index 20c999c..b065ed0 100644
--- a/src/tint/BUILD.gn
+++ b/src/tint/BUILD.gn
@@ -1751,7 +1751,6 @@
"reader/wgsl/parser_impl_break_stmt_test.cc",
"reader/wgsl/parser_impl_bug_cases_test.cc",
"reader/wgsl/parser_impl_call_stmt_test.cc",
- "reader/wgsl/parser_impl_case_body_test.cc",
"reader/wgsl/parser_impl_compound_stmt_test.cc",
"reader/wgsl/parser_impl_const_literal_test.cc",
"reader/wgsl/parser_impl_continue_stmt_test.cc",
diff --git a/src/tint/CMakeLists.txt b/src/tint/CMakeLists.txt
index 47f13ea..d9b9469 100644
--- a/src/tint/CMakeLists.txt
+++ b/src/tint/CMakeLists.txt
@@ -1104,7 +1104,6 @@
reader/wgsl/parser_impl_break_stmt_test.cc
reader/wgsl/parser_impl_bug_cases_test.cc
reader/wgsl/parser_impl_call_stmt_test.cc
- reader/wgsl/parser_impl_case_body_test.cc
reader/wgsl/parser_impl_compound_stmt_test.cc
reader/wgsl/parser_impl_const_literal_test.cc
reader/wgsl/parser_impl_continue_stmt_test.cc
diff --git a/src/tint/reader/wgsl/parser_impl.cc b/src/tint/reader/wgsl/parser_impl.cc
index e4a8367..38d9aa2 100644
--- a/src/tint/reader/wgsl/parser_impl.cc
+++ b/src/tint/reader/wgsl/parser_impl.cc
@@ -1730,36 +1730,6 @@
return create<ast::CaseSelector>(p.source(), expr.value);
}
-// case_body
-// :
-// | statement case_body
-Maybe<const ast::BlockStatement*> ParserImpl::case_body() {
- StatementList stmts;
- while (continue_parsing()) {
- Source source;
- if (match(Token::Type::kFallthrough, &source)) {
- return add_error(
- source,
- "fallthrough is not premitted in WGSL. "
- "Case can accept multiple selectors if the existing case bodies are empty. "
- "(e.g. `case 1, 2, 3:`) "
- "`default` is a valid case selector value. (e.g. `case 1, default:`)");
- }
-
- auto stmt = statement();
- if (stmt.errored) {
- return Failure::kErrored;
- }
- if (!stmt.matched) {
- break;
- }
-
- stmts.Push(stmt.value);
- }
-
- return create<ast::BlockStatement>(Source{}, stmts, utils::Empty);
-}
-
// loop_statement
// : LOOP BRACKET_LEFT statements continuing_statement? BRACKET_RIGHT
Maybe<const ast::LoopStatement*> ParserImpl::loop_statement() {
diff --git a/src/tint/reader/wgsl/parser_impl.h b/src/tint/reader/wgsl/parser_impl.h
index d7b787b..7ad2e6f 100644
--- a/src/tint/reader/wgsl/parser_impl.h
+++ b/src/tint/reader/wgsl/parser_impl.h
@@ -509,9 +509,6 @@
/// Parses a `case_selector` grammar element
/// @returns the selector
Maybe<const ast::CaseSelector*> case_selector();
- /// Parses a `case_body` grammar element
- /// @returns the parsed statements
- Maybe<const ast::BlockStatement*> case_body();
/// Parses a `func_call_statement` grammar element
/// @returns the parsed function call or nullptr
Maybe<const ast::CallStatement*> func_call_statement();
diff --git a/src/tint/reader/wgsl/parser_impl_case_body_test.cc b/src/tint/reader/wgsl/parser_impl_case_body_test.cc
deleted file mode 100644
index 4d60e23..0000000
--- a/src/tint/reader/wgsl/parser_impl_case_body_test.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2020 The Tint Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "src/tint/reader/wgsl/parser_impl_test_helper.h"
-
-namespace tint::reader::wgsl {
-namespace {
-
-TEST_F(ParserImplTest, CaseBody_Empty) {
- auto p = parser("");
- auto e = p->case_body();
- ASSERT_FALSE(p->has_error()) << p->error();
- EXPECT_FALSE(e.errored);
- EXPECT_TRUE(e.matched);
- EXPECT_EQ(e->statements.Length(), 0u);
-}
-
-TEST_F(ParserImplTest, CaseBody_Statements) {
- auto p = parser(R"(
- var a: i32;
- a = 2;)");
-
- auto e = p->case_body();
- ASSERT_FALSE(p->has_error()) << p->error();
- EXPECT_FALSE(e.errored);
- EXPECT_TRUE(e.matched);
- ASSERT_EQ(e->statements.Length(), 2u);
- EXPECT_TRUE(e->statements[0]->Is<ast::VariableDeclStatement>());
- EXPECT_TRUE(e->statements[1]->Is<ast::AssignmentStatement>());
-}
-
-TEST_F(ParserImplTest, CaseBody_InvalidStatement) {
- auto p = parser("a =");
- auto e = p->case_body();
- EXPECT_TRUE(p->has_error());
- EXPECT_TRUE(e.errored);
- EXPECT_FALSE(e.matched);
- EXPECT_EQ(e.value, nullptr);
-}
-
-} // namespace
-} // namespace tint::reader::wgsl