ast::Module: Move ConstructedTypes() to typ::Type

And add a few additional helper methods.
Stepping stone to having the module only reference AST nodes.

Bug: tint:724
Change-Id: Ib321dadce5f739afe4f71cbafde9dd2d1c6431bb
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/49743
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/ast/module.cc b/src/ast/module.cc
index d6cc39a..463b2dd 100644
--- a/src/ast/module.cc
+++ b/src/ast/module.cc
@@ -16,6 +16,7 @@
 
 #include <utility>
 
+#include "src/ast/named_type.h"
 #include "src/program_builder.h"
 
 TINT_INSTANTIATE_TYPEINFO(tint::ast::Module);
@@ -50,6 +51,17 @@
 
 Module::~Module() = default;
 
+const ast::NamedType* Module::LookupType(Symbol name) const {
+  for (auto ct : ConstructedTypes()) {
+    if (auto* ty = ct.ast->As<ast::NamedType>()) {
+      if (ty->name() == name) {
+        return ty;
+      }
+    }
+  }
+  return nullptr;
+}
+
 Module* Module::Clone(CloneContext* ctx) const {
   auto* out = ctx->dst->create<Module>();
   out->Copy(ctx, this);
@@ -80,7 +92,7 @@
   make_indent(out, indent);
   out << "Module{" << std::endl;
   indent += 2;
-  for (auto* const ty : constructed_types_) {
+  for (auto const ty : constructed_types_) {
     make_indent(out, indent);
     if (auto* alias = ty->As<sem::Alias>()) {
       out << alias->symbol().to_str() << " -> " << alias->type()->type_name()