ast: Move Module function methods to FunctionList

Module will be split into Module (immutable) and ModuleBuilder (mutable).
By moving these methods to the FunctionList, we can deduplicate a bunch of common logic.

Bug: tint:390
Change-Id: I3fd85200aae4e8dc3d5afce8c9aaa6512809a3a0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38363
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2021-01-21 18:45:50 +00:00
committed by Commit Bot service account
parent 281b602f59
commit 6761160dc1
38 changed files with 354 additions and 305 deletions

View File

@@ -41,7 +41,7 @@ EmitVertexPointSize::~EmitVertexPointSize() = default;
Transform::Output EmitVertexPointSize::Run(ast::Module* in) {
Output out;
if (!in->HasStage(ast::PipelineStage::kVertex)) {
if (!in->Functions().HasStage(ast::PipelineStage::kVertex)) {
// If the module doesn't have any vertex stages, then there's nothing to do.
out.module = in->Clone();
return out;

View File

@@ -85,8 +85,8 @@ Transform::Output VertexPulling::Run(ast::Module* in) {
}
// Find entry point
auto* func = in->FindFunctionBySymbolAndStage(
in->GetSymbol(cfg.entry_point_name), ast::PipelineStage::kVertex);
auto* func = in->Functions().Find(in->GetSymbol(cfg.entry_point_name),
ast::PipelineStage::kVertex);
if (func == nullptr) {
diag::Diagnostic err;
err.severity = diag::Severity::Error;