diff --git a/common/fuzzing/proto_to_carbon.cpp b/common/fuzzing/proto_to_carbon.cpp index 732c60c2386f..99c53ab6b740 100644 --- a/common/fuzzing/proto_to_carbon.cpp +++ b/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; } diff --git a/explorer/ast/static_scope.cpp b/explorer/ast/static_scope.cpp index 19e55392a2c5..ada3da76cdbf 100644 --- a/explorer/ast/static_scope.cpp +++ b/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 { + NameStatus status) -> ErrorOr { auto [it, inserted] = declared_names_.insert({name, {entity, status}}); if (!inserted) { if (it->second.entity != entity) { diff --git a/explorer/ast/static_scope.h b/explorer/ast/static_scope.h index a8412d7c7045..9991452c7f72 100644 --- a/explorer/ast/static_scope.h +++ b/explorer/ast/static_scope.h @@ -33,29 +33,27 @@ static constexpr std::string_view AnonymousName = "_"; template 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>; - - // 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>; - - // 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>; +// +// // 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>; +// +// // 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 diff --git a/explorer/interpreter/type_checker.cpp b/explorer/interpreter/type_checker.cpp index a9f1ba8d1a8c..447fb77f85fb 100644 --- a/explorer/interpreter/type_checker.cpp +++ b/explorer/interpreter/type_checker.cpp @@ -4144,13 +4144,11 @@ auto TypeChecker::DeclareMixinDeclaration(Nonnull 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 mixin_decl, const ImplScope& impl_scope) -> ErrorOr { @@ -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 mix_decl, const ImplScope& impl_scope, std::optional> enclosing_decl) diff --git a/explorer/interpreter/type_checker.h b/explorer/interpreter/type_checker.h index 8525051841cd..beb24ec6789f 100644 --- a/explorer/interpreter/type_checker.h +++ b/explorer/interpreter/type_checker.h @@ -51,14 +51,12 @@ class TypeChecker { SourceLocation source_loc) const -> std::optional>; - /* - ** 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> members, @@ -445,17 +443,13 @@ class TypeChecker { Nonnull member) const -> std::optional; - /* - ** Adds a member of a declaration to collected_members_ - */ + // Adds a member of a declaration to collected_members_ auto CollectMember(Nonnull enclosing_decl, Nonnull member_decl) -> ErrorOr; - /* - ** 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 decl) -> CollectedMembersMap&;