Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 855f8d34596ce76104a6e39ff7bec126130fe1ce
      
https://github.com/WebKit/WebKit/commit/855f8d34596ce76104a6e39ff7bec126130fe1ce
  Author: Tadeu Zagallo <[email protected]>
  Date:   2023-06-06 (Tue, 06 Jun 2023)

  Changed paths:
    M Source/WebGPU/WGSL/ConstantRewriter.cpp
    M Source/WebGPU/WGSL/tests/lit.cfg
    A Source/WebGPU/WGSL/tests/valid/shadowing.wgsl

  Log Message:
  -----------
  [WGSL] Constant rewriter should handle shadowing
https://bugs.webkit.org/show_bug.cgi?id=257718
rdar://110266026

Reviewed by Myles C. Maxfield.

The constant rewriter currently only looks into constant declarations, but it
also needs to look at other definitions in order to account for shadowing.
E.g.

const x = 1; { let x = 2; f(x); }

Incorrectly gets rewritten into:

const x = 1; { let x = 2; f(1); }

The patch introduces fairly extensive tests for different kinds of shadowing.

* Source/WebGPU/WGSL/ConstantRewriter.cpp:
(WGSL::ConstantRewriter::rewrite):
(WGSL::ConstantRewriter::visit):
* Source/WebGPU/WGSL/tests/lit.cfg:
* Source/WebGPU/WGSL/tests/valid/shadowing.wgsl: Added.

Canonical link: https://commits.webkit.org/264926@main


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to