ast::Builder: Add shortcuts to the Program methods

This builder will be merged into ProgramBuilder, where these will become methods.
To breakup this change, perform the refactoring as a separate change.

Bug: tint:390
Change-Id: I2c9151cd9f198e99d88eaf296dd994293df6c425
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/38720
Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/src/ast/builder.h b/src/ast/builder.h
index bbb6ecf..d77b0b9 100644
--- a/src/ast/builder.h
+++ b/src/ast/builder.h
@@ -742,6 +742,15 @@
   /// @param loc the Source used for future create() calls
   void SetSource(const Source::Location& loc) { source_ = Source(loc); }
 
+  /// @returns true if all required fields in the AST are present.
+  bool IsValid() const { return mod->IsValid(); }
+
+  /// @returns a reference to the program's AST root Module
+  ast::Module& AST() { return mod->AST(); }
+
+  /// @returns a reference to the program's SymbolTable
+  SymbolTable& Symbols() { return mod->Symbols(); }
+
   /// The builder program
   Program* const program;
   /// The builder types
diff --git a/src/ast/function_test.cc b/src/ast/function_test.cc
index 636042a..fac3dd1 100644
--- a/src/ast/function_test.cc
+++ b/src/ast/function_test.cc
@@ -36,7 +36,7 @@
 
   auto* f = Func("func", params, ty.void_(), StatementList{},
                  FunctionDecorationList{});
-  EXPECT_EQ(f->symbol(), mod->Symbols().Register("func"));
+  EXPECT_EQ(f->symbol(), Symbols().Register("func"));
   ASSERT_EQ(f->params().size(), 1u);
   EXPECT_EQ(f->return_type(), ty.void_());
   EXPECT_EQ(f->params()[0], var);
@@ -151,7 +151,7 @@
   auto* f = Func("func", VariableList{}, ty.void_(), StatementList{},
                  FunctionDecorationList{});
 
-  auto main_sym = mod->Symbols().Register("main");
+  auto main_sym = Symbols().Register("main");
   f->add_ancestor_entry_point(main_sym);
   ASSERT_EQ(1u, f->ancestor_entry_points().size());
   EXPECT_EQ(main_sym, f->ancestor_entry_points()[0]);
@@ -364,12 +364,12 @@
                     ast::FunctionDecorationList{});
   FunctionList list;
   list.Add(func);
-  EXPECT_EQ(func, list.Find(mod->Symbols().Register("main")));
+  EXPECT_EQ(func, list.Find(Symbols().Register("main")));
 }
 
 TEST_F(FunctionListTest, FindSymbolMissing) {
   FunctionList list;
-  EXPECT_EQ(nullptr, list.Find(mod->Symbols().Register("Missing")));
+  EXPECT_EQ(nullptr, list.Find(Symbols().Register("Missing")));
 }
 
 TEST_F(FunctionListTest, FindSymbolStage) {
@@ -384,10 +384,9 @@
   FunctionList list;
   list.Add(fs);
   list.Add(vs);
-  EXPECT_EQ(
-      fs, list.Find(mod->Symbols().Register("main"), PipelineStage::kFragment));
-  EXPECT_EQ(vs,
-            list.Find(mod->Symbols().Register("main"), PipelineStage::kVertex));
+  EXPECT_EQ(fs,
+            list.Find(Symbols().Register("main"), PipelineStage::kFragment));
+  EXPECT_EQ(vs, list.Find(Symbols().Register("main"), PipelineStage::kVertex));
 }
 
 TEST_F(FunctionListTest, FindSymbolStageMissing) {
@@ -397,7 +396,7 @@
                     create<ast::StageDecoration>(PipelineStage::kFragment),
                 }));
   EXPECT_EQ(nullptr,
-            list.Find(mod->Symbols().Register("main"), PipelineStage::kVertex));
+            list.Find(Symbols().Register("main"), PipelineStage::kVertex));
 }
 
 TEST_F(FunctionListTest, HasStage) {
diff --git a/src/ast/test_helper.h b/src/ast/test_helper.h
index 9f39b02..8ae08f5 100644
--- a/src/ast/test_helper.h
+++ b/src/ast/test_helper.h
@@ -35,7 +35,7 @@
   /// @param s the string to demangle
   /// @returns the demangled string
   std::string demangle(const std::string& s) {
-    return demanger.Demangle(mod->Symbols(), s);
+    return demanger.Demangle(Symbols(), s);
   }
 
   /// A demangler
diff --git a/src/inspector/inspector_test.cc b/src/inspector/inspector_test.cc
index 3659928..569086b 100644
--- a/src/inspector/inspector_test.cc
+++ b/src/inspector/inspector_test.cc
@@ -114,11 +114,11 @@
       std::string in, out;
       std::tie(in, out) = inout;
 
-      mod->AST().AddGlobalVariable(
+      AST().AddGlobalVariable(
           Var(in, ast::StorageClass::kInput, ty.u32(), nullptr,
               ast::VariableDecorationList{
                   create<ast::LocationDecoration>(location++)}));
-      mod->AST().AddGlobalVariable(
+      AST().AddGlobalVariable(
           Var(out, ast::StorageClass::kOutput, ty.u32(), nullptr,
               ast::VariableDecorationList{
                   create<ast::LocationDecoration>(location++)}));
@@ -187,7 +187,7 @@
                       ast::VariableDecorationList{
                           create<ast::ConstantIdDecoration>(id),
                       });
-    mod->AST().AddGlobalVariable(var);
+    AST().AddGlobalVariable(var);
   }
 
   /// @param type AST type of the literal, must resolve to BoolLiteral
@@ -334,7 +334,7 @@
                         create<ast::GroupDecoration>(group),
                     });
 
-    mod->AST().AddGlobalVariable(var);
+    AST().AddGlobalVariable(var);
   }
 
   /// Adds an uniform buffer variable to the program
@@ -469,7 +469,7 @@
   }
 
   void AddGlobalVariable(const std::string& name, type::Type* type) {
-    mod->AST().AddGlobalVariable(
+    AST().AddGlobalVariable(
         Var(name, ast::StorageClass::kUniformConstant, type));
   }
 
@@ -477,7 +477,7 @@
   /// @param name the name of the variable
   /// @param type the type to use
   void AddDepthTexture(const std::string& name, type::Type* type) {
-    mod->AST().AddGlobalVariable(
+    AST().AddGlobalVariable(
         Var(name, ast::StorageClass::kUniformConstant, type));
   }
 
@@ -701,7 +701,7 @@
 }
 
 TEST_F(InspectorGetEntryPointTest, NoEntryPoints) {
-  mod->AST().Functions().Add(MakeEmptyBodyFunction("foo", {}));
+  AST().Functions().Add(MakeEmptyBodyFunction("foo", {}));
 
   auto result = inspector()->GetEntryPoints();
   ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
@@ -714,7 +714,7 @@
       "foo", ast::FunctionDecorationList{
                  create<ast::StageDecoration>(ast::PipelineStage::kVertex),
              });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   // TODO(dsinclair): Update to run the namer transform when available.
 
@@ -732,13 +732,13 @@
       "foo", ast::FunctionDecorationList{
                  create<ast::StageDecoration>(ast::PipelineStage::kVertex),
              });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   auto* bar = MakeEmptyBodyFunction(
       "bar", ast::FunctionDecorationList{
                  create<ast::StageDecoration>(ast::PipelineStage::kCompute),
              });
-  mod->AST().Functions().Add(bar);
+  AST().Functions().Add(bar);
 
   // TODO(dsinclair): Update to run the namer transform when available.
 
@@ -756,21 +756,21 @@
 
 TEST_F(InspectorGetEntryPointTest, MixFunctionsAndEntryPoints) {
   auto* func = MakeEmptyBodyFunction("func", {});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   auto* foo = MakeCallerBodyFunction(
       "foo", "func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   auto* bar = MakeCallerBodyFunction(
       "bar", "func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kFragment),
       });
-  mod->AST().Functions().Add(bar);
+  AST().Functions().Add(bar);
 
   // TODO(dsinclair): Update to run the namer transform when available.
 
@@ -792,7 +792,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   auto result = inspector()->GetEntryPoints();
   ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
@@ -811,7 +811,7 @@
                  create<ast::StageDecoration>(ast::PipelineStage::kCompute),
                  create<ast::WorkgroupDecoration>(8u, 2u, 1u),
              });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   auto result = inspector()->GetEntryPoints();
   ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
