Add TypeDeterminer::Run()
This is a temporary function to help with Dawn migration. It will be removed after the migration to using Program and ProgramBuilder is complete. Bug: tint:390 Change-Id: I98c73a6b8102eebf48a889315a376195f9379f63 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38556 Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
b16a5d6e9b
commit
be610ba987
|
@ -66,6 +66,17 @@ TypeDeterminer::TypeDeterminer(Program* program)
|
|||
|
||||
TypeDeterminer::~TypeDeterminer() = default;
|
||||
|
||||
diag::List TypeDeterminer::Run(Program* program) {
|
||||
TypeDeterminer td(program);
|
||||
if (!td.Determine()) {
|
||||
diag::Diagnostic err;
|
||||
err.severity = diag::Severity::Error;
|
||||
err.message = td.error();
|
||||
return {err};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
void TypeDeterminer::set_error(const Source& src, const std::string& msg) {
|
||||
error_ = "";
|
||||
if (src.range.begin.line > 0) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <vector>
|
||||
|
||||
#include "src/ast/module.h"
|
||||
#include "src/diagnostic/diagnostic.h"
|
||||
#include "src/program.h"
|
||||
#include "src/scope_stack.h"
|
||||
#include "src/type/storage_texture_type.h"
|
||||
|
@ -54,6 +55,14 @@ class TypeDeterminer {
|
|||
/// Destructor
|
||||
~TypeDeterminer();
|
||||
|
||||
/// Run the type determiner on `program`, replacing the Program with a new
|
||||
/// program containing type information.
|
||||
/// [TEMPORARY] - Exists for making incremental changes.
|
||||
/// @param program a pointer to the program variable that will be read from
|
||||
/// and assigned to.
|
||||
/// @returns a list of diagnostic messages
|
||||
static diag::List Run(Program* program);
|
||||
|
||||
/// @returns error messages from the type determiner
|
||||
const std::string& error() { return error_; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue