Resolver: Generate mapping for ast::Type -> sem::Type

Currently untestable as nothing currently calls Type(const ast::Type* ty).

Bug: tint:724
Change-Id: I92dd772acd758b0960a7e9a19f15c91414ab505c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49527
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton
2021-04-30 20:20:19 +00:00
committed by Commit Bot service account
parent f34cb1fe70
commit fbec46fba9
8 changed files with 127 additions and 53 deletions

View File

@@ -1788,7 +1788,15 @@ class ProgramBuilder {
/// @param expr the AST expression
/// @return the resolved semantic type for the expression, or nullptr if the
/// expression has no resolved type.
sem::Type* TypeOf(ast::Expression* expr) const;
sem::Type* TypeOf(const ast::Expression* expr) const;
/// Helper for returning the resolved semantic type of the AST type `type`.
/// @note As the Resolver is run when the Program is built, this will only be
/// useful for the Resolver itself and tests that use their own Resolver.
/// @param expr the AST type
/// @return the resolved semantic type for the type, or nullptr if the type
/// has no resolved type.
const sem::Type* TypeOf(const ast::Type* expr) const;
/// Wraps the ast::Literal in a statement. This is used by tests that
/// construct a partial AST and require the Resolver to reach these