mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 02:39:11 +00:00
Update internals to initializer instead of constructor.
This CL catches up the internals (along with a few error messages) to say `initializer` instead of `constructor. Bug: tint:1600 Change-Id: I8e56572c310d77da1130380bdd32b334f27c8e46 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/106462 Reviewed-by: Antonio Maiorano <amaiorano@google.com> Auto-Submit: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
56ce1a2155
commit
6e77b47ed9
@@ -27,10 +27,10 @@ Const::Const(ProgramID pid,
|
||||
const Source& src,
|
||||
const Symbol& sym,
|
||||
const ast::Type* ty,
|
||||
const Expression* ctor,
|
||||
const Expression* init,
|
||||
utils::VectorRef<const Attribute*> attrs)
|
||||
: Base(pid, nid, src, sym, ty, ctor, std::move(attrs)) {
|
||||
TINT_ASSERT(AST, ctor != nullptr);
|
||||
: Base(pid, nid, src, sym, ty, init, std::move(attrs)) {
|
||||
TINT_ASSERT(AST, init != nullptr);
|
||||
}
|
||||
|
||||
Const::Const(Const&&) = default;
|
||||
@@ -45,9 +45,9 @@ const Const* Const::Clone(CloneContext* ctx) const {
|
||||
auto src = ctx->Clone(source);
|
||||
auto sym = ctx->Clone(symbol);
|
||||
auto* ty = ctx->Clone(type);
|
||||
auto* ctor = ctx->Clone(constructor);
|
||||
auto* init = ctx->Clone(initializer);
|
||||
auto attrs = ctx->Clone(attributes);
|
||||
return ctx->dst->create<Const>(src, sym, ty, ctor, std::move(attrs));
|
||||
return ctx->dst->create<Const>(src, sym, ty, init, std::move(attrs));
|
||||
}
|
||||
|
||||
} // namespace tint::ast
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
namespace tint::ast {
|
||||
|
||||
/// A "const" declaration is a name for a module-scoped or function-scoped creation-time value.
|
||||
/// const must have a constructor expression.
|
||||
/// const must have a initializer expression.
|
||||
///
|
||||
/// Examples:
|
||||
///
|
||||
@@ -38,14 +38,14 @@ class Const final : public Castable<Const, Variable> {
|
||||
/// @param source the variable source
|
||||
/// @param sym the variable symbol
|
||||
/// @param type the declared variable type
|
||||
/// @param constructor the constructor expression. Must not be nullptr.
|
||||
/// @param initializer the initializer expression. Must not be nullptr.
|
||||
/// @param attributes the variable attributes
|
||||
Const(ProgramID pid,
|
||||
NodeID nid,
|
||||
const Source& source,
|
||||
const Symbol& sym,
|
||||
const ast::Type* type,
|
||||
const Expression* constructor,
|
||||
const Expression* initializer,
|
||||
utils::VectorRef<const Attribute*> attributes);
|
||||
|
||||
/// Move constructor
|
||||
|
||||
@@ -27,10 +27,10 @@ Let::Let(ProgramID pid,
|
||||
const Source& src,
|
||||
const Symbol& sym,
|
||||
const ast::Type* ty,
|
||||
const Expression* ctor,
|
||||
const Expression* init,
|
||||
utils::VectorRef<const Attribute*> attrs)
|
||||
: Base(pid, nid, src, sym, ty, ctor, std::move(attrs)) {
|
||||
TINT_ASSERT(AST, ctor != nullptr);
|
||||
: Base(pid, nid, src, sym, ty, init, std::move(attrs)) {
|
||||
TINT_ASSERT(AST, init != nullptr);
|
||||
}
|
||||
|
||||
Let::Let(Let&&) = default;
|
||||
@@ -45,9 +45,9 @@ const Let* Let::Clone(CloneContext* ctx) const {
|
||||
auto src = ctx->Clone(source);
|
||||
auto sym = ctx->Clone(symbol);
|
||||
auto* ty = ctx->Clone(type);
|
||||
auto* ctor = ctx->Clone(constructor);
|
||||
auto* init = ctx->Clone(initializer);
|
||||
auto attrs = ctx->Clone(attributes);
|
||||
return ctx->dst->create<Let>(src, sym, ty, ctor, std::move(attrs));
|
||||
return ctx->dst->create<Let>(src, sym, ty, init, std::move(attrs));
|
||||
}
|
||||
|
||||
} // namespace tint::ast
|
||||
|
||||
@@ -35,14 +35,14 @@ class Let final : public Castable<Let, Variable> {
|
||||
/// @param source the variable source
|
||||
/// @param sym the variable symbol
|
||||
/// @param type the declared variable type
|
||||
/// @param constructor the constructor expression
|
||||
/// @param initializer the initializer expression
|
||||
/// @param attributes the variable attributes
|
||||
Let(ProgramID pid,
|
||||
NodeID nid,
|
||||
const Source& source,
|
||||
const Symbol& sym,
|
||||
const ast::Type* type,
|
||||
const Expression* constructor,
|
||||
const Expression* initializer,
|
||||
utils::VectorRef<const Attribute*> attributes);
|
||||
|
||||
/// Move constructor
|
||||
|
||||
@@ -29,8 +29,8 @@ class Matrix final : public Castable<Matrix, Type> {
|
||||
/// @param nid the unique node identifier
|
||||
/// @param src the source of this node
|
||||
/// @param subtype the declared type of the matrix components. May be null for
|
||||
/// matrix constructors, where the element type will be inferred from
|
||||
/// the constructor arguments
|
||||
/// matrix initializers, where the element type will be inferred from
|
||||
/// the initializer arguments
|
||||
/// @param rows the number of rows in the matrix
|
||||
/// @param columns the number of columns in the matrix
|
||||
Matrix(ProgramID pid,
|
||||
@@ -54,7 +54,7 @@ class Matrix final : public Castable<Matrix, Type> {
|
||||
const Matrix* Clone(CloneContext* ctx) const override;
|
||||
|
||||
/// The declared type of the matrix components. May be null for matrix
|
||||
/// constructors, where the element type will be inferred from the constructor
|
||||
/// initializers, where the element type will be inferred from the initializer
|
||||
/// arguments
|
||||
const Type* const type;
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ Override::Override(ProgramID pid,
|
||||
const Source& src,
|
||||
const Symbol& sym,
|
||||
const ast::Type* ty,
|
||||
const Expression* ctor,
|
||||
const Expression* init,
|
||||
utils::VectorRef<const Attribute*> attrs)
|
||||
: Base(pid, nid, src, sym, ty, ctor, std::move(attrs)) {}
|
||||
: Base(pid, nid, src, sym, ty, init, std::move(attrs)) {}
|
||||
|
||||
Override::Override(Override&&) = default;
|
||||
|
||||
@@ -43,9 +43,9 @@ const Override* Override::Clone(CloneContext* ctx) const {
|
||||
auto src = ctx->Clone(source);
|
||||
auto sym = ctx->Clone(symbol);
|
||||
auto* ty = ctx->Clone(type);
|
||||
auto* ctor = ctx->Clone(constructor);
|
||||
auto* init = ctx->Clone(initializer);
|
||||
auto attrs = ctx->Clone(attributes);
|
||||
return ctx->dst->create<Override>(src, sym, ty, ctor, std::move(attrs));
|
||||
return ctx->dst->create<Override>(src, sym, ty, init, std::move(attrs));
|
||||
}
|
||||
|
||||
} // namespace tint::ast
|
||||
|
||||
@@ -38,14 +38,14 @@ class Override final : public Castable<Override, Variable> {
|
||||
/// @param source the variable source
|
||||
/// @param sym the variable symbol
|
||||
/// @param type the declared variable type
|
||||
/// @param constructor the constructor expression
|
||||
/// @param initializer the initializer expression
|
||||
/// @param attributes the variable attributes
|
||||
Override(ProgramID pid,
|
||||
NodeID nid,
|
||||
const Source& source,
|
||||
const Symbol& sym,
|
||||
const ast::Type* type,
|
||||
const Expression* constructor,
|
||||
const Expression* initializer,
|
||||
utils::VectorRef<const Attribute*> attributes);
|
||||
|
||||
/// Move constructor
|
||||
|
||||
@@ -27,9 +27,9 @@ Var::Var(ProgramID pid,
|
||||
const ast::Type* ty,
|
||||
AddressSpace address_space,
|
||||
Access access,
|
||||
const Expression* ctor,
|
||||
const Expression* init,
|
||||
utils::VectorRef<const Attribute*> attrs)
|
||||
: Base(pid, nid, src, sym, ty, ctor, std::move(attrs)),
|
||||
: Base(pid, nid, src, sym, ty, init, std::move(attrs)),
|
||||
declared_address_space(address_space),
|
||||
declared_access(access) {}
|
||||
|
||||
@@ -45,9 +45,9 @@ const Var* Var::Clone(CloneContext* ctx) const {
|
||||
auto src = ctx->Clone(source);
|
||||
auto sym = ctx->Clone(symbol);
|
||||
auto* ty = ctx->Clone(type);
|
||||
auto* ctor = ctx->Clone(constructor);
|
||||
auto* init = ctx->Clone(initializer);
|
||||
auto attrs = ctx->Clone(attributes);
|
||||
return ctx->dst->create<Var>(src, sym, ty, declared_address_space, declared_access, ctor,
|
||||
return ctx->dst->create<Var>(src, sym, ty, declared_address_space, declared_access, init,
|
||||
std::move(attrs));
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class Var final : public Castable<Var, Variable> {
|
||||
/// @param type the declared variable type
|
||||
/// @param declared_address_space the declared address space
|
||||
/// @param declared_access the declared access control
|
||||
/// @param constructor the constructor expression
|
||||
/// @param initializer the initializer expression
|
||||
/// @param attributes the variable attributes
|
||||
Var(ProgramID pid,
|
||||
NodeID nid,
|
||||
@@ -58,7 +58,7 @@ class Var final : public Castable<Var, Variable> {
|
||||
const ast::Type* type,
|
||||
AddressSpace declared_address_space,
|
||||
Access declared_access,
|
||||
const Expression* constructor,
|
||||
const Expression* initializer,
|
||||
utils::VectorRef<const Attribute*> attributes);
|
||||
|
||||
/// Move constructor
|
||||
|
||||
@@ -25,12 +25,12 @@ Variable::Variable(ProgramID pid,
|
||||
const Source& src,
|
||||
const Symbol& sym,
|
||||
const ast::Type* ty,
|
||||
const Expression* ctor,
|
||||
const Expression* init,
|
||||
utils::VectorRef<const Attribute*> attrs)
|
||||
: Base(pid, nid, src), symbol(sym), type(ty), constructor(ctor), attributes(std::move(attrs)) {
|
||||
: Base(pid, nid, src), symbol(sym), type(ty), initializer(init), attributes(std::move(attrs)) {
|
||||
TINT_ASSERT(AST, symbol.IsValid());
|
||||
TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, symbol, program_id);
|
||||
TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, constructor, program_id);
|
||||
TINT_ASSERT_PROGRAM_IDS_EQUAL_IF_VALID(AST, initializer, program_id);
|
||||
}
|
||||
|
||||
Variable::Variable(Variable&&) = default;
|
||||
|
||||
@@ -47,14 +47,14 @@ class Variable : public Castable<Variable, Node> {
|
||||
/// @param source the variable source
|
||||
/// @param sym the variable symbol
|
||||
/// @param type the declared variable type
|
||||
/// @param constructor the constructor expression
|
||||
/// @param initializer the initializer expression
|
||||
/// @param attributes the variable attributes
|
||||
Variable(ProgramID pid,
|
||||
NodeID nid,
|
||||
const Source& source,
|
||||
const Symbol& sym,
|
||||
const ast::Type* type,
|
||||
const Expression* constructor,
|
||||
const Expression* initializer,
|
||||
utils::VectorRef<const Attribute*> attributes);
|
||||
|
||||
/// Move constructor
|
||||
@@ -81,8 +81,8 @@ class Variable : public Castable<Variable, Node> {
|
||||
/// var i = 1;
|
||||
const ast::Type* const type;
|
||||
|
||||
/// The constructor expression or nullptr if none set
|
||||
const Expression* const constructor;
|
||||
/// The initializer expression or nullptr if none set
|
||||
const Expression* const initializer;
|
||||
|
||||
/// The attributes attached to this variable
|
||||
const utils::Vector<const Attribute*, 2> attributes;
|
||||
|
||||
@@ -81,7 +81,7 @@ TEST_F(VariableTest, Assert_DifferentProgramID_Symbol) {
|
||||
"internal compiler error");
|
||||
}
|
||||
|
||||
TEST_F(VariableTest, Assert_DifferentProgramID_Constructor) {
|
||||
TEST_F(VariableTest, Assert_DifferentProgramID_Initializer) {
|
||||
EXPECT_FATAL_FAILURE(
|
||||
{
|
||||
ProgramBuilder b1;
|
||||
|
||||
@@ -29,8 +29,8 @@ class Vector final : public Castable<Vector, Type> {
|
||||
/// @param nid the unique node identifier
|
||||
/// @param src the source of this node
|
||||
/// @param subtype the declared type of the vector components. May be null
|
||||
/// for vector constructors, where the element type will be inferred
|
||||
/// from the constructor arguments
|
||||
/// for vector initializers, where the element type will be inferred
|
||||
/// from the initializer arguments
|
||||
/// @param width the number of elements in the vector
|
||||
Vector(ProgramID pid, NodeID nid, Source const& src, const Type* subtype, uint32_t width);
|
||||
/// Move constructor
|
||||
@@ -48,7 +48,7 @@ class Vector final : public Castable<Vector, Type> {
|
||||
const Vector* Clone(CloneContext* ctx) const override;
|
||||
|
||||
/// The declared type of the vector components. May be null for vector
|
||||
/// constructors, where the element type will be inferred from the constructor
|
||||
/// initializers, where the element type will be inferred from the initializer
|
||||
/// arguments
|
||||
const Type* const type;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user