From e9927fb515576125c3fa7d5d848c4f30bb2e32a4 Mon Sep 17 00:00:00 2001 From: Tadeu Zagallo Date: Tue, 18 Apr 2023 00:41:16 -0700 Subject: [PATCH] [WGSL] GlobalVariableRewriter needs to visit variable initializers 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 --- Source/WebGPU/WGSL/GlobalVariableRewriter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/WebGPU/WGSL/GlobalVariableRewriter.cpp b/Source/WebGPU/WGSL/GlobalVariableRewriter.cpp index 0131663e72bd..4c52d3156ecb 100644 --- a/Source/WebGPU/WGSL/GlobalVariableRewriter.cpp +++ b/Source/WebGPU/WGSL/GlobalVariableRewriter.cpp @@ -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)