-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WGSL] Add typing for field access expressions #9743
[WGSL] Add typing for field access expressions #9743
Conversation
EWS run on previous version of this PR (hash 1d2abec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, super straightforward.
Source/WebGPU/WGSL/TypeCheck.cpp
Outdated
if (std::holds_alternative<Struct>(*baseType)) { | ||
auto& structType = std::get<Struct>(*baseType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This feels like the pattern in WGSL::AST
that is written:
if (is<Struct>(*baseType)) {
auto& structType = downcast<Struct>(*baseType);
I would like to err on the side of consistency in the compiler. (Also, after looking at built times with -ftime-trace
, I hate how slow std::variant
s are to compile)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can refactor to match that in a separate commit. (Just because it's already used in several other places in the type checker)
1d2abec
to
977726b
Compare
EWS run on current version of this PR (hash 977726b) |
https://bugs.webkit.org/show_bug.cgi?id=251842 rdar://105120646 Reviewed by Myles C. Maxfield. Now that we can infer struct types, add support for access struct members. Support for accessing vector members will follow in a separate patch. * Source/WebGPU/WGSL/TypeCheck.cpp: (WGSL::TypeChecker::check): (WGSL::TypeChecker::visitStructMembers): (WGSL::TypeChecker::visit): (WGSL::TypeChecker::inferred): Canonical link: https://commits.webkit.org/260196@main
977726b
to
7b9d9eb
Compare
Committed 260196@main (7b9d9eb): https://commits.webkit.org/260196@main Reviewed commits have been landed. Closing PR #9743 and removing active labels. |
https://bugs.webkit.org/show_bug.cgi?id=251843 <rdar://problem/105121069> Reviewed by Myles C. Maxfield. Continuing from WebKit#9743, expand the typing for field access expressions to also work with vectors. * Source/WebGPU/WGSL/TypeCheck.cpp: (WGSL::TypeChecker::visit): (WGSL::TypeChecker::vectorFieldAccess): Canonical link: https://commits.webkit.org/260200@main
7b9d9eb
977726b