mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
Add type inference support to Resolver
There is still no way to spell this out in WGSL, but this adds support for VariableDecls with an ast::Variable that has nullptr type. In this case, the Resolver uses the type of the rhs (constructor expression), which is stored in semantic::Variable. Added tests for resolving inferred types from constructor, arithmetic, and call expressions. Bug: tint:672 Change-Id: I3dcfd18adecebc8b969373d2ac72c21891c21a87 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/46160 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
55bc5409c2
commit
39a65a1d1e
@@ -38,7 +38,8 @@ Variable::Variable(const Source& source,
|
||||
decorations_(std::move(decorations)),
|
||||
declared_storage_class_(declared_storage_class) {
|
||||
TINT_ASSERT(symbol_.IsValid());
|
||||
TINT_ASSERT(declared_type_);
|
||||
// no type means we must have a constructor to infer it
|
||||
TINT_ASSERT(declared_type_ || constructor);
|
||||
}
|
||||
|
||||
Variable::Variable(Variable&&) = default;
|
||||
|
||||
Reference in New Issue
Block a user