[tint] Remove current_function from ValidateFunction.

The ValidateFunction method just required the current pipeline stage.
Provide the stage directly instead of using current_function.

Bug: tint:1313
Change-Id: I0c12bef4b28b9cecfbd2b9d7d336a8ff3f8c3a77
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87144
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-04-19 03:24:24 +00:00 committed by Dawn LUCI CQ
parent d382e20b00
commit 8c67fec731
3 changed files with 7 additions and 6 deletions

View File

@ -699,7 +699,10 @@ sem::Function* Resolver::Function(const ast::Function* decl) {
return nullptr;
}
if (!ValidateFunction(func)) {
auto stage = current_function_
? current_function_->Declaration()->PipelineStage()
: ast::PipelineStage::kNone;
if (!ValidateFunction(func, stage)) {
return nullptr;
}

View File

@ -260,7 +260,7 @@ class Resolver {
bool ValidateEntryPoint(const sem::Function* func, ast::PipelineStage stage);
bool ValidateForLoopStatement(const sem::ForLoopStatement* stmt);
bool ValidateFallthroughStatement(const sem::Statement* stmt);
bool ValidateFunction(const sem::Function* func);
bool ValidateFunction(const sem::Function* func, ast::PipelineStage stage);
bool ValidateFunctionCall(const sem::Call* call);
bool ValidateGlobalVariable(const sem::Variable* var);
bool ValidateIfStatement(const sem::IfStatement* stmt);

View File

@ -832,7 +832,8 @@ bool Resolver::ValidateInterpolateAttribute(
return true;
}
bool Resolver::ValidateFunction(const sem::Function* func) {
bool Resolver::ValidateFunction(const sem::Function* func,
ast::PipelineStage stage) {
auto* decl = func->Declaration();
auto name = builder_->Symbols().NameFor(decl->symbol);
@ -917,9 +918,6 @@ bool Resolver::ValidateFunction(const sem::Function* func) {
}
if (decl->IsEntryPoint()) {
auto stage = current_function_
? current_function_->Declaration()->PipelineStage()
: ast::PipelineStage::kNone;
if (!ValidateEntryPoint(func, stage)) {
return false;
}