Rename paren_rhs_stmt to paren_expression.

This CL renames paren_rhs_stmt to match the new spec name of
paren_expression.

Bug: tint:891
Change-Id: I040137d8264916ce2fecce90edad97f622be354d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96940
Reviewed-by: Ben Clayton <bclayton@google.com>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
dan sinclair 2022-07-22 16:07:36 +00:00 committed by Dawn LUCI CQ
parent 256f1116b8
commit 05288f6cff
5 changed files with 16 additions and 16 deletions

View File

@ -1369,7 +1369,7 @@ if (tint_build_unittests) {
"reader/wgsl/parser_impl_loop_stmt_test.cc", "reader/wgsl/parser_impl_loop_stmt_test.cc",
"reader/wgsl/parser_impl_multiplicative_expression_test.cc", "reader/wgsl/parser_impl_multiplicative_expression_test.cc",
"reader/wgsl/parser_impl_param_list_test.cc", "reader/wgsl/parser_impl_param_list_test.cc",
"reader/wgsl/parser_impl_paren_rhs_stmt_test.cc", "reader/wgsl/parser_impl_paren_expression_test.cc",
"reader/wgsl/parser_impl_pipeline_stage_test.cc", "reader/wgsl/parser_impl_pipeline_stage_test.cc",
"reader/wgsl/parser_impl_primary_expression_test.cc", "reader/wgsl/parser_impl_primary_expression_test.cc",
"reader/wgsl/parser_impl_relational_expression_test.cc", "reader/wgsl/parser_impl_relational_expression_test.cc",

View File

@ -966,7 +966,7 @@ if(TINT_BUILD_TESTS)
reader/wgsl/parser_impl_loop_stmt_test.cc reader/wgsl/parser_impl_loop_stmt_test.cc
reader/wgsl/parser_impl_multiplicative_expression_test.cc reader/wgsl/parser_impl_multiplicative_expression_test.cc
reader/wgsl/parser_impl_param_list_test.cc reader/wgsl/parser_impl_param_list_test.cc
reader/wgsl/parser_impl_paren_rhs_stmt_test.cc reader/wgsl/parser_impl_paren_expression_test.cc
reader/wgsl/parser_impl_pipeline_stage_test.cc reader/wgsl/parser_impl_pipeline_stage_test.cc
reader/wgsl/parser_impl_primary_expression_test.cc reader/wgsl/parser_impl_primary_expression_test.cc
reader/wgsl/parser_impl_relational_expression_test.cc reader/wgsl/parser_impl_relational_expression_test.cc

View File

@ -1567,9 +1567,9 @@ Expect<ast::BlockStatement*> ParserImpl::expect_body_stmt() {
}); });
} }
// paren_rhs_stmt // paren_expression
// : PAREN_LEFT logical_or_expression PAREN_RIGHT // : PAREN_LEFT logical_or_expression PAREN_RIGHT
Expect<const ast::Expression*> ParserImpl::expect_paren_rhs_stmt() { Expect<const ast::Expression*> ParserImpl::expect_paren_expression() {
return expect_paren_block("", [&]() -> Expect<const ast::Expression*> { return expect_paren_block("", [&]() -> Expect<const ast::Expression*> {
auto expr = logical_or_expression(); auto expr = logical_or_expression();
if (expr.errored) { if (expr.errored) {
@ -1963,7 +1963,7 @@ Maybe<const ast::IfStatement*> ParserImpl::if_stmt() {
} }
// switch_stmt // switch_stmt
// : SWITCH paren_rhs_stmt BRACKET_LEFT switch_body+ BRACKET_RIGHT // : SWITCH paren_expression BRACKET_LEFT switch_body+ BRACKET_RIGHT
Maybe<const ast::SwitchStatement*> ParserImpl::switch_stmt() { Maybe<const ast::SwitchStatement*> ParserImpl::switch_stmt() {
Source source; Source source;
if (!match(Token::Type::kSwitch, &source)) { if (!match(Token::Type::kSwitch, &source)) {
@ -2325,8 +2325,8 @@ Maybe<const ast::BlockStatement*> ParserImpl::continuing_stmt() {
// : IDENT argument_expression_list? // : IDENT argument_expression_list?
// | type_decl argument_expression_list // | type_decl argument_expression_list
// | const_literal // | const_literal
// | paren_rhs_stmt // | paren_expression
// | BITCAST LESS_THAN type_decl GREATER_THAN paren_rhs_stmt // | BITCAST LESS_THAN type_decl GREATER_THAN paren_expression
Maybe<const ast::Expression*> ParserImpl::primary_expression() { Maybe<const ast::Expression*> ParserImpl::primary_expression() {
auto t = peek(); auto t = peek();
auto source = t.source(); auto source = t.source();
@ -2340,7 +2340,7 @@ Maybe<const ast::Expression*> ParserImpl::primary_expression() {
} }
if (t.Is(Token::Type::kParenLeft)) { if (t.Is(Token::Type::kParenLeft)) {
auto paren = expect_paren_rhs_stmt(); auto paren = expect_paren_expression();
if (paren.errored) { if (paren.errored) {
return Failure::kErrored; return Failure::kErrored;
} }
@ -2356,7 +2356,7 @@ Maybe<const ast::Expression*> ParserImpl::primary_expression() {
return Failure::kErrored; return Failure::kErrored;
} }
auto params = expect_paren_rhs_stmt(); auto params = expect_paren_expression();
if (params.errored) { if (params.errored) {
return Failure::kErrored; return Failure::kErrored;
} }

View File

@ -476,9 +476,9 @@ class ParserImpl {
/// Parses a `body_stmt` grammar element, erroring on parse failure. /// Parses a `body_stmt` grammar element, erroring on parse failure.
/// @returns the parsed statements /// @returns the parsed statements
Expect<ast::BlockStatement*> expect_body_stmt(); Expect<ast::BlockStatement*> expect_body_stmt();
/// Parses a `paren_rhs_stmt` grammar element, erroring on parse failure. /// Parses a `paren_expression` grammar element, erroring on parse failure.
/// @returns the parsed element or nullptr /// @returns the parsed element or nullptr
Expect<const ast::Expression*> expect_paren_rhs_stmt(); Expect<const ast::Expression*> expect_paren_expression();
/// Parses a `statements` grammar element /// Parses a `statements` grammar element
/// @returns the statements parsed /// @returns the statements parsed
Expect<ast::StatementList> expect_statements(); Expect<ast::StatementList> expect_statements();

View File

@ -19,7 +19,7 @@ namespace {
TEST_F(ParserImplTest, ParenRhsStmt) { TEST_F(ParserImplTest, ParenRhsStmt) {
auto p = parser("(a + b)"); auto p = parser("(a + b)");
auto e = p->expect_paren_rhs_stmt(); auto e = p->expect_paren_expression();
ASSERT_FALSE(p->has_error()) << p->error(); ASSERT_FALSE(p->has_error()) << p->error();
ASSERT_FALSE(e.errored); ASSERT_FALSE(e.errored);
ASSERT_NE(e.value, nullptr); ASSERT_NE(e.value, nullptr);
@ -28,7 +28,7 @@ TEST_F(ParserImplTest, ParenRhsStmt) {
TEST_F(ParserImplTest, ParenRhsStmt_MissingLeftParen) { TEST_F(ParserImplTest, ParenRhsStmt_MissingLeftParen) {
auto p = parser("true)"); auto p = parser("true)");
auto e = p->expect_paren_rhs_stmt(); auto e = p->expect_paren_expression();
ASSERT_TRUE(p->has_error()); ASSERT_TRUE(p->has_error());
ASSERT_TRUE(e.errored); ASSERT_TRUE(e.errored);
ASSERT_EQ(e.value, nullptr); ASSERT_EQ(e.value, nullptr);
@ -37,7 +37,7 @@ TEST_F(ParserImplTest, ParenRhsStmt_MissingLeftParen) {
TEST_F(ParserImplTest, ParenRhsStmt_MissingRightParen) { TEST_F(ParserImplTest, ParenRhsStmt_MissingRightParen) {
auto p = parser("(true"); auto p = parser("(true");
auto e = p->expect_paren_rhs_stmt(); auto e = p->expect_paren_expression();
ASSERT_TRUE(p->has_error()); ASSERT_TRUE(p->has_error());
ASSERT_TRUE(e.errored); ASSERT_TRUE(e.errored);
ASSERT_EQ(e.value, nullptr); ASSERT_EQ(e.value, nullptr);
@ -46,7 +46,7 @@ TEST_F(ParserImplTest, ParenRhsStmt_MissingRightParen) {
TEST_F(ParserImplTest, ParenRhsStmt_InvalidExpression) { TEST_F(ParserImplTest, ParenRhsStmt_InvalidExpression) {
auto p = parser("(if (a() {})"); auto p = parser("(if (a() {})");
auto e = p->expect_paren_rhs_stmt(); auto e = p->expect_paren_expression();
ASSERT_TRUE(p->has_error()); ASSERT_TRUE(p->has_error());
ASSERT_TRUE(e.errored); ASSERT_TRUE(e.errored);
ASSERT_EQ(e.value, nullptr); ASSERT_EQ(e.value, nullptr);
@ -55,7 +55,7 @@ TEST_F(ParserImplTest, ParenRhsStmt_InvalidExpression) {
TEST_F(ParserImplTest, ParenRhsStmt_MissingExpression) { TEST_F(ParserImplTest, ParenRhsStmt_MissingExpression) {
auto p = parser("()"); auto p = parser("()");
auto e = p->expect_paren_rhs_stmt(); auto e = p->expect_paren_expression();
ASSERT_TRUE(p->has_error()); ASSERT_TRUE(p->has_error());
ASSERT_TRUE(e.errored); ASSERT_TRUE(e.errored);
ASSERT_EQ(e.value, nullptr); ASSERT_EQ(e.value, nullptr);