ast/type: Remove Type suffix from all types

They already exist in a `ast::type` namespace, so `ast::type::BlahType` is just stuttering.
This is more important now that Is<> and As<> use the full type name.

Change-Id: I7c661fe58cdc33ba7e9a95c82c996a799786661f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34321
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2020-11-30 23:30:58 +00:00
parent 03ae9a397f
commit f1b0e1ee57
202 changed files with 3909 additions and 3998 deletions

View File

@@ -179,17 +179,15 @@ bool BoundArrayAccessorsTransform::ProcessArrayAccessor(
}
auto* ret_type = expr->array()->result_type()->UnwrapAll();
if (!ret_type->Is<ast::type::ArrayType>() &&
!ret_type->Is<ast::type::MatrixType>() &&
!ret_type->Is<ast::type::VectorType>()) {
if (!ret_type->Is<ast::type::Array>() && !ret_type->Is<ast::type::Matrix>() &&
!ret_type->Is<ast::type::Vector>()) {
return true;
}
if (ret_type->Is<ast::type::VectorType>() ||
ret_type->Is<ast::type::ArrayType>()) {
uint32_t size = ret_type->Is<ast::type::VectorType>()
? ret_type->As<ast::type::VectorType>()->size()
: ret_type->As<ast::type::ArrayType>()->size();
if (ret_type->Is<ast::type::Vector>() || ret_type->Is<ast::type::Array>()) {
uint32_t size = ret_type->Is<ast::type::Vector>()
? ret_type->As<ast::type::Vector>()->size()
: ret_type->As<ast::type::Array>()->size();
if (size == 0) {
error_ = "invalid 0 size for array or vector";
return false;
@@ -201,7 +199,7 @@ bool BoundArrayAccessorsTransform::ProcessArrayAccessor(
} else {
// The row accessor would have been an embedded array accessor and already
// handled, so we just need to do columns here.
uint32_t size = ret_type->As<ast::type::MatrixType>()->columns();
uint32_t size = ret_type->As<ast::type::Matrix>()->columns();
if (!ProcessAccessExpression(expr, size)) {
return false;
}
@@ -234,7 +232,7 @@ bool BoundArrayAccessorsTransform::ProcessAccessExpression(
return false;
}
} else {
auto* u32 = mod_->create<ast::type::U32Type>();
auto* u32 = mod_->create<ast::type::U32>();
ast::ExpressionList cast_expr;
cast_expr.push_back(expr->idx_expr());

View File

@@ -89,7 +89,7 @@ class BoundArrayAccessorsTest : public testing::Test {
Context ctx_;
ast::Module mod_;
TypeDeterminer td_;
ast::type::VoidType void_type_;
ast::type::Void void_type_;
std::unique_ptr<Manager> manager_;
BoundArrayAccessorsTransform* transform_;
ast::BlockStatement* body_ = nullptr;
@@ -102,10 +102,10 @@ TEST_F(BoundArrayAccessorsTest, Ptrs_Clamp) {
//
// -> const b : ptr<function, i32> = a[min(u32(c), 2)]
ast::type::F32Type f32;
ast::type::U32Type u32;
ast::type::ArrayType ary(&f32, 3);
ast::type::PointerType ptr_type(&f32, ast::StorageClass::kFunction);
ast::type::F32 f32;
ast::type::U32 u32;
ast::type::Array ary(&f32, 3);
ast::type::Pointer ptr_type(&f32, ast::StorageClass::kFunction);
SetupFunctionAndBody();
DeclareVariable(
@@ -141,7 +141,7 @@ TEST_F(BoundArrayAccessorsTest, Ptrs_Clamp) {
ASSERT_TRUE(idx->params()[0]->Is<ast::ConstructorExpression>());
ASSERT_TRUE(idx->params()[0]->Is<ast::TypeConstructorExpression>());
auto* tc = idx->params()[0]->As<ast::TypeConstructorExpression>();
EXPECT_TRUE(tc->type()->Is<ast::type::U32Type>());
EXPECT_TRUE(tc->type()->Is<ast::type::U32>());
ASSERT_EQ(tc->values().size(), 1u);
ASSERT_EQ(tc->values()[0], access_idx);
@@ -152,7 +152,7 @@ TEST_F(BoundArrayAccessorsTest, Ptrs_Clamp) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 2u);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32>());
}
TEST_F(BoundArrayAccessorsTest, Array_Idx_Nested_Scalar) {
@@ -163,10 +163,10 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Nested_Scalar) {
//
// -> var c : f32 = a[min(u32(b[min(u32(i), 4)]), 2)];
ast::type::F32Type f32;
ast::type::U32Type u32;
ast::type::ArrayType ary3(&f32, 3);
ast::type::ArrayType ary5(&f32, 5);
ast::type::F32 f32;
ast::type::U32 u32;
ast::type::Array ary3(&f32, 3);
ast::type::Array ary5(&f32, 5);
SetupFunctionAndBody();
DeclareVariable(
@@ -204,7 +204,7 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Nested_Scalar) {
ASSERT_TRUE(idx->params()[0]->Is<ast::ConstructorExpression>());
ASSERT_TRUE(idx->params()[0]->Is<ast::TypeConstructorExpression>());
auto* tc = idx->params()[0]->As<ast::TypeConstructorExpression>();
EXPECT_TRUE(tc->type()->Is<ast::type::U32Type>());
EXPECT_TRUE(tc->type()->Is<ast::type::U32>());
ASSERT_EQ(tc->values().size(), 1u);
auto* sub = tc->values()[0];
@@ -222,7 +222,7 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Nested_Scalar) {
ASSERT_TRUE(sub_idx->params()[0]->Is<ast::ConstructorExpression>());
ASSERT_TRUE(sub_idx->params()[0]->Is<ast::TypeConstructorExpression>());
tc = sub_idx->params()[0]->As<ast::TypeConstructorExpression>();
EXPECT_TRUE(tc->type()->Is<ast::type::U32Type>());
EXPECT_TRUE(tc->type()->Is<ast::type::U32>());
ASSERT_EQ(tc->values().size(), 1u);
ASSERT_EQ(tc->values()[0], b_access_idx);
@@ -239,7 +239,7 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Nested_Scalar) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 2u);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32>());
}
TEST_F(BoundArrayAccessorsTest, Array_Idx_Scalar) {
@@ -248,9 +248,9 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Scalar) {
//
// -> var b : f32 = a[1];
ast::type::F32Type f32;
ast::type::U32Type u32;
ast::type::ArrayType ary(&f32, 3);
ast::type::F32 f32;
ast::type::U32 u32;
ast::type::Array ary(&f32, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -278,7 +278,7 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Scalar) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 1u);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32>());
}
TEST_F(BoundArrayAccessorsTest, Array_Idx_Expr) {
@@ -288,9 +288,9 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Expr) {
//
// -> var b : f32 = a[min(u32(c + 2 - 3), 2)]
ast::type::F32Type f32;
ast::type::U32Type u32;
ast::type::ArrayType ary(&f32, 3);
ast::type::F32 f32;
ast::type::U32 u32;
ast::type::Array ary(&f32, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -329,7 +329,7 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Expr) {
ASSERT_TRUE(idx->params()[0]->Is<ast::ConstructorExpression>());
ASSERT_TRUE(idx->params()[0]->Is<ast::TypeConstructorExpression>());
auto* tc = idx->params()[0]->As<ast::TypeConstructorExpression>();
EXPECT_TRUE(tc->type()->Is<ast::type::U32Type>());
EXPECT_TRUE(tc->type()->Is<ast::type::U32>());
ASSERT_EQ(tc->values().size(), 1u);
ASSERT_EQ(tc->values()[0], access_idx);
@@ -340,7 +340,7 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Expr) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 2u);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32>());
}
TEST_F(BoundArrayAccessorsTest, Array_Idx_Negative) {
@@ -349,9 +349,9 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Negative) {
//
// -> var b : f32 = a[0]
ast::type::F32Type f32;
ast::type::I32Type i32;
ast::type::ArrayType ary(&f32, 3);
ast::type::F32 f32;
ast::type::I32 i32;
ast::type::Array ary(&f32, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -379,7 +379,7 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_Negative) {
EXPECT_EQ(scalar->literal()->As<ast::SintLiteral>()->value(), 0);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::I32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::I32>());
}
TEST_F(BoundArrayAccessorsTest, Array_Idx_OutOfBounds) {
@@ -388,9 +388,9 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_OutOfBounds) {
//
// -> var b : f32 = a[2]
ast::type::F32Type f32;
ast::type::U32Type u32;
ast::type::ArrayType ary(&f32, 3);
ast::type::F32 f32;
ast::type::U32 u32;
ast::type::Array ary(&f32, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -418,7 +418,7 @@ TEST_F(BoundArrayAccessorsTest, Array_Idx_OutOfBounds) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 2u);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32>());
}
TEST_F(BoundArrayAccessorsTest, Vector_Idx_Scalar) {
@@ -427,9 +427,9 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_Scalar) {
//
// -> var b : f32 = a[1]
ast::type::F32Type f32;
ast::type::U32Type u32;
ast::type::VectorType vec(&f32, 3);
ast::type::F32 f32;
ast::type::U32 u32;
ast::type::Vector vec(&f32, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -457,7 +457,7 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_Scalar) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 1u);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32>());
}
TEST_F(BoundArrayAccessorsTest, Vector_Idx_Expr) {
@@ -467,9 +467,9 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_Expr) {
//
// -> var b : f32 = a[min(u32(c + 2 - 3), 2)]
ast::type::F32Type f32;
ast::type::U32Type u32;
ast::type::VectorType vec(&f32, 3);
ast::type::F32 f32;
ast::type::U32 u32;
ast::type::Vector vec(&f32, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -507,7 +507,7 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_Expr) {
ASSERT_TRUE(idx->params()[0]->Is<ast::ConstructorExpression>());
ASSERT_TRUE(idx->params()[0]->Is<ast::TypeConstructorExpression>());
auto* tc = idx->params()[0]->As<ast::TypeConstructorExpression>();
EXPECT_TRUE(tc->type()->Is<ast::type::U32Type>());
EXPECT_TRUE(tc->type()->Is<ast::type::U32>());
ASSERT_EQ(tc->values().size(), 1u);
ASSERT_EQ(tc->values()[0], access_idx);
@@ -518,7 +518,7 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_Expr) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 2u);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32>());
}
TEST_F(BoundArrayAccessorsTest, Vector_Idx_Negative) {
@@ -527,9 +527,9 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_Negative) {
//
// -> var b : f32 = a[0]
ast::type::F32Type f32;
ast::type::I32Type i32;
ast::type::VectorType vec(&f32, 3);
ast::type::F32 f32;
ast::type::I32 i32;
ast::type::Vector vec(&f32, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -557,7 +557,7 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_Negative) {
EXPECT_EQ(scalar->literal()->As<ast::SintLiteral>()->value(), 0);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::I32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::I32>());
}
TEST_F(BoundArrayAccessorsTest, Vector_Idx_OutOfBounds) {
@@ -566,9 +566,9 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_OutOfBounds) {
//
// -> var b : f32 = a[2]
ast::type::F32Type f32;
ast::type::U32Type u32;
ast::type::VectorType vec(&f32, 3);
ast::type::F32 f32;
ast::type::U32 u32;
ast::type::Vector vec(&f32, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -596,7 +596,7 @@ TEST_F(BoundArrayAccessorsTest, Vector_Idx_OutOfBounds) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 2u);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32>());
}
TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Scalar) {
@@ -605,9 +605,9 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Scalar) {
//
// -> var b : f32 = a[2][1]
ast::type::F32Type f32;
ast::type::U32Type u32;
ast::type::MatrixType mat(&f32, 2, 3);
ast::type::F32 f32;
ast::type::U32 u32;
ast::type::Matrix mat(&f32, 2, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -641,7 +641,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Scalar) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 2u);
ASSERT_NE(ary->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ary->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ary->idx_expr()->result_type()->Is<ast::type::U32>());
ASSERT_TRUE(ptr->idx_expr()->Is<ast::ConstructorExpression>());
ASSERT_TRUE(ptr->idx_expr()->Is<ast::ScalarConstructorExpression>());
@@ -651,7 +651,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Scalar) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 1u);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32>());
}
TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Column) {
@@ -661,9 +661,9 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Column) {
//
// -> var b : f32 = a[min(u32(c + 2 - 3), 2)][1]
ast::type::F32Type f32;
ast::type::U32Type u32;
ast::type::MatrixType mat(&f32, 2, 3);
ast::type::F32 f32;
ast::type::U32 u32;
ast::type::Matrix mat(&f32, 2, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -708,7 +708,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Column) {
ASSERT_TRUE(idx->params()[0]->Is<ast::ConstructorExpression>());
ASSERT_TRUE(idx->params()[0]->Is<ast::TypeConstructorExpression>());
auto* tc = idx->params()[0]->As<ast::TypeConstructorExpression>();
EXPECT_TRUE(tc->type()->Is<ast::type::U32Type>());
EXPECT_TRUE(tc->type()->Is<ast::type::U32>());
ASSERT_EQ(tc->values().size(), 1u);
ASSERT_EQ(tc->values()[0], access_idx);
@@ -719,7 +719,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Column) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 2u);
ASSERT_NE(ary->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ary->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ary->idx_expr()->result_type()->Is<ast::type::U32>());
ASSERT_TRUE(ptr->idx_expr()->Is<ast::ConstructorExpression>());
ASSERT_TRUE(ptr->idx_expr()->Is<ast::ScalarConstructorExpression>());
@@ -729,7 +729,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Column) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 1u);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32>());
}
TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Row) {
@@ -739,9 +739,9 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Row) {
//
// -> var b : f32 = a[1][min(u32(c + 2 - 3), 1)]
ast::type::F32Type f32;
ast::type::U32Type u32;
ast::type::MatrixType mat(&f32, 2, 3);
ast::type::F32 f32;
ast::type::U32 u32;
ast::type::Matrix mat(&f32, 2, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -794,7 +794,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Row) {
ASSERT_TRUE(idx->params()[0]->Is<ast::ConstructorExpression>());
ASSERT_TRUE(idx->params()[0]->Is<ast::TypeConstructorExpression>());
auto* tc = idx->params()[0]->As<ast::TypeConstructorExpression>();
EXPECT_TRUE(tc->type()->Is<ast::type::U32Type>());
EXPECT_TRUE(tc->type()->Is<ast::type::U32>());
ASSERT_EQ(tc->values().size(), 1u);
ASSERT_EQ(tc->values()[0], access_idx);
@@ -805,10 +805,10 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Expr_Row) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 1u);
ASSERT_NE(ary->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ary->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ary->idx_expr()->result_type()->Is<ast::type::U32>());
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32>());
}
TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Negative_Column) {
@@ -816,9 +816,9 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Negative_Column) {
// var b : f32 = a[-1][1]
//
// -> var b : f32 = a[0][1]
ast::type::F32Type f32;
ast::type::I32Type i32;
ast::type::MatrixType mat(&f32, 2, 3);
ast::type::F32 f32;
ast::type::I32 i32;
ast::type::Matrix mat(&f32, 2, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -852,7 +852,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Negative_Column) {
EXPECT_EQ(scalar->literal()->As<ast::SintLiteral>()->value(), 0);
ASSERT_NE(ary->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ary->idx_expr()->result_type()->Is<ast::type::I32Type>());
ASSERT_TRUE(ary->idx_expr()->result_type()->Is<ast::type::I32>());
ASSERT_TRUE(ptr->idx_expr()->Is<ast::ConstructorExpression>());
ASSERT_TRUE(ptr->idx_expr()->Is<ast::ScalarConstructorExpression>());
@@ -862,7 +862,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Negative_Column) {
EXPECT_EQ(scalar->literal()->As<ast::SintLiteral>()->value(), 1);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::I32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::I32>());
}
TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Negative_Row) {
@@ -870,9 +870,9 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Negative_Row) {
// var b : f32 = a[2][-1]
//
// -> var b : f32 = a[2][0]
ast::type::F32Type f32;
ast::type::I32Type i32;
ast::type::MatrixType mat(&f32, 2, 3);
ast::type::F32 f32;
ast::type::I32 i32;
ast::type::Matrix mat(&f32, 2, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -906,7 +906,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Negative_Row) {
EXPECT_EQ(scalar->literal()->As<ast::SintLiteral>()->value(), 2);
ASSERT_NE(ary->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ary->idx_expr()->result_type()->Is<ast::type::I32Type>());
ASSERT_TRUE(ary->idx_expr()->result_type()->Is<ast::type::I32>());
ASSERT_TRUE(ptr->idx_expr()->Is<ast::ConstructorExpression>());
ASSERT_TRUE(ptr->idx_expr()->Is<ast::ScalarConstructorExpression>());
@@ -916,7 +916,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_Negative_Row) {
EXPECT_EQ(scalar->literal()->As<ast::SintLiteral>()->value(), 0);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::I32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::I32>());
}
TEST_F(BoundArrayAccessorsTest, Matrix_Idx_OutOfBounds_Column) {
@@ -925,9 +925,9 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_OutOfBounds_Column) {
//
// -> var b : f32 = a[2][1]
ast::type::F32Type f32;
ast::type::U32Type u32;
ast::type::MatrixType mat(&f32, 2, 3);
ast::type::F32 f32;
ast::type::U32 u32;
ast::type::Matrix mat(&f32, 2, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -961,7 +961,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_OutOfBounds_Column) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 2u);
ASSERT_NE(ary->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ary->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ary->idx_expr()->result_type()->Is<ast::type::U32>());
ASSERT_TRUE(ptr->idx_expr()->Is<ast::ConstructorExpression>());
ASSERT_TRUE(ptr->idx_expr()->Is<ast::ScalarConstructorExpression>());
@@ -971,7 +971,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_OutOfBounds_Column) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 1u);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32>());
}
TEST_F(BoundArrayAccessorsTest, Matrix_Idx_OutOfBounds_Row) {
@@ -980,9 +980,9 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_OutOfBounds_Row) {
//
// -> var b : f32 = a[2][1]
ast::type::F32Type f32;
ast::type::U32Type u32;
ast::type::MatrixType mat(&f32, 2, 3);
ast::type::F32 f32;
ast::type::U32 u32;
ast::type::Matrix mat(&f32, 2, 3);
SetupFunctionAndBody();
DeclareVariable(
@@ -1016,7 +1016,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_OutOfBounds_Row) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 2u);
ASSERT_NE(ary->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ary->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ary->idx_expr()->result_type()->Is<ast::type::U32>());
ASSERT_TRUE(ptr->idx_expr()->Is<ast::ConstructorExpression>());
ASSERT_TRUE(ptr->idx_expr()->Is<ast::ScalarConstructorExpression>());
@@ -1026,7 +1026,7 @@ TEST_F(BoundArrayAccessorsTest, Matrix_Idx_OutOfBounds_Row) {
EXPECT_EQ(scalar->literal()->As<ast::UintLiteral>()->value(), 1u);
ASSERT_NE(ptr->idx_expr()->result_type(), nullptr);
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32Type>());
ASSERT_TRUE(ptr->idx_expr()->result_type()->Is<ast::type::U32>());
}
// TODO(dsinclair): Implement when constant_id exists

