tint/resolver: Resolve dependencies of parameter attributes

Fixed: chromium:1381883
Change-Id: If93840977407e349ab8d3ea5a2f51b9e03c7d0e5
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108920
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2022-11-07 13:15:21 +00:00
committed by Dawn LUCI CQ
parent 6f799d676d
commit ca98b1b1b9
9 changed files with 100 additions and 5 deletions

View File

@@ -193,8 +193,6 @@ class DependencyScanner {
},
[&](const ast::Function* func) {
Declare(func->symbol, func);
TraverseAttributes(func->attributes);
TraverseAttributes(func->return_type_attributes);
TraverseFunction(func);
},
[&](const ast::Variable* var) {
@@ -216,10 +214,13 @@ class DependencyScanner {
/// Traverses the function, performing symbol resolution and determining
/// global dependencies.
void TraverseFunction(const ast::Function* func) {
TraverseAttributes(func->attributes);
TraverseAttributes(func->return_type_attributes);
// Perform symbol resolution on all the parameter types before registering
// the parameters themselves. This allows the case of declaring a parameter
// with the same identifier as its type.
for (auto* param : func->params) {
TraverseAttributes(param->attributes);
TraverseType(param->type);
}
// Resolve the return type

View File

@@ -1237,9 +1237,14 @@ TEST_F(ResolverDependencyGraphTraversalTest, SymbolsReached) {
})});
GlobalVar(Sym(), T, V);
GlobalConst(Sym(), T, V);
Func(Sym(), //
utils::Vector{Param(Sym(), T)}, //
T, // Return type
Func(Sym(),
utils::Vector{
Param(Sym(), T,
utils::Vector{
Location(V), // Parameter attributes
}),
},
T, // Return type
utils::Vector{
Decl(Var(Sym(), T, V)), //
Decl(Let(Sym(), T, V)), //