Rename VariableStatement to VariableDeclStatement.

This CL renames VariableStatement to VariableDeclStatement to make it
clearer what it was modeling.

Bug: tint:25
Change-Id: Idd0d27fad7cc402f286e1abad74092c9d1961d91
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/18341
Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
dan sinclair
2020-03-30 22:46:48 +00:00
committed by dan sinclair
parent a322f5ddfa
commit e49bd5eeb4
14 changed files with 69 additions and 68 deletions

View File

@@ -59,7 +59,7 @@
#include "src/ast/unary_method_expression.h"
#include "src/ast/unary_op_expression.h"
#include "src/ast/unless_statement.h"
#include "src/ast/variable_statement.h"
#include "src/ast/variable_decl_statement.h"
namespace tint {
namespace writer {
@@ -752,8 +752,8 @@ bool GeneratorImpl::EmitStatement(ast::Statement* stmt) {
if (stmt->IsSwitch()) {
return EmitSwitch(stmt->AsSwitch());
}
if (stmt->IsVariable()) {
return EmitVariable(stmt->AsVariable()->variable());
if (stmt->IsVariableDecl()) {
return EmitVariable(stmt->AsVariableDecl()->variable());
}
if (stmt->IsUnless()) {
return EmitUnless(stmt->AsUnless());

View File

@@ -18,7 +18,7 @@
#include "gtest/gtest.h"
#include "src/ast/type/f32_type.h"
#include "src/ast/variable.h"
#include "src/ast/variable_statement.h"
#include "src/ast/variable_decl_statement.h"
#include "src/writer/wgsl/generator_impl.h"
namespace tint {
@@ -28,12 +28,12 @@ namespace {
using GeneratorImplTest = testing::Test;
TEST_F(GeneratorImplTest, Emit_VariableStatement) {
TEST_F(GeneratorImplTest, Emit_VariableDeclStatement) {
ast::type::F32Type f32;
auto var =
std::make_unique<ast::Variable>("a", ast::StorageClass::kNone, &f32);
ast::VariableStatement stmt(std::move(var));
ast::VariableDeclStatement stmt(std::move(var));
GeneratorImpl g;
g.increment_indent();