View File

@@ -220,7 +220,7 @@ void VertexPullingTransform::ConvertVertexInputVariablesToPrivate() {
void VertexPullingTransform::AddVertexStorageBuffers() {
// TODO(idanr): Make this readonly https://github.com/gpuweb/gpuweb/issues/935
// The array inside the struct definition
auto internal_array = std::make_unique<ast::type::ArrayType>(GetU32Type());
auto internal_array = std::make_unique<ast::type::Array>(GetU32Type());
ast::ArrayDecorationList ary_decos;
ary_decos.push_back(create<ast::StrideDecoration>(4u, Source{}));
internal_array->set_decorations(std::move(ary_decos));
@@ -238,7 +238,7 @@ void VertexPullingTransform::AddVertexStorageBuffers() {
ast::StructDecorationList decos;
decos.push_back(create<ast::StructBlockDecoration>(Source{}));
auto* struct_type = mod_->create<ast::type::StructType>(
auto* struct_type = mod_->create<ast::type::Struct>(
kStructName, create<ast::Struct>(std::move(decos), std::move(members)));
for (uint32_t i = 0; i < vertex_state_->vertex_buffers.size(); ++i) {
@@ -412,20 +412,19 @@ ast::Expression* VertexPullingTransform::AccessVec(uint32_t buffer,
}
return create<ast::TypeConstructorExpression>(
mod_->create<ast::type::VectorType>(base_type, count),
std::move(expr_list));
mod_->create<ast::type::Vector>(base_type, count), std::move(expr_list));
}
ast::type::Type* VertexPullingTransform::GetU32Type() {
return mod_->create<ast::type::U32Type>();
return mod_->create<ast::type::U32>();
}
ast::type::Type* VertexPullingTransform::GetI32Type() {
return mod_->create<ast::type::I32Type>();
return mod_->create<ast::type::I32>();
}
ast::type::Type* VertexPullingTransform::GetF32Type() {
return mod_->create<ast::type::F32Type>();
return mod_->create<ast::type::F32>();
}
VertexBufferLayoutDescriptor::VertexBufferLayoutDescriptor() = default;

View File

@@ -47,7 +47,7 @@ class VertexPullingTransformHelper {
// Create basic module with an entry point and vertex function
void InitBasicModule() {
auto* func = create<ast::Function>("main", ast::VariableList{},
mod_->create<ast::type::VoidType>(),
mod_->create<ast::type::Void>(),
create<ast::BlockStatement>());
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
@@ -125,7 +125,7 @@ TEST_F(VertexPullingTransformTest, Error_InvalidEntryPoint) {
TEST_F(VertexPullingTransformTest, Error_EntryPointWrongStage) {
auto* func = create<ast::Function>("main", ast::VariableList{},
mod()->create<ast::type::VoidType>(),
mod()->create<ast::type::Void>(),
create<ast::BlockStatement>());
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
@@ -145,7 +145,7 @@ TEST_F(VertexPullingTransformTest, BasicModule) {
TEST_F(VertexPullingTransformTest, OneAttribute) {
InitBasicModule();
ast::type::F32Type f32;
ast::type::F32 f32;
AddVertexInputVariable(0, "var_a", &f32);
InitTransform({{{4, InputStepMode::kVertex, {{VertexFormat::kF32, 0, 0}}}}});
@@ -229,7 +229,7 @@ TEST_F(VertexPullingTransformTest, OneAttribute) {
TEST_F(VertexPullingTransformTest, OneInstancedAttribute) {
InitBasicModule();
ast::type::F32Type f32;
ast::type::F32 f32;
AddVertexInputVariable(0, "var_a", &f32);
InitTransform(
@@ -314,7 +314,7 @@ TEST_F(VertexPullingTransformTest, OneInstancedAttribute) {
TEST_F(VertexPullingTransformTest, OneAttributeDifferentOutputSet) {
InitBasicModule();
ast::type::F32Type f32;
ast::type::F32 f32;
AddVertexInputVariable(0, "var_a", &f32);
InitTransform({{{4, InputStepMode::kVertex, {{VertexFormat::kF32, 0, 0}}}}});
@@ -400,11 +400,11 @@ TEST_F(VertexPullingTransformTest, OneAttributeDifferentOutputSet) {
TEST_F(VertexPullingTransformTest, ExistingVertexIndexAndInstanceIndex) {
InitBasicModule();
ast::type::F32Type f32;
ast::type::F32 f32;
AddVertexInputVariable(0, "var_a", &f32);
AddVertexInputVariable(1, "var_b", &f32);
ast::type::I32Type i32;
ast::type::I32 i32;
{
auto* vertex_index_var =
create<ast::DecoratedVariable>(create<ast::Variable>(
@@ -564,10 +564,10 @@ TEST_F(VertexPullingTransformTest, ExistingVertexIndexAndInstanceIndex) {
TEST_F(VertexPullingTransformTest, TwoAttributesSameBuffer) {
InitBasicModule();
ast::type::F32Type f32;
ast::type::F32 f32;
AddVertexInputVariable(0, "var_a", &f32);
ast::type::ArrayType vec4_f32{&f32, 4u};
ast::type::Array vec4_f32{&f32, 4u};
AddVertexInputVariable(1, "var_b", &vec4_f32);
InitTransform(
@@ -745,14 +745,14 @@ TEST_F(VertexPullingTransformTest, TwoAttributesSameBuffer) {
TEST_F(VertexPullingTransformTest, FloatVectorAttributes) {
InitBasicModule();
ast::type::F32Type f32;
ast::type::ArrayType vec2_f32{&f32, 2u};
ast::type::F32 f32;
ast::type::Array vec2_f32{&f32, 2u};
AddVertexInputVariable(0, "var_a", &vec2_f32);
ast::type::ArrayType vec3_f32{&f32, 3u};
ast::type::Array vec3_f32{&f32, 3u};
AddVertexInputVariable(1, "var_b", &vec3_f32);
ast::type::ArrayType vec4_f32{&f32, 4u};
ast::type::Array vec4_f32{&f32, 4u};
AddVertexInputVariable(2, "var_c", &vec4_f32);
InitTransform(