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:
dan sinclair
2022-10-20 13:38:28 +00:00
committed by Dawn LUCI CQ
parent 56ce1a2155
commit 6e77b47ed9
155 changed files with 6593 additions and 6593 deletions

View File

@@ -67,7 +67,7 @@ struct CallTargetSignature {
}
};
/// CallTarget is the base for callable functions, builtins, type constructors
/// CallTarget is the base for callable functions, builtins, type initializers
/// and type casts.
class CallTarget : public Castable<CallTarget, Node> {
public:

View File

@@ -12,19 +12,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "src/tint/sem/type_constructor.h"
#include "src/tint/sem/type_initializer.h"
#include <utility>
TINT_INSTANTIATE_TYPEINFO(tint::sem::TypeConstructor);
TINT_INSTANTIATE_TYPEINFO(tint::sem::TypeInitializer);
namespace tint::sem {
TypeConstructor::TypeConstructor(const sem::Type* type,
TypeInitializer::TypeInitializer(const sem::Type* type,
utils::VectorRef<const Parameter*> parameters,
EvaluationStage stage)
: Base(type, std::move(parameters), stage) {}
TypeConstructor::~TypeConstructor() = default;
TypeInitializer::~TypeInitializer() = default;
} // namespace tint::sem

View File

@@ -12,29 +12,29 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SRC_TINT_SEM_TYPE_CONSTRUCTOR_H_
#define SRC_TINT_SEM_TYPE_CONSTRUCTOR_H_
#ifndef SRC_TINT_SEM_TYPE_INITIALIZER_H_
#define SRC_TINT_SEM_TYPE_INITIALIZER_H_
#include "src/tint/sem/call_target.h"
#include "src/tint/utils/vector.h"
namespace tint::sem {
/// TypeConstructor is the CallTarget for a type constructor.
class TypeConstructor final : public Castable<TypeConstructor, CallTarget> {
/// TypeInitializer is the CallTarget for a type initializer.
class TypeInitializer final : public Castable<TypeInitializer, CallTarget> {
public:
/// Constructor
/// @param type the type that's being constructed
/// @param parameters the type constructor parameters
/// @param parameters the type initializer parameters
/// @param stage the earliest evaluation stage for the expression
TypeConstructor(const sem::Type* type,
TypeInitializer(const sem::Type* type,
utils::VectorRef<const Parameter*> parameters,
EvaluationStage stage);
/// Destructor
~TypeConstructor() override;
~TypeInitializer() override;
};
} // namespace tint::sem
#endif // SRC_TINT_SEM_TYPE_CONSTRUCTOR_H_
#endif // SRC_TINT_SEM_TYPE_INITIALIZER_H_

View File

@@ -96,8 +96,8 @@ VariableUser::VariableUser(const ast::IdentifierExpression* declaration,
/* has_side_effects */ false),
variable_(variable) {
auto* type = variable->Type();
if (type->Is<sem::Pointer>() && variable->Constructor()) {
source_variable_ = variable->Constructor()->SourceVariable();
if (type->Is<sem::Pointer>() && variable->Initializer()) {
source_variable_ = variable->Initializer()->SourceVariable();
} else {
source_variable_ = variable;
}

View File

@@ -80,13 +80,13 @@ class Variable : public Castable<Variable, Node> {
/// @return the constant value of this expression
const Constant* ConstantValue() const { return constant_value_; }
/// @returns the variable constructor expression, or nullptr if the variable
/// @returns the variable initializer expression, or nullptr if the variable
/// does not have one.
const Expression* Constructor() const { return constructor_; }
const Expression* Initializer() const { return initializer_; }
/// Sets the variable constructor expression.
/// @param constructor the constructor expression to assign to this variable.
void SetConstructor(const Expression* constructor) { constructor_ = constructor; }
/// Sets the variable initializer expression.
/// @param initializer the initializer expression to assign to this variable.
void SetInitializer(const Expression* initializer) { initializer_ = initializer; }
/// @returns the expressions that use the variable
const std::vector<const VariableUser*>& Users() const { return users_; }
@@ -101,7 +101,7 @@ class Variable : public Castable<Variable, Node> {
const ast::AddressSpace address_space_;
const ast::Access access_;
const Constant* constant_value_;
const Expression* constructor_ = nullptr;
const Expression* initializer_ = nullptr;
std::vector<const VariableUser*> users_;
};