[tint] Remove current_function from ValidateReturn.
The current_function was used to retrieve the functions return type. Pass it in directly instead of using current_function. Bug: tint:1313 Change-Id: Ie29407aecc51e8453460f46437b5c011088c3749 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/87145 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
8c67fec731
commit
5d4cac1da1
|
@ -2507,7 +2507,7 @@ sem::Statement* Resolver::ReturnStatement(const ast::ReturnStatement* stmt) {
|
|||
|
||||
// Validate after processing the return value expression so that its type
|
||||
// is available for validation.
|
||||
return ValidateReturn(stmt);
|
||||
return ValidateReturn(stmt, current_function_->ReturnType());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,8 @@ class Resolver {
|
|||
bool ValidateFunctionParameter(const ast::Function* func,
|
||||
const sem::Variable* var);
|
||||
bool ValidateParameter(const ast::Function* func, const sem::Variable* var);
|
||||
bool ValidateReturn(const ast::ReturnStatement* ret);
|
||||
bool ValidateReturn(const ast::ReturnStatement* ret,
|
||||
const sem::Type* func_type);
|
||||
bool ValidateStatements(const ast::StatementList& stmts);
|
||||
bool ValidateStorageTexture(const ast::StorageTexture* t);
|
||||
bool ValidateStructure(const sem::Struct* str, ast::PipelineStage stage);
|
||||
|
|
|
@ -2181,9 +2181,8 @@ bool Resolver::ValidateLocationAttribute(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Resolver::ValidateReturn(const ast::ReturnStatement* ret) {
|
||||
auto* func_type = current_function_->ReturnType();
|
||||
|
||||
bool Resolver::ValidateReturn(const ast::ReturnStatement* ret,
|
||||
const sem::Type* func_type) {
|
||||
auto* ret_type = ret->value ? TypeOf(ret->value)->UnwrapRef()
|
||||
: builder_->create<sem::Void>();
|
||||
|
||||
|
|
Loading…
Reference in New Issue