Add DecoratedVariable tests
This CL adds tests for decorated variable and updates the API to be
slightly nicer.
Bug: tint:11
Change-Id: I0bd5b8b6e6f682dc9d405e02e51d5dbcaeccc5f3
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/16465
Commit-Queue: Sarah Mashayekhi <sarahmashay@google.com>
Reviewed-by: Sarah Mashayekhi <sarahmashay@google.com>
diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc
index 58d4bf2..59d461b 100644
--- a/src/reader/wgsl/parser_impl.cc
+++ b/src/reader/wgsl/parser_impl.cc
@@ -329,11 +329,7 @@
}
if (decos.size() > 0) {
- auto dv = std::make_unique<ast::DecoratedVariable>();
- dv->set_source(var->source());
- dv->set_name(var->name());
- dv->set_type(var->type());
- dv->set_storage_class(var->storage_class());
+ auto dv = std::make_unique<ast::DecoratedVariable>(std::move(var));
dv->set_decorations(std::move(decos));
var = std::move(dv);