Przeglądaj źródła

Move ChoiceDeferredBinding for style (#5002)

https://google.github.io/styleguide/cppguide.html#Declaration_Order says
types go first. Also moving the accessor to match the order of members
(`choice_deferred_bindings_` was added between `var_storage_map_` and
`region_stack_`).
Jon Ross-Perkins 1 rok temu
rodzic
commit
de0cab1e66
1 zmienionych plików z 24 dodań i 26 usunięć
  1. 24 26
      toolchain/check/context.h

+ 24 - 26
toolchain/check/context.h

@@ -55,20 +55,6 @@ class Context {
   // add contextual notes as appropriate.
   using BuildDiagnosticFn = llvm::function_ref<auto()->DiagnosticBuilder>;
 
-  // Pre-computed parts of a binding pattern.
-  struct BindingPatternInfo {
-    // The corresponding AnyBindName inst.
-    SemIR::InstId bind_name_id;
-    // The region of insts that computes the type of the binding.
-    SemIR::ExprRegionId type_expr_region_id;
-  };
-
-  // An ongoing impl lookup, used to ensure termination.
-  struct ImplLookupStackEntry {
-    SemIR::ConstantId type_const_id;
-    SemIR::ConstantId interface_const_id;
-  };
-
   // Stores references for work.
   explicit Context(DiagnosticEmitter* emitter,
                    Parse::GetTreeAndSubtreesFn tree_and_subtrees_getter,
@@ -179,8 +165,15 @@ class Context {
     return import_ref_ids_;
   }
 
+  // Pre-computed parts of a binding pattern.
   // TODO: Consider putting this behind a narrower API to guard against emitting
   // multiple times.
+  struct BindingPatternInfo {
+    // The corresponding AnyBindName inst.
+    SemIR::InstId bind_name_id;
+    // The region of insts that computes the type of the binding.
+    SemIR::ExprRegionId type_expr_region_id;
+  };
   auto bind_name_map() -> Map<SemIR::InstId, BindingPatternInfo>& {
     return bind_name_map_;
   }
@@ -189,8 +182,25 @@ class Context {
     return var_storage_map_;
   }
 
+  // During Choice typechecking, each alternative turns into a name binding on
+  // the Choice type, but this can't be done until the full Choice type is
+  // known. This represents each binding to be done at the end of checking the
+  // Choice type.
+  struct ChoiceDeferredBinding {
+    Parse::NodeId node_id;
+    NameComponent name_component;
+  };
+  auto choice_deferred_bindings() -> llvm::SmallVector<ChoiceDeferredBinding>& {
+    return choice_deferred_bindings_;
+  }
+
   auto region_stack() -> RegionStack& { return region_stack_; }
 
+  // An ongoing impl lookup, used to ensure termination.
+  struct ImplLookupStackEntry {
+    SemIR::ConstantId type_const_id;
+    SemIR::ConstantId interface_const_id;
+  };
   auto impl_lookup_stack() -> llvm::SmallVector<ImplLookupStackEntry>& {
     return impl_lookup_stack_;
   }
@@ -262,18 +272,6 @@ class Context {
   // End of SemIR::File members.
   // --------------------------------------------------------------------------
 
-  // During Choice typechecking, each alternative turns into a name binding on
-  // the Choice type, but this can't be done until the full Choice type is
-  // known. This represents each binding to be done at the end of checking the
-  // Choice type.
-  struct ChoiceDeferredBinding {
-    Parse::NodeId node_id;
-    NameComponent name_component;
-  };
-  auto choice_deferred_bindings() -> llvm::SmallVector<ChoiceDeferredBinding>& {
-    return choice_deferred_bindings_;
-  }
-
  private:
   // Handles diagnostics.
   DiagnosticEmitter* emitter_;