ast: Keep style consistent
Methods and functions are `CamelCase()`
Public fields are `snake_case` with no trailing `_`
Private fields are `snake_case` with a trailing `_`
Remove pointless getters on fully immutable fields.
They provide no value, and just add `()` noise on use.
Remove unused methods.
Bug: tint:1231
Change-Id: If32efd039df48938efd5bc2186d51fe4853e9840
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/66600
Reviewed-by: David Neto <dneto@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/transform/external_texture_transform.cc b/src/transform/external_texture_transform.cc
index da2539a..3b540ad 100644
--- a/src/transform/external_texture_transform.cc
+++ b/src/transform/external_texture_transform.cc
@@ -53,43 +53,43 @@
// When a textureLoad or textureSampleLevel has been identified, check
// if the first parameter is an external texture.
if (auto* var =
- sem.Get(call_expr->args()[0])->As<sem::VariableUser>()) {
+ sem.Get(call_expr->args[0])->As<sem::VariableUser>()) {
if (var->Variable()
->Type()
->UnwrapRef()
->Is<sem::ExternalTexture>()) {
if (intrinsic->Type() == sem::IntrinsicType::kTextureLoad &&
- call_expr->args().size() != 2) {
+ call_expr->args.size() != 2) {
TINT_ICE(Transform, ctx.dst->Diagnostics())
<< "expected textureLoad call with a texture_external to "
"have 2 parameters, found "
- << call_expr->args().size() << " parameters";
+ << call_expr->args.size() << " parameters";
}
if (intrinsic->Type() ==
sem::IntrinsicType::kTextureSampleLevel &&
- call_expr->args().size() != 3) {
+ call_expr->args.size() != 3) {
TINT_ICE(Transform, ctx.dst->Diagnostics())
<< "expected textureSampleLevel call with a "
"texture_external to have 3 parameters, found "
- << call_expr->args().size() << " parameters";
+ << call_expr->args.size() << " parameters";
}
// Replace the call with another that has the same parameters in
// addition to a level parameter (always zero for external
// textures).
- auto* exp = ctx.Clone(call_expr->func());
- auto* externalTextureParam = ctx.Clone(call_expr->args()[0]);
+ auto* exp = ctx.Clone(call_expr->func);
+ auto* externalTextureParam = ctx.Clone(call_expr->args[0]);
ast::ExpressionList params;
if (intrinsic->Type() == sem::IntrinsicType::kTextureLoad) {
- auto* coordsParam = ctx.Clone(call_expr->args()[1]);
+ auto* coordsParam = ctx.Clone(call_expr->args[1]);
auto* levelParam = ctx.dst->Expr(0);
params = {externalTextureParam, coordsParam, levelParam};
} else if (intrinsic->Type() ==
sem::IntrinsicType::kTextureSampleLevel) {
- auto* samplerParam = ctx.Clone(call_expr->args()[1]);
- auto* coordsParam = ctx.Clone(call_expr->args()[2]);
+ auto* samplerParam = ctx.Clone(call_expr->args[1]);
+ auto* coordsParam = ctx.Clone(call_expr->args[2]);
auto* levelParam = ctx.dst->Expr(0.0f);
params = {externalTextureParam, samplerParam, coordsParam,
levelParam};
@@ -107,18 +107,18 @@
// Scan the AST nodes for external texture declarations.
for (auto* node : ctx.src->ASTNodes().Objects()) {
if (auto* var = node->As<ast::Variable>()) {
- if (::tint::Is<ast::ExternalTexture>(var->type())) {
+ if (::tint::Is<ast::ExternalTexture>(var->type)) {
// Replace a single-plane external texture with a 2D, f32 sampled
// texture.
auto* newType = ctx.dst->ty.sampled_texture(ast::TextureDimension::k2d,
ctx.dst->ty.f32());
- auto clonedSrc = ctx.Clone(var->source());
- auto clonedSym = ctx.Clone(var->symbol());
- auto* clonedConstructor = ctx.Clone(var->constructor());
- auto clonedDecorations = ctx.Clone(var->decorations());
+ auto clonedSrc = ctx.Clone(var->source);
+ auto clonedSym = ctx.Clone(var->symbol);
+ auto* clonedConstructor = ctx.Clone(var->constructor);
+ auto clonedDecorations = ctx.Clone(var->decorations);
auto* newVar = ctx.dst->create<ast::Variable>(
- clonedSrc, clonedSym, var->declared_storage_class(),
- var->declared_access(), newType, var->is_const(), clonedConstructor,
+ clonedSrc, clonedSym, var->declared_storage_class,
+ var->declared_access, newType, var->is_const, clonedConstructor,
clonedDecorations);
ctx.Replace(var, newVar);