Context object owns a TypeManager

Add a Context::Reset method to clear state.

Hide the member behind an accessor.

Change-Id: Iafb7c39249f66f70c5a99a8ed1c69f2c0238834f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/17742
Reviewed-by: dan sinclair <dsinclair@google.com>
diff --git a/src/type_manager.h b/src/type_manager.h
index 61ca864..eb26a25 100644
--- a/src/type_manager.h
+++ b/src/type_manager.h
@@ -29,11 +29,21 @@
   TypeManager();
   ~TypeManager();
 
+  /// Clears all registered types.
+  void Reset();
+
   /// Get the given type from the type manager
   /// @param type The type to register
   /// @return the pointer to the registered type
   ast::type::Type* Get(std::unique_ptr<ast::type::Type> type);
 
+  /// Returns the type map, for testing purposes.
+  /// @returns the mapping from name string to type.
+  const std::unordered_map<std::string, std::unique_ptr<ast::type::Type>>&
+  TypesForTesting() {
+    return types_;
+  }
+
  private:
   std::unordered_map<std::string, std::unique_ptr<ast::type::Type>> types_;
 };