[webkit-changes] [WebKit/WebKit] 4c7e11: [WGSL] ParameterizedTypeName should not parse the ...

Tadeu Zagallo noreply at github.com
Mon Aug 28 02:31:13 PDT 2023


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

  Changed paths:
    M Source/WebGPU/WGSL/AST/ASTStringDumper.cpp
    M Source/WebGPU/WGSL/AST/ASTTypeName.h
    M Source/WebGPU/WGSL/ConstantRewriter.cpp
    M Source/WebGPU/WGSL/GlobalVariableRewriter.cpp
    M Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
    M Source/WebGPU/WGSL/Parser.cpp
    M Source/WebGPU/WGSL/TypeCheck.cpp
    M Source/WebGPU/WGSL/TypeStore.cpp
    M Source/WebGPU/WGSL/TypeStore.h
    M Source/WebGPU/WGSL/Types.cpp
    M Source/WebGPU/WGSL/Types.h
    M Tools/TestWebKitAPI/Tests/WGSL/ParserTests.cpp

  Log Message:
  -----------
  [WGSL] ParameterizedTypeName should not parse the base
https://bugs.webkit.org/show_bug.cgi?id=260611
rdar://114321019

Reviewed by Dan Glastonbury.

Currently, when parsing, we make assumptions about what are the valid bases for
a ParameterizedTypeName, but that is not correct, as it can be affected by aliases
and also adds unnecessary complexity by going back and forth between identifiers
and enum values. To simplify things, we keep the base of a ParameterizedTypeName
as an identifier and also move type constructors from TypeStore into the regular
typing context. This makes it so that manipulating ParameterizedTypeNames works
more like any other type.

* Source/WebGPU/WGSL/AST/ASTStringDumper.cpp:
(WGSL::AST::StringDumper::visit):
* Source/WebGPU/WGSL/AST/ASTTypeName.h:
(WGSL::AST::ParameterizedTypeName::base):
(WGSL::AST::ParameterizedTypeName::ParameterizedTypeName):
(WGSL::AST::ParameterizedTypeName::stringViewToKind): Deleted.
(WGSL::AST::ParameterizedTypeName::baseToString): Deleted.
(WGSL::AST::ParameterizedTypeName::base const): Deleted.
* Source/WebGPU/WGSL/ConstantRewriter.cpp:
(WGSL::ConstantRewriter::visit):
(WGSL::ConstantRewriter::materialize):
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::bindingMemberForGlobal):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/Parser.cpp:
(WGSL::Parser<Lexer>::parseTypeNameAfterIdentifier):
(WGSL::Parser<Lexer>::parsePrimaryExpression):
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::TypeChecker):
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::lookupType):
(WGSL::TypeChecker::vectorFieldAccess):
(WGSL::TypeChecker::allocateSimpleConstructor):
* Source/WebGPU/WGSL/TypeStore.cpp:
(WGSL::TypeStore::TypeStore):
(WGSL::TypeStore::typeConstructorType):
(WGSL::TypeStore::constructType): Deleted.
(WGSL::TypeStore::allocateConstructor): Deleted.
* Source/WebGPU/WGSL/TypeStore.h:
* Source/WebGPU/WGSL/Types.cpp:
(WGSL::Type::dump const):
(WGSL::Type::size const):
(WGSL::Type::alignment const):
* Source/WebGPU/WGSL/Types.h:

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




More information about the webkit-changes mailing list