mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
Remove regardless.
This CL removes the regardless statement and turns `regardless` into a reserved word. Change-Id: I50c521111b90dbadddaeb36674e8c40205186076 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19361 Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
committed by
dan sinclair
parent
2a3e79cf8c
commit
efb5d4e10f
@@ -39,7 +39,6 @@
|
||||
#include "src/ast/location_decoration.h"
|
||||
#include "src/ast/loop_statement.h"
|
||||
#include "src/ast/member_accessor_expression.h"
|
||||
#include "src/ast/regardless_statement.h"
|
||||
#include "src/ast/return_statement.h"
|
||||
#include "src/ast/scalar_constructor_expression.h"
|
||||
#include "src/ast/set_decoration.h"
|
||||
@@ -742,9 +741,6 @@ bool GeneratorImpl::EmitStatement(ast::Statement* stmt) {
|
||||
if (stmt->IsNop()) {
|
||||
return EmitNop(stmt->AsNop());
|
||||
}
|
||||
if (stmt->IsRegardless()) {
|
||||
return EmitRegardless(stmt->AsRegardless());
|
||||
}
|
||||
if (stmt->IsReturn()) {
|
||||
return EmitReturn(stmt->AsReturn());
|
||||
}
|
||||
@@ -932,18 +928,6 @@ bool GeneratorImpl::EmitNop(ast::NopStatement*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GeneratorImpl::EmitRegardless(ast::RegardlessStatement* stmt) {
|
||||
make_indent();
|
||||
|
||||
out_ << "regardless (";
|
||||
if (!EmitExpression(stmt->condition())) {
|
||||
return false;
|
||||
}
|
||||
out_ << ")";
|
||||
|
||||
return EmitStatementBlockAndNewline(stmt->body());
|
||||
}
|
||||
|
||||
bool GeneratorImpl::EmitReturn(ast::ReturnStatement* stmt) {
|
||||
make_indent();
|
||||
|
||||
|
||||
@@ -166,10 +166,6 @@ class GeneratorImpl {
|
||||
/// @param stmt the nop statement
|
||||
/// @returns true if the statement was successfully emitted
|
||||
bool EmitNop(ast::NopStatement* stmt);
|
||||
/// Handles regardless statements
|
||||
/// @param stmt the statement to emit
|
||||
/// @returns true if the statement was successfully emitted
|
||||
bool EmitRegardless(ast::RegardlessStatement* stmt);
|
||||
/// Handles return statements
|
||||
/// @param stmt the statement to emit
|
||||
/// @returns true if the statement was successfully emitted
|
||||
|
||||
@@ -1,54 +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 <memory>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "src/ast/identifier_expression.h"
|
||||
#include "src/ast/kill_statement.h"
|
||||
#include "src/ast/nop_statement.h"
|
||||
#include "src/ast/regardless_statement.h"
|
||||
#include "src/writer/wgsl/generator_impl.h"
|
||||
|
||||
namespace tint {
|
||||
namespace writer {
|
||||
namespace wgsl {
|
||||
namespace {
|
||||
|
||||
using GeneratorImplTest = testing::Test;
|
||||
|
||||
TEST_F(GeneratorImplTest, Emit_Regardless) {
|
||||
auto cond = std::make_unique<ast::IdentifierExpression>("cond");
|
||||
|
||||
ast::StatementList body;
|
||||
body.push_back(std::make_unique<ast::NopStatement>());
|
||||
body.push_back(std::make_unique<ast::KillStatement>());
|
||||
|
||||
ast::RegardlessStatement r(std::move(cond), std::move(body));
|
||||
|
||||
GeneratorImpl g;
|
||||
g.increment_indent();
|
||||
|
||||
ASSERT_TRUE(g.EmitStatement(&r)) << g.error();
|
||||
EXPECT_EQ(g.result(), R"( regardless (cond) {
|
||||
nop;
|
||||
kill;
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace wgsl
|
||||
} // namespace writer
|
||||
} // namespace tint
|
||||
Reference in New Issue
Block a user