浏览代码

Fix comment styles to use // consistently. (#2307)

Per https://github.com/carbon-language/carbon-lang/blob/trunk/docs/project/cpp_style_guide.md#syntax-and-formatting
Jon Ross-Perkins 3 年之前
父节点
当前提交
1c5770452e

+ 4 - 6
common/fuzzing/proto_to_carbon.cpp

@@ -819,12 +819,10 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration,
       PatternToCarbon(let.pattern(), out);
 
       // TODO: Print out the initializer once it's supported.
-      /*
-      if (let.has_initializer()) {
-        out << " = ";
-        ExpressionToCarbon(let.initializer(), out);
-      }
-      */
+      // if (let.has_initializer()) {
+      //   out << " = ";
+      //   ExpressionToCarbon(let.initializer(), out);
+      // }
       out << ";";
       break;
     }

+ 1 - 2
explorer/ast/static_scope.cpp

@@ -12,8 +12,7 @@
 namespace Carbon {
 
 auto StaticScope::Add(const std::string& name, ValueNodeView entity,
-                      NameStatus status /* = NameStatus::Usable*/)
-    -> ErrorOr<Success> {
+                      NameStatus status) -> ErrorOr<Success> {
   auto [it, inserted] = declared_names_.insert({name, {entity, status}});
   if (!inserted) {
     if (it->second.entity != entity) {

+ 21 - 23
explorer/ast/static_scope.h

@@ -33,29 +33,27 @@ static constexpr std::string_view AnonymousName = "_";
 template <typename NodeType, typename = void>
 static constexpr bool ImplementsValueNode = false;
 
-/*
-  ValueNode is an interface implemented by AstNodes that can be associated
-  with a value, such as declarations and bindings. The interface consists of
-  the following methods:
-
-  // Returns the constant associated with the node.
-  // This is called by the interpreter, not the type checker.
-  auto constant_value() const -> std::optional<Nonnull<const Value*>>;
-
-  // Returns the symbolic compile-time identity of the node.
-  // This is called by the type checker, not the interpreter.
-  auto symbolic_identity() const -> std::optional<Nonnull<const Value*>>;
-
-  // Returns the static type of an IdentifierExpression that names *this.
-  auto static_type() const -> const Value&;
-
-  // Returns the value category of an IdentifierExpression that names *this.
-  auto value_category() const -> ValueCategory;
-
-  // Print the node's identity (e.g. its name).
-  void PrintID(llvm::raw_ostream& out) const;
-
-*/
+// ValueNode is an interface implemented by AstNodes that can be associated
+// with a value, such as declarations and bindings. The interface consists of
+// the following methods:
+//
+// // Returns the constant associated with the node.
+// // This is called by the interpreter, not the type checker.
+// auto constant_value() const -> std::optional<Nonnull<const Value*>>;
+//
+// // Returns the symbolic compile-time identity of the node.
+// // This is called by the type checker, not the interpreter.
+// auto symbolic_identity() const -> std::optional<Nonnull<const Value*>>;
+//
+// // Returns the static type of an IdentifierExpression that names *this.
+// auto static_type() const -> const Value&;
+//
+// // Returns the value category of an IdentifierExpression that names *this.
+// auto value_category() const -> ValueCategory;
+//
+// // Print the node's identity (e.g. its name).
+// void PrintID(llvm::raw_ostream& out) const;
+//
 // TODO: consider turning the above documentation into real code, as sketched
 // at https://godbolt.org/z/186oEozhc
 

+ 9 - 13
explorer/interpreter/type_checker.cpp

@@ -4144,13 +4144,11 @@ auto TypeChecker::DeclareMixinDeclaration(Nonnull<MixinDeclaration*> mixin_decl,
 }
 
 // EXPERIMENTAL MIXIN FEATURE
-/*
-** Checks to see if mixin_decl is already within collected_members_. If it is,
-** then the mixin has already been type checked before either while type
-** checking a previous mix declaration or while type checking the original mixin
-** declaration. If not, then every member declaration is type checked and then
-** added to collected_members_ under the mixin_decl key.
-*/
+// Checks to see if mixin_decl is already within collected_members_. If it is,
+// then the mixin has already been type checked before either while type
+// checking a previous mix declaration or while type checking the original mixin
+// declaration. If not, then every member declaration is type checked and then
+// added to collected_members_ under the mixin_decl key.
 auto TypeChecker::TypeCheckMixinDeclaration(
     Nonnull<const MixinDeclaration*> mixin_decl, const ImplScope& impl_scope)
     -> ErrorOr<Success> {
@@ -4187,12 +4185,10 @@ auto TypeChecker::TypeCheckMixinDeclaration(
 }
 
 // EXPERIMENTAL MIXIN FEATURE
-/*
-** Type checks the mixin mentioned in the mix declaration.
-** TypeCheckMixinDeclaration ensures that the members of that mixin are
-** available in collected_members_. The mixin members are then collected as
-** members of the enclosing class or mixin declaration.
-*/
+// Type checks the mixin mentioned in the mix declaration.
+// TypeCheckMixinDeclaration ensures that the members of that mixin are
+// available in collected_members_. The mixin members are then collected as
+// members of the enclosing class or mixin declaration.
 auto TypeChecker::TypeCheckMixDeclaration(
     Nonnull<MixDeclaration*> mix_decl, const ImplScope& impl_scope,
     std::optional<Nonnull<const Declaration*>> enclosing_decl)

+ 9 - 15
explorer/interpreter/type_checker.h

@@ -51,14 +51,12 @@ class TypeChecker {
                  SourceLocation source_loc) const
       -> std::optional<Nonnull<const Witness*>>;
 
-  /*
-  ** Finds the direct or indirect member of a class or mixin by its name and
-  ** returns the member's declaration and type. Indirect members are members of
-  ** mixins that are mixed by member mix declarations. If the member is an
-  ** indirect member from a mix declaration, then the Self type variable within
-  ** the member's type is substituted with the type of the enclosing declaration
-  ** containing the mix declaration.
-  */
+  // Finds the direct or indirect member of a class or mixin by its name and
+  // returns the member's declaration and type. Indirect members are members of
+  // mixins that are mixed by member mix declarations. If the member is an
+  // indirect member from a mix declaration, then the Self type variable within
+  // the member's type is substituted with the type of the enclosing declaration
+  // containing the mix declaration.
   auto FindMixedMemberAndType(SourceLocation source_loc,
                               const std::string_view& name,
                               llvm::ArrayRef<Nonnull<Declaration*>> members,
@@ -445,17 +443,13 @@ class TypeChecker {
                               Nonnull<const Declaration*> member) const
       -> std::optional<const ValueLiteral*>;
 
-  /*
-  ** Adds a member of a declaration to collected_members_
-  */
+  // Adds a member of a declaration to collected_members_
   auto CollectMember(Nonnull<const Declaration*> enclosing_decl,
                      Nonnull<const Declaration*> member_decl)
       -> ErrorOr<Success>;
 
-  /*
-  ** Fetches all direct and indirect members of a class or mixin declaration
-  ** stored within collected_members_
-  */
+  // Fetches all direct and indirect members of a class or mixin declaration
+  // stored within collected_members_
   auto FindCollectedMembers(Nonnull<const Declaration*> decl)
       -> CollectedMembersMap&;