[webkit-changes] [WebKit/WebKit] eb76ee: [WGSL] Distinguish between value and type bindings
Tadeu Zagallo
noreply at github.com
Tue Jun 13 01:44:20 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: eb76ee09c3fc574a8c8bc7e3d8a9cbf8bdeee99f
https://github.com/WebKit/WebKit/commit/eb76ee09c3fc574a8c8bc7e3d8a9cbf8bdeee99f
Author: Tadeu Zagallo <tzagallo at apple.com>
Date: 2023-06-13 (Tue, 13 Jun 2023)
Changed paths:
M Source/WebGPU/WGSL/TypeCheck.cpp
M Source/WebGPU/WGSL/tests/invalid/function-call.wgsl
A Source/WebGPU/WGSL/tests/invalid/types-vs-values.wgsl
Log Message:
-----------
[WGSL] Distinguish between value and type bindings
https://bugs.webkit.org/show_bug.cgi?id=257883
rdar://110515257
Reviewed by Dan Glastonbury.
When the type checker looks up types for identifiers it needs to distinguish
between types and values. e.g.
struct S { x: i32 };
var s: S;
Currently, we have no way of distinguishing between `s` and `S`, as they both
return the same struct type. To fix it, instead of adding `Type*`s directly to
the typing context, we wrap types in a struct `Binding`, which indicates whether
the binding is a value or a type.
* Source/WebGPU/WGSL/TypeCheck.cpp:
(WGSL::TypeChecker::TypeChecker):
(WGSL::TypeChecker::visit):
(WGSL::TypeChecker::visitStructMembers):
(WGSL::TypeChecker::visitVariable):
(WGSL::TypeChecker::visitFunctionBody):
(WGSL::TypeChecker::introduceType):
(WGSL::TypeChecker::introduceValue):
* Source/WebGPU/WGSL/tests/invalid/function-call.wgsl:
Canonical link: https://commits.webkit.org/265112@main
More information about the webkit-changes
mailing list