Skip to content

Commit

Permalink
[WGSL] GlobalVariableRewriter needs to visit variable initializers
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=255515
rdar://108134621

Reviewed by Mike Wyrzykowski.

The global variable rewriter visitor overrides the Variable visitor, as it needs to record
variable definitions that may shadow globals, but it fails to visit the variable initializer
(if there is one), which means that globals used in the initializer are undetected. To fix
that we simply call the base visitor's visit method on the variable declaration.

* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::visit):

Canonical link: https://commits.webkit.org/263062@main
  • Loading branch information
tadeuzagallo committed Apr 18, 2023
1 parent 5fa2966 commit e9927fb
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
Expand Up @@ -118,6 +118,7 @@ void RewriteGlobalVariables::visit(AST::Function& function)
void RewriteGlobalVariables::visit(AST::Variable& variable)
{
def(variable.name());
AST::Visitor::visit(variable);
}

void RewriteGlobalVariables::visit(AST::IdentifierExpression& identifier)
Expand Down

0 comments on commit e9927fb

Please sign in to comment.