diff options
author | ezhi <ezhi@yandex-team.ru> | 2022-02-10 16:47:33 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:33 +0300 |
commit | 91627ad918ce331c6d185aaaef1e5d1353c390b0 (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c | |
parent | bca37983f653bba53f02a2bd0dc36c8ae58278ed (diff) | |
download | ydb-91627ad918ce331c6d185aaaef1e5d1353c390b0.tar.gz |
Restoring authorship annotation for <ezhi@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc index d872466b17..3ae4a39fd5 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/perlxs/perlxs_generator.cc @@ -16,21 +16,21 @@ namespace protobuf { namespace compiler { namespace perlxs { -inline bool HasFieldPresence(const FileDescriptor* file) { - return file->syntax() != FileDescriptor::SYNTAX_PROTO3; -} - -bool HasHasMethod(const FieldDescriptor* field) { - if (HasFieldPresence(field->file())) { - // In proto1/proto2, every field has a has_$name$() method. - return true; - } - // For message types without true field presence, only fields with a message - // type have a has_$name$() method. - return field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE; -} - - +inline bool HasFieldPresence(const FileDescriptor* file) { + return file->syntax() != FileDescriptor::SYNTAX_PROTO3; +} + +bool HasHasMethod(const FieldDescriptor* field) { + if (HasFieldPresence(field->file())) { + // In proto1/proto2, every field has a has_$name$() method. + return true; + } + // For message types without true field presence, only fields with a message + // type have a has_$name$() method. + return field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE; +} + + PerlXSGenerator::PerlXSGenerator() {} PerlXSGenerator::~PerlXSGenerator() {} @@ -766,7 +766,7 @@ PerlXSGenerator::GenerateMessageXSFieldAccessors(const FieldDescriptor* field, "\n" " OUTPUT:\n" " RETVAL\n"); - } else if ( HasHasMethod(field) ) { + } else if ( HasHasMethod(field) ) { printer.Print(vars, "I32\n" "has_$perlname$(svTHIS)\n" @@ -1729,14 +1729,14 @@ PerlXSGenerator::StartFieldToHashref(const FieldDescriptor * field, "$i$ < msg$pdepth$->$cppname$_size(); $i$++ ) {\n"); } else { vars["i"] = ""; - if ( HasHasMethod(field) ) { - printer.Print(vars, - "if ( msg$pdepth$->has_$cppname$() ) {\n"); - } - else { - printer.Print(vars, - "{\n"); - } + if ( HasHasMethod(field) ) { + printer.Print(vars, + "if ( msg$pdepth$->has_$cppname$() ) {\n"); + } + else { + printer.Print(vars, + "{\n"); + } } printer.Indent(); } |