ast/function: Remove [set|add]_decorations()

Move them to the constructor

Bug: tint:390
Change-Id: I30bb6a1de060b790bf5202194d020d4e3889a307
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35008
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2020-12-07 20:45:14 +00:00
committed by Commit Bot service account
parent 9838768599
commit 234b7de460
32 changed files with 1154 additions and 698 deletions

View File

@@ -46,11 +46,11 @@ class VertexPullingHelper {
// Create basic module with an entry point and vertex function
void InitBasicModule() {
auto* func = create<ast::Function>("main", ast::VariableList{},
mod_->create<ast::type::Void>(),
create<ast::BlockStatement>());
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kVertex, Source{}));
auto* func = create<ast::Function>(
Source{}, "main", ast::VariableList{}, mod_->create<ast::type::Void>(),
create<ast::BlockStatement>(),
ast::FunctionDecorationList{create<ast::StageDecoration>(
ast::PipelineStage::kVertex, Source{})});
mod()->AddFunction(func);
}
@@ -128,11 +128,12 @@ TEST_F(VertexPullingTest, Error_InvalidEntryPoint) {
}
TEST_F(VertexPullingTest, Error_EntryPointWrongStage) {
auto* func = create<ast::Function>("main", ast::VariableList{},
mod()->create<ast::type::Void>(),
create<ast::BlockStatement>());
func->add_decoration(
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}));
auto* func = create<ast::Function>(
Source{}, "main", ast::VariableList{}, mod()->create<ast::type::Void>(),
create<ast::BlockStatement>(),
ast::FunctionDecorationList{
create<ast::StageDecoration>(ast::PipelineStage::kFragment, Source{}),
});
mod()->AddFunction(func);
InitTransform({});