[webkit-changes] [WebKit/WebKit] 51cdfa: [WGSL] Assertion failure when declarations have no...

Tadeu Zagallo noreply at github.com
Mon Aug 7 06:39:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 51cdfa635552c4c3e0fc3c4449af399b790ffc7f
      https://github.com/WebKit/WebKit/commit/51cdfa635552c4c3e0fc3c4449af399b790ffc7f
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-08-07 (Mon, 07 Aug 2023)

  Changed paths:
    M Source/WebGPU/WGSL/Parser.cpp
    M Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp

  Log Message:
  -----------
  [WGSL] Assertion failure when declarations have no type nor initializer
https://bugs.webkit.org/show_bug.cgi?id=259728
rdar://113258649

Reviewed by Dan Glastonbury.

We (correctly) assert that every variable declaration should (at least) have either
a type annotation or an initializer expression. However, that is currently not
handled by the parser, so invalid programs result in an assertion failure. This
patch updates the parser according to the spec:
- const and let: optional type annotation and require an initializer
- override and var: optional type annotation and optional initializer, but at least
  one of the two must be present.

* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser<Lexer>::parseVariableWithAttributes):
* Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp:
(TEST):

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




More information about the webkit-changes mailing list