From 34d128783f764a6a420b072c3ecf9f68e0be74d6 Mon Sep 17 00:00:00 2001 From: pk19604014 <95385881+pk19604014@users.noreply.github.com> Date: Wed, 6 Apr 2022 08:44:33 -0400 Subject: [PATCH] style fixes (#1172) --- common/fuzzing/carbon.proto | 2 +- common/fuzzing/proto_to_carbon.cpp | 4 ++-- executable_semantics/fuzzing/ast_to_proto.cpp | 2 +- executable_semantics/interpreter/impl_scope.cpp | 2 +- executable_semantics/interpreter/type_checker.cpp | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/common/fuzzing/carbon.proto b/common/fuzzing/carbon.proto index 56f7a16299ac..f0de0539a409 100644 --- a/common/fuzzing/carbon.proto +++ b/common/fuzzing/carbon.proto @@ -258,7 +258,7 @@ message Statement { MatchStatement match = 8; ContinuationStatement continuation = 9; RunStatement run = 10; - AwaitStatement await = 11; + AwaitStatement await_statement = 11; BreakStatement break_statement = 12; ContinueStatement continue_statement = 13; } diff --git a/common/fuzzing/proto_to_carbon.cpp b/common/fuzzing/proto_to_carbon.cpp index 485ca4896b9b..4aeb2bbb6a51 100644 --- a/common/fuzzing/proto_to_carbon.cpp +++ b/common/fuzzing/proto_to_carbon.cpp @@ -88,7 +88,7 @@ static auto PrimitiveOperatorToCarbon( const Fuzzing::PrimitiveOperatorExpression& primitive_operator, llvm::raw_ostream& out) -> void { const Fuzzing::Expression& arg0 = - primitive_operator.arguments().size() > 0 + !primitive_operator.arguments().empty() ? primitive_operator.arguments(0) : Fuzzing::Expression::default_instance(); const Fuzzing::Expression& arg1 = @@ -536,7 +536,7 @@ static auto StatementToCarbon(const Fuzzing::Statement& statement, break; } - case Fuzzing::Statement::kAwait: + case Fuzzing::Statement::kAwaitStatement: out << "__await;"; break; diff --git a/executable_semantics/fuzzing/ast_to_proto.cpp b/executable_semantics/fuzzing/ast_to_proto.cpp index 9cc96969eb4c..95411900b88e 100644 --- a/executable_semantics/fuzzing/ast_to_proto.cpp +++ b/executable_semantics/fuzzing/ast_to_proto.cpp @@ -421,7 +421,7 @@ static auto StatementToProto(const Statement& statement) -> Fuzzing::Statement { case StatementKind::Await: // Initializes with the default value; there's nothing to set. - statement_proto.mutable_await(); + statement_proto.mutable_await_statement(); break; case StatementKind::Break: diff --git a/executable_semantics/interpreter/impl_scope.cpp b/executable_semantics/interpreter/impl_scope.cpp index 8b61f109e44a..6598e4979cce 100644 --- a/executable_semantics/interpreter/impl_scope.cpp +++ b/executable_semantics/interpreter/impl_scope.cpp @@ -84,7 +84,7 @@ auto ImplScope::ResolveHere(Nonnull iface_type, void ImplScope::Print(llvm::raw_ostream& out) const { out << "impls: "; llvm::ListSeparator sep; - for (Impl impl : impls_) { + for (const Impl& impl : impls_) { out << sep << *(impl.type) << " as " << *(impl.interface); } out << "\n"; diff --git a/executable_semantics/interpreter/type_checker.cpp b/executable_semantics/interpreter/type_checker.cpp index 6299d4819447..9e74d1517d42 100644 --- a/executable_semantics/interpreter/type_checker.cpp +++ b/executable_semantics/interpreter/type_checker.cpp @@ -1440,14 +1440,14 @@ auto TypeChecker::ExpectReturnOnAllPaths( // TODO: Add checking to function definitions to ensure that // all deduced type parameters will be deduced. auto TypeChecker::DeclareFunctionDeclaration(Nonnull f, - const ImplScope& impl_scope) + const ImplScope& enclosing_scope) -> ErrorOr { if (trace_) { llvm::outs() << "** declaring function " << f->name() << "\n"; } // Bring the deduced parameters into scope for (Nonnull deduced : f->deduced_parameters()) { - RETURN_IF_ERROR(TypeCheckExp(&deduced->type(), impl_scope)); + RETURN_IF_ERROR(TypeCheckExp(&deduced->type(), enclosing_scope)); deduced->set_symbolic_identity(arena_->New(deduced)); ASSIGN_OR_RETURN(Nonnull type_of_type, InterpExp(&deduced->type(), arena_, trace_)); @@ -1464,7 +1464,7 @@ auto TypeChecker::DeclareFunctionDeclaration(Nonnull f, } // Bring the impl bindings into scope. ImplScope function_scope; - function_scope.AddParent(&impl_scope); + function_scope.AddParent(&enclosing_scope); for (Nonnull impl_binding : impl_bindings) { CHECK(impl_binding->type_var()->symbolic_identity().has_value()); function_scope.Add(impl_binding->interface(),