Allow setting the namer into the inspector.

This CL adds an extra constructor to the inspector to change the namer
user. The inspector tests are then updated to use the test namer.

Change-Id: Ibc91de89b52161dc125b38d65e445b5833ad6c18
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/36943
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
This commit is contained in:
dan sinclair
2021-01-11 16:24:32 +00:00
committed by dan sinclair
parent b920e604b2
commit a8d9755053
3 changed files with 61 additions and 68 deletions

View File

@@ -43,10 +43,18 @@
namespace tint {
namespace inspector {
Inspector::Inspector(ast::Module& module)
: module_(module), namer_(std::make_unique<UnsafeNamer>(&module)) {}
Inspector::Inspector(ast::Module& module, Namer* namer)
: module_(module), namer_(namer), namer_is_owned_(false) {}
Inspector::~Inspector() = default;
Inspector::Inspector(ast::Module& module)
: module_(module),
namer_(new UnsafeNamer(&module)),
namer_is_owned_(true) {}
Inspector::~Inspector() {
if (namer_is_owned_)
delete namer_;
}
std::vector<EntryPoint> Inspector::GetEntryPoints() {
std::vector<EntryPoint> result;