[webkit-changes] [WebKit/WebKit] 0c11a5: [WGSL] Fix source locations

Tadeu Zagallo noreply at github.com
Thu Sep 14 06:40:10 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0c11a59de5ef49334ab3c619753ca3f482018e17
      https://github.com/WebKit/WebKit/commit/0c11a59de5ef49334ab3c619753ca3f482018e17
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-09-14 (Thu, 14 Sep 2023)

  Changed paths:
    M Source/WebGPU/WGSL/Lexer.h
    M Source/WebGPU/WGSL/Parser.cpp
    M Source/WebGPU/WGSL/ParserPrivate.h
    M Tools/TestWebKitAPI/Tests/WGSL/ConstLiteralTests.cpp

  Log Message:
  -----------
  [WGSL] Fix source locations
https://bugs.webkit.org/show_bug.cgi?id=261521
rdar://115438296

Reviewed by Dan Glastonbury.

In 267855 at main I implemented template disambiguation, which required changing how
we handle tokens: instead of consuming them progressively as we parse, we now need
to generate a list of tokens upfront. However, the parser was still using the lexer's
current position in order to assign source locations to AST nodes, but since all the
lexing was done upfront the current location was always the end of the file. In order
to fix it we keep track of the current location in the parser itself, instead of
consulting the lexer.

* Source/WebGPU/WGSL/Lexer.h:
(WGSL::Lexer::currentPosition const): Deleted.
* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser<Lexer>::consume):
(WGSL::Parser<Lexer>::parsePostfixExpression):
* Source/WebGPU/WGSL/ParserPrivate.h:

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




More information about the webkit-changes mailing list