Cleanup: Remove unnecessary namespace prefixes
No need to prefix with `ast::` when you're in the ast namespace already.
Change-Id: Iac6cd3a215c05a80ee2035d582500f1d6c882a06
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34320
Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/src/ast/array_accessor_expression_test.cc b/src/ast/array_accessor_expression_test.cc
index e49ba8e..f657815 100644
--- a/src/ast/array_accessor_expression_test.cc
+++ b/src/ast/array_accessor_expression_test.cc
@@ -44,7 +44,7 @@
TEST_F(ArrayAccessorExpressionTest, IsArrayAccessor) {
ArrayAccessorExpression exp;
- EXPECT_TRUE(exp.Is<ast::ArrayAccessorExpression>());
+ EXPECT_TRUE(exp.Is<ArrayAccessorExpression>());
}
TEST_F(ArrayAccessorExpressionTest, IsValid) {
diff --git a/src/ast/assignment_statement_test.cc b/src/ast/assignment_statement_test.cc
index ad430b7..b804363 100644
--- a/src/ast/assignment_statement_test.cc
+++ b/src/ast/assignment_statement_test.cc
@@ -24,8 +24,8 @@
using AssignmentStatementTest = TestHelper;
TEST_F(AssignmentStatementTest, Creation) {
- auto* lhs = create<ast::IdentifierExpression>("lhs");
- auto* rhs = create<ast::IdentifierExpression>("rhs");
+ auto* lhs = create<IdentifierExpression>("lhs");
+ auto* rhs = create<IdentifierExpression>("rhs");
AssignmentStatement stmt(lhs, rhs);
EXPECT_EQ(stmt.lhs(), lhs);
@@ -33,8 +33,8 @@
}
TEST_F(AssignmentStatementTest, CreationWithSource) {
- auto* lhs = create<ast::IdentifierExpression>("lhs");
- auto* rhs = create<ast::IdentifierExpression>("rhs");
+ auto* lhs = create<IdentifierExpression>("lhs");
+ auto* rhs = create<IdentifierExpression>("rhs");
AssignmentStatement stmt(Source{Source::Location{20, 2}}, lhs, rhs);
auto src = stmt.source();
@@ -43,23 +43,23 @@
}
TEST_F(AssignmentStatementTest, IsAssign) {
- auto* lhs = create<ast::IdentifierExpression>("lhs");
- auto* rhs = create<ast::IdentifierExpression>("rhs");
+ auto* lhs = create<IdentifierExpression>("lhs");
+ auto* rhs = create<IdentifierExpression>("rhs");
AssignmentStatement stmt(lhs, rhs);
EXPECT_TRUE(stmt.Is<AssignmentStatement>());
}
TEST_F(AssignmentStatementTest, IsValid) {
- auto* lhs = create<ast::IdentifierExpression>("lhs");
- auto* rhs = create<ast::IdentifierExpression>("rhs");
+ auto* lhs = create<IdentifierExpression>("lhs");
+ auto* rhs = create<IdentifierExpression>("rhs");
AssignmentStatement stmt(lhs, rhs);
EXPECT_TRUE(stmt.IsValid());
}
TEST_F(AssignmentStatementTest, IsValid_MissingLHS) {
- auto* rhs = create<ast::IdentifierExpression>("rhs");
+ auto* rhs = create<IdentifierExpression>("rhs");
AssignmentStatement stmt;
stmt.set_rhs(rhs);
@@ -67,7 +67,7 @@
}
TEST_F(AssignmentStatementTest, IsValid_MissingRHS) {
- auto* lhs = create<ast::IdentifierExpression>("lhs");
+ auto* lhs = create<IdentifierExpression>("lhs");
AssignmentStatement stmt;
stmt.set_lhs(lhs);
@@ -75,22 +75,22 @@
}
TEST_F(AssignmentStatementTest, IsValid_InvalidLHS) {
- auto* lhs = create<ast::IdentifierExpression>("");
- auto* rhs = create<ast::IdentifierExpression>("rhs");
+ auto* lhs = create<IdentifierExpression>("");
+ auto* rhs = create<IdentifierExpression>("rhs");
AssignmentStatement stmt(lhs, rhs);
EXPECT_FALSE(stmt.IsValid());
}
TEST_F(AssignmentStatementTest, IsValid_InvalidRHS) {
- auto* lhs = create<ast::IdentifierExpression>("lhs");
- auto* rhs = create<ast::IdentifierExpression>("");
+ auto* lhs = create<IdentifierExpression>("lhs");
+ auto* rhs = create<IdentifierExpression>("");
AssignmentStatement stmt(lhs, rhs);
EXPECT_FALSE(stmt.IsValid());
}
TEST_F(AssignmentStatementTest, ToStr) {
- auto* lhs = create<ast::IdentifierExpression>("lhs");
- auto* rhs = create<ast::IdentifierExpression>("rhs");
+ auto* lhs = create<IdentifierExpression>("lhs");
+ auto* rhs = create<IdentifierExpression>("rhs");
AssignmentStatement stmt(lhs, rhs);
std::ostringstream out;
diff --git a/src/ast/binary_expression_test.cc b/src/ast/binary_expression_test.cc
index d056ebc..2242b24 100644
--- a/src/ast/binary_expression_test.cc
+++ b/src/ast/binary_expression_test.cc
@@ -48,7 +48,7 @@
TEST_F(BinaryExpressionTest, IsBinaryal) {
BinaryExpression r;
- EXPECT_TRUE(r.Is<ast::BinaryExpression>());
+ EXPECT_TRUE(r.Is<BinaryExpression>());
}
TEST_F(BinaryExpressionTest, IsValid) {
diff --git a/src/ast/bitcast_expression_test.cc b/src/ast/bitcast_expression_test.cc
index 9810a2f..a07eee7 100644
--- a/src/ast/bitcast_expression_test.cc
+++ b/src/ast/bitcast_expression_test.cc
@@ -45,7 +45,7 @@
TEST_F(BitcastExpressionTest, IsBitcast) {
BitcastExpression exp;
- EXPECT_TRUE(exp.Is<ast::BitcastExpression>());
+ EXPECT_TRUE(exp.Is<BitcastExpression>());
}
TEST_F(BitcastExpressionTest, IsValid) {
diff --git a/src/ast/block_statement.h b/src/ast/block_statement.h
index 0b8dac5..f5803c3 100644
--- a/src/ast/block_statement.h
+++ b/src/ast/block_statement.h
@@ -38,12 +38,12 @@
/// Appends a statement to the block
/// @param stmt the statement to append
- void append(ast::Statement* stmt) { statements_.push_back(stmt); }
+ void append(Statement* stmt) { statements_.push_back(stmt); }
/// Insert a statement to the block
/// @param index the index to insert at
/// @param stmt the statement to insert
- void insert(size_t index, ast::Statement* stmt) {
+ void insert(size_t index, Statement* stmt) {
auto offset = static_cast<decltype(statements_)::difference_type>(index);
statements_.insert(statements_.begin() + offset, stmt);
}
@@ -54,36 +54,34 @@
size_t size() const { return statements_.size(); }
/// @returns the last statement in the block or nullptr if block empty
- const ast::Statement* last() const {
+ const Statement* last() const {
return statements_.empty() ? nullptr : statements_.back();
}
/// @returns the last statement in the block or nullptr if block empty
- ast::Statement* last() {
+ Statement* last() {
return statements_.empty() ? nullptr : statements_.back();
}
/// Retrieves the statement at |idx|
/// @param idx the index. The index is not bounds checked.
/// @returns the statement at |idx|
- const ast::Statement* get(size_t idx) const { return statements_[idx]; }
+ const Statement* get(size_t idx) const { return statements_[idx]; }
/// Retrieves the statement at |idx|
/// @param idx the index. The index is not bounds checked.
/// @returns the statement at |idx|
- ast::Statement* operator[](size_t idx) { return statements_[idx]; }
+ Statement* operator[](size_t idx) { return statements_[idx]; }
/// Retrieves the statement at |idx|
/// @param idx the index. The index is not bounds checked.
/// @returns the statement at |idx|
- const ast::Statement* operator[](size_t idx) const {
- return statements_[idx];
- }
+ const Statement* operator[](size_t idx) const { return statements_[idx]; }
/// @returns the beginning iterator
- std::vector<ast::Statement*>::const_iterator begin() const {
+ std::vector<Statement*>::const_iterator begin() const {
return statements_.begin();
}
/// @returns the ending iterator
- std::vector<ast::Statement*>::const_iterator end() const {
+ std::vector<Statement*>::const_iterator end() const {
return statements_.end();
}
@@ -98,7 +96,7 @@
private:
BlockStatement(const BlockStatement&) = delete;
- std::vector<ast::Statement*> statements_;
+ std::vector<Statement*> statements_;
};
} // namespace ast
diff --git a/src/ast/bool_literal.cc b/src/ast/bool_literal.cc
index a40d99a..7f909a6 100644
--- a/src/ast/bool_literal.cc
+++ b/src/ast/bool_literal.cc
@@ -17,7 +17,7 @@
namespace tint {
namespace ast {
-BoolLiteral::BoolLiteral(ast::type::Type* type, bool value)
+BoolLiteral::BoolLiteral(type::Type* type, bool value)
: Base(type), value_(value) {}
BoolLiteral::~BoolLiteral() = default;
diff --git a/src/ast/bool_literal.h b/src/ast/bool_literal.h
index 2700531..4b5acf3 100644
--- a/src/ast/bool_literal.h
+++ b/src/ast/bool_literal.h
@@ -28,7 +28,7 @@
/// Constructor
/// @param type the type of the literal
/// @param value the bool literals value
- BoolLiteral(ast::type::Type* type, bool value);
+ BoolLiteral(type::Type* type, bool value);
~BoolLiteral() override;
/// @returns true if the bool literal is true
diff --git a/src/ast/bool_literal_test.cc b/src/ast/bool_literal_test.cc
index 63fe663..ca2ff78 100644
--- a/src/ast/bool_literal_test.cc
+++ b/src/ast/bool_literal_test.cc
@@ -28,7 +28,7 @@
using BoolLiteralTest = TestHelper;
TEST_F(BoolLiteralTest, True) {
- ast::type::BoolType bool_type;
+ type::BoolType bool_type;
BoolLiteral b{&bool_type, true};
ASSERT_TRUE(b.Is<BoolLiteral>());
ASSERT_TRUE(b.IsTrue());
@@ -36,7 +36,7 @@
}
TEST_F(BoolLiteralTest, False) {
- ast::type::BoolType bool_type;
+ type::BoolType bool_type;
BoolLiteral b{&bool_type, false};
ASSERT_TRUE(b.Is<BoolLiteral>());
ASSERT_FALSE(b.IsTrue());
@@ -44,7 +44,7 @@
}
TEST_F(BoolLiteralTest, Is) {
- ast::type::BoolType bool_type;
+ type::BoolType bool_type;
BoolLiteral b{&bool_type, false};
Literal* l = &b;
EXPECT_TRUE(l->Is<BoolLiteral>());
@@ -56,7 +56,7 @@
}
TEST_F(BoolLiteralTest, ToStr) {
- ast::type::BoolType bool_type;
+ type::BoolType bool_type;
BoolLiteral t{&bool_type, true};
BoolLiteral f{&bool_type, false};
diff --git a/src/ast/builder.cc b/src/ast/builder.cc
index 0b27fd9..eca0c04 100644
--- a/src/ast/builder.cc
+++ b/src/ast/builder.cc
@@ -18,27 +18,26 @@
namespace ast {
TypesBuilder::TypesBuilder(Module* mod)
- : bool_(mod->create<ast::type::BoolType>()),
- f32(mod->create<ast::type::F32Type>()),
- i32(mod->create<ast::type::I32Type>()),
- u32(mod->create<ast::type::U32Type>()),
- void_(mod->create<ast::type::VoidType>()),
+ : bool_(mod->create<type::BoolType>()),
+ f32(mod->create<type::F32Type>()),
+ i32(mod->create<type::I32Type>()),
+ u32(mod->create<type::U32Type>()),
+ void_(mod->create<type::VoidType>()),
mod_(mod) {}
-Builder::Builder(tint::Context* c, tint::ast::Module* m)
- : ctx(c), mod(m), ty(m) {}
+Builder::Builder(Context* c, Module* m) : ctx(c), mod(m), ty(m) {}
Builder::~Builder() = default;
-ast::Variable* Builder::Var(const std::string& name,
- ast::StorageClass storage,
- ast::type::Type* type) {
- auto* var = create<ast::Variable>(name, storage, type);
+Variable* Builder::Var(const std::string& name,
+ StorageClass storage,
+ type::Type* type) {
+ auto* var = create<Variable>(name, storage, type);
OnVariableBuilt(var);
return var;
}
BuilderWithContextAndModule::BuilderWithContextAndModule()
- : Builder(new Context(), new ast::Module()) {}
+ : Builder(new Context(), new Module()) {}
BuilderWithContextAndModule::~BuilderWithContextAndModule() {
delete ctx;
delete mod;
diff --git a/src/ast/builder.h b/src/ast/builder.h
index f80a4f6..7ea6078 100644
--- a/src/ast/builder.h
+++ b/src/ast/builder.h
@@ -43,7 +43,7 @@
namespace tint {
namespace ast {
-/// TypesBuilder holds basic `ast::tint` types and methods for constructing
+/// TypesBuilder holds basic `tint` types and methods for constructing
/// complex types.
class TypesBuilder {
public:
@@ -52,104 +52,104 @@
explicit TypesBuilder(Module* mod);
/// A boolean type
- ast::type::BoolType* const bool_;
+ type::BoolType* const bool_;
/// A f32 type
- ast::type::F32Type* const f32;
+ type::F32Type* const f32;
/// A i32 type
- ast::type::I32Type* const i32;
+ type::I32Type* const i32;
/// A u32 type
- ast::type::U32Type* const u32;
+ type::U32Type* const u32;
/// A void type
- ast::type::VoidType* const void_;
+ type::VoidType* const void_;
/// @return the tint AST type for the C type `T`.
template <typename T>
- ast::type::Type* Of() const {
+ type::Type* Of() const {
return CToAST<T>::get(this);
}
/// @return the tint AST type for a 2-element vector of the C type `T`.
template <typename T>
- ast::type::VectorType* vec2() const {
- return mod_->create<ast::type::VectorType>(Of<T>(), 2);
+ type::VectorType* vec2() const {
+ return mod_->create<type::VectorType>(Of<T>(), 2);
}
/// @return the tint AST type for a 3-element vector of the C type `T`.
template <typename T>
- ast::type::VectorType* vec3() const {
- return mod_->create<ast::type::VectorType>(Of<T>(), 3);
+ type::VectorType* vec3() const {
+ return mod_->create<type::VectorType>(Of<T>(), 3);
}
/// @return the tint AST type for a 4-element vector of the C type `T`.
template <typename T>
- ast::type::Type* vec4() const {
- return mod_->create<ast::type::VectorType>(Of<T>(), 4);
+ type::Type* vec4() const {
+ return mod_->create<type::VectorType>(Of<T>(), 4);
}
/// @return the tint AST type for a 2x3 matrix of the C type `T`.
template <typename T>
- ast::type::MatrixType* mat2x2() const {
- return mod_->create<ast::type::MatrixType>(Of<T>(), 2, 2);
+ type::MatrixType* mat2x2() const {
+ return mod_->create<type::MatrixType>(Of<T>(), 2, 2);
}
/// @return the tint AST type for a 2x3 matrix of the C type `T`.
template <typename T>
- ast::type::MatrixType* mat2x3() const {
- return mod_->create<ast::type::MatrixType>(Of<T>(), 3, 2);
+ type::MatrixType* mat2x3() const {
+ return mod_->create<type::MatrixType>(Of<T>(), 3, 2);
}
/// @return the tint AST type for a 2x4 matrix of the C type `T`.
template <typename T>
- ast::type::MatrixType* mat2x4() const {
- return mod_->create<ast::type::MatrixType>(Of<T>(), 4, 2);
+ type::MatrixType* mat2x4() const {
+ return mod_->create<type::MatrixType>(Of<T>(), 4, 2);
}
/// @return the tint AST type for a 3x2 matrix of the C type `T`.
template <typename T>
- ast::type::MatrixType* mat3x2() const {
- return mod_->create<ast::type::MatrixType>(Of<T>(), 2, 3);
+ type::MatrixType* mat3x2() const {
+ return mod_->create<type::MatrixType>(Of<T>(), 2, 3);
}
/// @return the tint AST type for a 3x3 matrix of the C type `T`.
template <typename T>
- ast::type::MatrixType* mat3x3() const {
- return mod_->create<ast::type::MatrixType>(Of<T>(), 3, 3);
+ type::MatrixType* mat3x3() const {
+ return mod_->create<type::MatrixType>(Of<T>(), 3, 3);
}
/// @return the tint AST type for a 3x4 matrix of the C type `T`.
template <typename T>
- ast::type::MatrixType* mat3x4() const {
- return mod_->create<ast::type::MatrixType>(Of<T>(), 4, 3);
+ type::MatrixType* mat3x4() const {
+ return mod_->create<type::MatrixType>(Of<T>(), 4, 3);
}
/// @return the tint AST type for a 4x2 matrix of the C type `T`.
template <typename T>
- ast::type::MatrixType* mat4x2() const {
- return mod_->create<ast::type::MatrixType>(Of<T>(), 2, 4);
+ type::MatrixType* mat4x2() const {
+ return mod_->create<type::MatrixType>(Of<T>(), 2, 4);
}
/// @return the tint AST type for a 4x3 matrix of the C type `T`.
template <typename T>
- ast::type::MatrixType* mat4x3() const {
- return mod_->create<ast::type::MatrixType>(Of<T>(), 3, 4);
+ type::MatrixType* mat4x3() const {
+ return mod_->create<type::MatrixType>(Of<T>(), 3, 4);
}
/// @return the tint AST type for a 4x4 matrix of the C type `T`.
template <typename T>
- ast::type::MatrixType* mat4x4() const {
- return mod_->create<ast::type::MatrixType>(Of<T>(), 4, 4);
+ type::MatrixType* mat4x4() const {
+ return mod_->create<type::MatrixType>(Of<T>(), 4, 4);
}
/// @param subtype the array element type
/// @param n the array size. 0 represents unbounded
/// @return the tint AST type for a array of size `n` of type `T`
- ast::type::ArrayType* array(ast::type::Type* subtype, uint32_t n) const {
- return mod_->create<ast::type::ArrayType>(subtype, n);
+ type::ArrayType* array(type::Type* subtype, uint32_t n) const {
+ return mod_->create<type::ArrayType>(subtype, n);
}
/// @return the tint AST type for an array of size `N` of type `T`
template <typename T, int N = 0>
- ast::type::ArrayType* array() const {
+ type::ArrayType* array() const {
return array(Of<T>(), N);
}
@@ -158,7 +158,7 @@
/// contains a single static `get()` method for obtaining the corresponding
/// AST type for the C type `T`.
/// `get()` has the signature:
- /// `static ast::type::Type* get(Types* t)`
+ /// `static type::Type* get(Types* t)`
template <typename T>
struct CToAST {};
@@ -188,78 +188,78 @@
/// Constructor
/// @param ctx the context to use in the builder
/// @param mod the module to use in the builder
- explicit Builder(tint::Context* ctx, tint::ast::Module* mod);
+ explicit Builder(Context* ctx, Module* mod);
virtual ~Builder();
/// @param expr the expression
/// @return expr
- ast::Expression* Expr(ast::Expression* expr) { return expr; }
+ Expression* Expr(Expression* expr) { return expr; }
/// @param name the identifier name
/// @return an IdentifierExpression with the given name
- ast::IdentifierExpression* Expr(const std::string& name) {
- return create<ast::IdentifierExpression>(name);
+ IdentifierExpression* Expr(const std::string& name) {
+ return create<IdentifierExpression>(name);
}
/// @param name the identifier name
/// @return an IdentifierExpression with the given name
- ast::IdentifierExpression* Expr(const char* name) {
- return create<ast::IdentifierExpression>(name);
+ IdentifierExpression* Expr(const char* name) {
+ return create<IdentifierExpression>(name);
}
/// @param value the boolean value
/// @return a Scalar constructor for the given value
- ast::ScalarConstructorExpression* Expr(bool value) {
- return create<ast::ScalarConstructorExpression>(Literal(value));
+ ScalarConstructorExpression* Expr(bool value) {
+ return create<ScalarConstructorExpression>(Literal(value));
}
/// @param value the float value
/// @return a Scalar constructor for the given value
- ast::ScalarConstructorExpression* Expr(f32 value) {
- return create<ast::ScalarConstructorExpression>(Literal(value));
+ ScalarConstructorExpression* Expr(f32 value) {
+ return create<ScalarConstructorExpression>(Literal(value));
}
/// @param value the integer value
/// @return a Scalar constructor for the given value
- ast::ScalarConstructorExpression* Expr(i32 value) {
- return create<ast::ScalarConstructorExpression>(Literal(value));
+ ScalarConstructorExpression* Expr(i32 value) {
+ return create<ScalarConstructorExpression>(Literal(value));
}
/// @param value the unsigned int value
/// @return a Scalar constructor for the given value
- ast::ScalarConstructorExpression* Expr(u32 value) {
- return create<ast::ScalarConstructorExpression>(Literal(value));
+ ScalarConstructorExpression* Expr(u32 value) {
+ return create<ScalarConstructorExpression>(Literal(value));
}
- /// Converts `arg` to an `ast::Expression` using `Expr()`, then appends it to
+ /// Converts `arg` to an `Expression` using `Expr()`, then appends it to
/// `list`.
/// @param list the list to append too
/// @param arg the arg to create
template <typename ARG>
- void Append(ast::ExpressionList& list, ARG&& arg) {
+ void Append(ExpressionList& list, ARG&& arg) {
list.emplace_back(Expr(std::forward<ARG>(arg)));
}
- /// Converts `arg0` and `args` to `ast::Expression`s using `Expr()`,
+ /// Converts `arg0` and `args` to `Expression`s using `Expr()`,
/// then appends them to `list`.
/// @param list the list to append too
/// @param arg0 the first argument
/// @param args the rest of the arguments
template <typename ARG0, typename... ARGS>
- void Append(ast::ExpressionList& list, ARG0&& arg0, ARGS&&... args) {
+ void Append(ExpressionList& list, ARG0&& arg0, ARGS&&... args) {
Append(list, std::forward<ARG0>(arg0));
Append(list, std::forward<ARGS>(args)...);
}
/// @return an empty list of expressions,
- ast::ExpressionList ExprList() { return {}; }
+ ExpressionList ExprList() { return {}; }
/// @param args the list of expressions
- /// @return the list of expressions converted to `ast::Expression`s using
+ /// @return the list of expressions converted to `Expression`s using
/// `Expr()`,
template <typename... ARGS>
- ast::ExpressionList ExprList(ARGS&&... args) {
- ast::ExpressionList list;
+ ExpressionList ExprList(ARGS&&... args) {
+ ExpressionList list;
list.reserve(sizeof...(args));
Append(list, std::forward<ARGS>(args)...);
return list;
@@ -267,185 +267,175 @@
/// @param val the boolan value
/// @return a boolean literal with the given value
- ast::BoolLiteral* Literal(bool val) {
- return create<ast::BoolLiteral>(ty.bool_, val);
- }
+ BoolLiteral* Literal(bool val) { return create<BoolLiteral>(ty.bool_, val); }
/// @param val the float value
/// @return a float literal with the given value
- ast::FloatLiteral* Literal(f32 val) {
- return create<ast::FloatLiteral>(ty.f32, val);
- }
+ FloatLiteral* Literal(f32 val) { return create<FloatLiteral>(ty.f32, val); }
/// @param val the unsigned int value
/// @return a UintLiteral with the given value
- ast::UintLiteral* Literal(u32 val) {
- return create<ast::UintLiteral>(ty.u32, val);
- }
+ UintLiteral* Literal(u32 val) { return create<UintLiteral>(ty.u32, val); }
/// @param val the integer value
/// @return the SintLiteral with the given value
- ast::SintLiteral* Literal(i32 val) {
- return create<ast::SintLiteral>(ty.i32, val);
- }
+ SintLiteral* Literal(i32 val) { return create<SintLiteral>(ty.i32, val); }
/// @param args the arguments for the type constructor
- /// @return an `ast::TypeConstructorExpression` of type `ty`, with the values
- /// of `args` converted to `ast::Expression`s using `Expr()`
+ /// @return an `TypeConstructorExpression` of type `ty`, with the values
+ /// of `args` converted to `Expression`s using `Expr()`
template <typename T, typename... ARGS>
- ast::TypeConstructorExpression* Construct(ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* Construct(ARGS&&... args) {
+ return create<TypeConstructorExpression>(
ty.Of<T>(), ExprList(std::forward<ARGS>(args)...));
}
/// @param type the type to construct
/// @param args the arguments for the constructor
- /// @return an `ast::TypeConstructorExpression` of `type` constructed with the
+ /// @return an `TypeConstructorExpression` of `type` constructed with the
/// values `args`.
template <typename... ARGS>
- ast::TypeConstructorExpression* Construct(ast::type::Type* type,
- ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* Construct(type::Type* type, ARGS&&... args) {
+ return create<TypeConstructorExpression>(
type, ExprList(std::forward<ARGS>(args)...));
}
/// @param args the arguments for the vector constructor
- /// @return an `ast::TypeConstructorExpression` of a 2-element vector of type
+ /// @return an `TypeConstructorExpression` of a 2-element vector of type
/// `T`, constructed with the values `args`.
template <typename T, typename... ARGS>
- ast::TypeConstructorExpression* vec2(ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* vec2(ARGS&&... args) {
+ return create<TypeConstructorExpression>(
ty.vec2<T>(), ExprList(std::forward<ARGS>(args)...));
}
/// @param args the arguments for the vector constructor
- /// @return an `ast::TypeConstructorExpression` of a 3-element vector of type
+ /// @return an `TypeConstructorExpression` of a 3-element vector of type
/// `T`, constructed with the values `args`.
template <typename T, typename... ARGS>
- ast::TypeConstructorExpression* vec3(ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* vec3(ARGS&&... args) {
+ return create<TypeConstructorExpression>(
ty.vec3<T>(), ExprList(std::forward<ARGS>(args)...));
}
/// @param args the arguments for the vector constructor
- /// @return an `ast::TypeConstructorExpression` of a 4-element vector of type
+ /// @return an `TypeConstructorExpression` of a 4-element vector of type
/// `T`, constructed with the values `args`.
template <typename T, typename... ARGS>
- ast::TypeConstructorExpression* vec4(ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* vec4(ARGS&&... args) {
+ return create<TypeConstructorExpression>(
ty.vec4<T>(), ExprList(std::forward<ARGS>(args)...));
}
/// @param args the arguments for the matrix constructor
- /// @return an `ast::TypeConstructorExpression` of a 2x2 matrix of type
+ /// @return an `TypeConstructorExpression` of a 2x2 matrix of type
/// `T`, constructed with the values `args`.
template <typename T, typename... ARGS>
- ast::TypeConstructorExpression* mat2x2(ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* mat2x2(ARGS&&... args) {
+ return create<TypeConstructorExpression>(
ty.mat2x2<T>(), ExprList(std::forward<ARGS>(args)...));
}
/// @param args the arguments for the matrix constructor
- /// @return an `ast::TypeConstructorExpression` of a 2x3 matrix of type
+ /// @return an `TypeConstructorExpression` of a 2x3 matrix of type
/// `T`, constructed with the values `args`.
template <typename T, typename... ARGS>
- ast::TypeConstructorExpression* mat2x3(ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* mat2x3(ARGS&&... args) {
+ return create<TypeConstructorExpression>(
ty.mat2x3<T>(), ExprList(std::forward<ARGS>(args)...));
}
/// @param args the arguments for the matrix constructor
- /// @return an `ast::TypeConstructorExpression` of a 2x4 matrix of type
+ /// @return an `TypeConstructorExpression` of a 2x4 matrix of type
/// `T`, constructed with the values `args`.
template <typename T, typename... ARGS>
- ast::TypeConstructorExpression* mat2x4(ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* mat2x4(ARGS&&... args) {
+ return create<TypeConstructorExpression>(
ty.mat2x4<T>(), ExprList(std::forward<ARGS>(args)...));
}
/// @param args the arguments for the matrix constructor
- /// @return an `ast::TypeConstructorExpression` of a 3x2 matrix of type
+ /// @return an `TypeConstructorExpression` of a 3x2 matrix of type
/// `T`, constructed with the values `args`.
template <typename T, typename... ARGS>
- ast::TypeConstructorExpression* mat3x2(ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* mat3x2(ARGS&&... args) {
+ return create<TypeConstructorExpression>(
ty.mat3x2<T>(), ExprList(std::forward<ARGS>(args)...));
}
/// @param args the arguments for the matrix constructor
- /// @return an `ast::TypeConstructorExpression` of a 3x3 matrix of type
+ /// @return an `TypeConstructorExpression` of a 3x3 matrix of type
/// `T`, constructed with the values `args`.
template <typename T, typename... ARGS>
- ast::TypeConstructorExpression* mat3x3(ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* mat3x3(ARGS&&... args) {
+ return create<TypeConstructorExpression>(
ty.mat3x3<T>(), ExprList(std::forward<ARGS>(args)...));
}
/// @param args the arguments for the matrix constructor
- /// @return an `ast::TypeConstructorExpression` of a 3x4 matrix of type
+ /// @return an `TypeConstructorExpression` of a 3x4 matrix of type
/// `T`, constructed with the values `args`.
template <typename T, typename... ARGS>
- ast::TypeConstructorExpression* mat3x4(ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* mat3x4(ARGS&&... args) {
+ return create<TypeConstructorExpression>(
ty.mat3x4<T>(), ExprList(std::forward<ARGS>(args)...));
}
/// @param args the arguments for the matrix constructor
- /// @return an `ast::TypeConstructorExpression` of a 4x2 matrix of type
+ /// @return an `TypeConstructorExpression` of a 4x2 matrix of type
/// `T`, constructed with the values `args`.
template <typename T, typename... ARGS>
- ast::TypeConstructorExpression* mat4x2(ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* mat4x2(ARGS&&... args) {
+ return create<TypeConstructorExpression>(
ty.mat4x2<T>(), ExprList(std::forward<ARGS>(args)...));
}
/// @param args the arguments for the matrix constructor
- /// @return an `ast::TypeConstructorExpression` of a 4x3 matrix of type
+ /// @return an `TypeConstructorExpression` of a 4x3 matrix of type
/// `T`, constructed with the values `args`.
template <typename T, typename... ARGS>
- ast::TypeConstructorExpression* mat4x3(ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* mat4x3(ARGS&&... args) {
+ return create<TypeConstructorExpression>(
ty.mat4x3<T>(), ExprList(std::forward<ARGS>(args)...));
}
/// @param args the arguments for the matrix constructor
- /// @return an `ast::TypeConstructorExpression` of a 4x4 matrix of type
+ /// @return an `TypeConstructorExpression` of a 4x4 matrix of type
/// `T`, constructed with the values `args`.
template <typename T, typename... ARGS>
- ast::TypeConstructorExpression* mat4x4(ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* mat4x4(ARGS&&... args) {
+ return create<TypeConstructorExpression>(
ty.mat4x4<T>(), ExprList(std::forward<ARGS>(args)...));
}
/// @param args the arguments for the array constructor
- /// @return an `ast::TypeConstructorExpression` of a 4x4 matrix of type
+ /// @return an `TypeConstructorExpression` of a 4x4 matrix of type
/// `T`, constructed with the values `args`.
template <typename T, int N = 0, typename... ARGS>
- ast::TypeConstructorExpression* array(ARGS&&... args) {
- return create<ast::TypeConstructorExpression>(
+ TypeConstructorExpression* array(ARGS&&... args) {
+ return create<TypeConstructorExpression>(
ty.array<T, N>(), ExprList(std::forward<ARGS>(args)...));
}
/// @param name the variable name
/// @param storage the variable storage class
/// @param type the variable type
- /// @returns a `ast::Variable` with the given name, storage and type
- ast::Variable* Var(const std::string& name,
- ast::StorageClass storage,
- ast::type::Type* type);
+ /// @returns a `Variable` with the given name, storage and type
+ Variable* Var(const std::string& name,
+ StorageClass storage,
+ type::Type* type);
/// @param func the function name
/// @param args the function call arguments
- /// @returns a `ast::CallExpression` to the function `func`, with the
- /// arguments of `args` converted to `ast::Expression`s using `Expr()`.
+ /// @returns a `CallExpression` to the function `func`, with the
+ /// arguments of `args` converted to `Expression`s using `Expr()`.
template <typename... ARGS>
- ast::CallExpression Call(const std::string& func, ARGS&&... args) {
- return ast::CallExpression{Expr(func),
- ExprList(std::forward<ARGS>(args)...)};
+ CallExpression Call(const std::string& func, ARGS&&... args) {
+ return CallExpression{Expr(func), ExprList(std::forward<ARGS>(args)...)};
}
- /// Creates a new `ast::Node` owned by the Module. When the Module is
- /// destructed, the `ast::Node` will also be destructed.
+ /// Creates a new `Node` owned by the Module. When the Module is
+ /// destructed, the `Node` will also be destructed.
/// @param args the arguments to pass to the type constructor
/// @returns the node pointer
template <typename T, typename... ARGS>
@@ -454,15 +444,15 @@
}
/// The builder module
- tint::Context* const ctx;
+ Context* const ctx;
/// The builder module
- tint::ast::Module* const mod;
+ Module* const mod;
/// The builder types
const TypesBuilder ty;
protected:
/// Called whenever a new variable is built with `Var()`.
- virtual void OnVariableBuilt(ast::Variable*) {}
+ virtual void OnVariableBuilt(Variable*) {}
};
/// BuilderWithContextAndModule is a `Builder` that constructs and owns its
@@ -477,23 +467,23 @@
// Various template specializations for TypesBuilder::CToAST.
template <>
struct TypesBuilder::CToAST<Builder::i32> {
- static ast::type::Type* get(const TypesBuilder* t) { return t->i32; }
+ static type::Type* get(const TypesBuilder* t) { return t->i32; }
};
template <>
struct TypesBuilder::CToAST<Builder::u32> {
- static ast::type::Type* get(const TypesBuilder* t) { return t->u32; }
+ static type::Type* get(const TypesBuilder* t) { return t->u32; }
};
template <>
struct TypesBuilder::CToAST<Builder::f32> {
- static ast::type::Type* get(const TypesBuilder* t) { return t->f32; }
+ static type::Type* get(const TypesBuilder* t) { return t->f32; }
};
template <>
struct TypesBuilder::CToAST<bool> {
- static ast::type::Type* get(const TypesBuilder* t) { return t->bool_; }
+ static type::Type* get(const TypesBuilder* t) { return t->bool_; }
};
template <>
struct TypesBuilder::CToAST<void> {
- static ast::type::Type* get(const TypesBuilder* t) { return t->void_; }
+ static type::Type* get(const TypesBuilder* t) { return t->void_; }
};
//! @endcond
diff --git a/src/ast/call_expression_test.cc b/src/ast/call_expression_test.cc
index 0da64ec..0d30953 100644
--- a/src/ast/call_expression_test.cc
+++ b/src/ast/call_expression_test.cc
@@ -49,7 +49,7 @@
TEST_F(CallExpressionTest, IsCall) {
auto* func = create<IdentifierExpression>("func");
CallExpression stmt(func, {});
- EXPECT_TRUE(stmt.Is<ast::CallExpression>());
+ EXPECT_TRUE(stmt.Is<CallExpression>());
}
TEST_F(CallExpressionTest, IsValid) {
diff --git a/src/ast/call_statement_test.cc b/src/ast/call_statement_test.cc
index 528ecc1..4a6a5fe 100644
--- a/src/ast/call_statement_test.cc
+++ b/src/ast/call_statement_test.cc
@@ -25,8 +25,8 @@
using CallStatementTest = TestHelper;
TEST_F(CallStatementTest, Creation) {
- auto* expr = create<ast::CallExpression>(
- create<ast::IdentifierExpression>("func"), ExpressionList{});
+ auto* expr = create<CallExpression>(create<IdentifierExpression>("func"),
+ ExpressionList{});
CallStatement c(expr);
EXPECT_EQ(c.expr(), expr);
@@ -38,8 +38,8 @@
}
TEST_F(CallStatementTest, IsValid) {
- CallStatement c(create<ast::CallExpression>(
- create<ast::IdentifierExpression>("func"), ExpressionList{}));
+ CallStatement c(create<CallExpression>(create<IdentifierExpression>("func"),
+ ExpressionList{}));
EXPECT_TRUE(c.IsValid());
}
@@ -49,13 +49,13 @@
}
TEST_F(CallStatementTest, IsValid_InvalidExpr) {
- CallStatement c(create<ast::CallExpression>());
+ CallStatement c(create<CallExpression>());
EXPECT_FALSE(c.IsValid());
}
TEST_F(CallStatementTest, ToStr) {
- CallStatement c(create<ast::CallExpression>(
- create<ast::IdentifierExpression>("func"), ExpressionList{}));
+ CallStatement c(create<CallExpression>(create<IdentifierExpression>("func"),
+ ExpressionList{}));
std::ostringstream out;
c.to_str(out, 2);
diff --git a/src/ast/case_statement_test.cc b/src/ast/case_statement_test.cc
index d5c77b6..8b6e6d9 100644
--- a/src/ast/case_statement_test.cc
+++ b/src/ast/case_statement_test.cc
@@ -29,7 +29,7 @@
using CaseStatementTest = TestHelper;
TEST_F(CaseStatementTest, Creation_i32) {
- ast::type::I32Type i32;
+ type::I32Type i32;
CaseSelectorList b;
auto* selector = create<SintLiteral>(&i32, 2);
@@ -47,7 +47,7 @@
}
TEST_F(CaseStatementTest, Creation_u32) {
- ast::type::U32Type u32;
+ type::U32Type u32;
CaseSelectorList b;
auto* selector = create<SintLiteral>(&u32, 2);
@@ -65,7 +65,7 @@
}
TEST_F(CaseStatementTest, Creation_WithSource) {
- ast::type::I32Type i32;
+ type::I32Type i32;
CaseSelectorList b;
b.push_back(create<SintLiteral>(&i32, 2));
@@ -82,33 +82,33 @@
auto* body = create<BlockStatement>();
body->append(create<DiscardStatement>());
- CaseStatement c(create<ast::BlockStatement>());
+ CaseStatement c(create<BlockStatement>());
c.set_body(body);
EXPECT_TRUE(c.IsDefault());
}
TEST_F(CaseStatementTest, IsDefault_WithSelectors) {
- ast::type::I32Type i32;
+ type::I32Type i32;
CaseSelectorList b;
b.push_back(create<SintLiteral>(&i32, 2));
- CaseStatement c(create<ast::BlockStatement>());
+ CaseStatement c(create<BlockStatement>());
c.set_selectors(b);
EXPECT_FALSE(c.IsDefault());
}
TEST_F(CaseStatementTest, IsCase) {
- CaseStatement c(create<ast::BlockStatement>());
- EXPECT_TRUE(c.Is<ast::CaseStatement>());
+ CaseStatement c(create<BlockStatement>());
+ EXPECT_TRUE(c.Is<CaseStatement>());
}
TEST_F(CaseStatementTest, IsValid) {
- CaseStatement c(create<ast::BlockStatement>());
+ CaseStatement c(create<BlockStatement>());
EXPECT_TRUE(c.IsValid());
}
TEST_F(CaseStatementTest, IsValid_NullBodyStatement) {
- ast::type::I32Type i32;
+ type::I32Type i32;
CaseSelectorList b;
b.push_back(create<SintLiteral>(&i32, 2));
@@ -121,19 +121,19 @@
}
TEST_F(CaseStatementTest, IsValid_InvalidBodyStatement) {
- ast::type::I32Type i32;
+ type::I32Type i32;
CaseSelectorList b;
b.push_back(create<SintLiteral>(&i32, 2));
auto* body = create<BlockStatement>();
- body->append(create<IfStatement>(nullptr, create<ast::BlockStatement>()));
+ body->append(create<IfStatement>(nullptr, create<BlockStatement>()));
CaseStatement c({b}, body);
EXPECT_FALSE(c.IsValid());
}
TEST_F(CaseStatementTest, ToStr_WithSelectors_i32) {
- ast::type::I32Type i32;
+ type::I32Type i32;
CaseSelectorList b;
b.push_back(create<SintLiteral>(&i32, -2));
@@ -150,7 +150,7 @@
}
TEST_F(CaseStatementTest, ToStr_WithSelectors_u32) {
- ast::type::U32Type u32;
+ type::U32Type u32;
CaseSelectorList b;
b.push_back(create<UintLiteral>(&u32, 2));
@@ -167,7 +167,7 @@
}
TEST_F(CaseStatementTest, ToStr_WithMultipleSelectors) {
- ast::type::I32Type i32;
+ type::I32Type i32;
CaseSelectorList b;
b.push_back(create<SintLiteral>(&i32, 1));
diff --git a/src/ast/decorated_variable_test.cc b/src/ast/decorated_variable_test.cc
index 2b41652..e9c2a52 100644
--- a/src/ast/decorated_variable_test.cc
+++ b/src/ast/decorated_variable_test.cc
@@ -77,7 +77,7 @@
VariableDecorationList decos;
decos.push_back(create<LocationDecoration>(1, Source{}));
- decos.push_back(create<BuiltinDecoration>(ast::Builtin::kPosition, Source{}));
+ decos.push_back(create<BuiltinDecoration>(Builtin::kPosition, Source{}));
decos.push_back(create<ConstantIdDecoration>(1200, Source{}));
dv.set_decorations(decos);
@@ -108,7 +108,7 @@
TEST_F(DecoratedVariableTest, IsDecorated) {
DecoratedVariable dv;
- EXPECT_TRUE(dv.Is<ast::DecoratedVariable>());
+ EXPECT_TRUE(dv.Is<DecoratedVariable>());
}
TEST_F(DecoratedVariableTest, to_str) {
diff --git a/src/ast/else_statement_test.cc b/src/ast/else_statement_test.cc
index f90d7b5..2e60b39 100644
--- a/src/ast/else_statement_test.cc
+++ b/src/ast/else_statement_test.cc
@@ -28,7 +28,7 @@
using ElseStatementTest = TestHelper;
TEST_F(ElseStatementTest, Creation) {
- ast::type::BoolType bool_type;
+ type::BoolType bool_type;
auto* cond = create<ScalarConstructorExpression>(
create<BoolLiteral>(&bool_type, true));
auto* body = create<BlockStatement>();
@@ -55,7 +55,7 @@
}
TEST_F(ElseStatementTest, HasCondition) {
- ast::type::BoolType bool_type;
+ type::BoolType bool_type;
auto* cond = create<ScalarConstructorExpression>(
create<BoolLiteral>(&bool_type, true));
ElseStatement e(cond, create<BlockStatement>());
@@ -97,14 +97,14 @@
TEST_F(ElseStatementTest, IsValid_InvalidBodyStatement) {
auto* body = create<BlockStatement>();
- body->append(create<IfStatement>(nullptr, create<ast::BlockStatement>()));
+ body->append(create<IfStatement>(nullptr, create<BlockStatement>()));
ElseStatement e(body);
EXPECT_FALSE(e.IsValid());
}
TEST_F(ElseStatementTest, ToStr) {
- ast::type::BoolType bool_type;
+ type::BoolType bool_type;
auto* cond = create<ScalarConstructorExpression>(
create<BoolLiteral>(&bool_type, true));
auto* body = create<BlockStatement>();
diff --git a/src/ast/expression_test.cc b/src/ast/expression_test.cc
index b651b01..c6337a4 100644
--- a/src/ast/expression_test.cc
+++ b/src/ast/expression_test.cc
@@ -38,7 +38,7 @@
Expr e;
e.set_result_type(&i32);
ASSERT_NE(e.result_type(), nullptr);
- EXPECT_TRUE(e.result_type()->Is<ast::type::I32Type>());
+ EXPECT_TRUE(e.result_type()->Is<type::I32Type>());
}
TEST_F(ExpressionTest, set_result_type_alias) {
@@ -49,7 +49,7 @@
Expr e;
e.set_result_type(&b);
ASSERT_NE(e.result_type(), nullptr);
- EXPECT_TRUE(e.result_type()->Is<ast::type::I32Type>());
+ EXPECT_TRUE(e.result_type()->Is<type::I32Type>());
}
} // namespace
diff --git a/src/ast/float_literal.cc b/src/ast/float_literal.cc
index 70ba92e..c781afa 100644
--- a/src/ast/float_literal.cc
+++ b/src/ast/float_literal.cc
@@ -20,7 +20,7 @@
namespace tint {
namespace ast {
-FloatLiteral::FloatLiteral(ast::type::Type* type, float value)
+FloatLiteral::FloatLiteral(type::Type* type, float value)
: Base(type), value_(value) {}
FloatLiteral::~FloatLiteral() = default;
diff --git a/src/ast/float_literal.h b/src/ast/float_literal.h
index 411deaa..f474c67 100644
--- a/src/ast/float_literal.h
+++ b/src/ast/float_literal.h
@@ -28,7 +28,7 @@
/// Constructor
/// @param type the type of the literal
/// @param value the float literals value
- FloatLiteral(ast::type::Type* type, float value);
+ FloatLiteral(type::Type* type, float value);
~FloatLiteral() override;
/// @returns the float literal value
diff --git a/src/ast/float_literal_test.cc b/src/ast/float_literal_test.cc
index 568df88..ffc9361 100644
--- a/src/ast/float_literal_test.cc
+++ b/src/ast/float_literal_test.cc
@@ -28,14 +28,14 @@
using FloatLiteralTest = TestHelper;
TEST_F(FloatLiteralTest, Value) {
- ast::type::F32Type f32;
+ type::F32Type f32;
FloatLiteral f{&f32, 47.2f};
ASSERT_TRUE(f.Is<FloatLiteral>());
EXPECT_EQ(f.value(), 47.2f);
}
TEST_F(FloatLiteralTest, Is) {
- ast::type::F32Type f32;
+ type::F32Type f32;
FloatLiteral f{&f32, 42.f};
Literal* l = &f;
EXPECT_FALSE(l->Is<BoolLiteral>());
@@ -47,14 +47,14 @@
}
TEST_F(FloatLiteralTest, ToStr) {
- ast::type::F32Type f32;
+ type::F32Type f32;
FloatLiteral f{&f32, 42.1f};
EXPECT_EQ(f.to_str(), "42.099998");
}
TEST_F(FloatLiteralTest, ToName) {
- ast::type::F32Type f32;
+ type::F32Type f32;
FloatLiteral f{&f32, 42.1f};
EXPECT_EQ(f.name(), "__float42.0999985");
}
diff --git a/src/ast/function.cc b/src/ast/function.cc
index 8c72209..b251a7d 100644
--- a/src/ast/function.cc
+++ b/src/ast/function.cc
@@ -62,13 +62,13 @@
return {1, 1, 1};
}
-ast::PipelineStage Function::pipeline_stage() const {
+PipelineStage Function::pipeline_stage() const {
for (auto* deco : decorations_) {
if (auto* stage = deco->As<StageDecoration>()) {
return stage->value();
}
}
- return ast::PipelineStage::kNone;
+ return PipelineStage::kNone;
}
void Function::add_referenced_module_variable(Variable* var) {
@@ -85,7 +85,7 @@
std::vector<std::pair<Variable*, LocationDecoration*>> ret;
for (auto* var : referenced_module_variables()) {
- if (auto* decos = var->As<ast::DecoratedVariable>()) {
+ if (auto* decos = var->As<DecoratedVariable>()) {
for (auto* deco : decos->decorations()) {
if (auto* location = deco->As<LocationDecoration>()) {
ret.push_back({var, location});
@@ -102,17 +102,17 @@
std::vector<std::pair<Variable*, Function::BindingInfo>> ret;
for (auto* var : referenced_module_variables()) {
- if (!var->Is<ast::DecoratedVariable>() ||
- var->storage_class() != ast::StorageClass::kUniform) {
+ if (!var->Is<DecoratedVariable>() ||
+ var->storage_class() != StorageClass::kUniform) {
continue;
}
BindingDecoration* binding = nullptr;
SetDecoration* set = nullptr;
- for (auto* deco : var->As<ast::DecoratedVariable>()->decorations()) {
- if (auto* b = deco->As<ast::BindingDecoration>()) {
+ for (auto* deco : var->As<DecoratedVariable>()->decorations()) {
+ if (auto* b = deco->As<BindingDecoration>()) {
binding = b;
- } else if (auto* s = deco->As<ast::SetDecoration>()) {
+ } else if (auto* s = deco->As<SetDecoration>()) {
set = s;
}
}
@@ -130,17 +130,17 @@
std::vector<std::pair<Variable*, Function::BindingInfo>> ret;
for (auto* var : referenced_module_variables()) {
- if (!var->Is<ast::DecoratedVariable>() ||
- var->storage_class() != ast::StorageClass::kStorageBuffer) {
+ if (!var->Is<DecoratedVariable>() ||
+ var->storage_class() != StorageClass::kStorageBuffer) {
continue;
}
BindingDecoration* binding = nullptr;
SetDecoration* set = nullptr;
- for (auto* deco : var->As<ast::DecoratedVariable>()->decorations()) {
- if (auto* b = deco->As<ast::BindingDecoration>()) {
+ for (auto* deco : var->As<DecoratedVariable>()->decorations()) {
+ if (auto* b = deco->As<BindingDecoration>()) {
binding = b;
- } else if (auto* s = deco->As<ast::SetDecoration>()) {
+ } else if (auto* s = deco->As<SetDecoration>()) {
set = s;
}
}
@@ -158,10 +158,10 @@
std::vector<std::pair<Variable*, BuiltinDecoration*>> ret;
for (auto* var : referenced_module_variables()) {
- if (!var->Is<ast::DecoratedVariable>()) {
+ if (!var->Is<DecoratedVariable>()) {
continue;
}
- for (auto* deco : var->As<ast::DecoratedVariable>()->decorations()) {
+ for (auto* deco : var->As<DecoratedVariable>()->decorations()) {
if (auto* builtin = deco->As<BuiltinDecoration>()) {
ret.push_back({var, builtin});
break;
@@ -282,18 +282,18 @@
for (auto* var : referenced_module_variables()) {
auto* unwrapped_type = var->type()->UnwrapIfNeeded();
- if (!var->Is<ast::DecoratedVariable>() ||
- !unwrapped_type->Is<ast::type::SamplerType>() ||
- unwrapped_type->As<ast::type::SamplerType>()->kind() != kind) {
+ if (!var->Is<DecoratedVariable>() ||
+ !unwrapped_type->Is<type::SamplerType>() ||
+ unwrapped_type->As<type::SamplerType>()->kind() != kind) {
continue;
}
BindingDecoration* binding = nullptr;
SetDecoration* set = nullptr;
- for (auto* deco : var->As<ast::DecoratedVariable>()->decorations()) {
- if (auto* b = deco->As<ast::BindingDecoration>()) {
+ for (auto* deco : var->As<DecoratedVariable>()->decorations()) {
+ if (auto* b = deco->As<BindingDecoration>()) {
binding = b;
- } else if (auto* s = deco->As<ast::SetDecoration>()) {
+ } else if (auto* s = deco->As<SetDecoration>()) {
set = s;
}
}
@@ -312,24 +312,23 @@
for (auto* var : referenced_module_variables()) {
auto* unwrapped_type = var->type()->UnwrapIfNeeded();
- if (!var->Is<ast::DecoratedVariable>() ||
- !unwrapped_type->Is<ast::type::TextureType>()) {
+ if (!var->Is<DecoratedVariable>() ||
+ !unwrapped_type->Is<type::TextureType>()) {
continue;
}
if ((multisampled &&
- !unwrapped_type->Is<ast::type::MultisampledTextureType>()) ||
- (!multisampled &&
- !unwrapped_type->Is<ast::type::SampledTextureType>())) {
+ !unwrapped_type->Is<type::MultisampledTextureType>()) ||
+ (!multisampled && !unwrapped_type->Is<type::SampledTextureType>())) {
continue;
}
BindingDecoration* binding = nullptr;
SetDecoration* set = nullptr;
- for (auto* deco : var->As<ast::DecoratedVariable>()->decorations()) {
- if (auto* b = deco->As<ast::BindingDecoration>()) {
+ for (auto* deco : var->As<DecoratedVariable>()->decorations()) {
+ if (auto* b = deco->As<BindingDecoration>()) {
binding = b;
- } else if (auto* s = deco->As<ast::SetDecoration>()) {
+ } else if (auto* s = deco->As<SetDecoration>()) {
set = s;
}
}
diff --git a/src/ast/function.h b/src/ast/function.h
index acaf30c..f539224 100644
--- a/src/ast/function.h
+++ b/src/ast/function.h
@@ -91,7 +91,7 @@
/// Sets the function decorations
/// @param decos the decorations to set. This will overwrite any existing
/// decorations
- void set_decorations(ast::FunctionDecorationList decos) {
+ void set_decorations(FunctionDecorationList decos) {
decorations_ = std::move(decos);
}
/// Adds a decoration to the function
@@ -107,12 +107,10 @@
std::tuple<uint32_t, uint32_t, uint32_t> workgroup_size() const;
/// @returns the functions pipeline stage or None if not set
- ast::PipelineStage pipeline_stage() const;
+ PipelineStage pipeline_stage() const;
/// @returns true if this function is an entry point
- bool IsEntryPoint() const {
- return pipeline_stage() != ast::PipelineStage::kNone;
- }
+ bool IsEntryPoint() const { return pipeline_stage() != PipelineStage::kNone; }
/// Adds the given variable to the list of referenced module variables if it
/// is not already included.
diff --git a/src/ast/function_test.cc b/src/ast/function_test.cc
index a305c96..d94f928 100644
--- a/src/ast/function_test.cc
+++ b/src/ast/function_test.cc
@@ -40,7 +40,7 @@
params.push_back(create<Variable>("var", StorageClass::kNone, &i32));
auto* var = params[0];
- Function f("func", params, &void_type, create<ast::BlockStatement>());
+ Function f("func", params, &void_type, create<BlockStatement>());
EXPECT_EQ(f.name(), "func");
ASSERT_EQ(f.params().size(), 1u);
EXPECT_EQ(f.return_type(), &void_type);
@@ -55,7 +55,7 @@
params.push_back(create<Variable>("var", StorageClass::kNone, &i32));
Function f(Source{Source::Location{20, 2}}, "func", params, &void_type,
- create<ast::BlockStatement>());
+ create<BlockStatement>());
auto src = f.source();
EXPECT_EQ(src.range.begin.line, 20u);
EXPECT_EQ(src.range.begin.column, 2u);
@@ -66,7 +66,7 @@
type::I32Type i32;
Variable v("var", StorageClass::kInput, &i32);
- Function f("func", VariableList{}, &void_type, create<ast::BlockStatement>());
+ Function f("func", VariableList{}, &void_type, create<BlockStatement>());
f.add_referenced_module_variable(&v);
ASSERT_EQ(f.referenced_module_variables().size(), 1u);
@@ -85,25 +85,23 @@
type::VoidType void_type;
type::I32Type i32;
- DecoratedVariable loc1(
- create<ast::Variable>("loc1", StorageClass::kInput, &i32));
- loc1.set_decorations({create<ast::LocationDecoration>(0, Source{})});
+ DecoratedVariable loc1(create<Variable>("loc1", StorageClass::kInput, &i32));
+ loc1.set_decorations({create<LocationDecoration>(0, Source{})});
- DecoratedVariable loc2(
- create<ast::Variable>("loc2", StorageClass::kInput, &i32));
- loc2.set_decorations({create<ast::LocationDecoration>(1, Source{})});
+ DecoratedVariable loc2(create<Variable>("loc2", StorageClass::kInput, &i32));
+ loc2.set_decorations({create<LocationDecoration>(1, Source{})});
DecoratedVariable builtin1(
- create<ast::Variable>("builtin1", StorageClass::kInput, &i32));
+ create<Variable>("builtin1", StorageClass::kInput, &i32));
builtin1.set_decorations(
- {create<ast::BuiltinDecoration>(ast::Builtin::kPosition, Source{})});
+ {create<BuiltinDecoration>(Builtin::kPosition, Source{})});
DecoratedVariable builtin2(
- create<ast::Variable>("builtin2", StorageClass::kInput, &i32));
+ create<Variable>("builtin2", StorageClass::kInput, &i32));
builtin2.set_decorations(
- {create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{})});
+ {create<BuiltinDecoration>(Builtin::kFragDepth, Source{})});
- Function f("func", VariableList{}, &void_type, create<ast::BlockStatement>());
+ Function f("func", VariableList{}, &void_type, create<BlockStatement>());
f.add_referenced_module_variable(&loc1);
f.add_referenced_module_variable(&builtin1);
@@ -123,25 +121,23 @@
type::VoidType void_type;
type::I32Type i32;
- DecoratedVariable loc1(
- create<ast::Variable>("loc1", StorageClass::kInput, &i32));
- loc1.set_decorations({create<ast::LocationDecoration>(0, Source{})});
+ DecoratedVariable loc1(create<Variable>("loc1", StorageClass::kInput, &i32));
+ loc1.set_decorations({create<LocationDecoration>(0, Source{})});
- DecoratedVariable loc2(
- create<ast::Variable>("loc2", StorageClass::kInput, &i32));
- loc2.set_decorations({create<ast::LocationDecoration>(1, Source{})});
+ DecoratedVariable loc2(create<Variable>("loc2", StorageClass::kInput, &i32));
+ loc2.set_decorations({create<LocationDecoration>(1, Source{})});
DecoratedVariable builtin1(
- create<ast::Variable>("builtin1", StorageClass::kInput, &i32));
+ create<Variable>("builtin1", StorageClass::kInput, &i32));
builtin1.set_decorations(
- {create<ast::BuiltinDecoration>(ast::Builtin::kPosition, Source{})});
+ {create<BuiltinDecoration>(Builtin::kPosition, Source{})});
DecoratedVariable builtin2(
- create<ast::Variable>("builtin2", StorageClass::kInput, &i32));
+ create<Variable>("builtin2", StorageClass::kInput, &i32));
builtin2.set_decorations(
- {create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth, Source{})});
+ {create<BuiltinDecoration>(Builtin::kFragDepth, Source{})});
- Function f("func", VariableList{}, &void_type, create<ast::BlockStatement>());
+ Function f("func", VariableList{}, &void_type, create<BlockStatement>());
f.add_referenced_module_variable(&loc1);
f.add_referenced_module_variable(&builtin1);
@@ -152,14 +148,14 @@
auto ref_locs = f.referenced_builtin_variables();
ASSERT_EQ(ref_locs.size(), 2u);
EXPECT_EQ(ref_locs[0].first, &builtin1);
- EXPECT_EQ(ref_locs[0].second->value(), ast::Builtin::kPosition);
+ EXPECT_EQ(ref_locs[0].second->value(), Builtin::kPosition);
EXPECT_EQ(ref_locs[1].first, &builtin2);
- EXPECT_EQ(ref_locs[1].second->value(), ast::Builtin::kFragDepth);
+ EXPECT_EQ(ref_locs[1].second->value(), Builtin::kFragDepth);
}
TEST_F(FunctionTest, AddDuplicateEntryPoints) {
- ast::type::VoidType void_type;
- Function f("func", VariableList{}, &void_type, create<ast::BlockStatement>());
+ type::VoidType void_type;
+ Function f("func", VariableList{}, &void_type, create<BlockStatement>());
f.add_ancestor_entry_point("main");
ASSERT_EQ(1u, f.ancestor_entry_points().size());
@@ -177,10 +173,10 @@
VariableList params;
params.push_back(create<Variable>("var", StorageClass::kNone, &i32));
- auto* block = create<ast::BlockStatement>();
+ auto* block = create<BlockStatement>();
block->append(create<DiscardStatement>());
- Function f("func", params, &void_type, create<ast::BlockStatement>());
+ Function f("func", params, &void_type, create<BlockStatement>());
f.set_body(block);
EXPECT_TRUE(f.IsValid());
}
@@ -192,7 +188,7 @@
VariableList params;
params.push_back(create<Variable>("var", StorageClass::kNone, &i32));
- Function f("", params, &void_type, create<ast::BlockStatement>());
+ Function f("", params, &void_type, create<BlockStatement>());
EXPECT_FALSE(f.IsValid());
}
@@ -202,7 +198,7 @@
VariableList params;
params.push_back(create<Variable>("var", StorageClass::kNone, &i32));
- Function f("func", params, nullptr, create<ast::BlockStatement>());
+ Function f("func", params, nullptr, create<BlockStatement>());
EXPECT_FALSE(f.IsValid());
}
@@ -214,7 +210,7 @@
params.push_back(create<Variable>("var", StorageClass::kNone, &i32));
params.push_back(nullptr);
- Function f("func", params, &void_type, create<ast::BlockStatement>());
+ Function f("func", params, &void_type, create<BlockStatement>());
EXPECT_FALSE(f.IsValid());
}
@@ -224,7 +220,7 @@
VariableList params;
params.push_back(create<Variable>("var", StorageClass::kNone, nullptr));
- Function f("func", params, &void_type, create<ast::BlockStatement>());
+ Function f("func", params, &void_type, create<BlockStatement>());
EXPECT_FALSE(f.IsValid());
}
@@ -235,11 +231,11 @@
VariableList params;
params.push_back(create<Variable>("var", StorageClass::kNone, &i32));
- auto* block = create<ast::BlockStatement>();
+ auto* block = create<BlockStatement>();
block->append(create<DiscardStatement>());
block->append(nullptr);
- Function f("func", params, &void_type, create<ast::BlockStatement>());
+ Function f("func", params, &void_type, create<BlockStatement>());
f.set_body(block);
EXPECT_FALSE(f.IsValid());
}
@@ -251,11 +247,11 @@
VariableList params;
params.push_back(create<Variable>("var", StorageClass::kNone, &i32));
- auto* block = create<ast::BlockStatement>();
+ auto* block = create<BlockStatement>();
block->append(create<DiscardStatement>());
block->append(nullptr);
- Function f("func", params, &void_type, create<ast::BlockStatement>());
+ Function f("func", params, &void_type, create<BlockStatement>());
f.set_body(block);
EXPECT_FALSE(f.IsValid());
}
@@ -264,10 +260,10 @@
type::VoidType void_type;
type::I32Type i32;
- auto* block = create<ast::BlockStatement>();
+ auto* block = create<BlockStatement>();
block->append(create<DiscardStatement>());
- Function f("func", {}, &void_type, create<ast::BlockStatement>());
+ Function f("func", {}, &void_type, create<BlockStatement>());
f.set_body(block);
std::ostringstream out;
@@ -284,10 +280,10 @@
type::VoidType void_type;
type::I32Type i32;
- auto* block = create<ast::BlockStatement>();
+ auto* block = create<BlockStatement>();
block->append(create<DiscardStatement>());
- Function f("func", {}, &void_type, create<ast::BlockStatement>());
+ Function f("func", {}, &void_type, create<BlockStatement>());
f.set_body(block);
f.add_decoration(create<WorkgroupDecoration>(2, 4, 6, Source{}));
@@ -309,10 +305,10 @@
VariableList params;
params.push_back(create<Variable>("var", StorageClass::kNone, &i32));
- auto* block = create<ast::BlockStatement>();
+ auto* block = create<BlockStatement>();
block->append(create<DiscardStatement>());
- Function f("func", params, &void_type, create<ast::BlockStatement>());
+ Function f("func", params, &void_type, create<BlockStatement>());
f.set_body(block);
std::ostringstream out;
@@ -334,7 +330,7 @@
TEST_F(FunctionTest, TypeName) {
type::VoidType void_type;
- Function f("func", {}, &void_type, create<ast::BlockStatement>());
+ Function f("func", {}, &void_type, create<BlockStatement>());
EXPECT_EQ(f.type_name(), "__func__void");
}
@@ -347,7 +343,7 @@
params.push_back(create<Variable>("var1", StorageClass::kNone, &i32));
params.push_back(create<Variable>("var2", StorageClass::kNone, &f32));
- Function f("func", params, &void_type, create<ast::BlockStatement>());
+ Function f("func", params, &void_type, create<BlockStatement>());
EXPECT_EQ(f.type_name(), "__func__void__i32__f32");
}
@@ -355,10 +351,10 @@
type::VoidType void_type;
VariableList params;
- auto* body = create<ast::BlockStatement>();
+ auto* body = create<BlockStatement>();
auto* stmt = create<DiscardStatement>();
body->append(stmt);
- Function f("func", params, &void_type, create<ast::BlockStatement>());
+ Function f("func", params, &void_type, create<BlockStatement>());
f.set_body(body);
EXPECT_EQ(f.get_last_statement(), stmt);
@@ -368,8 +364,8 @@
type::VoidType void_type;
VariableList params;
- auto* body = create<ast::BlockStatement>();
- Function f("func", params, &void_type, create<ast::BlockStatement>());
+ auto* body = create<BlockStatement>();
+ Function f("func", params, &void_type, create<BlockStatement>());
f.set_body(body);
EXPECT_EQ(f.get_last_statement(), nullptr);
@@ -377,7 +373,7 @@
TEST_F(FunctionTest, WorkgroupSize_NoneSet) {
type::VoidType void_type;
- Function f("f", {}, &void_type, create<ast::BlockStatement>());
+ Function f("f", {}, &void_type, create<BlockStatement>());
uint32_t x = 0;
uint32_t y = 0;
uint32_t z = 0;
@@ -389,7 +385,7 @@
TEST_F(FunctionTest, WorkgroupSize) {
type::VoidType void_type;
- Function f("f", {}, &void_type, create<ast::BlockStatement>());
+ Function f("f", {}, &void_type, create<BlockStatement>());
f.add_decoration(create<WorkgroupDecoration>(2u, 4u, 6u, Source{}));
uint32_t x = 0;
diff --git a/src/ast/identifier_expression_test.cc b/src/ast/identifier_expression_test.cc
index 1bef59d..7ef416e 100644
--- a/src/ast/identifier_expression_test.cc
+++ b/src/ast/identifier_expression_test.cc
@@ -38,7 +38,7 @@
TEST_F(IdentifierExpressionTest, IsIdentifier) {
IdentifierExpression i("ident");
- EXPECT_TRUE(i.Is<ast::IdentifierExpression>());
+ EXPECT_TRUE(i.Is<IdentifierExpression>());
}
TEST_F(IdentifierExpressionTest, IsValid) {
diff --git a/src/ast/int_literal.cc b/src/ast/int_literal.cc
index bb86821..afb8a29 100644
--- a/src/ast/int_literal.cc
+++ b/src/ast/int_literal.cc
@@ -17,7 +17,7 @@
namespace tint {
namespace ast {
-IntLiteral::IntLiteral(ast::type::Type* type) : Base(type) {}
+IntLiteral::IntLiteral(type::Type* type) : Base(type) {}
IntLiteral::~IntLiteral() = default;
diff --git a/src/ast/int_literal.h b/src/ast/int_literal.h
index e2f5c66..5cf808d 100644
--- a/src/ast/int_literal.h
+++ b/src/ast/int_literal.h
@@ -30,7 +30,7 @@
protected:
/// Constructor
/// @param type the type of the literal
- explicit IntLiteral(ast::type::Type* type);
+ explicit IntLiteral(type::Type* type);
};
} // namespace ast
diff --git a/src/ast/int_literal_test.cc b/src/ast/int_literal_test.cc
index f002d49..70d399a 100644
--- a/src/ast/int_literal_test.cc
+++ b/src/ast/int_literal_test.cc
@@ -30,13 +30,13 @@
using IntLiteralTest = TestHelper;
TEST_F(IntLiteralTest, Sint_IsInt) {
- ast::type::I32Type i32;
+ type::I32Type i32;
SintLiteral i{&i32, 47};
ASSERT_TRUE(i.Is<IntLiteral>());
}
TEST_F(IntLiteralTest, Uint_IsInt) {
- ast::type::I32Type i32;
+ type::I32Type i32;
UintLiteral i{&i32, 42};
EXPECT_TRUE(i.Is<IntLiteral>());
}
diff --git a/src/ast/intrinsic.cc b/src/ast/intrinsic.cc
index dc6c60a..6ebd412 100644
--- a/src/ast/intrinsic.cc
+++ b/src/ast/intrinsic.cc
@@ -240,28 +240,28 @@
TextureSignature::Parameters::Index::Index() = default;
TextureSignature::Parameters::Index::Index(const Index&) = default;
-bool IsCoarseDerivative(ast::Intrinsic i) {
+bool IsCoarseDerivative(Intrinsic i) {
return i == Intrinsic::kDpdxCoarse || i == Intrinsic::kDpdyCoarse ||
i == Intrinsic::kFwidthCoarse;
}
-bool IsFineDerivative(ast::Intrinsic i) {
+bool IsFineDerivative(Intrinsic i) {
return i == Intrinsic::kDpdxFine || i == Intrinsic::kDpdyFine ||
i == Intrinsic::kFwidthFine;
}
-bool IsDerivative(ast::Intrinsic i) {
+bool IsDerivative(Intrinsic i) {
return i == Intrinsic::kDpdx || i == Intrinsic::kDpdy ||
i == Intrinsic::kFwidth || IsCoarseDerivative(i) ||
IsFineDerivative(i);
}
-bool IsFloatClassificationIntrinsic(ast::Intrinsic i) {
+bool IsFloatClassificationIntrinsic(Intrinsic i) {
return i == Intrinsic::kIsFinite || i == Intrinsic::kIsInf ||
i == Intrinsic::kIsNan || i == Intrinsic::kIsNormal;
}
-bool IsTextureIntrinsic(ast::Intrinsic i) {
+bool IsTextureIntrinsic(Intrinsic i) {
return i == Intrinsic::kTextureLoad || i == Intrinsic::kTextureSample ||
i == Intrinsic::kTextureSampleLevel ||
i == Intrinsic::kTextureSampleBias ||
diff --git a/src/ast/intrinsic.h b/src/ast/intrinsic.h
index a122ad3..24650c2 100644
--- a/src/ast/intrinsic.h
+++ b/src/ast/intrinsic.h
@@ -161,27 +161,27 @@
/// Determines if the given |name| is a coarse derivative
/// @param i the intrinsic
/// @returns true if the given derivative is coarse.
-bool IsCoarseDerivative(ast::Intrinsic i);
+bool IsCoarseDerivative(Intrinsic i);
/// Determines if the given |name| is a fine derivative
/// @param i the intrinsic
/// @returns true if the given derivative is fine.
-bool IsFineDerivative(ast::Intrinsic i);
+bool IsFineDerivative(Intrinsic i);
/// Determine if the given |name| is a derivative intrinsic
/// @param i the intrinsic
/// @returns true if the given |name| is a derivative intrinsic
-bool IsDerivative(ast::Intrinsic i);
+bool IsDerivative(Intrinsic i);
/// Determines if the given |name| is a float classification intrinsic
/// @param i the intrinsic
/// @returns true if the given |name| is a float intrinsic
-bool IsFloatClassificationIntrinsic(ast::Intrinsic i);
+bool IsFloatClassificationIntrinsic(Intrinsic i);
/// Determines if the given |name| is a texture operation intrinsic
/// @param i the intrinsic
/// @returns true if the given |name| is a texture operation intrinsic
-bool IsTextureIntrinsic(ast::Intrinsic i);
+bool IsTextureIntrinsic(Intrinsic i);
} // namespace intrinsic
} // namespace ast
diff --git a/src/ast/intrinsic_texture_helper_test.cc b/src/ast/intrinsic_texture_helper_test.cc
index b1bd426..9cb6150 100644
--- a/src/ast/intrinsic_texture_helper_test.cc
+++ b/src/ast/intrinsic_texture_helper_test.cc
@@ -26,11 +26,11 @@
ValidTextureOverload o,
const char* d,
TextureKind tk,
- ast::type::SamplerKind sk,
- ast::type::TextureDimension td,
+ type::SamplerKind sk,
+ type::TextureDimension td,
TextureDataType tdt,
const char* f,
- std::function<ast::ExpressionList(ast::Builder*)> a)
+ std::function<ExpressionList(Builder*)> a)
: overload(o),
description(d),
texture_kind(tk),
@@ -49,11 +49,11 @@
" s : sampler,\n"
" coords : f32) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k1d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k1d,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
+ [](Builder* b) {
return b->ExprList("texture", // t
"sampler", // s
1.0f); // coords
@@ -66,11 +66,11 @@
" coords : f32,\n"
" array_index : u32) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k1dArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k1dArray,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
+ [](Builder* b) {
return b->ExprList("texture", // t
"sampler", // s
1.0f, // coords
@@ -83,12 +83,12 @@
" s : sampler,\n"
" coords : vec2<f32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2d,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f)); // coords
@@ -101,13 +101,13 @@
" coords : vec2<f32>\n"
" offset : vec2<i32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2d,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -121,12 +121,12 @@
" coords : vec2<f32>,\n"
" array_index : u32) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2dArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2dArray,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -141,13 +141,13 @@
" array_index : u32\n"
" offset : vec2<i32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2dArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2dArray,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -161,12 +161,12 @@
" s : sampler,\n"
" coords : vec3<f32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k3d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k3d,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f)); // coords
@@ -179,13 +179,13 @@
" coords : vec3<f32>\n"
" offset : vec3<i32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k3d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k3d,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -198,12 +198,12 @@
" s : sampler,\n"
" coords : vec3<f32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::kCube,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::kCube,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f)); // coords
@@ -216,12 +216,12 @@
" coords : vec3<f32>,\n"
" array_index : u32) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::kCubeArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::kCubeArray,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -234,12 +234,12 @@
" s : sampler,\n"
" coords : vec2<f32>) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2d,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f)); // coords
@@ -252,13 +252,13 @@
" coords : vec2<f32>\n"
" offset : vec2<i32>) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2d,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -272,12 +272,12 @@
" coords : vec2<f32>,\n"
" array_index : u32) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2dArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2dArray,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -292,13 +292,13 @@
" array_index : u32\n"
" offset : vec2<i32>) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2dArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2dArray,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -312,12 +312,12 @@
" s : sampler,\n"
" coords : vec3<f32>) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::kCube,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::kCube,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f)); // coords
@@ -330,12 +330,12 @@
" coords : vec3<f32>,\n"
" array_index : u32) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::kCubeArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::kCubeArray,
TextureDataType::kF32,
"textureSample",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -349,12 +349,12 @@
" coords : vec2<f32>,\n"
" bias : f32) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2d,
TextureDataType::kF32,
"textureSampleBias",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -369,13 +369,13 @@
" bias : f32,\n"
" offset : vec2<i32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2d,
TextureDataType::kF32,
"textureSampleBias",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -391,12 +391,12 @@
" array_index : u32,\n"
" bias : f32) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2dArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2dArray,
TextureDataType::kF32,
"textureSampleBias",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -413,13 +413,13 @@
" bias : f32,\n"
" offset : vec2<i32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2dArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2dArray,
TextureDataType::kF32,
"textureSampleBias",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -435,12 +435,12 @@
" coords : vec3<f32>,\n"
" bias : f32) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k3d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k3d,
TextureDataType::kF32,
"textureSampleBias",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -455,13 +455,13 @@
" bias : f32,\n"
" offset : vec3<i32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k3d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k3d,
TextureDataType::kF32,
"textureSampleBias",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -476,12 +476,12 @@
" coords : vec3<f32>,\n"
" bias : f32) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::kCube,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::kCube,
TextureDataType::kF32,
"textureSampleBias",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -496,12 +496,12 @@
" array_index : u32,\n"
" bias : f32) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::kCubeArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::kCubeArray,
TextureDataType::kF32,
"textureSampleBias",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -516,12 +516,12 @@
" coords : vec2<f32>,\n"
" level : f32) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2d,
TextureDataType::kF32,
"textureSampleLevel",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -536,13 +536,13 @@
" level : f32,\n"
" offset : vec2<i32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2d,
TextureDataType::kF32,
"textureSampleLevel",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -558,12 +558,12 @@
" array_index : u32,\n"
" level : f32) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2dArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2dArray,
TextureDataType::kF32,
"textureSampleLevel",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -580,13 +580,13 @@
" level : f32,\n"
" offset : vec2<i32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2dArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2dArray,
TextureDataType::kF32,
"textureSampleLevel",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -602,12 +602,12 @@
" coords : vec3<f32>,\n"
" level : f32) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k3d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k3d,
TextureDataType::kF32,
"textureSampleLevel",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -622,13 +622,13 @@
" level : f32,\n"
" offset : vec3<i32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k3d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k3d,
TextureDataType::kF32,
"textureSampleLevel",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -643,12 +643,12 @@
" coords : vec3<f32>,\n"
" level : f32) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::kCube,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::kCube,
TextureDataType::kF32,
"textureSampleLevel",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -663,12 +663,12 @@
" array_index : u32,\n"
" level : f32) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::kCubeArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::kCubeArray,
TextureDataType::kF32,
"textureSampleLevel",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -683,12 +683,12 @@
" coords : vec2<f32>,\n"
" level : u32) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2d,
TextureDataType::kF32,
"textureSampleLevel",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -703,13 +703,13 @@
" level : u32,\n"
" offset : vec2<i32>) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2d,
TextureDataType::kF32,
"textureSampleLevel",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -725,12 +725,12 @@
" array_index : u32,\n"
" level : u32) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2dArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2dArray,
TextureDataType::kF32,
"textureSampleLevel",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -747,13 +747,13 @@
" level : u32,\n"
" offset : vec2<i32>) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2dArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2dArray,
TextureDataType::kF32,
"textureSampleLevel",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -769,12 +769,12 @@
" coords : vec3<f32>,\n"
" level : u32) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::kCube,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::kCube,
TextureDataType::kF32,
"textureSampleLevel",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -789,12 +789,12 @@
" array_index : u32,\n"
" level : u32) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::kCubeArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::kCubeArray,
TextureDataType::kF32,
"textureSampleLevel",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -810,12 +810,12 @@
" ddx : vec2<f32>,\n"
" ddy : vec2<f32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2d,
TextureDataType::kF32,
"textureSampleGrad",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.0f, 2.0f), // coords
@@ -832,13 +832,13 @@
" ddy : vec2<f32>,\n"
" offset : vec2<i32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2d,
TextureDataType::kF32,
"textureSampleGrad",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -856,12 +856,12 @@
" ddx : vec2<f32>,\n"
" ddy : vec2<f32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2dArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2dArray,
TextureDataType::kF32,
"textureSampleGrad",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -880,13 +880,13 @@
" ddy : vec2<f32>,\n"
" offset : vec2<i32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k2dArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k2dArray,
TextureDataType::kF32,
"textureSampleGrad",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -904,12 +904,12 @@
" ddx : vec3<f32>,\n"
" ddy : vec3<f32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k3d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k3d,
TextureDataType::kF32,
"textureSampleGrad",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -926,13 +926,13 @@
" ddy : vec3<f32>,\n"
" offset : vec3<i32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::k3d,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::k3d,
TextureDataType::kF32,
"textureSampleGrad",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -949,12 +949,12 @@
" ddx : vec3<f32>,\n"
" ddy : vec3<f32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::kCube,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::kCube,
TextureDataType::kF32,
"textureSampleGrad",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -971,12 +971,12 @@
" ddx : vec3<f32>,\n"
" ddy : vec3<f32>) -> vec4<f32>",
TextureKind::kRegular,
- ast::type::SamplerKind::kSampler,
- ast::type::TextureDimension::kCubeArray,
+ type::SamplerKind::kSampler,
+ type::TextureDimension::kCubeArray,
TextureDataType::kF32,
"textureSampleGrad",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -992,12 +992,12 @@
" coords : vec2<f32>,\n"
" depth_ref : f32) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kComparisonSampler,
- ast::type::TextureDimension::k2d,
+ type::SamplerKind::kComparisonSampler,
+ type::TextureDimension::k2d,
TextureDataType::kF32,
"textureSampleCompare",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -1012,13 +1012,13 @@
" depth_ref : f32,\n"
" offset : vec2<i32>) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kComparisonSampler,
- ast::type::TextureDimension::k2d,
+ type::SamplerKind::kComparisonSampler,
+ type::TextureDimension::k2d,
TextureDataType::kF32,
"textureSampleCompare",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -1034,12 +1034,12 @@
" array_index : u32,\n"
" depth_ref : f32) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kComparisonSampler,
- ast::type::TextureDimension::k2dArray,
+ type::SamplerKind::kComparisonSampler,
+ type::TextureDimension::k2dArray,
TextureDataType::kF32,
"textureSampleCompare",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -1056,13 +1056,13 @@
" depth_ref : f32,\n"
" offset : vec2<i32>) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kComparisonSampler,
- ast::type::TextureDimension::k2dArray,
+ type::SamplerKind::kComparisonSampler,
+ type::TextureDimension::k2dArray,
TextureDataType::kF32,
"textureSampleCompare",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
- using i32 = ast::Builder::i32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
+ using i32 = Builder::i32;
return b->ExprList("texture", // t
"sampler", // s
b->vec2<f32>(1.f, 2.f), // coords
@@ -1078,12 +1078,12 @@
" coords : vec3<f32>,\n"
" depth_ref : f32) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kComparisonSampler,
- ast::type::TextureDimension::kCube,
+ type::SamplerKind::kComparisonSampler,
+ type::TextureDimension::kCube,
TextureDataType::kF32,
"textureSampleCompare",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
@@ -1098,12 +1098,12 @@
" array_index : u32,\n"
" depth_ref : f32) -> f32",
TextureKind::kDepth,
- ast::type::SamplerKind::kComparisonSampler,
- ast::type::TextureDimension::kCubeArray,
+ type::SamplerKind::kComparisonSampler,
+ type::TextureDimension::kCubeArray,
TextureDataType::kF32,
"textureSampleCompare",
- [](ast::Builder* b) {
- using f32 = ast::Builder::f32;
+ [](Builder* b) {
+ using f32 = Builder::f32;
return b->ExprList("texture", // t
"sampler", // s
b->vec3<f32>(1.f, 2.f, 3.f), // coords
diff --git a/src/ast/intrinsic_texture_helper_test.h b/src/ast/intrinsic_texture_helper_test.h
index 5e7da8a..88bac80 100644
--- a/src/ast/intrinsic_texture_helper_test.h
+++ b/src/ast/intrinsic_texture_helper_test.h
@@ -121,11 +121,11 @@
TextureOverloadCase(ValidTextureOverload,
const char*,
TextureKind,
- ast::type::SamplerKind,
- ast::type::TextureDimension,
+ type::SamplerKind,
+ type::TextureDimension,
TextureDataType,
const char*,
- std::function<ast::ExpressionList(ast::Builder*)>);
+ std::function<ExpressionList(Builder*)>);
/// Copy constructor
TextureOverloadCase(const TextureOverloadCase&);
/// Destructor
@@ -141,15 +141,15 @@
/// The texture kind for the texture parameter
TextureKind texture_kind;
/// The sampler kind for the sampler parameter
- ast::type::SamplerKind sampler_kind;
+ type::SamplerKind sampler_kind;
/// The dimensions of the texture parameter
- ast::type::TextureDimension texture_dimension;
+ type::TextureDimension texture_dimension;
/// The data type of the texture parameter
TextureDataType texture_data_type;
/// Name of the function. e.g. `textureSample`, `textureSampleGrad`, etc
const char* function;
/// A function that builds the AST arguments for the overload
- std::function<ast::ExpressionList(ast::Builder*)> args;
+ std::function<ExpressionList(Builder*)> args;
};
inline std::ostream& operator<<(std::ostream& out,
diff --git a/src/ast/literal.cc b/src/ast/literal.cc
index 9b7b892..19fa717 100644
--- a/src/ast/literal.cc
+++ b/src/ast/literal.cc
@@ -17,7 +17,7 @@
namespace tint {
namespace ast {
-Literal::Literal(ast::type::Type* type) : type_(type) {}
+Literal::Literal(type::Type* type) : type_(type) {}
Literal::~Literal() = default;
diff --git a/src/ast/literal.h b/src/ast/literal.h
index 4e3ff0f..947ed38 100644
--- a/src/ast/literal.h
+++ b/src/ast/literal.h
@@ -29,7 +29,7 @@
~Literal() override;
/// @returns the type of the literal
- ast::type::Type* type() const { return type_; }
+ type::Type* type() const { return type_; }
/// @returns true if the node is valid
bool IsValid() const override;
@@ -48,10 +48,10 @@
protected:
/// Constructor
/// @param type the type of the literal
- explicit Literal(ast::type::Type* type);
+ explicit Literal(type::Type* type);
private:
- ast::type::Type* type_ = nullptr;
+ type::Type* type_ = nullptr;
};
} // namespace ast
diff --git a/src/ast/member_accessor_expression_test.cc b/src/ast/member_accessor_expression_test.cc
index ddf5477..331157f 100644
--- a/src/ast/member_accessor_expression_test.cc
+++ b/src/ast/member_accessor_expression_test.cc
@@ -46,7 +46,7 @@
TEST_F(MemberAccessorExpressionTest, IsMemberAccessor) {
MemberAccessorExpression stmt;
- EXPECT_TRUE(stmt.Is<ast::MemberAccessorExpression>());
+ EXPECT_TRUE(stmt.Is<MemberAccessorExpression>());
}
TEST_F(MemberAccessorExpressionTest, IsValid) {
diff --git a/src/ast/module.cc b/src/ast/module.cc
index aed71b2..c11bbd7 100644
--- a/src/ast/module.cc
+++ b/src/ast/module.cc
@@ -37,7 +37,7 @@
}
Function* Module::FindFunctionByNameAndStage(const std::string& name,
- ast::PipelineStage stage) const {
+ PipelineStage stage) const {
for (auto* func : functions_) {
if (func->name() == name && func->pipeline_stage() == stage) {
return func;
@@ -56,17 +56,17 @@
if (ty == nullptr) {
return false;
}
- if (ty->Is<ast::type::AliasType>()) {
- auto* alias = ty->As<ast::type::AliasType>();
+ if (ty->Is<type::AliasType>()) {
+ auto* alias = ty->As<type::AliasType>();
if (alias->type() == nullptr) {
return false;
}
- if (alias->type()->Is<ast::type::StructType>() &&
- alias->type()->As<ast::type::StructType>()->name().empty()) {
+ if (alias->type()->Is<type::StructType>() &&
+ alias->type()->As<type::StructType>()->name().empty()) {
return false;
}
- } else if (ty->Is<ast::type::StructType>()) {
- auto* str = ty->As<ast::type::StructType>();
+ } else if (ty->Is<type::StructType>()) {
+ auto* str = ty->As<type::StructType>();
if (str->name().empty()) {
return false;
}
@@ -91,14 +91,14 @@
for (size_t i = 0; i < indent; ++i) {
out << " ";
}
- if (ty->Is<ast::type::AliasType>()) {
- auto* alias = ty->As<ast::type::AliasType>();
+ if (ty->Is<type::AliasType>()) {
+ auto* alias = ty->As<type::AliasType>();
out << alias->name() << " -> " << alias->type()->type_name() << std::endl;
- if (alias->type()->Is<ast::type::StructType>()) {
- alias->type()->As<ast::type::StructType>()->impl()->to_str(out, indent);
+ if (alias->type()->Is<type::StructType>()) {
+ alias->type()->As<type::StructType>()->impl()->to_str(out, indent);
}
- } else if (ty->Is<ast::type::StructType>()) {
- auto* str = ty->As<ast::type::StructType>();
+ } else if (ty->Is<type::StructType>()) {
+ auto* str = ty->As<type::StructType>();
out << str->name() << " ";
str->impl()->to_str(out, indent);
}
diff --git a/src/ast/module.h b/src/ast/module.h
index a688cc9..ded2225 100644
--- a/src/ast/module.h
+++ b/src/ast/module.h
@@ -76,7 +76,7 @@
/// @param stage the pipeline stage
/// @returns the associated function or nullptr if none exists
Function* FindFunctionByNameAndStage(const std::string& name,
- ast::PipelineStage stage) const;
+ PipelineStage stage) const;
/// @returns true if all required fields in the AST are present.
bool IsValid() const;
@@ -84,23 +84,23 @@
/// @returns a string representation of the module
std::string to_str() const;
- /// Creates a new `ast::Node` owned by the Module. When the Module is
- /// destructed, the `ast::Node` will also be destructed.
+ /// Creates a new `Node` owned by the Module. When the Module is
+ /// destructed, the `Node` will also be destructed.
/// @param args the arguments to pass to the type constructor
/// @returns the node pointer
template <typename T, typename... ARGS>
- EnableIfIsType<T, ast::Node>* create(ARGS&&... args) {
- static_assert(std::is_base_of<ast::Node, T>::value,
- "T does not derive from ast::Node");
+ EnableIfIsType<T, Node>* create(ARGS&&... args) {
+ static_assert(std::is_base_of<Node, T>::value,
+ "T does not derive from Node");
auto uptr = std::make_unique<T>(std::forward<ARGS>(args)...);
auto ptr = uptr.get();
ast_nodes_.emplace_back(std::move(uptr));
return ptr;
}
- /// Creates a new `ast::Type` owned by the Module.
+ /// Creates a new `Type` owned by the Module.
/// When the Module is destructed, owned Module and the returned
- /// `ast::Type` will also be destructed.
+ /// `Type` will also be destructed.
/// Types are unique (de-aliased), and so calling create() for the same `T`
/// and arguments will return the same pointer.
/// @warning Use this method to acquire a type only if all of its type
@@ -111,28 +111,27 @@
/// @param args the arguments to pass to the type constructor
/// @returns the de-aliased type pointer
template <typename T, typename... ARGS>
- EnableIfIsType<T, ast::type::Type>* create(ARGS&&... args) {
- static_assert(std::is_base_of<ast::type::Type, T>::value,
- "T does not derive from ast::type::Type");
+ EnableIfIsType<T, type::Type>* create(ARGS&&... args) {
+ static_assert(std::is_base_of<type::Type, T>::value,
+ "T does not derive from type::Type");
return type_mgr_.Get<T>(std::forward<ARGS>(args)...);
}
/// Moves the type `ty` to the Module, returning a pointer to the unique
/// (de-aliased) type.
- /// When the Module is destructed, the returned `ast::Type` will also be
+ /// When the Module is destructed, the returned `Type` will also be
/// destructed.
/// @see create()
/// @param ty the type to add to the module
/// @returns the de-aliased type pointer
template <typename T>
- EnableIfIsType<T, ast::type::Type>* unique_type(std::unique_ptr<T> ty) {
+ EnableIfIsType<T, type::Type>* unique_type(std::unique_ptr<T> ty) {
return static_cast<T*>(type_mgr_.Get(std::move(ty)));
}
/// Returns all the declared types in the module
/// @returns the mapping from name string to type.
- const std::unordered_map<std::string, std::unique_ptr<ast::type::Type>>&
- types() {
+ const std::unordered_map<std::string, std::unique_ptr<type::Type>>& types() {
return type_mgr_.types();
}
@@ -143,8 +142,8 @@
// The constructed types are owned by the type manager
std::vector<type::Type*> constructed_types_;
FunctionList functions_;
- std::vector<std::unique_ptr<ast::Node>> ast_nodes_;
- ast::TypeManager type_mgr_;
+ std::vector<std::unique_ptr<Node>> ast_nodes_;
+ TypeManager type_mgr_;
};
} // namespace ast
diff --git a/src/ast/module_test.cc b/src/ast/module_test.cc
index f52f9d6..cf05d4e 100644
--- a/src/ast/module_test.cc
+++ b/src/ast/module_test.cc
@@ -48,8 +48,8 @@
type::F32Type f32;
Module m;
- auto* func = create<Function>("main", VariableList{}, &f32,
- create<ast::BlockStatement>());
+ auto* func =
+ create<Function>("main", VariableList{}, &f32, create<BlockStatement>());
m.AddFunction(func);
EXPECT_EQ(func, m.FindFunctionByName("main"));
}
@@ -124,8 +124,8 @@
TEST_F(ModuleTest, IsValid_Function) {
type::F32Type f32;
- auto* func = create<Function>("main", VariableList(), &f32,
- create<ast::BlockStatement>());
+ auto* func =
+ create<Function>("main", VariableList(), &f32, create<BlockStatement>());
Module m;
m.AddFunction(func);
diff --git a/src/ast/null_literal.cc b/src/ast/null_literal.cc
index 54b9344..eb3d589 100644
--- a/src/ast/null_literal.cc
+++ b/src/ast/null_literal.cc
@@ -17,7 +17,7 @@
namespace tint {
namespace ast {
-NullLiteral::NullLiteral(ast::type::Type* type) : Base(type) {}
+NullLiteral::NullLiteral(type::Type* type) : Base(type) {}
NullLiteral::~NullLiteral() = default;
diff --git a/src/ast/null_literal.h b/src/ast/null_literal.h
index 93b5f89..7cffcad 100644
--- a/src/ast/null_literal.h
+++ b/src/ast/null_literal.h
@@ -27,7 +27,7 @@
public:
/// Constructor
/// @param type the type
- explicit NullLiteral(ast::type::Type* type);
+ explicit NullLiteral(type::Type* type);
~NullLiteral() override;
/// @returns the name for this literal. This name is unique to this value.
diff --git a/src/ast/null_literal_test.cc b/src/ast/null_literal_test.cc
index d45b3e2..8c151ee 100644
--- a/src/ast/null_literal_test.cc
+++ b/src/ast/null_literal_test.cc
@@ -28,7 +28,7 @@
using NullLiteralTest = TestHelper;
TEST_F(NullLiteralTest, Is) {
- ast::type::I32Type i32;
+ type::I32Type i32;
NullLiteral i{&i32};
Literal* l = &i;
EXPECT_FALSE(l->Is<BoolLiteral>());
@@ -40,14 +40,14 @@
}
TEST_F(NullLiteralTest, ToStr) {
- ast::type::I32Type i32;
+ type::I32Type i32;
NullLiteral i{&i32};
EXPECT_EQ(i.to_str(), "null __i32");
}
TEST_F(NullLiteralTest, Name_I32) {
- ast::type::I32Type i32;
+ type::I32Type i32;
NullLiteral i{&i32};
EXPECT_EQ("__null__i32", i.name());
}
diff --git a/src/ast/scalar_constructor_expression_test.cc b/src/ast/scalar_constructor_expression_test.cc
index 61f1bd2..d7184c6 100644
--- a/src/ast/scalar_constructor_expression_test.cc
+++ b/src/ast/scalar_constructor_expression_test.cc
@@ -25,14 +25,14 @@
using ScalarConstructorExpressionTest = TestHelper;
TEST_F(ScalarConstructorExpressionTest, Creation) {
- ast::type::BoolType bool_type;
+ type::BoolType bool_type;
auto* b = create<BoolLiteral>(&bool_type, true);
ScalarConstructorExpression c(b);
EXPECT_EQ(c.literal(), b);
}
TEST_F(ScalarConstructorExpressionTest, Creation_WithSource) {
- ast::type::BoolType bool_type;
+ type::BoolType bool_type;
auto* b = create<BoolLiteral>(&bool_type, true);
ScalarConstructorExpression c(Source{Source::Location{20, 2}}, b);
auto src = c.source();
@@ -41,7 +41,7 @@
}
TEST_F(ScalarConstructorExpressionTest, IsValid) {
- ast::type::BoolType bool_type;
+ type::BoolType bool_type;
auto* b = create<BoolLiteral>(&bool_type, true);
ScalarConstructorExpression c(b);
EXPECT_TRUE(c.IsValid());
@@ -53,7 +53,7 @@
}
TEST_F(ScalarConstructorExpressionTest, ToStr) {
- ast::type::BoolType bool_type;
+ type::BoolType bool_type;
auto* b = create<BoolLiteral>(&bool_type, true);
ScalarConstructorExpression c(b);
std::ostringstream out;
diff --git a/src/ast/sint_literal.cc b/src/ast/sint_literal.cc
index ab44c21..c94e7c9 100644
--- a/src/ast/sint_literal.cc
+++ b/src/ast/sint_literal.cc
@@ -17,7 +17,7 @@
namespace tint {
namespace ast {
-SintLiteral::SintLiteral(ast::type::Type* type, int32_t value)
+SintLiteral::SintLiteral(type::Type* type, int32_t value)
: Base(type), value_(value) {}
SintLiteral::~SintLiteral() = default;
diff --git a/src/ast/sint_literal.h b/src/ast/sint_literal.h
index 90e78c3..dd56fb3 100644
--- a/src/ast/sint_literal.h
+++ b/src/ast/sint_literal.h
@@ -28,7 +28,7 @@
/// Constructor
/// @param type the type
/// @param value the signed int literals value
- SintLiteral(ast::type::Type* type, int32_t value);
+ SintLiteral(type::Type* type, int32_t value);
~SintLiteral() override;
/// Updates the literals value
diff --git a/src/ast/sint_literal_test.cc b/src/ast/sint_literal_test.cc
index cc49ce6..7a8972f 100644
--- a/src/ast/sint_literal_test.cc
+++ b/src/ast/sint_literal_test.cc
@@ -29,14 +29,14 @@
using SintLiteralTest = TestHelper;
TEST_F(SintLiteralTest, Value) {
- ast::type::I32Type i32;
+ type::I32Type i32;
SintLiteral i{&i32, 47};
ASSERT_TRUE(i.Is<SintLiteral>());
EXPECT_EQ(i.value(), 47);
}
TEST_F(SintLiteralTest, Is) {
- ast::type::I32Type i32;
+ type::I32Type i32;
SintLiteral i{&i32, 42};
Literal* l = &i;
EXPECT_FALSE(l->Is<BoolLiteral>());
@@ -47,20 +47,20 @@
}
TEST_F(SintLiteralTest, ToStr) {
- ast::type::I32Type i32;
+ type::I32Type i32;
SintLiteral i{&i32, -42};
EXPECT_EQ(i.to_str(), "-42");
}
TEST_F(SintLiteralTest, Name_I32) {
- ast::type::I32Type i32;
+ type::I32Type i32;
SintLiteral i{&i32, 2};
EXPECT_EQ("__sint__i32_2", i.name());
}
TEST_F(SintLiteralTest, Name_U32) {
- ast::type::U32Type u32;
+ type::U32Type u32;
SintLiteral i{&u32, 2};
EXPECT_EQ("__sint__u32_2", i.name());
}
diff --git a/src/ast/stage_decoration.cc b/src/ast/stage_decoration.cc
index 4469c01..af9676e 100644
--- a/src/ast/stage_decoration.cc
+++ b/src/ast/stage_decoration.cc
@@ -17,7 +17,7 @@
namespace tint {
namespace ast {
-StageDecoration::StageDecoration(ast::PipelineStage stage, const Source& source)
+StageDecoration::StageDecoration(PipelineStage stage, const Source& source)
: Base(source), stage_(stage) {}
StageDecoration::~StageDecoration() = default;
diff --git a/src/ast/stage_decoration.h b/src/ast/stage_decoration.h
index e70e94a..1ae3372 100644
--- a/src/ast/stage_decoration.h
+++ b/src/ast/stage_decoration.h
@@ -27,11 +27,11 @@
/// constructor
/// @param stage the pipeline stage
/// @param source the source of this decoration
- StageDecoration(ast::PipelineStage stage, const Source& source);
+ StageDecoration(PipelineStage stage, const Source& source);
~StageDecoration() override;
/// @returns the stage
- ast::PipelineStage value() const { return stage_; }
+ PipelineStage value() const { return stage_; }
/// Outputs the decoration to the given stream
/// @param out the stream to write to
@@ -39,7 +39,7 @@
void to_str(std::ostream& out, size_t indent) const override;
private:
- ast::PipelineStage stage_ = ast::PipelineStage::kNone;
+ PipelineStage stage_ = PipelineStage::kNone;
};
} // namespace ast
diff --git a/src/ast/stage_decoration_test.cc b/src/ast/stage_decoration_test.cc
index 83acb5b..4bfdad9 100644
--- a/src/ast/stage_decoration_test.cc
+++ b/src/ast/stage_decoration_test.cc
@@ -26,19 +26,19 @@
using StageDecorationTest = TestHelper;
TEST_F(StageDecorationTest, Creation_1param) {
- StageDecoration d{ast::PipelineStage::kFragment, Source{}};
- EXPECT_EQ(d.value(), ast::PipelineStage::kFragment);
+ StageDecoration d{PipelineStage::kFragment, Source{}};
+ EXPECT_EQ(d.value(), PipelineStage::kFragment);
}
TEST_F(StageDecorationTest, Is) {
- StageDecoration sd{ast::PipelineStage::kFragment, Source{}};
+ StageDecoration sd{PipelineStage::kFragment, Source{}};
Decoration* d = &sd;
EXPECT_FALSE(d->Is<WorkgroupDecoration>());
EXPECT_TRUE(d->Is<StageDecoration>());
}
TEST_F(StageDecorationTest, ToStr) {
- StageDecoration d{ast::PipelineStage::kFragment, Source{}};
+ StageDecoration d{PipelineStage::kFragment, Source{}};
std::ostringstream out;
d.to_str(out, 0);
EXPECT_EQ(out.str(), R"(StageDecoration{fragment}
diff --git a/src/ast/struct_member.cc b/src/ast/struct_member.cc
index ea5223c..0905557 100644
--- a/src/ast/struct_member.cc
+++ b/src/ast/struct_member.cc
@@ -41,7 +41,7 @@
bool StructMember::has_offset_decoration() const {
for (auto* deco : decorations_) {
- if (deco->Is<ast::StructMemberOffsetDecoration>()) {
+ if (deco->Is<StructMemberOffsetDecoration>()) {
return true;
}
}
@@ -50,7 +50,7 @@
uint32_t StructMember::offset() const {
for (auto* deco : decorations_) {
- if (auto* offset = deco->As<ast::StructMemberOffsetDecoration>()) {
+ if (auto* offset = deco->As<StructMemberOffsetDecoration>()) {
return offset->offset();
}
}
diff --git a/src/ast/struct_member_offset_decoration_test.cc b/src/ast/struct_member_offset_decoration_test.cc
index 51fab73..2197f03 100644
--- a/src/ast/struct_member_offset_decoration_test.cc
+++ b/src/ast/struct_member_offset_decoration_test.cc
@@ -29,7 +29,7 @@
TEST_F(StructMemberOffsetDecorationTest, Is) {
StructMemberOffsetDecoration d{2, Source{}};
- EXPECT_TRUE(d.Is<ast::StructMemberOffsetDecoration>());
+ EXPECT_TRUE(d.Is<StructMemberOffsetDecoration>());
}
} // namespace
diff --git a/src/ast/struct_member_test.cc b/src/ast/struct_member_test.cc
index 729c11a..18a71eb 100644
--- a/src/ast/struct_member_test.cc
+++ b/src/ast/struct_member_test.cc
@@ -36,7 +36,7 @@
EXPECT_EQ(st.name(), "a");
EXPECT_EQ(st.type(), &i32);
EXPECT_EQ(st.decorations().size(), 1u);
- EXPECT_TRUE(st.decorations()[0]->Is<ast::StructMemberOffsetDecoration>());
+ EXPECT_TRUE(st.decorations()[0]->Is<StructMemberOffsetDecoration>());
EXPECT_EQ(st.source().range.begin.line, 0u);
EXPECT_EQ(st.source().range.begin.column, 0u);
EXPECT_EQ(st.source().range.end.line, 0u);
diff --git a/src/ast/switch_statement_test.cc b/src/ast/switch_statement_test.cc
index eadc87c..7627a0b 100644
--- a/src/ast/switch_statement_test.cc
+++ b/src/ast/switch_statement_test.cc
@@ -29,14 +29,14 @@
using SwitchStatementTest = TestHelper;
TEST_F(SwitchStatementTest, Creation) {
- ast::type::I32Type i32;
+ type::I32Type i32;
CaseSelectorList lit;
lit.push_back(create<SintLiteral>(&i32, 1));
auto* ident = create<IdentifierExpression>("ident");
CaseStatementList body;
- auto* case_stmt = create<CaseStatement>(lit, create<ast::BlockStatement>());
+ auto* case_stmt = create<CaseStatement>(lit, create<BlockStatement>());
body.push_back(case_stmt);
SwitchStatement stmt(ident, body);
@@ -61,27 +61,27 @@
}
TEST_F(SwitchStatementTest, IsValid) {
- ast::type::I32Type i32;
+ type::I32Type i32;
CaseSelectorList lit;
lit.push_back(create<SintLiteral>(&i32, 2));
auto* ident = create<IdentifierExpression>("ident");
CaseStatementList body;
- body.push_back(create<CaseStatement>(lit, create<ast::BlockStatement>()));
+ body.push_back(create<CaseStatement>(lit, create<BlockStatement>()));
SwitchStatement stmt(ident, body);
EXPECT_TRUE(stmt.IsValid());
}
TEST_F(SwitchStatementTest, IsValid_Null_Condition) {
- ast::type::I32Type i32;
+ type::I32Type i32;
CaseSelectorList lit;
lit.push_back(create<SintLiteral>(&i32, 2));
CaseStatementList body;
- body.push_back(create<CaseStatement>(lit, create<ast::BlockStatement>()));
+ body.push_back(create<CaseStatement>(lit, create<BlockStatement>()));
SwitchStatement stmt;
stmt.set_body(body);
@@ -89,28 +89,28 @@
}
TEST_F(SwitchStatementTest, IsValid_Invalid_Condition) {
- ast::type::I32Type i32;
+ type::I32Type i32;
CaseSelectorList lit;
lit.push_back(create<SintLiteral>(&i32, 2));
auto* ident = create<IdentifierExpression>("");
CaseStatementList body;
- body.push_back(create<CaseStatement>(lit, create<ast::BlockStatement>()));
+ body.push_back(create<CaseStatement>(lit, create<BlockStatement>()));
SwitchStatement stmt(ident, body);
EXPECT_FALSE(stmt.IsValid());
}
TEST_F(SwitchStatementTest, IsValid_Null_BodyStatement) {
- ast::type::I32Type i32;
+ type::I32Type i32;
CaseSelectorList lit;
lit.push_back(create<SintLiteral>(&i32, 2));
auto* ident = create<IdentifierExpression>("ident");
CaseStatementList body;
- body.push_back(create<CaseStatement>(lit, create<ast::BlockStatement>()));
+ body.push_back(create<CaseStatement>(lit, create<BlockStatement>()));
body.push_back(nullptr);
SwitchStatement stmt(ident, body);
@@ -120,7 +120,7 @@
TEST_F(SwitchStatementTest, IsValid_Invalid_BodyStatement) {
auto* ident = create<IdentifierExpression>("ident");
- auto* case_body = create<ast::BlockStatement>();
+ auto* case_body = create<BlockStatement>();
case_body->append(nullptr);
CaseStatementList body;
@@ -145,14 +145,14 @@
}
TEST_F(SwitchStatementTest, ToStr) {
- ast::type::I32Type i32;
+ type::I32Type i32;
CaseSelectorList lit;
lit.push_back(create<SintLiteral>(&i32, 2));
auto* ident = create<IdentifierExpression>("ident");
CaseStatementList body;
- body.push_back(create<CaseStatement>(lit, create<ast::BlockStatement>()));
+ body.push_back(create<CaseStatement>(lit, create<BlockStatement>()));
SwitchStatement stmt(ident, body);
std::ostringstream out;
diff --git a/src/ast/test_helper.h b/src/ast/test_helper.h
index 18ad0cf..bb558e2 100644
--- a/src/ast/test_helper.h
+++ b/src/ast/test_helper.h
@@ -31,8 +31,8 @@
TestHelperBase() {}
~TestHelperBase() = default;
- /// Creates a new `ast::Node` owned by the Module. When the Module is
- /// destructed, the `ast::Node` will also be destructed.
+ /// Creates a new `Node` owned by the Module. When the Module is
+ /// destructed, the `Node` will also be destructed.
/// @param args the arguments to pass to the type constructor
/// @returns the node pointer
template <typename T, typename... ARGS>
diff --git a/src/ast/type/access_control_type_test.cc b/src/ast/type/access_control_type_test.cc
index 9a9bacc..ded04fb 100644
--- a/src/ast/type/access_control_type_test.cc
+++ b/src/ast/type/access_control_type_test.cc
@@ -136,9 +136,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
AccessControlType at{AccessControl::kReadOnly, &struct_type};
EXPECT_EQ(16u, at.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
@@ -185,9 +185,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
AccessControlType at{AccessControl::kReadOnly, &struct_type};
EXPECT_EQ(16u, at.BaseAlignment(MemoryLayout::kUniformBuffer));
diff --git a/src/ast/type/alias_type_test.cc b/src/ast/type/alias_type_test.cc
index 2a2d35b..e2e5c6a 100644
--- a/src/ast/type/alias_type_test.cc
+++ b/src/ast/type/alias_type_test.cc
@@ -201,9 +201,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
AliasType alias{"alias", &struct_type};
EXPECT_EQ(16u, alias.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
@@ -250,9 +250,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
AliasType alias{"alias", &struct_type};
EXPECT_EQ(16u, alias.BaseAlignment(MemoryLayout::kUniformBuffer));
diff --git a/src/ast/type/array_type.cc b/src/ast/type/array_type.cc
index d46fcc5..2b4bb80 100644
--- a/src/ast/type/array_type.cc
+++ b/src/ast/type/array_type.cc
@@ -65,7 +65,7 @@
uint32_t ArrayType::array_stride() const {
for (auto* deco : decos_) {
- if (auto* stride = deco->As<ast::StrideDecoration>()) {
+ if (auto* stride = deco->As<StrideDecoration>()) {
return stride->stride();
}
}
@@ -74,7 +74,7 @@
bool ArrayType::has_array_stride() const {
for (auto* deco : decos_) {
- if (deco->Is<ast::StrideDecoration>()) {
+ if (deco->Is<StrideDecoration>()) {
return true;
}
}
diff --git a/src/ast/type/array_type.h b/src/ast/type/array_type.h
index 5341bf5..c44393b 100644
--- a/src/ast/type/array_type.h
+++ b/src/ast/type/array_type.h
@@ -57,9 +57,7 @@
/// Sets the array decorations
/// @param decos the decorations to set
- void set_decorations(ast::ArrayDecorationList decos) {
- decos_ = std::move(decos);
- }
+ void set_decorations(ArrayDecorationList decos) { decos_ = std::move(decos); }
/// @returns the array decorations
const ArrayDecorationList& decorations() const { return decos_; }
@@ -79,7 +77,7 @@
private:
Type* subtype_ = nullptr;
uint32_t size_ = 0;
- ast::ArrayDecorationList decos_;
+ ArrayDecorationList decos_;
};
} // namespace type
diff --git a/src/ast/type/storage_texture_type_test.cc b/src/ast/type/storage_texture_type_test.cc
index 0f29099..2664f1d 100644
--- a/src/ast/type/storage_texture_type_test.cc
+++ b/src/ast/type/storage_texture_type_test.cc
@@ -93,7 +93,7 @@
TEST_F(StorageTextureTypeTest, F32Type) {
Context ctx;
- ast::Module mod;
+ Module mod;
Type* s = mod.create<StorageTextureType>(TextureDimension::k2dArray,
AccessControl::kReadOnly,
ImageFormat::kRgba32Float);
@@ -108,7 +108,7 @@
TEST_F(StorageTextureTypeTest, U32Type) {
Context ctx;
- ast::Module mod;
+ Module mod;
Type* s = mod.create<StorageTextureType>(TextureDimension::k2dArray,
AccessControl::kReadOnly,
ImageFormat::kRg32Uint);
@@ -122,7 +122,7 @@
TEST_F(StorageTextureTypeTest, I32Type) {
Context ctx;
- ast::Module mod;
+ Module mod;
Type* s = mod.create<StorageTextureType>(TextureDimension::k2dArray,
AccessControl::kReadOnly,
ImageFormat::kRgba32Sint);
diff --git a/src/ast/type/struct_type_test.cc b/src/ast/type/struct_type_test.cc
index d0ba1e8..1f5587e 100644
--- a/src/ast/type/struct_type_test.cc
+++ b/src/ast/type/struct_type_test.cc
@@ -85,9 +85,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
EXPECT_EQ(16u,
struct_type.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
@@ -119,9 +119,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
members.push_back(create<StructMember>("bar", &arr, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
EXPECT_EQ(32u,
struct_type.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
@@ -154,9 +154,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
EXPECT_EQ(12u,
struct_type.MinBufferBindingSize(MemoryLayout::kStorageBuffer));
@@ -172,9 +172,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &vec2, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
EXPECT_EQ(16u,
struct_type.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
@@ -191,9 +191,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &vec3, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
EXPECT_EQ(16u,
struct_type.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
@@ -211,9 +211,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &vec4, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
EXPECT_EQ(16u,
struct_type.MinBufferBindingSize(MemoryLayout::kUniformBuffer));
@@ -235,9 +235,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(4, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
EXPECT_EQ(16u, struct_type.BaseAlignment(MemoryLayout::kUniformBuffer));
EXPECT_EQ(4u, struct_type.BaseAlignment(MemoryLayout::kStorageBuffer));
@@ -268,9 +268,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
members.push_back(create<StructMember>("bar", &arr, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
EXPECT_EQ(16u, struct_type.BaseAlignment(MemoryLayout::kUniformBuffer));
EXPECT_EQ(4u, struct_type.BaseAlignment(MemoryLayout::kStorageBuffer));
@@ -301,9 +301,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(8, Source{}));
members.push_back(create<StructMember>("bar", &u32, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
EXPECT_EQ(4u, struct_type.BaseAlignment(MemoryLayout::kStorageBuffer));
}
@@ -318,9 +318,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &vec2, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
EXPECT_EQ(16u, struct_type.BaseAlignment(MemoryLayout::kUniformBuffer));
EXPECT_EQ(8u, struct_type.BaseAlignment(MemoryLayout::kStorageBuffer));
@@ -336,9 +336,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &vec3, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
EXPECT_EQ(16u, struct_type.BaseAlignment(MemoryLayout::kUniformBuffer));
EXPECT_EQ(16u, struct_type.BaseAlignment(MemoryLayout::kStorageBuffer));
@@ -354,9 +354,9 @@
deco.push_back(create<StructMemberOffsetDecoration>(0, Source{}));
members.push_back(create<StructMember>("foo", &vec4, deco));
}
- ast::StructDecorationList decos;
+ StructDecorationList decos;
- auto* str = create<ast::Struct>(decos, members);
+ auto* str = create<Struct>(decos, members);
StructType struct_type("struct_type", str);
EXPECT_EQ(16u, struct_type.BaseAlignment(MemoryLayout::kUniformBuffer));
EXPECT_EQ(16u, struct_type.BaseAlignment(MemoryLayout::kStorageBuffer));
diff --git a/src/ast/type_constructor_expression_test.cc b/src/ast/type_constructor_expression_test.cc
index 24eb0e6..517b109 100644
--- a/src/ast/type_constructor_expression_test.cc
+++ b/src/ast/type_constructor_expression_test.cc
@@ -53,7 +53,7 @@
TEST_F(TypeConstructorExpressionTest, IsTypeConstructor) {
TypeConstructorExpression t;
- EXPECT_TRUE(t.Is<ast::TypeConstructorExpression>());
+ EXPECT_TRUE(t.Is<TypeConstructorExpression>());
}
TEST_F(TypeConstructorExpressionTest, IsValid) {
diff --git a/src/ast/type_manager.cc b/src/ast/type_manager.cc
index bd841ef..3369692 100644
--- a/src/ast/type_manager.cc
+++ b/src/ast/type_manager.cc
@@ -27,7 +27,7 @@
types_.clear();
}
-ast::type::Type* TypeManager::Get(std::unique_ptr<ast::type::Type> type) {
+type::Type* TypeManager::Get(std::unique_ptr<type::Type> type) {
auto name = type->type_name();
if (types_.find(name) == types_.end()) {
diff --git a/src/ast/type_manager.h b/src/ast/type_manager.h
index c9ca90f..f580c1a 100644
--- a/src/ast/type_manager.h
+++ b/src/ast/type_manager.h
@@ -39,7 +39,7 @@
/// Get the given type from the type manager
/// @param type The type to register
/// @return the pointer to the registered type
- ast::type::Type* Get(std::unique_ptr<ast::type::Type> type);
+ type::Type* Get(std::unique_ptr<type::Type> type);
/// Get the given type `T` from the type manager
/// @param args the arguments to pass to the type constructor
@@ -52,13 +52,12 @@
/// Returns the type map
/// @returns the mapping from name string to type.
- const std::unordered_map<std::string, std::unique_ptr<ast::type::Type>>&
- types() {
+ const std::unordered_map<std::string, std::unique_ptr<type::Type>>& types() {
return types_;
}
private:
- std::unordered_map<std::string, std::unique_ptr<ast::type::Type>> types_;
+ std::unordered_map<std::string, std::unique_ptr<type::Type>> types_;
};
} // namespace ast
diff --git a/src/ast/type_manager_test.cc b/src/ast/type_manager_test.cc
index 3d844d1..adced4b 100644
--- a/src/ast/type_manager_test.cc
+++ b/src/ast/type_manager_test.cc
@@ -20,51 +20,53 @@
#include "src/ast/type/u32_type.h"
namespace tint {
+namespace ast {
namespace {
using TypeManagerTest = testing::Test;
TEST_F(TypeManagerTest, GetUnregistered) {
- ast::TypeManager tm;
- auto* t = tm.Get(std::make_unique<ast::type::I32Type>());
+ TypeManager tm;
+ auto* t = tm.Get(std::make_unique<type::I32Type>());
ASSERT_NE(t, nullptr);
- EXPECT_TRUE(t->Is<ast::type::I32Type>());
+ EXPECT_TRUE(t->Is<type::I32Type>());
}
TEST_F(TypeManagerTest, GetSameTypeReturnsSamePtr) {
- ast::TypeManager tm;
- auto* t = tm.Get(std::make_unique<ast::type::I32Type>());
+ TypeManager tm;
+ auto* t = tm.Get(std::make_unique<type::I32Type>());
ASSERT_NE(t, nullptr);
- EXPECT_TRUE(t->Is<ast::type::I32Type>());
+ EXPECT_TRUE(t->Is<type::I32Type>());
- auto* t2 = tm.Get(std::make_unique<ast::type::I32Type>());
+ auto* t2 = tm.Get(std::make_unique<type::I32Type>());
EXPECT_EQ(t, t2);
}
TEST_F(TypeManagerTest, GetDifferentTypeReturnsDifferentPtr) {
- ast::TypeManager tm;
- auto* t = tm.Get(std::make_unique<ast::type::I32Type>());
+ TypeManager tm;
+ auto* t = tm.Get(std::make_unique<type::I32Type>());
ASSERT_NE(t, nullptr);
- EXPECT_TRUE(t->Is<ast::type::I32Type>());
+ EXPECT_TRUE(t->Is<type::I32Type>());
- auto* t2 = tm.Get(std::make_unique<ast::type::U32Type>());
+ auto* t2 = tm.Get(std::make_unique<type::U32Type>());
ASSERT_NE(t2, nullptr);
EXPECT_NE(t, t2);
- EXPECT_TRUE(t2->Is<ast::type::U32Type>());
+ EXPECT_TRUE(t2->Is<type::U32Type>());
}
TEST_F(TypeManagerTest, ResetClearsPreviousData) {
- ast::TypeManager tm;
- auto* t = tm.Get(std::make_unique<ast::type::I32Type>());
+ TypeManager tm;
+ auto* t = tm.Get(std::make_unique<type::I32Type>());
ASSERT_NE(t, nullptr);
EXPECT_FALSE(tm.types().empty());
tm.Reset();
EXPECT_TRUE(tm.types().empty());
- auto* t2 = tm.Get(std::make_unique<ast::type::I32Type>());
+ auto* t2 = tm.Get(std::make_unique<type::I32Type>());
ASSERT_NE(t2, nullptr);
}
} // namespace
+} // namespace ast
} // namespace tint
diff --git a/src/ast/uint_literal.cc b/src/ast/uint_literal.cc
index 201f17d..32bd0ed 100644
--- a/src/ast/uint_literal.cc
+++ b/src/ast/uint_literal.cc
@@ -17,7 +17,7 @@
namespace tint {
namespace ast {
-UintLiteral::UintLiteral(ast::type::Type* type, uint32_t value)
+UintLiteral::UintLiteral(type::Type* type, uint32_t value)
: Base(type), value_(value) {}
UintLiteral::~UintLiteral() = default;
diff --git a/src/ast/uint_literal.h b/src/ast/uint_literal.h
index 56936ee..33b7faa 100644
--- a/src/ast/uint_literal.h
+++ b/src/ast/uint_literal.h
@@ -28,7 +28,7 @@
/// Constructor
/// @param type the type of the literal
/// @param value the uint literals value
- UintLiteral(ast::type::Type* type, uint32_t value);
+ UintLiteral(type::Type* type, uint32_t value);
~UintLiteral() override;
/// Updates the literals value
diff --git a/src/ast/uint_literal_test.cc b/src/ast/uint_literal_test.cc
index b066bca..218c64f 100644
--- a/src/ast/uint_literal_test.cc
+++ b/src/ast/uint_literal_test.cc
@@ -28,14 +28,14 @@
using UintLiteralTest = TestHelper;
TEST_F(UintLiteralTest, Value) {
- ast::type::U32Type u32;
+ type::U32Type u32;
UintLiteral u{&u32, 47};
ASSERT_TRUE(u.Is<UintLiteral>());
EXPECT_EQ(u.value(), 47u);
}
TEST_F(UintLiteralTest, Is) {
- ast::type::U32Type u32;
+ type::U32Type u32;
UintLiteral u{&u32, 42};
Literal* l = &u;
EXPECT_FALSE(l->Is<BoolLiteral>());
@@ -46,7 +46,7 @@
}
TEST_F(UintLiteralTest, ToStr) {
- ast::type::U32Type u32;
+ type::U32Type u32;
UintLiteral i{&u32, 42};
EXPECT_EQ(i.to_str(), "42");
diff --git a/src/ast/unary_op_expression_test.cc b/src/ast/unary_op_expression_test.cc
index 3717a27..ea6e516 100644
--- a/src/ast/unary_op_expression_test.cc
+++ b/src/ast/unary_op_expression_test.cc
@@ -43,7 +43,7 @@
TEST_F(UnaryOpExpressionTest, IsUnaryOp) {
UnaryOpExpression u;
- EXPECT_TRUE(u.Is<ast::UnaryOpExpression>());
+ EXPECT_TRUE(u.Is<UnaryOpExpression>());
}
TEST_F(UnaryOpExpressionTest, IsValid) {