Bladeren bron

Clarify some comments (#3360)

josh11b 2 jaren geleden
bovenliggende
commit
0318631d1a
3 gewijzigde bestanden met toevoegingen van 6 en 5 verwijderingen
  1. 2 4
      toolchain/check/node_stack.h
  2. 3 0
      toolchain/parse/node_kind.def
  3. 1 1
      toolchain/parse/state.def

+ 2 - 4
toolchain/check/node_stack.h

@@ -168,12 +168,10 @@ class NodeStack {
     return std::nullopt;
   }
 
-  // Peeks at the parse node of the given depth in the stack, or by default the
-  // top node.
+  // Peeks at the parse node of the top of the name stack.
   auto PeekParseNode() const -> Parse::Node { return stack_.back().parse_node; }
 
-  // Peeks at the ID of node at the given depth in the stack, or by default the
-  // top node.
+  // Peeks at the ID associated with the top of the name stack.
   template <Parse::NodeKind::RawEnumType RequiredParseKind>
   auto Peek() const -> auto {
     Entry back = stack_.back();

+ 3 - 0
toolchain/parse/node_kind.def

@@ -89,6 +89,9 @@ CARBON_PARSE_NODE_KIND_CHILD_COUNT(NameExpression, 0, CARBON_TOKEN(Identifier))
 //    is documented separately.
 // -  `_optional_` if this node may be present or omitted in valid parses,
 //    depending on which tokens are in the source code.
+//
+// There is generally a close correspondence between handling of tokens and the
+// creation of non-external nodes in a given block.
 
 // ----------------------------------------------------------------------------
 

+ 1 - 1
toolchain/parse/state.def

@@ -242,9 +242,9 @@ CARBON_PARSE_STATE(DeclarationScopeLoop)
 // responsible for handling chaining.
 //
 // The forms of this are:
-// - Designated names in structs.
 // - Qualified names in declarations.
 // - Member access expressions.
+// - Designated names in structs.
 //
 // Declarations and expressions have qualifiers such as `x.y`, while structs
 // have designators such as `.z`.