Resolver: Move logic ValidateFunction() -> Function()

I inserted this non-validation code in the wrong method.

Change-Id: I43f6d8a0cbf6f0b5f20e453785b141b50d159044
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/46442
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton 2021-03-31 17:23:07 +00:00 committed by Commit Bot service account
parent 5c523f331d
commit c87ff9c238
1 changed files with 9 additions and 9 deletions

View File

@ -248,15 +248,6 @@ bool Resolver::ValidateFunction(const ast::Function* func) {
} }
for (auto* param : func->params()) { for (auto* param : func->params()) {
if (!ApplyStorageClassUsageToType(param->declared_storage_class(),
param->declared_type(),
param->source())) {
diagnostics_.add_note("while instantiating parameter " +
builder_->Symbols().NameFor(param->symbol()),
param->source());
return false;
}
if (!ValidateParameter(param)) { if (!ValidateParameter(param)) {
return false; return false;
} }
@ -294,6 +285,15 @@ bool Resolver::Function(ast::Function* func) {
for (auto* param : func->params()) { for (auto* param : func->params()) {
variable_stack_.set(param->symbol(), CreateVariableInfo(param)); variable_stack_.set(param->symbol(), CreateVariableInfo(param));
if (!ApplyStorageClassUsageToType(param->declared_storage_class(),
param->declared_type(),
param->source())) {
diagnostics_.add_note("while instantiating parameter " +
builder_->Symbols().NameFor(param->symbol()),
param->source());
return false;
}
if (auto* str = if (auto* str =
param->declared_type()->UnwrapAliasIfNeeded()->As<type::Struct>()) { param->declared_type()->UnwrapAliasIfNeeded()->As<type::Struct>()) {
auto* info = Structure(str); auto* info = Structure(str);