@@ -826,14 +826,14 @@
 
 TEST_F(InspectorGetEntryPointTest, NoInOutVariables) {
   auto* func = MakeEmptyBodyFunction("func", {});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   auto* foo = MakeCallerBodyFunction(
       "foo", "func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   auto result = inspector()->GetEntryPoints();
   ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
@@ -851,7 +851,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -875,14 +875,14 @@
 
   auto* func =
       MakeInOutVariableBodyFunction("func", {{"in_var", "out_var"}}, {});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   auto* foo = MakeCallerBodyFunction(
       "foo", "func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -906,14 +906,14 @@
 
   auto* func =
       MakeInOutVariableBodyFunction("func", {{"in_var", "out_var"}}, {});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   auto* foo = MakeInOutVariableCallerBodyFunction(
       "foo", "func", {{"in_var", "out_var"}},
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -940,7 +940,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -970,14 +970,14 @@
 
   auto* func = MakeInOutVariableBodyFunction(
       "func", {{"in_var", "out_var"}, {"in2_var", "out2_var"}}, {});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   auto* foo = MakeCallerBodyFunction(
       "foo", "func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1011,14 +1011,14 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   auto* bar = MakeInOutVariableBodyFunction(
       "bar", {{"in2_var", "out_var"}},
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kCompute),
       });
-  mod->AST().Functions().Add(bar);
+  AST().Functions().Add(bar);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1057,21 +1057,21 @@
 
   auto* func =
       MakeInOutVariableBodyFunction("func", {{"in2_var", "out2_var"}}, {});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   auto* foo = MakeInOutVariableCallerBodyFunction(
       "foo", "func", {{"in_var", "out_var"}},
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   auto* bar = MakeCallerBodyFunction(
       "bar", "func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kCompute),
       });
-  mod->AST().Functions().Add(bar);
+  AST().Functions().Add(bar);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1114,23 +1114,23 @@
 }
 
 TEST_F(InspectorGetEntryPointTest, BuiltInsNotStageVariables) {
-  mod->AST().AddGlobalVariable(
+  AST().AddGlobalVariable(
       Var("in_var", ast::StorageClass::kInput, ty.u32(), nullptr,
           ast::VariableDecorationList{
               create<ast::BuiltinDecoration>(ast::Builtin::kPosition)}));
-  mod->AST().AddGlobalVariable(
+  AST().AddGlobalVariable(
       Var("out_var", ast::StorageClass::kOutput, ty.u32(), nullptr,
           ast::VariableDecorationList{create<ast::LocationDecoration>(0)}));
   auto* func =
       MakeInOutVariableBodyFunction("func", {{"in_var", "out_var"}}, {});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   auto* foo = MakeCallerBodyFunction(
       "foo", "func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1162,7 +1162,7 @@
 // TODO(rharrison): Reenable once GetRemappedNameForEntryPoint isn't a pass
 // through
 TEST_F(InspectorGetRemappedNameForEntryPointTest, DISABLED_NoEntryPoints) {
-  mod->AST().Functions().Add(MakeEmptyBodyFunction("foo", {}));
+  AST().Functions().Add(MakeEmptyBodyFunction("foo", {}));
 
   auto result = inspector()->GetRemappedNameForEntryPoint("foo");
   ASSERT_TRUE(inspector()->has_error());
@@ -1177,7 +1177,7 @@
       "foo", ast::FunctionDecorationList{
                  create<ast::StageDecoration>(ast::PipelineStage::kVertex),
              });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   // TODO(dsinclair): Update to run the namer transform when available.
 
@@ -1195,7 +1195,7 @@
       "foo", ast::FunctionDecorationList{
                  create<ast::StageDecoration>(ast::PipelineStage::kVertex),
              });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   // TODO(dsinclair): Update to run the namer transform when available.
 
@@ -1203,7 +1203,7 @@
       "bar", ast::FunctionDecorationList{
                  create<ast::StageDecoration>(ast::PipelineStage::kCompute),
              });
-  mod->AST().Functions().Add(bar);
+  AST().Functions().Add(bar);
 
   {
     auto result = inspector()->GetRemappedNameForEntryPoint("foo");
@@ -1321,14 +1321,14 @@
 
   auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
                                                           {{0, ty.i32()}});
-  mod->AST().Functions().Add(ub_func);
+  AST().Functions().Add(ub_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "ub_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1349,14 +1349,14 @@
 
   auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
                                                           {{0, ty.i32()}});
-  mod->AST().Functions().Add(ub_func);
+  AST().Functions().Add(ub_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "ub_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1374,14 +1374,14 @@
 
   auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
                                                           {{0, ty.i32()}});
-  mod->AST().Functions().Add(ub_func);
+  AST().Functions().Add(ub_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "ub_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1403,14 +1403,14 @@
 
   auto* ub_func = MakeStructVariableReferenceBodyFunction(
       "ub_func", "foo_ub", {{0, ty.i32()}, {1, ty.u32()}, {2, ty.f32()}});
-  mod->AST().Functions().Add(ub_func);
+  AST().Functions().Add(ub_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "ub_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1436,7 +1436,7 @@
                                  const std::string& var_name) {
     auto* ub_func = MakeStructVariableReferenceBodyFunction(
         func_name, var_name, {{0, ty.i32()}, {1, ty.u32()}, {2, ty.f32()}});
-    mod->AST().Functions().Add(ub_func);
+    AST().Functions().Add(ub_func);
   };
   AddReferenceFunc("ub_foo_func", "ub_foo");
   AddReferenceFunc("ub_bar_func", "ub_bar");
@@ -1454,7 +1454,7 @@
            ast::FunctionDecorationList{
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1484,14 +1484,14 @@
 
   auto* ub_func = MakeStructVariableReferenceBodyFunction("ub_func", "foo_ub",
                                                           {{0, ty.i32()}});
-  mod->AST().Functions().Add(ub_func);
+  AST().Functions().Add(ub_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "ub_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1513,14 +1513,14 @@
 
   auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
                                                           {{0, ty.i32()}});
-  mod->AST().Functions().Add(sb_func);
+  AST().Functions().Add(sb_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "sb_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1542,14 +1542,14 @@
 
   auto* sb_func = MakeStructVariableReferenceBodyFunction(
       "sb_func", "foo_sb", {{0, ty.i32()}, {1, ty.u32()}, {2, ty.f32()}});
-  mod->AST().Functions().Add(sb_func);
+  AST().Functions().Add(sb_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "sb_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1575,7 +1575,7 @@
                                  const std::string& var_name) {
     auto* sb_func = MakeStructVariableReferenceBodyFunction(
         func_name, var_name, {{0, ty.i32()}, {1, ty.u32()}, {2, ty.f32()}});
-    mod->AST().Functions().Add(sb_func);
+    AST().Functions().Add(sb_func);
   };
   AddReferenceFunc("sb_foo_func", "sb_foo");
   AddReferenceFunc("sb_bar_func", "sb_bar");
@@ -1596,7 +1596,7 @@
            ast::FunctionDecorationList{
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1626,14 +1626,14 @@
 
   auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
                                                           {{0, ty.i32()}});
-  mod->AST().Functions().Add(sb_func);
+  AST().Functions().Add(sb_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "sb_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1655,14 +1655,14 @@
 
   auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
                                                           {{0, ty.i32()}});
-  mod->AST().Functions().Add(sb_func);
+  AST().Functions().Add(sb_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "sb_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1684,14 +1684,14 @@
 
   auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
                                                           {{0, ty.i32()}});
-  mod->AST().Functions().Add(sb_func);
+  AST().Functions().Add(sb_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "sb_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1709,14 +1709,14 @@
 
   auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
                                                           {{0, ty.i32()}});
-  mod->AST().Functions().Add(sb_func);
+  AST().Functions().Add(sb_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "sb_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1744,7 +1744,7 @@
                                  const std::string& var_name) {
     auto* sb_func = MakeStructVariableReferenceBodyFunction(
         func_name, var_name, {{0, ty.i32()}, {1, ty.u32()}, {2, ty.f32()}});
-    mod->AST().Functions().Add(sb_func);
+    AST().Functions().Add(sb_func);
   };
   AddReferenceFunc("sb_foo_func", "sb_foo");
   AddReferenceFunc("sb_bar_func", "sb_bar");
@@ -1765,7 +1765,7 @@
            ast::FunctionDecorationList{
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1796,14 +1796,14 @@
 
   auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
                                                           {{0, ty.i32()}});
-  mod->AST().Functions().Add(sb_func);
+  AST().Functions().Add(sb_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "sb_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1827,14 +1827,14 @@
 
   auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
                                                           {{0, ty.i32()}});
-  mod->AST().Functions().Add(sb_func);
+  AST().Functions().Add(sb_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "sb_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1857,14 +1857,14 @@
 
   auto* sb_func = MakeStructVariableReferenceBodyFunction("sb_func", "foo_sb",
                                                           {{0, ty.i32()}});
-  mod->AST().Functions().Add(sb_func);
+  AST().Functions().Add(sb_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "sb_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1886,7 +1886,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1903,7 +1903,7 @@
       "ep_func", ast::FunctionDecorationList{
                      create<ast::StageDecoration>(ast::PipelineStage::kVertex),
                  });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1922,14 +1922,14 @@
 
   auto* foo_func = MakeSamplerReferenceBodyFunction(
       "foo_func", "foo_texture", "foo_sampler", "foo_coords", ty.f32(), {});
-  mod->AST().Functions().Add(foo_func);
+  AST().Functions().Add(foo_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "foo_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1953,7 +1953,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1973,7 +1973,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1995,7 +1995,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -2012,7 +2012,7 @@
       "ep_func", ast::FunctionDecorationList{
                      create<ast::StageDecoration>(ast::PipelineStage::kVertex),
                  });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -2032,14 +2032,14 @@
   auto* foo_func = MakeComparisonSamplerReferenceBodyFunction(
       "foo_func", "foo_texture", "foo_sampler", "foo_coords", "foo_depth",
       ty.f32(), {});
-  mod->AST().Functions().Add(foo_func);
+  AST().Functions().Add(foo_func);
 
   auto* ep_func = MakeCallerBodyFunction(
       "ep_func", "foo_func",
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(ep_func);
+  AST().Functions().Add(ep_func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -2063,7 +2063,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -2083,7 +2083,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -2098,7 +2098,7 @@
       "foo", ast::FunctionDecorationList{
                  create<ast::StageDecoration>(ast::PipelineStage::kVertex),
              });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   auto result = inspector()->GetSampledTextureResourceBindings("foo");
   ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
@@ -2121,7 +2121,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -2212,7 +2212,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -2283,7 +2283,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -2338,7 +2338,7 @@
       "foo", ast::FunctionDecorationList{
                  create<ast::StageDecoration>(ast::PipelineStage::kVertex),
              });
-  mod->AST().Functions().Add(foo);
+  AST().Functions().Add(foo);
 
   auto result = inspector()->GetSampledTextureResourceBindings("foo");
   ASSERT_FALSE(inspector()->has_error()) << inspector()->error();
@@ -2363,7 +2363,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
diff --git a/src/program_test.cc b/src/program_test.cc
index a758663..6659ae3 100644
--- a/src/program_test.cc
+++ b/src/program_test.cc
@@ -31,7 +31,7 @@
 using ProgramTest = ast::TestHelper;
 
 TEST_F(ProgramTest, Creation) {
-  EXPECT_EQ(mod->AST().Functions().size(), 0u);
+  EXPECT_EQ(AST().Functions().size(), 0u);
 }
 
 TEST_F(ProgramTest, ToStrEmitsPreambleAndPostamble) {
@@ -41,70 +41,70 @@
 }
 
 TEST_F(ProgramTest, IsValid_Empty) {
-  EXPECT_TRUE(mod->IsValid());
+  EXPECT_TRUE(IsValid());
 }
 
 TEST_F(ProgramTest, IsValid_GlobalVariable) {
   auto* var = Var("var", ast::StorageClass::kInput, ty.f32());
-  mod->AST().AddGlobalVariable(var);
-  EXPECT_TRUE(mod->IsValid());
+  AST().AddGlobalVariable(var);
+  EXPECT_TRUE(IsValid());
 }
 
 TEST_F(ProgramTest, IsValid_Null_GlobalVariable) {
-  mod->AST().AddGlobalVariable(nullptr);
-  EXPECT_FALSE(mod->IsValid());
+  AST().AddGlobalVariable(nullptr);
+  EXPECT_FALSE(IsValid());
 }
 
 TEST_F(ProgramTest, IsValid_Invalid_GlobalVariable) {
   auto* var = Var("var", ast::StorageClass::kInput, nullptr);
-  mod->AST().AddGlobalVariable(var);
-  EXPECT_FALSE(mod->IsValid());
+  AST().AddGlobalVariable(var);
+  EXPECT_FALSE(IsValid());
 }
 
 TEST_F(ProgramTest, IsValid_Alias) {
   auto* alias = ty.alias("alias", ty.f32());
-  mod->AST().AddConstructedType(alias);
-  EXPECT_TRUE(mod->IsValid());
+  AST().AddConstructedType(alias);
+  EXPECT_TRUE(IsValid());
 }
 
 TEST_F(ProgramTest, IsValid_Null_Alias) {
-  mod->AST().AddConstructedType(nullptr);
-  EXPECT_FALSE(mod->IsValid());
+  AST().AddConstructedType(nullptr);
+  EXPECT_FALSE(IsValid());
 }
 
 TEST_F(ProgramTest, IsValid_Struct) {
   auto* st = ty.struct_("name", {});
   auto* alias = ty.alias("name", st);
-  mod->AST().AddConstructedType(alias);
-  EXPECT_TRUE(mod->IsValid());
+  AST().AddConstructedType(alias);
+  EXPECT_TRUE(IsValid());
 }
 
 TEST_F(ProgramTest, IsValid_Struct_EmptyName) {
   auto* st = ty.struct_("", {});
   auto* alias = ty.alias("name", st);
-  mod->AST().AddConstructedType(alias);
-  EXPECT_FALSE(mod->IsValid());
+  AST().AddConstructedType(alias);
+  EXPECT_FALSE(IsValid());
 }
 
 TEST_F(ProgramTest, IsValid_Function) {
   auto* func = Func("main", ast::VariableList(), ty.f32(), ast::StatementList{},
                     ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
-  EXPECT_TRUE(mod->IsValid());
+  AST().Functions().Add(func);
+  EXPECT_TRUE(IsValid());
 }
 
 TEST_F(ProgramTest, IsValid_Null_Function) {
-  mod->AST().Functions().Add(nullptr);
-  EXPECT_FALSE(mod->IsValid());
+  AST().Functions().Add(nullptr);
+  EXPECT_FALSE(IsValid());
 }
 
 TEST_F(ProgramTest, IsValid_Invalid_Function) {
   auto* func = Func("main", ast::VariableList{}, nullptr, ast::StatementList{},
                     ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
-  EXPECT_FALSE(mod->IsValid());
+  AST().Functions().Add(func);
+  EXPECT_FALSE(IsValid());
 }
 
 }  // namespace
diff --git a/src/type/storage_texture_type_test.cc b/src/type/storage_texture_type_test.cc
index 7b327da..7860926 100644
--- a/src/type/storage_texture_type_test.cc
+++ b/src/type/storage_texture_type_test.cc
@@ -80,8 +80,8 @@
 }
 
 TEST_F(StorageTextureTest, F32) {
-  Type* s = mod->create<StorageTexture>(TextureDimension::k2dArray,
-                                        ImageFormat::kRgba32Float);
+  Type* s = create<StorageTexture>(TextureDimension::k2dArray,
+                                   ImageFormat::kRgba32Float);
   TypeDeterminer td(mod);
 
   ASSERT_TRUE(td.Determine()) << td.error();
@@ -91,8 +91,8 @@
 }
 
 TEST_F(StorageTextureTest, U32) {
-  Type* s = mod->create<StorageTexture>(TextureDimension::k2dArray,
-                                        ImageFormat::kRg32Uint);
+  Type* s = create<StorageTexture>(TextureDimension::k2dArray,
+                                   ImageFormat::kRg32Uint);
   TypeDeterminer td(mod);
 
   ASSERT_TRUE(td.Determine()) << td.error();
@@ -102,8 +102,8 @@
 }
 
 TEST_F(StorageTextureTest, I32) {
-  Type* s = mod->create<StorageTexture>(TextureDimension::k2dArray,
-                                        ImageFormat::kRgba32Sint);
+  Type* s = create<StorageTexture>(TextureDimension::k2dArray,
+                                   ImageFormat::kRgba32Sint);
   TypeDeterminer td(mod);
 
   ASSERT_TRUE(td.Determine()) << td.error();
diff --git a/src/type/test_helper.h b/src/type/test_helper.h
index ac0a328..c1006bb 100644
--- a/src/type/test_helper.h
+++ b/src/type/test_helper.h
@@ -35,7 +35,7 @@
   /// @param s the string to demangle
   /// @returns the demangled string
   std::string demangle(const std::string& s) {
-    return demanger.Demangle(mod->Symbols(), s);
+    return demanger.Demangle(Symbols(), s);
   }
 
   /// A demangler
diff --git a/src/type_determiner_test.cc b/src/type_determiner_test.cc
index 3e856e9..e2035c3 100644
--- a/src/type_determiner_test.cc
+++ b/src/type_determiner_test.cc
@@ -292,7 +292,7 @@
   ast::VariableList params;
   auto* func = Func("my_func", params, ty.f32(), ast::StatementList{},
                     ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   // Register the function
   EXPECT_TRUE(td()->Determine());
@@ -319,14 +319,14 @@
                              create<ast::ReturnStatement>(),
                          },
                          ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func_main);
+  AST().Functions().Add(func_main);
 
   auto* func = Func("func", params0, ty.f32(),
                     ast::StatementList{
                         create<ast::ReturnStatement>(),
                     },
                     ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_FALSE(td()->Determine()) << td()->error();
   EXPECT_EQ(td()->error(),
@@ -350,7 +350,7 @@
                   ast::VariableDecorationList{});
   auto* init = var->constructor();
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   EXPECT_TRUE(td()->Determine());
   ASSERT_NE(init->result_type(), nullptr);
@@ -367,7 +367,7 @@
 TEST_F(TypeDeterminerTest, Expr_ArrayAccessor_Array) {
   auto* idx = Expr(2);
   auto* var = Var("my_var", ast::StorageClass::kFunction, ty.array<f32, 3>());
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   EXPECT_TRUE(td()->Determine());
 
@@ -383,8 +383,7 @@
 TEST_F(TypeDeterminerTest, Expr_ArrayAccessor_Alias_Array) {
   auto* aary = ty.alias("myarrty", ty.array<f32, 3>());
 
-  mod->AST().AddGlobalVariable(
-      Var("my_var", ast::StorageClass::kFunction, aary));
+  AST().AddGlobalVariable(Var("my_var", ast::StorageClass::kFunction, aary));
 
   EXPECT_TRUE(td()->Determine());
 
@@ -399,7 +398,7 @@
 
 TEST_F(TypeDeterminerTest, Expr_ArrayAccessor_Array_Constant) {
   auto* var = Const("my_var", ast::StorageClass::kFunction, ty.array<f32, 3>());
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   EXPECT_TRUE(td()->Determine());
 
@@ -412,7 +411,7 @@
 
 TEST_F(TypeDeterminerTest, Expr_ArrayAccessor_Matrix) {
   auto* var = Var("my_var", ast::StorageClass::kNone, ty.mat2x3<f32>());
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   EXPECT_TRUE(td()->Determine());
 
@@ -428,7 +427,7 @@
 
 TEST_F(TypeDeterminerTest, Expr_ArrayAccessor_Matrix_BothDimensions) {
   auto* var = Var("my_var", ast::StorageClass::kNone, ty.mat2x3<f32>());
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   EXPECT_TRUE(td()->Determine());
 
@@ -444,7 +443,7 @@
 
 TEST_F(TypeDeterminerTest, Expr_ArrayAccessor_Vector) {
   auto* var = Var("my_var", ast::StorageClass::kNone, ty.vec3<f32>());
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   EXPECT_TRUE(td()->Determine());
 
@@ -472,7 +471,7 @@
   ast::VariableList params;
   auto* func = Func("my_func", params, ty.f32(), ast::StatementList{},
                     ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   // Register the function
   EXPECT_TRUE(td()->Determine());
@@ -487,7 +486,7 @@
   ast::VariableList params;
   auto* func = Func("my_func", params, ty.f32(), ast::StatementList{},
                     ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   // Register the function
   EXPECT_TRUE(td()->Determine());
@@ -541,7 +540,7 @@
 
 TEST_F(TypeDeterminerTest, Expr_Identifier_GlobalVariable) {
   auto* var = Var("my_var", ast::StorageClass::kNone, ty.f32());
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   EXPECT_TRUE(td()->Determine());
 
@@ -554,8 +553,7 @@
 }
 
 TEST_F(TypeDeterminerTest, Expr_Identifier_GlobalConstant) {
-  mod->AST().AddGlobalVariable(
-      Const("my_var", ast::StorageClass::kNone, ty.f32()));
+  AST().AddGlobalVariable(Const("my_var", ast::StorageClass::kNone, ty.f32()));
 
   EXPECT_TRUE(td()->Determine());
 
@@ -626,7 +624,7 @@
 TEST_F(TypeDeterminerTest, Expr_Identifier_Function) {
   auto* func = Func("my_func", ast::VariableList{}, ty.f32(),
                     ast::StatementList{}, ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   // Register the function
   EXPECT_TRUE(td()->Determine());
@@ -649,11 +647,11 @@
   auto* wg_var = Var("wg_var", ast::StorageClass::kWorkgroup, ty.f32());
   auto* priv_var = Var("priv_var", ast::StorageClass::kPrivate, ty.f32());
 
-  mod->AST().AddGlobalVariable(in_var);
-  mod->AST().AddGlobalVariable(out_var);
-  mod->AST().AddGlobalVariable(sb_var);
-  mod->AST().AddGlobalVariable(wg_var);
-  mod->AST().AddGlobalVariable(priv_var);
+  AST().AddGlobalVariable(in_var);
+  AST().AddGlobalVariable(out_var);
+  AST().AddGlobalVariable(sb_var);
+  AST().AddGlobalVariable(wg_var);
+  AST().AddGlobalVariable(priv_var);
 
   auto* func = Func(
       "my_func", ast::VariableList{}, ty.f32(),
@@ -665,7 +663,7 @@
       },
       ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   // Register the function
   EXPECT_TRUE(td()->Determine());
@@ -686,11 +684,11 @@
   auto* wg_var = Var("wg_var", ast::StorageClass::kWorkgroup, ty.f32());
   auto* priv_var = Var("priv_var", ast::StorageClass::kPrivate, ty.f32());
 
-  mod->AST().AddGlobalVariable(in_var);
-  mod->AST().AddGlobalVariable(out_var);
-  mod->AST().AddGlobalVariable(sb_var);
-  mod->AST().AddGlobalVariable(wg_var);
-  mod->AST().AddGlobalVariable(priv_var);
+  AST().AddGlobalVariable(in_var);
+  AST().AddGlobalVariable(out_var);
+  AST().AddGlobalVariable(sb_var);
+  AST().AddGlobalVariable(wg_var);
+  AST().AddGlobalVariable(priv_var);
 
   auto* func = Func(
       "my_func", ast::VariableList{}, ty.f32(),
@@ -702,7 +700,7 @@
       },
       ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   auto* func2 = Func(
       "func", ast::VariableList{}, ty.f32(),
@@ -711,7 +709,7 @@
       },
       ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func2);
+  AST().Functions().Add(func2);
 
   // Register the function
   EXPECT_TRUE(td()->Determine());
@@ -736,7 +734,7 @@
            },
            ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   auto* v = Var("var", ast::StorageClass::kFunction, ty.f32());
   td()->RegisterVariableForTesting(v);
@@ -756,7 +754,7 @@
   auto* st = ty.struct_("S", strct);
   auto* var = Var("my_struct", ast::StorageClass::kNone, st);
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   EXPECT_TRUE(td()->Determine());
 
@@ -779,7 +777,7 @@
   auto* alias = ty.alias("alias", st);
   auto* var = Var("my_struct", ast::StorageClass::kNone, alias);
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   EXPECT_TRUE(td()->Determine());
 
@@ -794,7 +792,7 @@
 
 TEST_F(TypeDeterminerTest, Expr_MemberAccessor_VectorSwizzle) {
   auto* var = Var("my_vec", ast::StorageClass::kNone, ty.vec3<f32>());
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   EXPECT_TRUE(td()->Determine());
 
@@ -808,7 +806,7 @@
 
 TEST_F(TypeDeterminerTest, Expr_MemberAccessor_VectorSwizzle_SingleElement) {
   auto* var = Var("my_vec", ast::StorageClass::kNone, ty.vec3<f32>());
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   EXPECT_TRUE(td()->Determine());
 
@@ -858,7 +856,7 @@
 
   auto* stA = ty.struct_("A", strctA);
   auto* var = Var("c", ast::StorageClass::kNone, stA);
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
   EXPECT_TRUE(td()->Determine());
 
   auto* mem = MemberAccessor(
@@ -878,7 +876,7 @@
 
   auto* var = Var("val", ast::StorageClass::kNone, ty.i32());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -894,7 +892,7 @@
 
   auto* var = Var("val", ast::StorageClass::kNone, ty.vec3<i32>());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -924,7 +922,7 @@
 
   auto* var = Var("val", ast::StorageClass::kNone, ty.bool_());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -940,7 +938,7 @@
 
   auto* var = Var("val", ast::StorageClass::kNone, ty.vec3<bool>());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -964,7 +962,7 @@
 
   auto* var = Var("val", ast::StorageClass::kNone, ty.i32());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -980,7 +978,7 @@
 
   auto* var = Var("val", ast::StorageClass::kNone, ty.vec3<i32>());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1005,7 +1003,7 @@
 TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Scalar_Scalar) {
   auto* var = Var("val", ast::StorageClass::kNone, ty.i32());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1019,8 +1017,8 @@
 TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Vector_Scalar) {
   auto* scalar = Var("scalar", ast::StorageClass::kNone, ty.f32());
   auto* vector = Var("vector", ast::StorageClass::kNone, ty.vec3<f32>());
-  mod->AST().AddGlobalVariable(scalar);
-  mod->AST().AddGlobalVariable(vector);
+  AST().AddGlobalVariable(scalar);
+  AST().AddGlobalVariable(vector);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1036,8 +1034,8 @@
 TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Scalar_Vector) {
   auto* scalar = Var("scalar", ast::StorageClass::kNone, ty.f32());
   auto* vector = Var("vector", ast::StorageClass::kNone, ty.vec3<f32>());
-  mod->AST().AddGlobalVariable(scalar);
-  mod->AST().AddGlobalVariable(vector);
+  AST().AddGlobalVariable(scalar);
+  AST().AddGlobalVariable(vector);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1052,7 +1050,7 @@
 
 TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Vector_Vector) {
   auto* vector = Var("vector", ast::StorageClass::kNone, ty.vec3<f32>());
-  mod->AST().AddGlobalVariable(vector);
+  AST().AddGlobalVariable(vector);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1068,8 +1066,8 @@
 TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Matrix_Scalar) {
   auto* scalar = Var("scalar", ast::StorageClass::kNone, ty.f32());
   auto* matrix = Var("matrix", ast::StorageClass::kNone, ty.mat2x3<f32>());
-  mod->AST().AddGlobalVariable(scalar);
-  mod->AST().AddGlobalVariable(matrix);
+  AST().AddGlobalVariable(scalar);
+  AST().AddGlobalVariable(matrix);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1088,8 +1086,8 @@
 TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Scalar_Matrix) {
   auto* scalar = Var("scalar", ast::StorageClass::kNone, ty.f32());
   auto* matrix = Var("matrix", ast::StorageClass::kNone, ty.mat2x3<f32>());
-  mod->AST().AddGlobalVariable(scalar);
-  mod->AST().AddGlobalVariable(matrix);
+  AST().AddGlobalVariable(scalar);
+  AST().AddGlobalVariable(matrix);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1108,8 +1106,8 @@
 TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Matrix_Vector) {
   auto* vector = Var("vector", ast::StorageClass::kNone, ty.vec3<f32>());
   auto* matrix = Var("matrix", ast::StorageClass::kNone, ty.mat2x3<f32>());
-  mod->AST().AddGlobalVariable(vector);
-  mod->AST().AddGlobalVariable(matrix);
+  AST().AddGlobalVariable(vector);
+  AST().AddGlobalVariable(matrix);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1125,8 +1123,8 @@
 TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Vector_Matrix) {
   auto* vector = Var("vector", ast::StorageClass::kNone, ty.vec3<f32>());
   auto* matrix = Var("matrix", ast::StorageClass::kNone, ty.mat2x3<f32>());
-  mod->AST().AddGlobalVariable(vector);
-  mod->AST().AddGlobalVariable(matrix);
+  AST().AddGlobalVariable(vector);
+  AST().AddGlobalVariable(matrix);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1142,8 +1140,8 @@
 TEST_F(TypeDeterminerTest, Expr_Binary_Multiply_Matrix_Matrix) {
   auto* matrix1 = Var("mat3x4", ast::StorageClass::kNone, ty.mat3x4<f32>());
   auto* matrix2 = Var("mat4x3", ast::StorageClass::kNone, ty.mat4x3<f32>());
-  mod->AST().AddGlobalVariable(matrix1);
-  mod->AST().AddGlobalVariable(matrix2);
+  AST().AddGlobalVariable(matrix1);
+  AST().AddGlobalVariable(matrix2);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -1165,7 +1163,7 @@
 
   auto* var = Var("ident", ast::StorageClass::kNone, ty.f32());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   EXPECT_TRUE(td()->Determine());
 
@@ -1181,7 +1179,7 @@
 
   auto* var = Var("ident", ast::StorageClass::kNone, ty.vec4<f32>());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   EXPECT_TRUE(td()->Determine());
 
@@ -1209,8 +1207,8 @@
 
   auto* var1 = Var("ident1", ast::StorageClass::kNone, ty.vec4<f32>());
   auto* var2 = Var("ident2", ast::StorageClass::kNone, ty.vec4<f32>());
-  mod->AST().AddGlobalVariable(var1);
-  mod->AST().AddGlobalVariable(var2);
+  AST().AddGlobalVariable(var1);
+  AST().AddGlobalVariable(var2);
 
   EXPECT_TRUE(td()->Determine());
 
@@ -1236,7 +1234,7 @@
 
   auto* var = Var("my_var", ast::StorageClass::kNone, ty.vec3<bool>());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   auto* expr = Call(name, "my_var");
 
@@ -1257,7 +1255,7 @@
 
   auto* var = Var("my_var", ast::StorageClass::kNone, ty.vec3<f32>());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   auto* expr = Call(name, "my_var");
 
@@ -1277,7 +1275,7 @@
 
   auto* var = Var("my_var", ast::StorageClass::kNone, ty.f32());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   auto* expr = Call(name, "my_var");
 
@@ -1293,7 +1291,7 @@
 
   auto* var = Var("my_var", ast::StorageClass::kNone, ty.f32());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   auto* expr = Call(name);
 
@@ -1308,7 +1306,7 @@
 
   auto* var = Var("my_var", ast::StorageClass::kNone, ty.f32());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   auto* expr = Call(name, "my_var", "my_var");
 
@@ -1370,7 +1368,7 @@
                       type::Type* type,
                       ast::ExpressionList* call_params) {
     auto* var = Var(name, ast::StorageClass::kNone, type);
-    mod->AST().AddGlobalVariable(var);
+    AST().AddGlobalVariable(var);
     call_params->push_back(Expr(name));
   }
 
@@ -1393,7 +1391,7 @@
 
   auto* coords_type = get_coords_type(dim, ty.i32());
 
-  type::Type* texture_type = mod->create<type::StorageTexture>(dim, format);
+  type::Type* texture_type = create<type::StorageTexture>(dim, format);
 
   ast::ExpressionList call_params;
 
@@ -1502,7 +1500,7 @@
 TEST_F(TypeDeterminerTest, Intrinsic_Dot) {
   auto* var = Var("my_var", ast::StorageClass::kNone, ty.vec3<f32>());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   auto* expr = Call("dot", "my_var", "my_var");
 
@@ -1518,8 +1516,8 @@
 
   auto* bool_var = Var(  // source
       "bool_var", ast::StorageClass::kNone, ty.vec3<bool>());
-  mod->AST().AddGlobalVariable(var);
-  mod->AST().AddGlobalVariable(bool_var);
+  AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(bool_var);
 
   auto* expr = Call("select", "my_var", "my_var", "bool_var");
 
@@ -1535,7 +1533,7 @@
 TEST_F(TypeDeterminerTest, Intrinsic_Select_TooFewParams) {
   auto* var = Var("v", ast::StorageClass::kNone, ty.vec3<f32>());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   auto* expr = Call("select", "v");
 
@@ -1549,7 +1547,7 @@
 TEST_F(TypeDeterminerTest, Intrinsic_Select_TooManyParams) {
   auto* var = Var("v", ast::StorageClass::kNone, ty.vec3<f32>());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   auto* expr = Call("select", "v", "v", "v", "v");
 
@@ -1566,7 +1564,7 @@
 
   auto* var = Var("ident", ast::StorageClass::kNone, ty.vec4<f32>());
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   EXPECT_TRUE(td()->Determine());
 
@@ -1589,7 +1587,7 @@
   auto* func = Func("func", ast::VariableList{}, ty.i32(),
                     ast::StatementList{stmt}, ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
   EXPECT_EQ(var->storage_class(), ast::StorageClass::kFunction);
@@ -1601,7 +1599,7 @@
   auto* func = Func("func", ast::VariableList{}, ty.i32(),
                     ast::StatementList{stmt}, ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
   EXPECT_EQ(var->storage_class(), ast::StorageClass::kNone);
@@ -1614,7 +1612,7 @@
   auto* func = Func("func", ast::VariableList{}, ty.i32(),
                     ast::StatementList{stmt}, ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_FALSE(td()->Determine());
   EXPECT_EQ(td()->error(),
@@ -2652,7 +2650,7 @@
 
 TEST_F(TypeDeterminerTest, ImportData_GLSL_Determinant) {
   auto* var = Var("var", ast::StorageClass::kFunction, ty.mat3x3<f32>());
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -2671,7 +2669,7 @@
   auto param = GetParam();
 
   auto* var = Var("var", ast::StorageClass::kFunction, ty.f32());
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -2696,7 +2694,7 @@
   auto param = GetParam();
 
   auto* var = Var("var", ast::StorageClass::kFunction, ty.mat3x3<f32>());
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
@@ -2760,39 +2758,34 @@
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
 
-  mod->AST().Functions().Add(func_b);
-  mod->AST().Functions().Add(func_c);
-  mod->AST().Functions().Add(func_a);
-  mod->AST().Functions().Add(ep_1);
-  mod->AST().Functions().Add(ep_2);
+  AST().Functions().Add(func_b);
+  AST().Functions().Add(func_c);
+  AST().Functions().Add(func_a);
+  AST().Functions().Add(ep_1);
+  AST().Functions().Add(ep_2);
 
-  mod->AST().AddGlobalVariable(
-      Var("first", ast::StorageClass::kPrivate, ty.f32()));
-  mod->AST().AddGlobalVariable(
-      Var("second", ast::StorageClass::kPrivate, ty.f32()));
-  mod->AST().AddGlobalVariable(
-      Var("call_a", ast::StorageClass::kPrivate, ty.f32()));
-  mod->AST().AddGlobalVariable(
-      Var("call_b", ast::StorageClass::kPrivate, ty.f32()));
-  mod->AST().AddGlobalVariable(
-      Var("call_c", ast::StorageClass::kPrivate, ty.f32()));
+  AST().AddGlobalVariable(Var("first", ast::StorageClass::kPrivate, ty.f32()));
+  AST().AddGlobalVariable(Var("second", ast::StorageClass::kPrivate, ty.f32()));
+  AST().AddGlobalVariable(Var("call_a", ast::StorageClass::kPrivate, ty.f32()));
+  AST().AddGlobalVariable(Var("call_b", ast::StorageClass::kPrivate, ty.f32()));
+  AST().AddGlobalVariable(Var("call_c", ast::StorageClass::kPrivate, ty.f32()));
 
   // Register the functions and calculate the callers
   ASSERT_TRUE(td()->Determine()) << td()->error();
 
   const auto& b_eps = func_b->ancestor_entry_points();
   ASSERT_EQ(2u, b_eps.size());
-  EXPECT_EQ(mod->Symbols().Register("ep_1"), b_eps[0]);
-  EXPECT_EQ(mod->Symbols().Register("ep_2"), b_eps[1]);
+  EXPECT_EQ(Symbols().Register("ep_1"), b_eps[0]);
+  EXPECT_EQ(Symbols().Register("ep_2"), b_eps[1]);
 
   const auto& a_eps = func_a->ancestor_entry_points();
   ASSERT_EQ(1u, a_eps.size());
-  EXPECT_EQ(mod->Symbols().Register("ep_1"), a_eps[0]);
+  EXPECT_EQ(Symbols().Register("ep_1"), a_eps[0]);
 
   const auto& c_eps = func_c->ancestor_entry_points();
   ASSERT_EQ(2u, c_eps.size());
-  EXPECT_EQ(mod->Symbols().Register("ep_1"), c_eps[0]);
-  EXPECT_EQ(mod->Symbols().Register("ep_2"), c_eps[1]);
+  EXPECT_EQ(Symbols().Register("ep_1"), c_eps[0]);
+  EXPECT_EQ(Symbols().Register("ep_2"), c_eps[1]);
 
   EXPECT_TRUE(ep_1->ancestor_entry_points().empty());
   EXPECT_TRUE(ep_2->ancestor_entry_points().empty());
diff --git a/src/validator/validator_control_block_test.cc b/src/validator/validator_control_block_test.cc
index 12c7b1a..22e2986 100644
--- a/src/validator/validator_control_block_test.cc
+++ b/src/validator/validator_control_block_test.cc
@@ -375,7 +375,7 @@
       create<ast::VariableDeclStatement>(var),
       create<ast::SwitchStatement>(Expr("a"), body),
   });
-  mod->AST().AddConstructedType(my_int);
+  AST().AddConstructedType(my_int);
 
   EXPECT_TRUE(td()->DetermineStatements(block)) << td()->error();
 
diff --git a/src/validator/validator_function_test.cc b/src/validator/validator_function_test.cc
index f8240e1..1526dcb 100644
--- a/src/validator/validator_function_test.cc
+++ b/src/validator/validator_function_test.cc
@@ -49,7 +49,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
@@ -68,7 +68,7 @@
            ast::FunctionDecorationList{
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
@@ -89,7 +89,7 @@
                         create<ast::VariableDeclStatement>(var),
                     },
                     ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
@@ -105,7 +105,7 @@
   auto* func =
       Func(Source{Source::Location{12, 34}}, "func", ast::VariableList{},
            ty.i32(), ast::StatementList{}, ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
@@ -127,14 +127,13 @@
            ast::FunctionDecorationList{
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
-  EXPECT_TRUE(td()->DetermineFunctions(mod->AST().Functions()))
-      << td()->error();
+  EXPECT_TRUE(td()->DetermineFunctions(AST().Functions())) << td()->error();
 
   ValidatorImpl& v = Build();
 
-  EXPECT_TRUE(v.ValidateFunctions(mod->AST().Functions())) << v.error();
+  EXPECT_TRUE(v.ValidateFunctions(AST().Functions())) << v.error();
 }
 
 TEST_F(ValidateFunctionTest, FunctionTypeMustMatchReturnStatementType_fail) {
@@ -145,7 +144,7 @@
                             Source{Source::Location{12, 34}}, Expr(2)),
                     },
                     ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
@@ -166,7 +165,7 @@
                             Source{Source::Location{12, 34}}, Expr(2)),
                     },
                     ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
@@ -195,8 +194,8 @@
                          },
                          ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
-  mod->AST().Functions().Add(func_copy);
+  AST().Functions().Add(func);
+  AST().Functions().Add(func_copy);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
@@ -218,7 +217,7 @@
                          create<ast::ReturnStatement>(),
                      },
                      ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func0);
+  AST().Functions().Add(func0);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
@@ -242,7 +241,7 @@
                          create<ast::ReturnStatement>(Expr(2)),
                      },
                      ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func0);
+  AST().Functions().Add(func0);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
@@ -265,7 +264,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
   ValidatorImpl& v = Build();
@@ -290,7 +289,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
   ValidatorImpl& v = Build();
@@ -315,7 +314,7 @@
           create<ast::StageDecoration>(ast::PipelineStage::kFragment),
       });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
   ValidatorImpl& v = Build();
@@ -337,7 +336,7 @@
            ast::FunctionDecorationList{
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
@@ -353,7 +352,7 @@
                         create<ast::ReturnStatement>(),
                     },
                     ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
diff --git a/src/validator/validator_test.cc b/src/validator/validator_test.cc
index dba5197..2cd648f 100644
--- a/src/validator/validator_test.cc
+++ b/src/validator/validator_test.cc
@@ -324,21 +324,20 @@
 
 TEST_F(ValidatorTest, GlobalVariableWithStorageClass_Pass) {
   // var<in> gloabl_var: f32;
-  mod->AST().AddGlobalVariable(Var(
-      Source{Source::Location{12, 34}}, "global_var", ast::StorageClass::kInput,
-      ty.f32(), nullptr, ast::VariableDecorationList{}));
+  AST().AddGlobalVariable(Var(Source{Source::Location{12, 34}}, "global_var",
+                              ast::StorageClass::kInput, ty.f32(), nullptr,
+                              ast::VariableDecorationList{}));
 
   ValidatorImpl& v = Build();
 
-  EXPECT_TRUE(v.ValidateGlobalVariables(mod->AST().GlobalVariables()))
-      << v.error();
+  EXPECT_TRUE(v.ValidateGlobalVariables(AST().GlobalVariables())) << v.error();
 }
 
 TEST_F(ValidatorTest, GlobalVariableNoStorageClass_Fail) {
   // var gloabl_var: f32;
-  mod->AST().AddGlobalVariable(Var(
-      Source{Source::Location{12, 34}}, "global_var", ast::StorageClass::kNone,
-      ty.f32(), nullptr, ast::VariableDecorationList{}));
+  AST().AddGlobalVariable(Var(Source{Source::Location{12, 34}}, "global_var",
+                              ast::StorageClass::kNone, ty.f32(), nullptr,
+                              ast::VariableDecorationList{}));
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
   ValidatorImpl& v = Build();
@@ -350,9 +349,9 @@
 
 TEST_F(ValidatorTest, GlobalConstantWithStorageClass_Fail) {
   // const<in> gloabl_var: f32;
-  mod->AST().AddGlobalVariable(Const(
-      Source{Source::Location{12, 34}}, "global_var", ast::StorageClass::kInput,
-      ty.f32(), nullptr, ast::VariableDecorationList{}));
+  AST().AddGlobalVariable(Const(Source{Source::Location{12, 34}}, "global_var",
+                                ast::StorageClass::kInput, ty.f32(), nullptr,
+                                ast::VariableDecorationList{}));
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
   ValidatorImpl& v = Build();
@@ -365,9 +364,9 @@
 
 TEST_F(ValidatorTest, GlobalConstNoStorageClass_Pass) {
   // const gloabl_var: f32;
-  mod->AST().AddGlobalVariable(Const(
-      Source{Source::Location{12, 34}}, "global_var", ast::StorageClass::kNone,
-      ty.f32(), nullptr, ast::VariableDecorationList{}));
+  AST().AddGlobalVariable(Const(Source{Source::Location{12, 34}}, "global_var",
+                                ast::StorageClass::kNone, ty.f32(), nullptr,
+                                ast::VariableDecorationList{}));
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
   ValidatorImpl& v = Build();
@@ -380,9 +379,9 @@
   // fn my_func() -> f32 {
   //   not_global_var = 3.14f;
   // }
-  mod->AST().AddGlobalVariable(Var("global_var", ast::StorageClass::kPrivate,
-                                   ty.f32(), Expr(2.1f),
-                                   ast::VariableDecorationList{}));
+  AST().AddGlobalVariable(Var("global_var", ast::StorageClass::kPrivate,
+                              ty.f32(), Expr(2.1f),
+                              ast::VariableDecorationList{}));
 
   SetSource(Source{Source::Location{12, 34}});
   auto* lhs = Expr("not_global_var");
@@ -394,7 +393,7 @@
                             Source{Source::Location{12, 34}}, lhs, rhs),
                     },
                     ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ValidatorImpl& v = Build();
 
@@ -409,9 +408,9 @@
   //   return;
   // }
 
-  mod->AST().AddGlobalVariable(Var("global_var", ast::StorageClass::kPrivate,
-                                   ty.f32(), Expr(2.1f),
-                                   ast::VariableDecorationList{}));
+  AST().AddGlobalVariable(Var("global_var", ast::StorageClass::kPrivate,
+                              ty.f32(), Expr(2.1f),
+                              ast::VariableDecorationList{}));
 
   auto* func = Func(
       "my_func", ast::VariableList{}, ty.void_(),
@@ -423,7 +422,7 @@
       ast::FunctionDecorationList{
           create<ast::StageDecoration>(ast::PipelineStage::kVertex),
       });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
@@ -502,17 +501,16 @@
   // var global_var1 : i32 = 0;
   auto* var0 = Var("global_var0", ast::StorageClass::kPrivate, ty.f32(),
                    Expr(0.1f), ast::VariableDecorationList{});
-  mod->AST().AddGlobalVariable(var0);
+  AST().AddGlobalVariable(var0);
 
   auto* var1 = Var(Source{Source::Location{12, 34}}, "global_var1",
                    ast::StorageClass::kPrivate, ty.f32(), Expr(0),
                    ast::VariableDecorationList{});
-  mod->AST().AddGlobalVariable(var1);
+  AST().AddGlobalVariable(var1);
 
   ValidatorImpl& v = Build();
 
-  EXPECT_TRUE(v.ValidateGlobalVariables(mod->AST().GlobalVariables()))
-      << v.error();
+  EXPECT_TRUE(v.ValidateGlobalVariables(AST().GlobalVariables())) << v.error();
 }
 
 TEST_F(ValidatorTest, GlobalVariableNotUnique_Fail) {
@@ -520,16 +518,16 @@
   // var global_var : i32 = 0;
   auto* var0 = Var("global_var", ast::StorageClass::kPrivate, ty.f32(),
                    Expr(0.1f), ast::VariableDecorationList{});
-  mod->AST().AddGlobalVariable(var0);
+  AST().AddGlobalVariable(var0);
 
   auto* var1 = Var(Source{Source::Location{12, 34}}, "global_var",
                    ast::StorageClass::kPrivate, ty.i32(), Expr(0),
                    ast::VariableDecorationList{});
-  mod->AST().AddGlobalVariable(var1);
+  AST().AddGlobalVariable(var1);
 
   ValidatorImpl& v = Build();
 
-  EXPECT_FALSE(v.ValidateGlobalVariables(mod->AST().GlobalVariables()));
+  EXPECT_FALSE(v.ValidateGlobalVariables(AST().GlobalVariables()));
   EXPECT_EQ(v.error(),
             "12:34 v-0011: redeclared global identifier 'global_var'");
 }
@@ -570,7 +568,7 @@
 
   auto* global_var = Var("a", ast::StorageClass::kPrivate, ty.f32(), Expr(2.1f),
                          ast::VariableDecorationList{});
-  mod->AST().AddGlobalVariable(global_var);
+  AST().AddGlobalVariable(global_var);
 
   auto* var = Var("a", ast::StorageClass::kNone, ty.f32(), Expr(2.0f),
                   ast::VariableDecorationList{});
@@ -582,7 +580,7 @@
                     },
                     ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
   EXPECT_TRUE(td()->DetermineFunction(func)) << td()->error();
@@ -612,7 +610,7 @@
                     },
                     ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
   EXPECT_TRUE(td()->DetermineFunction(func)) << td()->error();
@@ -711,8 +709,8 @@
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
 
-  mod->AST().Functions().Add(func0);
-  mod->AST().Functions().Add(func1);
+  AST().Functions().Add(func0);
+  AST().Functions().Add(func1);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
diff --git a/src/validator/validator_type_test.cc b/src/validator/validator_type_test.cc
index b04aa9c..b1b063b 100644
--- a/src/validator/validator_type_test.cc
+++ b/src/validator/validator_type_test.cc
@@ -51,11 +51,11 @@
 
   auto* struct_type = ty.struct_("Foo", st);
 
-  mod->AST().AddConstructedType(struct_type);
+  AST().AddConstructedType(struct_type);
 
   ValidatorImpl& v = Build();
 
-  EXPECT_TRUE(v.ValidateConstructedTypes(mod->AST().ConstructedTypes()));
+  EXPECT_TRUE(v.ValidateConstructedTypes(AST().ConstructedTypes()));
 }
 
 TEST_F(ValidatorTypeTest, RuntimeArrayIsLastNoBlock_Fail) {
@@ -71,11 +71,11 @@
                           decos);
 
   auto* struct_type = ty.struct_("Foo", st);
-  mod->AST().AddConstructedType(struct_type);
+  AST().AddConstructedType(struct_type);
 
   ValidatorImpl& v = Build();
 
-  EXPECT_FALSE(v.ValidateConstructedTypes(mod->AST().ConstructedTypes()));
+  EXPECT_FALSE(v.ValidateConstructedTypes(AST().ConstructedTypes()));
   EXPECT_EQ(v.error(),
             "v-0031: a struct containing a runtime-sized array must be "
             "in the 'storage' storage class: 'Foo'");
@@ -99,11 +99,11 @@
 
   auto* struct_type = ty.struct_("Foo", st);
 
-  mod->AST().AddConstructedType(struct_type);
+  AST().AddConstructedType(struct_type);
 
   ValidatorImpl& v = Build();
 
-  EXPECT_FALSE(v.ValidateConstructedTypes(mod->AST().ConstructedTypes()));
+  EXPECT_FALSE(v.ValidateConstructedTypes(AST().ConstructedTypes()));
   EXPECT_EQ(v.error(),
             "12:34 v-0015: runtime arrays may only appear as the last member "
             "of a struct");
@@ -125,11 +125,11 @@
       ast::StructMemberList{Member("b", alias), Member("a", ty.u32())}, decos);
 
   auto* struct_type = ty.struct_("s", st);
-  mod->AST().AddConstructedType(struct_type);
+  AST().AddConstructedType(struct_type);
 
   ValidatorImpl& v = Build();
 
-  EXPECT_FALSE(v.ValidateConstructedTypes(mod->AST().ConstructedTypes()));
+  EXPECT_FALSE(v.ValidateConstructedTypes(AST().ConstructedTypes()));
   EXPECT_EQ(v.error(),
             "v-0015: runtime arrays may only appear as the last member "
             "of a struct");
@@ -151,11 +151,11 @@
       ast::StructMemberList{Member("a", ty.u32()), Member("b", alias)}, decos);
 
   auto* struct_type = ty.struct_("s", st);
-  mod->AST().AddConstructedType(struct_type);
+  AST().AddConstructedType(struct_type);
 
   ValidatorImpl& v = Build();
 
-  EXPECT_TRUE(v.ValidateConstructedTypes(mod->AST().ConstructedTypes()));
+  EXPECT_TRUE(v.ValidateConstructedTypes(AST().ConstructedTypes()));
 }
 
 TEST_F(ValidatorTypeTest, RuntimeArrayInFunction_Fail) {
@@ -172,7 +172,7 @@
            ast::FunctionDecorationList{
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
@@ -197,7 +197,7 @@
                         create<ast::ReturnStatement>(),
                     },
                     ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   auto* main =
       Func("main", ast::VariableList{}, ty.void_(),
@@ -207,7 +207,7 @@
            ast::FunctionDecorationList{
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
-  mod->AST().Functions().Add(main);
+  AST().Functions().Add(main);
 
   EXPECT_TRUE(td()->Determine()) << td()->error();
 
diff --git a/src/writer/hlsl/generator_impl_binary_test.cc b/src/writer/hlsl/generator_impl_binary_test.cc
index acf05d9..0067d40 100644
--- a/src/writer/hlsl/generator_impl_binary_test.cc
+++ b/src/writer/hlsl/generator_impl_binary_test.cc
@@ -507,7 +507,7 @@
 
   auto* func = Func("foo", ast::VariableList{}, ty.void_(),
                     ast::StatementList{}, ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ast::ExpressionList params;
   params.push_back(create<ast::BinaryExpression>(ast::BinaryOp::kLogicalAnd,
diff --git a/src/writer/hlsl/generator_impl_call_test.cc b/src/writer/hlsl/generator_impl_call_test.cc
index efa34d3..5cb93dc 100644
--- a/src/writer/hlsl/generator_impl_call_test.cc
+++ b/src/writer/hlsl/generator_impl_call_test.cc
@@ -34,7 +34,7 @@
 
   auto* func = Func("my_func", ast::VariableList{}, ty.void_(),
                     ast::StatementList{}, ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
@@ -47,7 +47,7 @@
 
   auto* func = Func("my_func", ast::VariableList{}, ty.void_(),
                     ast::StatementList{}, ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
@@ -60,7 +60,7 @@
 
   auto* func = Func("my_func", ast::VariableList{}, ty.void_(),
                     ast::StatementList{}, ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
diff --git a/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc b/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc
index f5890fb..800ce5b 100644
--- a/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc
+++ b/src/writer/hlsl/generator_impl_function_entry_point_data_test.cc
@@ -57,8 +57,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto* func =
       Func("vtx_main", ast::VariableList{}, ty.f32(),
@@ -70,7 +70,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   std::unordered_set<Symbol> globals;
 
@@ -110,8 +110,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto* func =
       Func("vtx_main", ast::VariableList{}, ty.f32(),
@@ -123,7 +123,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   std::unordered_set<Symbol> globals;
 
@@ -163,8 +163,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto* func =
       Func("main", ast::VariableList{}, ty.f32(),
@@ -176,7 +176,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   std::unordered_set<Symbol> globals;
 
@@ -216,8 +216,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto* func =
       Func("main", ast::VariableList{}, ty.f32(),
@@ -229,7 +229,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   std::unordered_set<Symbol> globals;
 
@@ -266,8 +266,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto* func =
       Func("main", ast::VariableList{}, ty.f32(),
@@ -279,7 +279,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kCompute),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   std::unordered_set<Symbol> globals;
 
@@ -311,8 +311,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto* func =
       Func("main", ast::VariableList{}, ty.f32(),
@@ -324,7 +324,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kCompute),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   std::unordered_set<Symbol> globals;
 
@@ -364,8 +364,8 @@
   td.RegisterVariableForTesting(coord_var);
   td.RegisterVariableForTesting(depth_var);
 
-  mod->AST().AddGlobalVariable(coord_var);
-  mod->AST().AddGlobalVariable(depth_var);
+  AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(depth_var);
 
   auto* func =
       Func("main", ast::VariableList{}, ty.void_(),
@@ -377,7 +377,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   std::unordered_set<Symbol> globals;
 
diff --git a/src/writer/hlsl/generator_impl_function_test.cc b/src/writer/hlsl/generator_impl_function_test.cc
index 735367a..ff489f8 100644
--- a/src/writer/hlsl/generator_impl_function_test.cc
+++ b/src/writer/hlsl/generator_impl_function_test.cc
@@ -59,7 +59,7 @@
                     },
                     ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
@@ -80,7 +80,7 @@
                     },
                     ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
@@ -105,7 +105,7 @@
            },
            ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
@@ -128,7 +128,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -157,8 +157,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto* func =
       Func("main", ast::VariableList{}, ty.void_(),
@@ -169,7 +169,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -208,8 +208,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto* func =
       Func("frag_main", ast::VariableList{}, ty.void_(),
@@ -221,7 +221,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -262,8 +262,8 @@
   td.RegisterVariableForTesting(coord_var);
   td.RegisterVariableForTesting(depth_var);
 
-  mod->AST().AddGlobalVariable(coord_var);
-  mod->AST().AddGlobalVariable(depth_var);
+  AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(depth_var);
 
   auto* func =
       Func("frag_main", ast::VariableList{}, ty.void_(),
@@ -276,7 +276,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -310,7 +310,7 @@
           });
 
   td.RegisterVariableForTesting(coord_var);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   auto* var = Var("v", ast::StorageClass::kFunction, ty.f32(),
                   MemberAccessor("coord", "x"), ast::VariableDecorationList{});
@@ -325,7 +325,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -358,10 +358,10 @@
                             create<ast::GroupDecoration>(1),
                         });
 
-  mod->AST().AddConstructedType(s);
+  AST().AddConstructedType(s);
 
   td.RegisterVariableForTesting(coord_var);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   auto* var = Var("v", ast::StorageClass::kFunction, ty.f32(),
                   create<ast::MemberAccessorExpression>(
@@ -378,7 +378,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -416,7 +416,7 @@
                         });
 
   td.RegisterVariableForTesting(coord_var);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   auto* var = Var("v", ast::StorageClass::kFunction, ty.f32(),
                   MemberAccessor("coord", "b"), ast::VariableDecorationList{});
@@ -431,7 +431,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -466,7 +466,7 @@
                         });
 
   td.RegisterVariableForTesting(coord_var);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   auto* var = Var("v", ast::StorageClass::kFunction, ty.f32(),
                   MemberAccessor("coord", "b"), ast::VariableDecorationList{});
@@ -481,7 +481,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -515,7 +515,7 @@
                         });
 
   td.RegisterVariableForTesting(coord_var);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   auto* func =
       Func("frag_main", ast::VariableList{}, ty.void_(),
@@ -528,7 +528,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -567,9 +567,9 @@
   td.RegisterVariableForTesting(bar_var);
   td.RegisterVariableForTesting(val_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
-  mod->AST().AddGlobalVariable(val_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(val_var);
 
   auto* sub_func = Func(
       "sub_func",
@@ -582,7 +582,7 @@
       },
       ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(sub_func);
+  AST().Functions().Add(sub_func);
 
   auto* func_1 = Func(
       "ep_1", ast::VariableList{}, ty.void_(),
@@ -594,7 +594,7 @@
           create<ast::StageDecoration>(ast::PipelineStage::kFragment),
       });
 
-  mod->AST().Functions().Add(func_1);
+  AST().Functions().Add(func_1);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -635,7 +635,7 @@
 
   td.RegisterVariableForTesting(depth_var);
 
-  mod->AST().AddGlobalVariable(depth_var);
+  AST().AddGlobalVariable(depth_var);
 
   auto* sub_func = Func(
       "sub_func",
@@ -646,7 +646,7 @@
       },
       ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(sub_func);
+  AST().Functions().Add(sub_func);
 
   auto* func_1 =
       Func("ep_1", ast::VariableList{}, ty.void_(),
@@ -659,7 +659,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func_1);
+  AST().Functions().Add(func_1);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -701,8 +701,8 @@
   td.RegisterVariableForTesting(coord_var);
   td.RegisterVariableForTesting(depth_var);
 
-  mod->AST().AddGlobalVariable(coord_var);
-  mod->AST().AddGlobalVariable(depth_var);
+  AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(depth_var);
 
   auto* sub_func = Func(
       "sub_func",
@@ -715,7 +715,7 @@
       },
       ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(sub_func);
+  AST().Functions().Add(sub_func);
 
   auto* func_1 =
       Func("ep_1", ast::VariableList{}, ty.void_(),
@@ -728,7 +728,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func_1);
+  AST().Functions().Add(func_1);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -768,7 +768,7 @@
 
   td.RegisterVariableForTesting(coord_var);
 
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   auto* sub_func = Func(
       "sub_func",
@@ -779,7 +779,7 @@
       },
       ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(sub_func);
+  AST().Functions().Add(sub_func);
 
   auto* var = Var("v", ast::StorageClass::kFunction, ty.f32(),
                   Call("sub_func", 1.0f), ast::VariableDecorationList{});
@@ -794,7 +794,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -828,7 +828,7 @@
 
   td.RegisterVariableForTesting(coord_var);
 
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   auto* sub_func = Func(
       "sub_func",
@@ -839,7 +839,7 @@
       },
       ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(sub_func);
+  AST().Functions().Add(sub_func);
 
   auto* var = Var("v", ast::StorageClass::kFunction, ty.f32(),
                   Call("sub_func", 1.0f), ast::VariableDecorationList{});
@@ -854,7 +854,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -883,7 +883,7 @@
                       });
 
   td.RegisterVariableForTesting(bar_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto* list = create<ast::BlockStatement>(ast::StatementList{
       create<ast::ReturnStatement>(),
@@ -902,7 +902,7 @@
           create<ast::StageDecoration>(ast::PipelineStage::kFragment),
       });
 
-  mod->AST().Functions().Add(func_1);
+  AST().Functions().Add(func_1);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -933,7 +933,7 @@
           create<ast::StageDecoration>(ast::PipelineStage::kFragment),
       });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
@@ -956,7 +956,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kCompute),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -983,7 +983,7 @@
                create<ast::WorkgroupDecoration>(2u, 4u, 6u),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -1008,7 +1008,7 @@
       },
       ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
@@ -1053,9 +1053,9 @@
                            create<ast::GroupDecoration>(0),
                        });
 
-  mod->AST().AddConstructedType(s);
+  AST().AddConstructedType(s);
   td.RegisterVariableForTesting(data_var);
-  mod->AST().AddGlobalVariable(data_var);
+  AST().AddGlobalVariable(data_var);
 
   {
     auto* var = Var("v", ast::StorageClass::kFunction, ty.f32(),
@@ -1071,7 +1071,7 @@
                  create<ast::StageDecoration>(ast::PipelineStage::kCompute),
              });
 
-    mod->AST().Functions().Add(func);
+    AST().Functions().Add(func);
   }
 
   {
@@ -1088,7 +1088,7 @@
                  create<ast::StageDecoration>(ast::PipelineStage::kCompute),
              });
 
-    mod->AST().Functions().Add(func);
+    AST().Functions().Add(func);
   }
 
   ASSERT_TRUE(td.Determine()) << td.error();
diff --git a/src/writer/hlsl/generator_impl_import_test.cc b/src/writer/hlsl/generator_impl_import_test.cc
index 5d075c1..3ad837b 100644
--- a/src/writer/hlsl/generator_impl_import_test.cc
+++ b/src/writer/hlsl/generator_impl_import_test.cc
@@ -213,7 +213,7 @@
 
   auto* expr = Call("determinant", "var");
 
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   // Register the global
   ASSERT_TRUE(td.Determine()) << td.error();
diff --git a/src/writer/hlsl/generator_impl_member_accessor_test.cc b/src/writer/hlsl/generator_impl_member_accessor_test.cc
index c86bab8..adeaee0 100644
--- a/src/writer/hlsl/generator_impl_member_accessor_test.cc
+++ b/src/writer/hlsl/generator_impl_member_accessor_test.cc
@@ -46,7 +46,7 @@
 
   auto* s = ty.struct_("Str", strct);
   auto* str_var = Var("str", ast::StorageClass::kPrivate, s);
-  mod->AST().AddGlobalVariable(str_var);
+  AST().AddGlobalVariable(str_var);
 
   auto* expr = MemberAccessor("str", "mem");
 
@@ -79,7 +79,7 @@
 
   auto* s = ty.struct_("Data", str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* expr = MemberAccessor("data", "b");
@@ -112,7 +112,7 @@
       ast::StructDecorationList{});
   auto* s = ty.struct_("Data", str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* expr = MemberAccessor("data", "a");
@@ -149,9 +149,9 @@
 
   auto* s = ty.struct_("Data", str);
   auto* b_var = Var("b", ast::StorageClass::kPrivate, ty.mat2x3<f32>());
-  mod->AST().AddGlobalVariable(b_var);
+  AST().AddGlobalVariable(b_var);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   auto* lhs = MemberAccessor("data", "a");
   auto* rhs = Expr("b");
@@ -197,7 +197,7 @@
 
   auto* s = ty.struct_("Data", str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* lhs = MemberAccessor("data", "a");
@@ -240,7 +240,7 @@
 
   auto* s = ty.struct_("Data", str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* expr = MemberAccessor("data", "a");
@@ -282,7 +282,7 @@
 
   auto* s = ty.struct_("Data", str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* expr = MemberAccessor("data", "a");
@@ -317,7 +317,7 @@
 
   auto* s = ty.struct_("Data", str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* expr = MemberAccessor("data", "a");
@@ -353,7 +353,7 @@
 
   auto* s = ty.struct_("Data", str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* expr = IndexAccessor(
@@ -389,7 +389,7 @@
       ast::StructDecorationList{});
   auto* s = ty.struct_("Data", str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* expr = IndexAccessor(MemberAccessor("data", "a"), Expr(2));
@@ -424,7 +424,7 @@
       ast::StructDecorationList{});
   auto* s = ty.struct_("Data", str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* expr = IndexAccessor(MemberAccessor("data", "a"),
@@ -459,7 +459,7 @@
 
   auto* s = ty.struct_("Data", str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* lhs = MemberAccessor("data", "b");
@@ -499,7 +499,7 @@
 
   auto* s = ty.struct_("Data", str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* lhs = IndexAccessor(MemberAccessor("data", "a"), Expr(2));
@@ -536,7 +536,7 @@
 
   auto* s = ty.struct_("Data", str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* lhs = MemberAccessor("data", "a");
@@ -573,7 +573,7 @@
 
   auto* s = ty.struct_("Data", str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* expr = MemberAccessor("data", "b");
@@ -607,7 +607,7 @@
 
   auto* s = ty.struct_("Data", str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, s);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* lhs = MemberAccessor("data", "b");
@@ -662,7 +662,7 @@
 
   auto* pre_struct = ty.struct_("Pre", pre_str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, pre_struct);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* expr =
@@ -711,7 +711,7 @@
 
   auto* pre_struct = ty.struct_("Pre", pre_str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, pre_struct);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   td.RegisterVariableForTesting(coord_var);
 
@@ -765,7 +765,7 @@
 
   auto* pre_struct = ty.struct_("Pre", pre_str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, pre_struct);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* expr = MemberAccessor(
@@ -817,7 +817,7 @@
 
   auto* pre_struct = ty.struct_("Pre", pre_str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, pre_struct);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* expr = IndexAccessor(
@@ -869,7 +869,7 @@
 
   auto* pre_struct = ty.struct_("Pre", pre_str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, pre_struct);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* lhs =
@@ -925,7 +925,7 @@
 
   auto* pre_struct = ty.struct_("Pre", pre_str);
   auto* coord_var = Var("data", ast::StorageClass::kStorage, pre_struct);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
   td.RegisterVariableForTesting(coord_var);
 
   auto* lhs = MemberAccessor(
diff --git a/src/writer/hlsl/generator_impl_test.cc b/src/writer/hlsl/generator_impl_test.cc
index e183d10..da195ef 100644
--- a/src/writer/hlsl/generator_impl_test.cc
+++ b/src/writer/hlsl/generator_impl_test.cc
@@ -30,7 +30,7 @@
 TEST_F(HlslGeneratorImplTest, Generate) {
   auto* func = Func("my_func", ast::VariableList{}, ty.void_(),
                     ast::StatementList{}, ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
diff --git a/src/writer/msl/generator_impl_call_test.cc b/src/writer/msl/generator_impl_call_test.cc
index a8d08b8..5c33043 100644
--- a/src/writer/msl/generator_impl_call_test.cc
+++ b/src/writer/msl/generator_impl_call_test.cc
@@ -35,7 +35,7 @@
   auto* call = Call("my_func");
   auto* func = Func("my_func", ast::VariableList{}, ty.void_(),
                     ast::StatementList{}, ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
@@ -47,7 +47,7 @@
   auto* call = Call("my_func", "param1", "param2");
   auto* func = Func("my_func", ast::VariableList{}, ty.void_(),
                     ast::StatementList{}, ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
@@ -59,7 +59,7 @@
   auto* call = Call("my_func", "param1", "param2");
   auto* func = Func("my_func", ast::VariableList{}, ty.void_(),
                     ast::StatementList{}, ast::FunctionDecorationList{});
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   auto* expr = create<ast::CallStatement>(call);
 
diff --git a/src/writer/msl/generator_impl_function_entry_point_data_test.cc b/src/writer/msl/generator_impl_function_entry_point_data_test.cc
index 2cccf77..e669d76 100644
--- a/src/writer/msl/generator_impl_function_entry_point_data_test.cc
+++ b/src/writer/msl/generator_impl_function_entry_point_data_test.cc
@@ -58,8 +58,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto body = ast::StatementList{
       create<ast::AssignmentStatement>(Expr("foo"), Expr("foo")),
@@ -71,7 +71,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -106,8 +106,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto body = ast::StatementList{
       create<ast::AssignmentStatement>(Expr("foo"), Expr("foo")),
@@ -119,7 +119,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kVertex),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -154,8 +154,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto body = ast::StatementList{
       create<ast::AssignmentStatement>(Expr("foo"), Expr("foo")),
@@ -167,7 +167,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -202,8 +202,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto body = ast::StatementList{
       create<ast::AssignmentStatement>(Expr("foo"), Expr("foo")),
@@ -215,7 +215,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -247,8 +247,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto body = ast::StatementList{
       create<ast::AssignmentStatement>(Expr("foo"), Expr("foo")),
@@ -260,7 +260,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kCompute),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -287,8 +287,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto body = ast::StatementList{
       create<ast::AssignmentStatement>(Expr("foo"), Expr("foo")),
@@ -300,7 +300,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kCompute),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -334,8 +334,8 @@
   td.RegisterVariableForTesting(coord_var);
   td.RegisterVariableForTesting(depth_var);
 
-  mod->AST().AddGlobalVariable(coord_var);
-  mod->AST().AddGlobalVariable(depth_var);
+  AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(depth_var);
 
   auto body = ast::StatementList{create<ast::AssignmentStatement>(
       Expr("depth"), MemberAccessor("coord", "x"))};
@@ -345,7 +345,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
diff --git a/src/writer/msl/generator_impl_function_test.cc b/src/writer/msl/generator_impl_function_test.cc
index a40cfb3..025b00d 100644
--- a/src/writer/msl/generator_impl_function_test.cc
+++ b/src/writer/msl/generator_impl_function_test.cc
@@ -62,7 +62,7 @@
                     },
                     ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
@@ -85,7 +85,7 @@
                     },
                     ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
@@ -112,7 +112,7 @@
                     },
                     ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
@@ -134,7 +134,7 @@
                     ast::FunctionDecorationList{create<ast::StageDecoration>(
                         ast::PipelineStage::kFragment)});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -163,8 +163,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto* func =
       Func("main", ast::VariableList{}, ty.void_(),
@@ -174,7 +174,7 @@
            ast::FunctionDecorationList{
                create<ast::StageDecoration>(ast::PipelineStage::kFragment)});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -212,8 +212,8 @@
   td.RegisterVariableForTesting(foo_var);
   td.RegisterVariableForTesting(bar_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto body = ast::StatementList{
       create<ast::AssignmentStatement>(Expr("bar"), Expr("foo")),
@@ -223,7 +223,7 @@
                     ast::FunctionDecorationList{create<ast::StageDecoration>(
                         ast::PipelineStage::kFragment)});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -264,8 +264,8 @@
   td.RegisterVariableForTesting(coord_var);
   td.RegisterVariableForTesting(depth_var);
 
-  mod->AST().AddGlobalVariable(coord_var);
-  mod->AST().AddGlobalVariable(depth_var);
+  AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(depth_var);
 
   auto body = ast::StatementList{
       create<ast::AssignmentStatement>(Expr("depth"),
@@ -278,7 +278,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -308,7 +308,7 @@
 
   td.RegisterVariableForTesting(coord_var);
 
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   auto* var = Var("v", ast::StorageClass::kFunction, ty.f32(),
                   MemberAccessor("coord", "x"), ast::VariableDecorationList{});
@@ -323,7 +323,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -350,7 +350,7 @@
   auto* s = ty.struct_("Data", str);
   type::AccessControl ac(ast::AccessControl::kReadWrite, s);
 
-  mod->AST().AddConstructedType(s);
+  AST().AddConstructedType(s);
 
   auto* coord_var =
       Var("coord", ast::StorageClass::kStorage, &ac, nullptr,
@@ -359,7 +359,7 @@
 
   td.RegisterVariableForTesting(coord_var);
 
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   auto* var = Var("v", ast::StorageClass::kFunction, ty.f32(),
                   MemberAccessor("coord", "b"), ast::VariableDecorationList{});
@@ -374,7 +374,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -405,7 +405,7 @@
 
   auto* s = ty.struct_("Data", str);
   type::AccessControl ac(ast::AccessControl::kReadOnly, s);
-  mod->AST().AddConstructedType(s);
+  AST().AddConstructedType(s);
 
   auto* coord_var =
       Var("coord", ast::StorageClass::kStorage, &ac, nullptr,
@@ -413,7 +413,7 @@
                                       create<ast::GroupDecoration>(1)});
 
   td.RegisterVariableForTesting(coord_var);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   auto* var = Var("v", ast::StorageClass::kFunction, ty.f32(),
                   MemberAccessor("coord", "b"), ast::VariableDecorationList{});
@@ -428,7 +428,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -469,9 +469,9 @@
   td.RegisterVariableForTesting(bar_var);
   td.RegisterVariableForTesting(val_var);
 
-  mod->AST().AddGlobalVariable(foo_var);
-  mod->AST().AddGlobalVariable(bar_var);
-  mod->AST().AddGlobalVariable(val_var);
+  AST().AddGlobalVariable(foo_var);
+  AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(val_var);
 
   ast::VariableList params;
   params.push_back(Var("param", ast::StorageClass::kFunction, ty.f32()));
@@ -483,7 +483,7 @@
   auto* sub_func =
       Func("sub_func", params, ty.f32(), body, ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(sub_func);
+  AST().Functions().Add(sub_func);
 
   body = ast::StatementList{
       create<ast::AssignmentStatement>(Expr("bar"), Call("sub_func", 1.0f)),
@@ -495,7 +495,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func_1);
+  AST().Functions().Add(func_1);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -536,7 +536,7 @@
               create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth)});
 
   td.RegisterVariableForTesting(depth_var);
-  mod->AST().AddGlobalVariable(depth_var);
+  AST().AddGlobalVariable(depth_var);
 
   ast::VariableList params;
   params.push_back(Var("param", ast::StorageClass::kFunction, ty.f32()));
@@ -547,7 +547,7 @@
                         },
                         ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(sub_func);
+  AST().Functions().Add(sub_func);
 
   auto body = ast::StatementList{
       create<ast::AssignmentStatement>(Expr("depth"), Call("sub_func", 1.0f)),
@@ -560,7 +560,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func_1);
+  AST().Functions().Add(func_1);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -602,8 +602,8 @@
   td.RegisterVariableForTesting(coord_var);
   td.RegisterVariableForTesting(depth_var);
 
-  mod->AST().AddGlobalVariable(coord_var);
-  mod->AST().AddGlobalVariable(depth_var);
+  AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(depth_var);
 
   ast::VariableList params;
   params.push_back(Var("param", ast::StorageClass::kFunction, ty.f32()));
@@ -616,7 +616,7 @@
   auto* sub_func =
       Func("sub_func", params, ty.f32(), body, ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(sub_func);
+  AST().Functions().Add(sub_func);
 
   body = ast::StatementList{
       create<ast::AssignmentStatement>(Expr("depth"), Call("sub_func", 1.0f)),
@@ -628,7 +628,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func_1);
+  AST().Functions().Add(func_1);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -663,7 +663,7 @@
                                       create<ast::GroupDecoration>(1)});
 
   td.RegisterVariableForTesting(coord_var);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   ast::VariableList params;
   params.push_back(Var("param", ast::StorageClass::kFunction, ty.f32()));
@@ -674,7 +674,7 @@
   auto* sub_func =
       Func("sub_func", params, ty.f32(), body, ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(sub_func);
+  AST().Functions().Add(sub_func);
 
   ast::ExpressionList expr;
   expr.push_back(Expr(1.0f));
@@ -692,7 +692,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -722,7 +722,7 @@
 
   auto* s = ty.struct_("Data", str);
   type::AccessControl ac(ast::AccessControl::kReadWrite, s);
-  mod->AST().AddConstructedType(s);
+  AST().AddConstructedType(s);
 
   auto* coord_var =
       Var("coord", ast::StorageClass::kStorage, &ac, nullptr,
@@ -730,7 +730,7 @@
                                       create<ast::GroupDecoration>(1)});
 
   td.RegisterVariableForTesting(coord_var);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   ast::VariableList params;
   params.push_back(
@@ -741,7 +741,7 @@
   auto* sub_func =
       Func("sub_func", params, ty.f32(), body, ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(sub_func);
+  AST().Functions().Add(sub_func);
 
   auto* var = Var("v", ast::StorageClass::kFunction, ty.f32(),
                   Call("sub_func", 1.0f), ast::VariableDecorationList{});
@@ -756,7 +756,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -791,7 +791,7 @@
 
   auto* s = ty.struct_("Data", str);
   type::AccessControl ac(ast::AccessControl::kReadOnly, s);
-  mod->AST().AddConstructedType(s);
+  AST().AddConstructedType(s);
 
   auto* coord_var =
       Var("coord", ast::StorageClass::kStorage, &ac, nullptr,
@@ -799,7 +799,7 @@
                                       create<ast::GroupDecoration>(1)});
 
   td.RegisterVariableForTesting(coord_var);
-  mod->AST().AddGlobalVariable(coord_var);
+  AST().AddGlobalVariable(coord_var);
 
   ast::VariableList params;
   params.push_back(
@@ -810,7 +810,7 @@
   auto* sub_func =
       Func("sub_func", params, ty.f32(), body, ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(sub_func);
+  AST().Functions().Add(sub_func);
 
   ast::ExpressionList expr;
   expr.push_back(Expr(1.0f));
@@ -828,7 +828,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -861,7 +861,7 @@
           ast::VariableDecorationList{create<ast::LocationDecoration>(1)});
 
   td.RegisterVariableForTesting(bar_var);
-  mod->AST().AddGlobalVariable(bar_var);
+  AST().AddGlobalVariable(bar_var);
 
   auto* list = create<ast::BlockStatement>(ast::StatementList{
       create<ast::ReturnStatement>(),
@@ -881,7 +881,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(func_1);
+  AST().Functions().Add(func_1);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
@@ -914,7 +914,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kCompute),
            });
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
@@ -938,7 +938,7 @@
                     },
                     ast::FunctionDecorationList{});
 
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
@@ -986,9 +986,9 @@
           ast::VariableDecorationList{create<ast::BindingDecoration>(0),
                                       create<ast::GroupDecoration>(0)});
 
-  mod->AST().AddConstructedType(s);
+  AST().AddConstructedType(s);
   td.RegisterVariableForTesting(data_var);
-  mod->AST().AddGlobalVariable(data_var);
+  AST().AddGlobalVariable(data_var);
 
   {
     auto* var = Var("v", ast::StorageClass::kFunction, ty.f32(),
@@ -1004,7 +1004,7 @@
                  create<ast::StageDecoration>(ast::PipelineStage::kCompute),
              });
 
-    mod->AST().Functions().Add(func);
+    AST().Functions().Add(func);
   }
 
   {
@@ -1018,7 +1018,7 @@
              ast::FunctionDecorationList{
                  create<ast::StageDecoration>(ast::PipelineStage::kCompute)});
 
-    mod->AST().Functions().Add(func);
+    AST().Functions().Add(func);
   }
 
   ASSERT_TRUE(td.Determine()) << td.error();
diff --git a/src/writer/msl/generator_impl_import_test.cc b/src/writer/msl/generator_impl_import_test.cc
index 7ef1375..1da5853 100644
--- a/src/writer/msl/generator_impl_import_test.cc
+++ b/src/writer/msl/generator_impl_import_test.cc
@@ -198,7 +198,7 @@
 
 TEST_F(MslGeneratorImplTest, MslImportData_Determinant) {
   auto* var = Var("var", ast::StorageClass::kFunction, ty.mat3x3<f32>());
-  mod->AST().AddGlobalVariable(var);
+  AST().AddGlobalVariable(var);
 
   auto* expr = Call("determinant", "var");
 
diff --git a/src/writer/msl/generator_impl_test.cc b/src/writer/msl/generator_impl_test.cc
index 909bafd..f3f85f2 100644
--- a/src/writer/msl/generator_impl_test.cc
+++ b/src/writer/msl/generator_impl_test.cc
@@ -53,7 +53,7 @@
            ast::FunctionDecorationList{
                create<ast::StageDecoration>(ast::PipelineStage::kCompute),
            });
-  mod->AST().Functions().Add(func);
+  AST().Functions().Add(func);
 
   GeneratorImpl& gen = Build();
 
diff --git a/src/writer/spirv/builder_function_decoration_test.cc b/src/writer/spirv/builder_function_decoration_test.cc
index d9b52f0..d904ca7 100644
--- a/src/writer/spirv/builder_function_decoration_test.cc
+++ b/src/writer/spirv/builder_function_decoration_test.cc
@@ -100,9 +100,9 @@
   auto* v_out = Var("my_out", ast::StorageClass::kOutput, ty.f32());
   auto* v_wg = Var("my_wg", ast::StorageClass::kWorkgroup, ty.f32());
 
-  mod->AST().AddGlobalVariable(v_in);
-  mod->AST().AddGlobalVariable(v_out);
-  mod->AST().AddGlobalVariable(v_wg);
+  AST().AddGlobalVariable(v_in);
+  AST().AddGlobalVariable(v_out);
+  AST().AddGlobalVariable(v_wg);
 
   spirv::Builder& b = Build();
 
@@ -149,9 +149,9 @@
   auto* v_out = Var("my_out", ast::StorageClass::kOutput, ty.f32());
   auto* v_wg = Var("my_wg", ast::StorageClass::kWorkgroup, ty.f32());
 
-  mod->AST().AddGlobalVariable(v_in);
-  mod->AST().AddGlobalVariable(v_out);
-  mod->AST().AddGlobalVariable(v_wg);
+  AST().AddGlobalVariable(v_in);
+  AST().AddGlobalVariable(v_out);
+  AST().AddGlobalVariable(v_wg);
 
   td.RegisterVariableForTesting(v_in);
   td.RegisterVariableForTesting(v_out);
@@ -276,7 +276,7 @@
           ast::VariableDecorationList{
               create<ast::BuiltinDecoration>(ast::Builtin::kFragDepth),
           });
-  mod->AST().AddGlobalVariable(fragdepth);
+  AST().AddGlobalVariable(fragdepth);
 
   auto* func =
       Func("main", ast::VariableList{}, ty.void_(),
diff --git a/src/writer/spirv/builder_function_test.cc b/src/writer/spirv/builder_function_test.cc
index d096957..e7a086a 100644
--- a/src/writer/spirv/builder_function_test.cc
+++ b/src/writer/spirv/builder_function_test.cc
@@ -242,10 +242,10 @@
                            create<ast::GroupDecoration>(0),
                        });
 
-  mod->AST().AddConstructedType(s);
+  AST().AddConstructedType(s);
 
   td.RegisterVariableForTesting(data_var);
-  mod->AST().AddGlobalVariable(data_var);
+  AST().AddGlobalVariable(data_var);
 
   {
     auto* var = Var("v", ast::StorageClass::kFunction, ty.f32(),
@@ -261,7 +261,7 @@
                  create<ast::StageDecoration>(ast::PipelineStage::kCompute),
              });
 
-    mod->AST().Functions().Add(func);
+    AST().Functions().Add(func);
   }
 
   {
@@ -278,7 +278,7 @@
                  create<ast::StageDecoration>(ast::PipelineStage::kCompute),
              });
 
-    mod->AST().Functions().Add(func);
+    AST().Functions().Add(func);
   }
 
   ASSERT_TRUE(td.Determine()) << td.error();
diff --git a/src/writer/spirv/builder_intrinsic_texture_test.cc b/src/writer/spirv/builder_intrinsic_texture_test.cc
index 34536c2..4035d3f 100644
--- a/src/writer/spirv/builder_intrinsic_texture_test.cc
+++ b/src/writer/spirv/builder_intrinsic_texture_test.cc
@@ -4150,8 +4150,8 @@
 TEST_P(IntrinsicTextureTest, ValidateSPIRV) {
   auto param = GetParam();
 
-  mod->AST().AddGlobalVariable(param.buildTextureVariable(this));
-  mod->AST().AddGlobalVariable(param.buildSamplerVariable(this));
+  AST().AddGlobalVariable(param.buildTextureVariable(this));
+  AST().AddGlobalVariable(param.buildSamplerVariable(this));
 
   auto* call =
       create<ast::CallExpression>(Expr(param.function), param.args(this));
@@ -4165,7 +4165,7 @@
                create<ast::StageDecoration>(ast::PipelineStage::kFragment),
            });
 
-  mod->AST().Functions().Add(main);
+  AST().Functions().Add(main);
 
   ASSERT_TRUE(td.Determine()) << td.error();
 
diff --git a/src/writer/wgsl/generator_impl_function_test.cc b/src/writer/wgsl/generator_impl_function_test.cc
index 5fc6caa..7f53616 100644
--- a/src/writer/wgsl/generator_impl_function_test.cc
+++ b/src/writer/wgsl/generator_impl_function_test.cc
@@ -191,10 +191,10 @@
                            create<ast::GroupDecoration>(0),
                        });
 
-  mod->AST().AddConstructedType(s);
+  AST().AddConstructedType(s);
 
   td.RegisterVariableForTesting(data_var);
-  mod->AST().AddGlobalVariable(data_var);
+  AST().AddGlobalVariable(data_var);
 
   {
     auto* var =
@@ -212,7 +212,7 @@
                  create<ast::StageDecoration>(ast::PipelineStage::kCompute),
              });
 
-    mod->AST().Functions().Add(func);
+    AST().Functions().Add(func);
   }
 
   {
@@ -231,7 +231,7 @@
                  create<ast::StageDecoration>(ast::PipelineStage::kCompute),
              });
 
-    mod->AST().Functions().Add(func);
+    AST().Functions().Add(func);
   }
 
   ASSERT_TRUE(td.Determine()) << td.error();
diff --git a/src/writer/wgsl/generator_impl_test.cc b/src/writer/wgsl/generator_impl_test.cc
index 24782e0..0e6ca83 100644
--- a/src/writer/wgsl/generator_impl_test.cc
+++ b/src/writer/wgsl/generator_impl_test.cc
@@ -30,9 +30,9 @@
 using WgslGeneratorImplTest = TestHelper;
 
 TEST_F(WgslGeneratorImplTest, Generate) {
-  mod->AST().Functions().Add(Func("my_func", ast::VariableList{}, ty.void_(),
-                                  ast::StatementList{},
-                                  ast::FunctionDecorationList{}));
+  AST().Functions().Add(Func("my_func", ast::VariableList{}, ty.void_(),
+                             ast::StatementList{},
+                             ast::FunctionDecorationList{}));
 
   GeneratorImpl& gen = Build();